Ejemplo n.º 1
0
 /// <summary>
 /// Enter combat with the specified Enemy.
 /// </summary>
 /// <param name="e">The Enemy to be fought.</param>
 public void EnterCombat(Enemy e)
 {
     player.baseattack = player.atk;
     player.basedef = player.def;
     player.basespeed = player.spd;
     player.baseintl = player.intl;
     CombatWindow cw = new CombatWindow(e);
     cw.Show();
 }
Ejemplo n.º 2
0
 public CombatWindow(Enemy e)
 {
     InitializeComponent();
     d = new Dice();
     //disable the main window
     Program.main.mainWindow.IsEnabled = false;
     //save the enemy
     enemy = e;
     //bind the Abililty picker ComboBox to the Player's Abilities.
     abilityPicker.ItemsSource = Program.main.player.combatAbilities;
     write("You have entered combat with a ", "Black", true);
     write(enemy.name, "LawnGreen", true);
     write(".", "Black", true);
     //update the enemt name label
     enemyName.Content = enemy.name;
     //if the Player is Human and the Enemy is stronger, buff him
     if (Program.main.player.pRace is Human && enemy.level > Program.main.player.level)
     {
         write(Program.main.player.name + "'s", "Black");
         write(" Spark of Hope ", "Aqua", true);
         write(" has given " + Program.main.player.name + " determination to win!", "Black", true);
         int difference = Convert.ToInt32((enemy.level - Program.main.player.level) * 1.5);
         Program.main.player.atk += difference;
         Program.main.player.def += difference;
         Program.main.player.spd += difference;
         Program.main.player.intl += difference;
     }
     else if (Program.main.player.pRace is Orc && Program.main.player.hp != Program.main.player.maxhp)
     {
         float mod = 1.0f - (float)(Program.main.player.hp / Program.main.player.maxhp);
         Program.main.player.atk = Convert.ToInt32(Program.main.player.atk * mod);
     }
     //write the stats
     writeEnemyStats();
     Program.main.writeStats();
     //give the first turn to whoever is faster
     isPlayerTurn = Program.main.player.spd >= enemy.spd;
     if (isPlayerTurn)
         goButton.IsEnabled = true;
     else
     {
         goButton.IsEnabled = false;
         EnemyAttack(enemy);
         isPlayerTurn = true;
         goButton.IsEnabled = true;
     }
 }
Ejemplo n.º 3
0
 public virtual void ApplyEffect(object Target)
 {
     turns--;
     //safe cast the target to a player to see what it is
     p = Target as Player;
     //if it isn't nu;;, it's a Player
     if (p != null)
         isPlayer = true;
     //otherwise it's an Enenmy
     else
     {
         isPlayer = false;
         //set the target to be an Enemy
         e = Target as Enemy;
     }
 }
Ejemplo n.º 4
0
 private void EnemyAttack(Enemy enemy)
 {
     //attack the Player
     if (enemy.canAttack)
     {
         if (!d.misschance(Program.main.player.spd))
         {
             string used = "";
             int damage = Program.main.player.canBeHit ? enemy.Attack(Program.main.player, out used) : 0;
             if (Program.main.player.pRace is Dwarf)
             {
                 if (Program.main.player.hp <= (int)Program.main.player.hp / 5)
                 {
                     damage /= 2;
                     write(Program.main.player.name + "'s ", "Black");
                     write("Reinforced Armor ", "Aqua", true);
                     write("has halved the incoming damage!", "Black", true);
                 }
                 else
                     damage -= ((damage * 100) / 15);
             }
             write(enemy.name + " used " + used + ".", "Red");
             write(Program.main.player.name + " took " + damage + " damage.", "Red");
             Program.main.player.hp -= damage;
         }
         else
             write(enemy.name + " missed!", "Gray");
     }
 }