Example #1
0
        static void Main(string[] args)
        {
            Character Player;
            Character Monster;
            Random randr = new Random();
            Fight f;

            Player = new Character("Matt");
            Monster = new Character("Harpy");

            Console.WriteLine("A fight breaks out");

            while (Monster.hits > 0)
            {
                f = new Fight(Player, "onehanded", Monster);

                Console.WriteLine(f);
                if (f.roll > 100 - f.toHit)
                {
                    Console.WriteLine("The Attacker scores a " + f.damagetype + " hit for: " + f.damage + " damage.");
                }
                else
                    Console.WriteLine("A miss!");
                //Console.ReadLine();
            }

               // Console.WriteLine(Monster.stuff);
            Console.ReadLine();
        }
Example #2
0
        public Fight(Character Attacker, string attackSkill, Character Defender)
        {
            this.attacker = Attacker;
            this.defender = Defender;

            this.attackSkill = attackSkill;

            this.roll = Dice.roll(100);
            this.toHit = attacker.Useskill(attackSkill) - Defender.defense + 90;
            int overhit = roll + toHit - 100;

            this.damage = Convert.ToInt32((overhit + 3) / 5);
            if (overhit > 50)
            {
                damage += 3;
                damagetype = "Hard";
            }
            else
                damagetype = "Normal";

            if (this.roll > 100 - this.toHit)
                defender.hits -= this.damage;
        }