using ActionGame.GameArtifacts.Models.Characters;
using ActionGame.GameArtifacts.Models.Game;
using ActionGame.GameArtifacts.Models.WeaponSprites;
using ActionGame.RawResources.Manager;
using Microsoft.Xna.Framework.Audio;
using System;


namespace ActionGame.GameArtifacts.Operators.Items
{
    public class BombDropper
    {
        private IRawContentManager rawContentManager;
        private GameData gameData;
        private Boolean isFixedAttackPower;
        private Int32 attackPower;

        public BombDropper(IRawContentManager rawContentManager, GameData gameData, Boolean isFixedAttackPower, Int32 attackPower)
        {
            this.rawContentManager = rawContentManager;
            this.gameData = gameData;
            this.isFixedAttackPower = isFixedAttackPower;
            this.attackPower = attackPower;
        }


        public void Do(IBattleObject caster)
        {
            Int32 attack = attackPower;
            if (isFixedAttackPower == false) attack += caster.CharacterStats.Attack;

            Bomb bomb = new Bomb(rawContentManager, gameData, caster, caster.WorldPosition, attack);

            //starting position
            bomb.WorldPosition.PositionY += 1;

            //add sprite to game
            gameData.GameState.ActiveWeaponSprites.Add(bomb);

            //sound effect
            SoundEffect sound = rawContentManager.SoundEffectRepository.GetContent(@"soundeffects\bomb-place");
            sound.Play();
        }


    }
}
