Exemple #1
0
        public static void DoCombat <T, V>(Group <T> gA, Group <V> gB)
            where T : Character
            where V : Character
        {
            while (!gA.Dead && !gB.Dead)
            {
                int coin = NumberGenerator.Next(0, 1);

                if (coin == 0) // Group A strikes first
                {
                    Do1on1Combat(gA.SelectRandomMember(), gB.SelectRandomMember());
                }
                else // Group B strikes first
                {
                    Do1on1Combat(gB.SelectRandomMember(), gA.SelectRandomMember());
                }
            }

            CombatLog.Save("--------------- BATTLE IS OVER ------------");
            CombatLog.Save((gA.Dead ? gB.ID : gA.ID) + " won! Status: ");
            gA.LogSurvivors();
            gB.LogSurvivors();

            CombatLog.PrintLog();
        }
Exemple #2
0
        public static void DoCombat(IndianGroup ig, PaleFaceGroup pg)
        {
            while (!ig.Dead && !pg.Dead)
            {
                int coin = NumberGenerator.Next(0, 1);

                if (coin == 0) // Indians strike first
                {
                    Indian i1 = ig.SelectRandomIndian();
                    if (i1 != null)
                    {
                        PaleFace p1 = pg.SelectRandomPaleFace();
                        if (p1 != null)
                        {
                            p1.ReceiveDamage(i1.DealDamage());
                        }
                    }

                    PaleFace p2 = pg.SelectRandomPaleFace();
                    if (p2 != null)
                    {
                        Indian i2 = ig.SelectRandomIndian();
                        if (i2 != null)
                        {
                            i2.ReceiveDamage(p2.DealDamage());
                        }
                    }
                }
                else  // PaleFaces strike first
                {
                    PaleFace p2 = pg.SelectRandomPaleFace();
                    if (p2 != null)
                    {
                        Indian i2 = ig.SelectRandomIndian();
                        if (i2 != null)
                        {
                            i2.ReceiveDamage(p2.DealDamage());
                        }
                    }

                    Indian i1 = ig.SelectRandomIndian();
                    if (i1 != null)
                    {
                        PaleFace p1 = pg.SelectRandomPaleFace();
                        if (p1 != null)
                        {
                            p1.ReceiveDamage(i1.DealDamage());
                        }
                    }
                }
            }

            CombatLog.Save("--------------- BATTLE IS OVER ------------");
            CombatLog.Save((ig.Dead ? "Palefaces" : "Indians") + " won! Status: ");
            ig.LogSurvivors();
            pg.LogSurvivors();

            CombatLog.PrintLog();
        }