Exemplo n.º 1
0
 public Tuple<double, int> magicalAttack(Hero enemy)
 {
     double damage;
     switch (level) {
         case 1:
             damage = 75;
             break;
         case 2:
             damage = 100;
             break;
         default:
             damage = 150;
             break;
     }
     enemy.currentState.health = Math.Max(0, enemy.currentState.health - damage);
     currentState.mana -= GameConstants.manaCost;
     int randomValue = random.Next() % 2;
     if(randomValue == 0)
     {
         currentState.armor = Math.Min(attributes.armor, currentState.armor + 5);
         return new Tuple<double, int>(damage, 5);
     }
     else
     {
         enemy.currentState.armor = Math.Min(enemy.attributes.armor, enemy.currentState.armor + 5);
         return new Tuple<double, int>(damage, -5);
     }
 }
Exemplo n.º 2
0
        public void initLevel(int level)
        {
            myHero = constants.MyHero;
            myHero.level = level;
            switch (level) {
                case 1:
                    enemyHero = constants.Lvl1Enemy;
                    break;
                case 2:
                    enemyHero = constants.Lvl2Enemy;
                    break;
                case 3:
                    enemyHero = constants.Lvl3Enemy;
                    break;
                default:
                    throw new Exception("INVALID_LEVEL");
            }

            MyLevelLabel.Text = "Level " + myHero.level;
            EnemyLevelLabel.Text = "Level" + enemyHero.level;
            updateGold();
            try {
                MyHeroImage.BackgroundImage = Image.FromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),myHero.imagePath));
                EnemyHeroImage.BackgroundImage = Image.FromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), enemyHero.imagePath));
            }
            catch(Exception e)
            {
                MessageBox.Show("Images are missing. Please move the Images folder to the location of your exe file : "+e.Message);
            }
            updateBars();
            initMyTurn();
        }
Exemplo n.º 3
0
 public double physicalAttack(Hero enemy)
 {
     double damage = currentState.damagePerHit - (currentState.damagePerHit * enemy.currentState.armor / 100);
     enemy.currentState.health = Math.Max(0, enemy.currentState.health - damage);
     return damage;
 }