コード例 #1
0
ファイル: GameStart.cs プロジェクト: iMitaka/HackBulgaria
 public static void Main()
 {
     string mapsFolderPath = @"..\..\maps\";
     var map = new Dungeon(mapsFolderPath + "level1.txt");
     map.Treasures.Add(new Weapon("The Sword Of Heroes", 50));
     map.Treasures.Add(new Spell("Frost Ball", 60, 20, 2));
     for (int i = 0; i < 5; i++)
     {
         map.Treasures.Add(new Potion(PotionType.health, "Health Potion", 50));
         map.Treasures.Add(new Potion(PotionType.mana, "Mana Potion", 50));
     }
     map.PrintMap();
     var hero = new Hero("Bron", "Dragonslayer", 100, 100, 2);
     var w = new Weapon("The Axe of Destiny", 20);
     hero.Equip(w);
     var s = new Spell("Fireball", 30, 50, 2);
     hero.Learn(s);
     map.Spawn(hero);
     map.PrintMap();
     map.MoveHero(Direction.Right);
     map.MoveHero(Direction.Down);
     map.PrintMap();
     map.HeroAttack("spell");
     map.MoveHero(Direction.Down);
     map.MoveHero(Direction.Down);
     map.PrintMap();
     map.HeroAttack("spell");
     map.PrintMap();
 }
コード例 #2
0
ファイル: Hero.cs プロジェクト: iMitaka/HackBulgaria
 public int Attack(Spell spell)
 {
     if (spell == null)
     {
         return 0;
     }
     else
     {
         this.currentMana -= spell.ManaCost;
         return spell.Damage;
     }
 }
コード例 #3
0
ファイル: Enemy.cs プロジェクト: iMitaka/HackBulgaria
 public int Attack(Spell spell)
 {
     if (this.spell == null)
     {
         return this.baseDamage;
     }
     else
     {
         this.mana -= this.spell.ManaCost;
         return spell.Damage;
     }
 }
コード例 #4
0
ファイル: Hero.cs プロジェクト: iMitaka/HackBulgaria
 public void Learn(Spell spell)
 {
     this.spell = spell;
 }