Пример #1
0
        private void fight_button_Click(object sender, EventArgs e)
        {
            int hero_power  = this.main_character.getAttack() + FightArena.double_roll_the_dice();
            int enemy_power = this.enemy.getAttack() + FightArena.double_roll_the_dice();

            if (hero_power > enemy_power)
            {
                this.enemy.changeHealtTo(this.enemy.getHealth() - 2);
                this.enemy_health_label.Text = this.enemy.getHealth().ToString();
            }
            else if (enemy_power > hero_power)
            {
                this.main_character.changeHealtTo(this.main_character.getHealth() - 2);
                this.herro_health_label.Text = this.main_character.getHealth().ToString();
            }

            if (this.main_character.getHealth() <= 0)
            {
                this.fight_button.Enabled = false;
                this.winner_label.Text    = "Winner is: Enemy !!";
            }
            else if (this.enemy.getHealth() <= 0)
            {
                this.fight_button.Enabled = false;
                this.winner_label.Text    = "Winner is: " + this.main_character.getName() + " !!";
            }

            this.hero_turn_label.Text  = hero_power.ToString();
            this.enemy_turn_label.Text = enemy_power.ToString();
        }
Пример #2
0
 public Character(String name)
 {
     if (name != "")
     {
         this.name = name;
     }
     else
     {
         this.name = "Default (no select)";
     }
     this.health = FightArena.double_roll_the_dice() + 12;
     this.attack = FightArena.roll_the_dice() + 6;
 }
Пример #3
0
 public static int double_roll_the_dice()
 {
     return(FightArena.roll_the_dice() + FightArena.roll_the_dice());
 }