Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            hero.Name          = "Huey";
            hero.Health        = 100;
            hero.DamageMaximum = 10;
            hero.AttackBonus   = false;

            Character monster = new Character();

            monster.Name          = "Donkey Kong";
            monster.Health        = 100;
            monster.DamageMaximum = 10;
            monster.AttackBonus   = true;

            Dice dice = new Dice();

            while (hero.Health > 0 & monster.Health > 0)
            {
                if (hero.AttackBonus)
                {
                    monster.Defend(hero.Attack(dice));
                }
                if (monster.AttackBonus)
                {
                    hero.Defend(monster.Attack(dice));
                }

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

                DisplayStats(hero, monster);
            }
        }
Пример #2
0
        private void heroAttack(Character hero, Character monster, Dice heroDice)
        {
            int heroDamage = hero.Attack(heroDice);

            monster.Defend(hero.Attack(heroDice));
            if (hero.AttackBonus == true)
            {
                heroDamage += hero.Attack(heroDice);
            }
            monster.Defend(heroDamage);
        }
Пример #3
0
        private void monsterAttack(Character monster, Character hero, Dice monsterDice)
        {
            int monsterDamage = monster.Attack(monsterDice);

            hero.Defend(monster.Attack(monsterDice));
            if (monster.AttackBonus == true)
            {
                monsterDamage += monster.Attack(monsterDice);
            }
            hero.Defend(monsterDamage);
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dice dice = new Dice();


            Character hero = new Character();

            hero.Name          = "Easy Company";
            hero.Health        = 110;
            hero.DamageMaximum = 60;
            hero.AttackBonus   = false;

            Character monster = new Character();

            monster.Name          = "Bad guys";
            monster.Health        = 150;
            monster.DamageMaximum = 45;
            monster.AttackBonus   = true;

            if (hero.AttackBonus)
            {
                monster.Defend(hero.Attack(dice));
            }
            if (monster.AttackBonus)
            {
                hero.Defend(monster.Attack(dice));
            }


            /*
             * int damage = hero.Attack();
             * monster.Defend(damage);
             *
             * damage = monster.Attack();
             * hero.Defend(damage);
             *
             * printStats(hero);
             * printStats(monster); */

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

                outcome(hero);
                outcome(monster);
            }

            displayResults(hero, monster);
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            hero.Name          = "Hercules";
            hero.Health        = 100;
            hero.DamageMaximum = 30;
            hero.AttackBonus   = 0;
            Character monster = new Character();

            monster.Name          = "Cyclops";
            monster.Health        = 100;
            monster.DamageMaximum = 20;
            monster.AttackBonus   = 0;

            int finalMonster = monster.Defend(hero.Attack());
            int finalHero    = hero.Defend(monster.Attack());



            resultLabel.Text = String.Format(" {0}: Health {2}, DamageMaximum {4}, AttackBonus {6}" +
                                             "<br/>" + "{1}: Health {3}, DamageMaximum {5}, AttackBonus {7}",
                                             hero.Name, monster.Name, finalHero, finalMonster,
                                             hero.DamageMaximum, monster.DamageMaximum,
                                             hero.AttackBonus, monster.AttackBonus);
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            hero.Name          = "Hero";
            hero.Health        = 35;
            hero.DamageMaximum = 20;
            hero.AttackBonus   = false;

            Character monster = new Character();

            monster.Name          = "Monster";
            monster.Health        = 21;
            monster.DamageMaximum = 25;
            monster.AttackBonus   = true;

            int damage = hero.Attack();

            monster.Defend(damage);

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


            printStats(hero);
            printStats(monster);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Character Hero    = new Character();
            Character Monster = new Character();

            Hero.Name          = "Huh-Yun-Mi";
            Hero.Health        = 10000;
            Hero.DamageMaximum = 50;
            Hero.AttackBonus   = 50;

            Monster.Name          = "Grendel";
            Monster.Health        = 1000;
            Monster.DamageMaximum = 10;
            Monster.AttackBonus   = 2;

            //Initialize the result labels:
            lblInitial.Text   = "Starting Out Stats: <br/>";
            lblPostRound.Text = "After One Round Each Stats: <br/>";
            CharacterStats(Hero, true);
            CharacterStats(Monster, true);

            //FIGHT!
            //First the hero -- I don't have to save the attack values to make this work, but I might need them later
            int HeroAttack = Hero.Attack();

            Monster.Defend(HeroAttack);
            int MonsterAttack = Monster.Attack();

            Hero.Defend(MonsterAttack);
            CharacterStats(Hero, false);
            CharacterStats(Monster, false);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero    = new Character();
            Character monster = new Character();

            hero.Name          = "Vulcoran";
            hero.Health        = 100;
            hero.DamageMaximum = 25;
            hero.AttackBonus   = true;

            monster.Name          = "Demigorgon";
            monster.Health        = 200;
            monster.DamageMaximum = 15;
            monster.AttackBonus   = false;

            int damage = hero.Attack();

            monster.Defend(damage);

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

            printStats(hero);
            printStats(monster);
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = "";

            Character hero = new Character();

            hero.Name        = "Eleven";
            hero.Health      = 100;
            hero.DamageMax   = 15;
            hero.AttackBonus = 10;
            hero.LabelName   = "elevenLabel";

            Character monster = new Character();

            monster.Name        = "Demogorgon";
            monster.Health      = 666;
            monster.DamageMax   = 35;
            monster.AttackBonus = 0;
            monster.LabelName   = "demogorgonLabel";

            monster.Defend(hero.Attack(), out action);
            writeAction(action);
            hero.Defend(monster.Attack(), out action);
            writeAction(action);

            updateStats(hero, monster);
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            Character monster = new Character();

            if (!IsPostBack)
            {
                hero.Name        = "Jason";
                hero.Health      = 10;
                hero.DamageMax   = 10;
                hero.AttackBonus = true;

                monster.Name        = "Balrog";
                monster.Health      = 10;
                monster.DamageMax   = 1;
                monster.AttackBonus = false;
            }


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

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

                DisplayStats(hero, monster);
            }
        }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero    = new Character();
            Character monster = new Character();

            hero.Name          = "He-Man";
            hero.Health        = 100;
            hero.DamageMaximum = 50;
            hero.AttackBonus   = true;

            monster.Name          = "Skeletor";
            monster.Health        = 100;
            monster.DamageMaximum = 50;
            monster.AttackBonus   = true;

            int heroAttack = hero.Attack();

            monster.Defend(heroAttack);

            int monsterAttack = monster.Attack();

            hero.Defend(monsterAttack);

            Stats(hero);
            Stats(monster);
        }
Пример #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            hero.Name          = "Batman";
            hero.Health        = 100;
            hero.DamageMaximum = 30;
            hero.AttackBonus   = false;

            Character monster = new Character();

            monster.Name          = "Joker";
            monster.Health        = 50;
            monster.DamageMaximum = 25;
            monster.AttackBonus   = true;

            int damage = hero.Attack();

            monster.Defend(damage);

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

            printstats(hero);
            printstats(monster);
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            hero.Name          = "Hero";
            hero.Health        = 50;
            hero.DamageMaximum = 20;
            hero.AttackBonus   = false;

            Character monster = new Character();

            monster.Name          = "Troll";
            monster.Health        = 35;
            monster.DamageMaximum = 15;
            monster.AttackBonus   = true;

            int damage = hero.Attack();

            monster.Defend(damage);

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

            roundResult(hero);
            roundResult(monster);
        }
Пример #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            hero.Name          = "Hero";
            hero.Health        = 100;
            hero.DamageMaximum = 15;
            hero.AttackBonus   = false;

            Character monster = new Character();

            monster.Name          = "Monster";
            monster.Health        = 100;
            monster.DamageMaximum = 12;
            monster.AttackBonus   = true;

            Dice dice = new Dice();

            //Bonus Attack
            if (hero.AttackBonus == true)
            {
                monster.Defend(hero.Attack(dice));
                resultLabel.Text = "<strong>Hero has an attack bonus!</strong><br>";
            }
            if (monster.AttackBonus == true)
            {
                hero.Defend(hero.Attack(dice));
                resultLabel.Text = "<strong>Monster has an attack bonus!</strong><br>";
            }


            //While loop
            while (hero.Health > 0 && monster.Health > 0)
            {
                monster.Defend(hero.Attack(dice));
                hero.Defend(hero.Attack(dice));

                displayResults(hero);
                displayResults(monster);
            }

            displayResult(monster, hero);
        }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            hero.Name          = "Jason";
            hero.Health        = 35;
            hero.DamageMaximum = 20;
            hero.AttackBonus   = false;

            Character monster = new Character();

            monster.Name          = "Monster";
            monster.Health        = 21;
            monster.DamageMaximum = 25;
            monster.AttackBonus   = true;

            Dice dice = new Dice();

            // Bonus
            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));

                printStats(hero);
                printStats(monster);
            }

            displayResult(hero, monster);
        }
Пример #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            hero.Name          = "Troll Hunter";
            hero.Health        = 100;
            hero.DamageMaximum = 40;
            hero.AttackBonus   = true;

            Character monster = new Character();

            monster.Name          = "Rattle Bones";
            monster.Health        = 100;
            monster.DamageMaximum = 25;
            monster.AttackBonus   = true;

            Dice dice = new Dice();

            // Bonus
            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));

                battleStats(hero);
                battleStats(monster);
            }

            displayResult(hero, monster);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();
            hero.Name = "Daniel";
            hero.Health = 100;
            hero.DamageMaximum = 10;
            hero.AttackBonus = 10;

            hero.Attack();
            //resultLabel.Text = 

            Character monster = new Character();
            monster.Name = "Creep";
            monster.Health = 100;
            monster.DamageMaximum = 10;
            monster.AttackBonus = 10;

            monster.Attack();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();
            hero.Name = "Hero";
            hero.Health = 100;
            hero.DamageMaximum = 40;
            hero.AttackBonus = true;

            Character monster = new Character();
            monster.Name = "Monster";
            monster.Health = 100;
            monster.DamageMaximum = 25;
            monster.AttackBonus = false;

            monster.Defend(hero.Attack());
            hero.Defend(monster.Attack());

            DisplayStats(hero);
            DisplayStats(monster);
        }
Пример #19
0
        protected void battleButton_Click(object sender, EventArgs e)
        {
            int damage = hero.Attack();

            monster.Defend(damage);
            showBattleExchange(hero, damage, monster);

            damage = monster.Attack();
            hero.Defend(damage);
            showBattleExchange(monster, damage, hero);

            Session["Hero"]    = hero;
            Session["Monster"] = monster;

            printStats(hero, monster);

            if (winConditionCheck(hero, monster))
            {
                //Someone has won
                showWinner(hero, monster);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            hero.Name          = "Hero";
            hero.Health        = 100;
            hero.DamageMaximum = 40;
            hero.AttackBonus   = true;

            Character monster = new Character();

            monster.Name          = "Monster";
            monster.Health        = 100;
            monster.DamageMaximum = 25;
            monster.AttackBonus   = false;

            monster.Defend(hero.Attack());
            hero.Defend(monster.Attack());

            DisplayStats(hero);
            DisplayStats(monster);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Character hero = new Character();

            hero.Name          = "Batman";
            hero.Health        = 100;
            hero.DamageMaximum = 75;
            hero.AttackBonus   = false;


            Character monster = new Character();

            monster.Name          = "Joker";
            monster.Health        = 100;
            monster.DamageMaximum = 25;
            monster.AttackBonus   = false;


            int damage = hero.Attack();

            monster.Defend(damage);

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

            /* monster.Health -= hero.Attack();
             * hero.Health -= monster.Defend(5);
             *
             * hero.Health -= monster.Attack();
             * monster.Health -= hero.Defend(10);
             */


            displayStats(hero);
            resultLabel.Text += "<br />";
            displayStats(monster);
        }
Пример #22
0
 private string performAttack(Character attacker, Dice dice, Character defender)
 {
     int attack = attacker.Attack(dice);
     defender.Defend(attack);
     return String.Format("{0} attacks {1} and deals {2} damage!", attacker.Name, defender.Name, attack);
 }
 public void Battle(Character character,Dice playerDice)
 {
     character.Attack(playerDice);
     character.Defend(playerDice.Roll());
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                Character hero = new Character();
                hero.Name          = "Manducate";
                hero.Health        = 50;
                hero.DamageMaximum = 10;
                hero.AttackBonus   = true;

                Character monster = new Character();
                monster.Name          = "Bolus";
                monster.Health        = 55;
                monster.DamageMaximum = 15;
                monster.AttackBonus   = true;

                Dice dice = new Dice();
                dice.Sides = 12;

                resultLabel.Text = "";
                // Variable initialization:
                int i      = 0;
                int round  = 1;
                int defend = monster.Health;
                while (defend >= 0)
                {
                    if (i == 0)
                    {
                        // First Round:
                        int bonus = hero.Attack(dice);
                        if (bonus > 7)
                        {
                            bonus = 2;
                        }
                        else
                        {
                            bonus = 1;
                        }
                        int attack = hero.Attack(dice);
                        defend = monster.Health - (attack * bonus);

                        DisplayStats(attack, defend, i, bonus, round);
                        monster.Health = defend;
                        i = 1;
                    }
                    else
                    {
                        // Second Round:
                        int bonus = monster.Attack(dice);
                        if (bonus > 7)
                        {
                            bonus = 2;
                        }
                        else
                        {
                            bonus = 1;
                        }
                        int attack = monster.Attack(dice);
                        defend = hero.Health - (attack * bonus);

                        DisplayStats(attack, defend, i, bonus, round);
                        hero.Health = defend;
                        i           = 0;
                        round++;
                    }
                }
                int heroHealth    = hero.Health;
                int monsterHealth = monster.Health;
                displayResult(heroHealth, monsterHealth);
            }
        }