private void useItem(Hero hero)
        {
            var consumableWindow = new ConsumableWindow(_BattleInventory);

            consumableWindow.ShowDialog();
            int        choiceFromConsumableWindow = consumableWindow.getChoiceFromSelect();
            Consumable itemToUse = _BattleInventory.findConsumableByIndex(choiceFromConsumableWindow);

            var choiceWindow = new ChoiceWindow(_theHeroes);

            choiceWindow.ShowDialog();
            int  attackTarget = choiceWindow.getChoiceFromSelect();
            Hero targetHero   = _theHeroes[attackTarget];

            string resultString = itemToUse.use(targetHero);

            _Paragraph.Inlines.Add(new Bold(new Run(resultString))
            {
                Foreground = _theHeroes[0].getTextColor()
            });
            _Paragraph.Inlines.Add(new LineBreak());
            _BattleInventory.removeFromConsumable(choiceFromConsumableWindow);
            checkForDepletedMana();
            updateVisuals();
        }
Esempio n. 2
0
        private void normalAttack(Hero hero) //Hero attacks!
        {
            var cw = new ChoiceWindow(_TheSwarm);

            cw.ShowDialog();
            int     attackTarget = cw.getChoiceFromSelect();
            Monster mon          = _TheSwarm[attackTarget];

            int heroDamage;

            if (hero.getIsPhysical())
            {
                heroDamage = hero.BasicAttack() - mon.getModDefense();
            }
            else
            {
                heroDamage = hero.BasicAttack() - mon.getModResistance();
            }
            if (heroDamage < 0)
            {
                heroDamage = 0;
            }

            _Paragraph.Inlines.Add(new Bold(new Run(hero.getName() + " used basic attack for: " + heroDamage + " damage"))
            {
                Foreground = hero.getTextColor()
            });
            _Paragraph.Inlines.Add(new LineBreak());

            mon.setCurHealth(mon.getCurHealth() - heroDamage);
            updateVisuals();

            checkForDefeatedUnit();
        }
Esempio n. 3
0
        /*PerformSpecialAttack - attacks for 2.5 strength*/
        public override String PerformSpecialAttack(Party theParty, int whichHero, Monster[] monsters)
        {
            int damage          = (int)(getModStrength() * 2.5);
            int monsterToAttack = 0;

            if (monsters.Length > 1)
            {
                var cWindow = new ChoiceWindow(monsters);

                cWindow.ShowDialog();
                monsterToAttack = cWindow.getChoiceFromSelect();
            }

            int damageWithCalculations = damage - monsters[monsterToAttack].getModDefense();

            setCurMana(getCurMana() - 15);
            monsters[monsterToAttack].setCurHealth(monsters[monsterToAttack].getCurHealth() - damageWithCalculations);

            return(getName() + " performed Throw Knives for " + damageWithCalculations + " damage!");
        }
        /*PerformSpecialAttack - Strong magic attack to one enemy*/
        public override String PerformSpecialAttack(Party theParty, int whichHero, Monster[] monsters)
        {
            int damage          = getModMagic() * 2;
            int monsterToAttack = 0;

            if (monsters.Length > 1)
            {
                var cWindow = new ChoiceWindow(monsters);

                cWindow.ShowDialog();
                monsterToAttack = cWindow.getChoiceFromSelect();
            }

            int damageWithCalculations = damage - monsters[monsterToAttack].getModResistance();

            monsters[monsterToAttack].setCurHealth(monsters[monsterToAttack].getCurHealth() - damageWithCalculations);
            setCurMana(getCurMana() - 15);

            return(getName() + " performed Blizzard for " + damageWithCalculations + " to monster!");
        }
        /*PerformSpecialAttack - attacks for 1.5 strength and buffs strength and defense for 5*/
        public override String PerformSpecialAttack(Party theParty, int whichHero, Monster[] monsters)
        {
            //Buff Strength and Defense
            setModDefense(getModDefense() + 1);
            setModStrength(getModStrength() + 1);

            //Damage Monster
            int dmg             = (int)(getModStrength() * 1.5);
            int monsterToAttack = 0;

            if (monsters.Length > 1)
            {
                var cWindow = new ChoiceWindow(monsters);

                cWindow.ShowDialog();
                monsterToAttack = cWindow.getChoiceFromSelect();
            }

            monsters[monsterToAttack].setCurHealth(monsters[monsterToAttack].getCurHealth() - dmg);
            setCurMana(getCurMana() - 15);

            return(getName() + " buffed own defense and strength by 1! Performed a Blade Slash for " + dmg + " damage!");
        }