Esempio n. 1
0
        public static int Versus(AbstractUnit unit, string tag, int caseSuccess, string param)
        {
            int extradamage = 0;

            if (unit.Is(tag))
            {
                extradamage = caseSuccess;
                Console.WriteLine(String.Format("   >{0} is {1}. Ability gain +{2}{3}", unit.ToString(), tag, caseSuccess, param));
            }
            return(extradamage);
        }
Esempio n. 2
0
        public bool Turn()
        {
            List <int> idexes = new List <int>();
            List <int> speeds = new List <int>();

            for (int i = 0; i < left.Count; i++)
            {
                if (left[i] as Corpse == null)
                {
                    idexes.Add(i + 1);
                    speeds.Add(left[i].Spd);
                }
            }
            for (int i = 0; i < right.Count; i++)
            {
                if (right[i] as Corpse == null)
                {
                    idexes.Add(-i - 1);
                    speeds.Add(right[i].Spd);
                }
            }

            idexes = sortBySpd(idexes, speeds);

            for (int i = 0; i < idexes.Count; i++)
            {
                int          pos = 0;
                AbstractUnit a   = null;
                if (idexes[i] > 0)
                {
                    a   = left[idexes[i] - 1];
                    pos = left[idexes[i] - 1].position;
                }
                if (idexes[i] < 0)
                {
                    a   = right[-idexes[i] - 1];
                    pos = -right[-idexes[i] - 1].position;
                }

                Random       rnd  = new Random();
                AbstractUnit unit = null;

                bool isEnemy = !TraceFighters(pos, out unit, left, right);
                unit.TickAllBuffs();
                if (!unit.isDead() && unit as Corpse == null)
                {
                    if (!unit.Is("stunned"))
                    {
                        if (isEnemy)
                        {
                            unit.TryRandomlySelectAbility(rnd, right, left);
                        }
                        else
                        {
                            //unit.TryRandomlySelectAbility(rnd, left, right);
                            PlayerControl(unit);
                        }
                        CheckMovement();
                    }
                    else
                    {
                        unit.Unstun();
                    }
                }
                List <int> deadIndexes = CheckForDeath();
                // remove dead characters from a queue
                for (int j = 0; j < deadIndexes.Count; j++)
                {
                    idexes.Remove(deadIndexes[j]);
                    for (int k = 0; k < idexes.Count; k++)
                    {
                        if (idexes[k] < deadIndexes[j] && deadIndexes[j] < 0)
                        {
                            idexes[k]++;
                        }
                        if (idexes[k] > deadIndexes[j] && deadIndexes[j] > 0)
                        {
                            idexes[k]--;
                        }
                    }
                    for (int z = 0; z < 5; z++)
                    {
                        Console.Beep(rnd.Next(100, 150), rnd.Next(50, 100));
                    }
                    AbstractUnit misc;
                    TraceFighters(pos, out misc, left, right);
                    Thread.Sleep(500);
                    // kostil
                }
                if (CountNonDead(left) == 0 || CountNonDead(right) == 0)
                {
                    return(true);
                }
            }

            return(false);
        }