using ActionGame.GameArtifacts.Models.Characters;
using ActionGame.GameArtifacts.Models.Game;
using ActionGame.GameArtifacts.Models.Items;
using ActionGame.RawResources.Manager;


namespace ActionGame.GameArtifacts.Operators.Items
{
    public class InventoryItemUser
    {
        private IRawContentManager rawContentManager;
        private GameData gameData;
        private IBattleObject user;

        public InventoryItemUser(IRawContentManager rawContentManager, GameData gameData, IBattleObject user)
        {
            this.rawContentManager = rawContentManager;
            this.gameData = gameData;
            this.user = user;
        }


        public void UseItem(Item item)
        {
            if(item.Key == 0)   //bomb
            {
                BombDropper bombDropper = new BombDropper(rawContentManager, gameData, item.IsFixedPower, item.Power);
                bombDropper.Do(user);
            }
            else if (item.Key == 1) //axe throw
            {
                TomahawkThrower starThrower = new TomahawkThrower(rawContentManager, gameData, item.IsFixedPower, item.Power);
                starThrower.Do(user);
            }
            else if (item.Key == 2) //punch
            {
                Puncher puncher = new Puncher(rawContentManager, gameData, item.IsFixedPower, item.Power);
                puncher.Do(user);
            }
            else if ((item.Key == 3) || (item.Key == 7)) //food
            {
                Healer healer = new Healer(rawContentManager, gameData, item.IsFixedPower, item.Power);
                healer.Do(user);
            }
            else if ((item.Key == 4) || (item.Key == 11)) //heart
            {
                Healer healer = new Healer(rawContentManager, gameData, item.IsFixedPower, item.Power);
                healer.Do(user);
            }
            else if (item.Key == 5) //fire thrower
            {
                FireThrower fireThrower = new FireThrower(rawContentManager, gameData, item.IsFixedPower, item.Power, null);
                fireThrower.Do(user);
            }
            else if (item.Key == 6) //dynamite
            {
                DynamiteThrower dynamiteThrower = new DynamiteThrower(rawContentManager, gameData, item.IsFixedPower, item.Power, null);
                dynamiteThrower.Do(user);
            }
            else if (item.Key == 8) //axe
            {
                AxeSlasher axeSlasher = new AxeSlasher(rawContentManager, gameData, item.IsFixedPower, item.Power);
                axeSlasher.Do(user);
            }
            else if (item.Key == 9) //gun
            {
                GunShooter gunShooter = new GunShooter(rawContentManager, gameData, item.IsFixedPower, item.Power, null);
                gunShooter.Do(user);
            }
            else if (item.Key == 10) //big gun
            {
                EnergyGunShooter energyGunShooter = new EnergyGunShooter(rawContentManager, gameData, item.IsFixedPower, item.Power, null);
                energyGunShooter.Do(user);
            }

        }


    }
}
