Exemplo n.º 1
0
 public void GainStrengthWhenAllyRecievesDamage(object sender, OnUnitAppliedDamageEventArgs e)
 {
     if (!e.DamagedUnit.Equals(UnitWithAbility))
     {
         UnitWithAbility.AddWeaponStrength(WeaponStrengthGain);
     }
 }
Exemplo n.º 2
0
 public void ShieldAllyFromEnergyDamage(object sender, OnUnitRecievedDamageEventArgs e)
 {
     if (!e.DamageWasRedirected && e.DamageDictionary.ContainsKey(DamageType.Energy) && !e.DamagedUnit.Equals(UnitWithAbility))
     {
         UnitWithAbility.DealDamage(DamageType.Energy, e.DamageDictionary[DamageType.Energy], true);
         e.DamageDictionary.Remove(DamageType.Energy);
     }
 }
Exemplo n.º 3
0
        public override string AbbilytySrategy(Army UserArmy, Army ComputerArmy, int TurnCounter)
        {
            if (UserArmy.UnitList.Count < 4)
            {
                return("");
            }
            if (ComputerArmy.UnitList.Count < 4)
            {
                return("");
            }

            int      FirstArmyCount  = UserArmy.UnitList.Count;
            int      SecondArmyCount = ComputerArmy.UnitList.Count;
            int      Count           = FirstArmyCount > SecondArmyCount ? FirstArmyCount : SecondArmyCount;
            IAbility UnitWithAbility;

            string result      = "Фаза абилити\n";
            string UserStr     = "Ваша армия: ";
            string ComputerStr = "\nАрмия противника: ";

            for (int i = 4; i < Count; i++)
            {
                if (i < FirstArmyCount)
                {
                    if (UserArmy.UnitList[i] is IAbility)
                    {
                        UnitWithAbility = UserArmy.UnitList[i] as IAbility;
                        UserStr        += UnitWithAbility.DoAbility(UserArmy.UnitList, ComputerArmy.UnitList, i);
                    }
                }

                if (i < SecondArmyCount)
                {
                    if (ComputerArmy.UnitList[i] is IAbility)
                    {
                        UnitWithAbility = ComputerArmy.UnitList[i] as IAbility;
                        ComputerStr    += UnitWithAbility.DoAbility(ComputerArmy.UnitList, UserArmy.UnitList, i);
                    }
                }

                UserArmy.RemoveTheDead(TurnCounter);
                ComputerArmy.RemoveTheDead(TurnCounter);
                FirstArmyCount  = UserArmy.UnitList.Count;
                SecondArmyCount = ComputerArmy.UnitList.Count;
            }

            return(result + UserStr + ComputerStr);
        }
Exemplo n.º 4
0
        public override string AbbilytySrategy(Army UserArmy, Army ComputerArmy, int TurnCounter)
        {
            int          FirstArmyCount = UserArmy.UnitList.Count;
            int          SecondArmyCount = ComputerArmy.UnitList.Count;
            int          Count = FirstArmyCount < SecondArmyCount ? FirstArmyCount : SecondArmyCount;
            string       result = "Фаза абилити\n";
            List <IUnit> TempList = new List <IUnit>();
            List <IUnit> Target; List <IUnit> Enemy;
            IAbility     UnitWithAbility;

            if (Count == UserArmy.UnitList.Count)
            {
                Target  = ComputerArmy.UnitList;
                Enemy   = UserArmy.UnitList;
                result += "Армия противника: ";
            }
            else
            {
                Target  = UserArmy.UnitList;
                Enemy   = ComputerArmy.UnitList;
                result += "Ваша армия: ";
            }

            for (int i = Count; i < Target.Count; i++)
            {
                TempList.Add(Target[i]);
            }

            for (int i = 0; i < TempList.Count; i++)
            {
                if (TempList[i] is IAbility)
                {
                    UnitWithAbility = TempList[i] as IAbility;
                    result         += UnitWithAbility.DoAbility(TempList, Enemy, i);
                }
            }

            return(result);
        }