コード例 #1
0
        //PAROWANIE
        public bool Parry(Creature creature, RollingDie die)
        {
            int roll = die.Roll();

            if (creature.WW1 >= roll)
            {
                creature.TakeDamage(0);
                Console.WriteLine("smok sparował");
                return(true);
            }
            else
            {
                Console.WriteLine("smok nie sparował ");
                return(false);
            }
        }
コード例 #2
0
        //UNIKI
        public bool DodgeBlow(Creature creature, RollingDie die)
        {
            int roll = die.Roll();

            if (creature.Dex1 >= roll)
            {
                creature.TakeDamage(0);
                Console.WriteLine("smok uniknął");
                return(true);
            }
            else
            {
                Console.WriteLine("smok nie uniknął");
                return(false);
            }
        }
コード例 #3
0
        //DRUZGOCZACY -> zastępuje metodę Attack - do poprawy!!!
        public int CrushingBlow(Creature creature, RollingDie die)
        {
            int damage1 = die.Roll();
            int damage2 = die.Roll();

            if (damage1 > damage2)
            {
                Console.WriteLine("DAMAGE => druzgoczacy1 za" + damage1);
                //creature.Attack(damage1);
                return(damage1);
            }
            else if (damage2 > damage1)
            {
                Console.WriteLine("DAMAGE =>druzgoczacy2 za " + damage2);
                //creature.Attack(damage2);
                return(damage2);
            }
            else
            {
                Console.WriteLine("DAMAGE =>EQUALS druzgoczacy za " + damage1);
                //creature.Attack(damage1);
                return(damage1);
            }
        }
コード例 #4
0
        static void Main(string[] args)
        {
            #region
            Skills     skills = new Skills();
            RollingDie Hit    = new RollingDie(100);
            RollingDie Damage = new RollingDie(10);
            #endregion
            #region PODSTAWA
            //---------------------------PODSTAWA----------------------------------------------------------------------------------
            //Creature smok = new Creature("smok", 65, 39, 8, 8, 55, 69, Hit, Damage, 1);
            //smok.PowerfulBlow(smok);


            ////---------------------wyciągnąć do klasy BATTLE-----------------------------------
            //for (int i = 0; i < 10; i++)
            //    smok.Attack();
            //smok.CrushingBlow(smok, Damage);

            //while (smok.CriticalHit())
            //{
            //    Console.WriteLine(smok.PrintZyw());


            //    Console.WriteLine("Wybierz akcję: ");
            //    Console.WriteLine("1 PARUJE");
            //    Console.WriteLine("2 UNIKA");
            //    Console.WriteLine("3 NIE MOŻE ? :D");

            //    int option = Convert.ToInt32(Console.ReadLine());

            //    if (option == 1)
            //    {
            //        if (!smok.Parry(smok, Hit))
            //        {
            //            Console.WriteLine("Smok nie sparował");
            //            Console.WriteLine("Wprowadź obrażenia");
            //            int val = Convert.ToInt32(Console.ReadLine());
            //            smok.TakeDamage(val);
            //        }
            //        else
            //        {
            //            Console.WriteLine("Smok sparował");
            //        }
            //    }

            //    else if (option == 2)
            //    {
            //        if (!smok.DodgeBlow(smok, Hit))
            //        {
            //            Console.WriteLine("Smok nie uniknął");
            //            Console.WriteLine("Wprowadź obrażenia");
            //            int val = Convert.ToInt32(Console.ReadLine());
            //            smok.TakeDamage(val);
            //        }
            //        else
            //        {
            //            Console.WriteLine("Smok uniknął");
            //        }
            //    }
            //    else
            //    {
            //        Console.WriteLine("Wprowadź obrażenia");
            //        int val = Convert.ToInt32(Console.ReadLine());
            //        smok.TakeDamage(val);
            //    }
            //}
            #endregion
            #region Decorator test
            ICreature         smok             = new Creature("smok", 95, 39, 0, 0, 50, 69, Hit, Damage);
            CreatureDecorator armoured         = new Kolcza(smok);
            CreatureDecorator creatureWeapon   = new TwoHanded(armoured);
            CreatureDecorator creaturePowerful = new PowerfulBlow(creatureWeapon);
            for (int i = 0; i < 1000; i++)
            {
                Console.WriteLine("Smok zadaje: " + creaturePowerful.Attack() + " obrażeń");
                creaturePowerful.TakeDamage(3);
                //Console.WriteLine(creaturePowerful.PrintZyw());
            }
            #endregion
        }