コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character Hero = new Character();

            Hero.name        = "Josh";
            Hero.health      = 100;
            Hero.damageMax   = 20;
            Hero.attackBonus = false;

            Character Monster = new Character();

            Monster.name        = "Ifrit";
            Monster.health      = 130;
            Monster.damageMax   = 15;
            Monster.attackBonus = true;

            Dice dice = new Dice();

            if (Hero.attackBonus)
            {
                Monster.defend(Hero.attack(dice));
            }
            if (Monster.attackBonus)
            {
                Hero.defend(Monster.attack(dice));
            }

            while (Hero.health > 0 && Monster.health > 0)
            {
                Monster.defend(Hero.attack(dice));
                Hero.defend(Monster.attack(dice));


                print(Hero);
                print(Monster);
            }

            displayResult(Hero, Monster);
        }