Beispiel #1
0
 public void castCombo(Character attacker, Character attacked, Spells spell1, Spells spell2)
 {
     castSpell(attacker, attacked, spell1);
     castSpell(attacker, attacked, spell2);
     mana -= 50;
 }
Beispiel #2
0
        public void castSpell(Character attacker, Character attacked, Spells spell)
        {
            if (attacker.characterClass.CharacterClass.Equals(spell.SpellClass.CharacterClass))
            {
                if (mana >= spell.ManaGet)
                {
                    mana -= spell.ManaGet;

                    if (spell.KindOfSpellGet == Spells.KindOfSpell.Damage)
                    {
                        attacked.health -= spell.SpellValue + valueByLevel(attacker.level) + weapon.ItemValueGetSet;
                        attacked.health += attacked.armor;
                        if (health > healthCap)
                        {
                            health = healthCap;
                        }
                        attacked.armor -= 5;
                        checkAlive(attacker, attacked);
                    }

                    else if (spell.KindOfSpellGet == Spells.KindOfSpell.Heal)
                    {
                        attacker.health += spell.SpellValue + valueByLevel(attacker.level) + weapon.ItemValueGetSet;
                        if (attacker.health > attacker.healthCap)
                        {
                            int overHealth = 0;
                            overHealth       = attacker.health - attacker.healthCap;
                            attacker.health -= overHealth;
                        }
                    }

                    else if (spell.KindOfSpellGet == Spells.KindOfSpell.LifeSteal)
                    {
                        attacked.health -= (spell.SpellValue - attacked.armor) + valueByLevel(attacker.level) + weapon.ItemValueGetSet;
                        attacked.armor  -= 5;
                        attacker.health += spell.SpellValue + valueByLevel(attacker.level) + weapon.ItemValueGetSet;
                        if (attacker.health > attacker.healthCap)
                        {
                            int overHealth = 0;
                            overHealth       = attacker.health - attacker.healthCap;
                            attacker.health -= overHealth;
                        }
                    }

                    else if (spell.KindOfSpellGet == Spells.KindOfSpell.ArmorGain)
                    {
                        attacker.armor += spell.SpellValue + valueByLevel(attacker.level);
                    }

                    if (mana <= 100)
                    {
                        Console.WriteLine("\nLow mana");
                        Console.ReadKey();
                    }
                }
                else
                {
                    Console.WriteLine("\nInsufficent mana");
                    Console.ReadKey();
                }
                if (mana < 0)
                {
                    mana = 0;
                }
            }
        }