Beispiel #1
0
 public Dungeon(Hero hero, Enemy enemy)
 {
     counter = Count;
     lineCounter = LineCounter;
     this.hero = hero;
     this.enemy = enemy;
     spell = new Spell();
 }
Beispiel #2
0
 public virtual int Attack(Spell spell)
 {
     return spell.Damage;
 }
Beispiel #3
0
 public virtual int Learn(Spell spell)
 {
     return spell.Damage;
 }
Beispiel #4
0
 public override int Attack(Spell spell)
 {
     return SDamage + spell.Damage;
 }
Beispiel #5
0
 public override int Learn(Spell spell)
 {
     if (spell.ManaCost > Mana)
     {
         throw new Exception("you cannot cast your spell");
     }
     return SDamage+=spell.Damage;
 }
Beispiel #6
0
        public void PickTreasure()
        {
            string trpath = @"C:\Users\Ivan Ivanov\Documents\Visual Studio 2015\Projects\DungeonAndLizards\treasures.txt";
            char[] sep = { '\r', '\n' };
            string text = File.ReadAllText(trpath);
            string[] treasures = text.Split(sep, StringSplitOptions.RemoveEmptyEntries);
            Random rnd = new Random();
            int randomNumber = rnd.Next(0, 12);
            string[] pickedTreasure = treasures[randomNumber].Split('-');
            if (pickedTreasure[0] == "mana")
            {
                Console.WriteLine($"Additional mana for your Hero  {pickedTreasure[1]}");
                hero.Mana += int.Parse(pickedTreasure[1]);
                if (hero.Mana > 100)
                {
                    hero.Mana = 100;
                }
            }
            if (pickedTreasure[0] == "Weapon")
            {
                Console.WriteLine($"Weapon which adds to your damage {pickedTreasure[1]}");
                hero.WDamage += int.Parse(pickedTreasure[1]);
            }
            if (pickedTreasure[0] == "health")
            {
                Console.WriteLine($"Blood bank with amount of {pickedTreasure[1]}");
                hero.Health += int.Parse(pickedTreasure[1]);
                if (hero.Health > 100)
                {
                    hero.Health = 100;
                }
            }
            if (pickedTreasure[0] == "Spell")
            {
                int damage = int.Parse(pickedTreasure[1]);
                int manaCost = int.Parse(pickedTreasure[2]);
                int castRange = int.Parse(pickedTreasure[3]);
                Console.WriteLine("Spell");
                if (manaCost > hero.Mana)
                {
                    Console.WriteLine("Your hero cannot use this spell due to low mana");
                }
                else
                {
                    hero.SDamage += damage;
                    spell = new Spell("ManaBonus", damage, manaCost, castRange);
                }

            }
        }