Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            dice dice = new dice();


            character hero = new character();

            hero.Name          = "Silly Sam";
            hero.Health        = 100;
            hero.DamageMaximum = 25;
            hero.AttackBonus   = false;

            character monster = new character();

            monster.Name          = "Jenova";
            monster.Health        = 200;
            monster.DamageMaximum = 15;
            monster.AttackBonus   = true;

            while (hero.Health > 0 && monster.Health > 0)
            {
                int damage = hero.Attack(dice);
                monster.Defend(damage);

                damage = monster.Attack(dice);
                hero.Defend(damage);

                displayCharacterStats(hero);
                displayCharacterStats(monster);
            }

            displayResults(hero, monster);
        }
Esempio n. 2
0
 public int Attack(dice dice)
 {
     dice.sides = this.DamageMaximum;
     return(dice.Roll(dice.sides));
 }