protected override bool CanAttackUnit(UnitInfo unit)
 {
     if (this.Id != unit.Id && InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification).Equals(this.UnitClassification))
     {
         return true;
     }
     return false;
 }
Exemple #2
0
 protected override bool CanAttackUnit(UnitInfo unit)
 {
     if (unit.Id != this.Id)
     {
         return true;
     }
     return false;
 }
Exemple #3
0
 protected override bool CanAttackUnit(UnitInfo unit)
 {
     if (unit.Power <= this.Aggression)
     {
         return true;
     }
     return false;
 }
        protected override bool CanAttackUnit(UnitInfo unit)
        {
            bool canInfest = this.Id != unit.Id &&
                this.UnitClassification ==
                InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification);

            return canInfest;
        }
Exemple #5
0
        protected override UnitInfo GetOptimalAttackableUnit(IEnumerable<UnitInfo> attackableUnits)
        {
            UnitInfo optimalAttackableUnit = new UnitInfo(null, UnitClassification.Unknown, 0, int.MaxValue, 0);

            var unitInfos = attackableUnits as IList<UnitInfo> ?? attackableUnits.ToList();
            optimalAttackableUnit = unitInfos.OrderBy(x => x.Health).FirstOrDefault();

            return optimalAttackableUnit;
        }
Exemple #6
0
        protected override UnitInfo GetOptimalAttackableUnit(IEnumerable<UnitInfo> attackableUnits)
        {
            UnitInfo optimalAttackableUnit = new UnitInfo(null, UnitClassification.Unknown, 0, int.MaxValue, 0);

            var leastHealth = attackableUnits.OrderBy(unit => unit.Health).First();
            optimalAttackableUnit = leastHealth;

            return optimalAttackableUnit;
        }
 protected override bool CanAttackUnit(UnitInfo unit)
 {
     bool attackUnit = false;
     if (this.Id != unit.Id)
     {
         attackUnit = true;
     }
     return attackUnit;
 }
        protected override bool CanAttackUnit(UnitInfo unit)
        {
            bool attackUnit = false;

            if (this.Id != unit.Id && this.UnitClassification == InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification))
            {
                attackUnit = true;
            }

            return attackUnit;
        }
 protected override bool CanAttackUnit(UnitInfo unit)
 {
     bool attackUnit = false;
     if (this.Id != unit.Id)
     {
         if (unit.UnitClassification.ToString() == "Biological")
         {
             attackUnit = true;
         }
     }
     return attackUnit;
 }
Exemple #10
0
 protected override bool CanAttackUnit(UnitInfo unit)
 {
     bool attackUnit = false;
     if (this.Id != unit.Id)
     {
         if (this.Aggression >= unit.Power)
         {
             attackUnit = true;
         }
     }
     return attackUnit;
 }
Exemple #11
0
 protected override bool CanAttackUnit(UnitInfo unit)
 {
     //	The target Unit can be any unit different than itself
     if (unit.Id != this.Id
         && (InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification)==this.UnitClassification))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Exemple #12
0
        protected override bool CanAttackUnit(UnitInfo unit)
        {
            if (this.Id != unit.Id)
            {
                var unitClassificationRequired = InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification);
                if (this.UnitClassification == unitClassificationRequired)
                {
                    return true;
                }
            }

            return base.CanAttackUnit(unit);
        }
Exemple #13
0
 protected override bool CanAttackUnit(UnitInfo unit)
 {
     bool attackUnit = true;
     if (this.Id == unit.Id)
     {
         attackUnit = false;
     }
     if (unit.UnitClassification != this.UnitClassification)
     {
         attackUnit = false;
     }
     return attackUnit;
 }
Exemple #14
0
        protected override UnitInfo GetOptimalAttackableUnit(IEnumerable<UnitInfo> attackableUnits)
        {
            UnitInfo optimalAttackableUnit = new UnitInfo(null, UnitClassification.Unknown, 0, int.MaxValue, 0);

            foreach (var unit in attackableUnits)
            {
                if (unit.Health > optimalAttackableUnit.Health)
                {
                    optimalAttackableUnit = unit;
                }
            }

            return optimalAttackableUnit;
        }
Exemple #15
0
        protected override UnitInfo GetOptimalAttackableUnit(IEnumerable<UnitInfo> attackableUnits)
        {
            // marine picks the one with the highest Health
            UnitInfo optimalAttackableUnit = new UnitInfo(null, UnitClassification.Unknown, 0, int.MaxValue, 0);

            foreach (var unit in attackableUnits)
            {
                if (unit.Health < optimalAttackableUnit.Health)
                {
                    optimalAttackableUnit = unit;
                }
            }

            return optimalAttackableUnit;
        }
Exemple #16
0
        //public override void AddSupplement(ISupplement newSupplement)
        //{
        //    if (newSupplement.GetType().Name != "WeaponrySkill")
        //    {
        //        base.AddSupplement(newSupplement);
        //    }
        //}

        protected override UnitInfo GetOptimalAttackableUnit(IEnumerable<UnitInfo> attackableUnits)
        {
            //This method finds the unit with the highest  health and attacks it
            UnitInfo optimalAttackableUnit = new UnitInfo(null, UnitClassification.Unknown, int.MinValue, 0, 0);

            foreach (var unit in attackableUnits)
            {
                if (unit.Health > optimalAttackableUnit.Health)
                {
                    optimalAttackableUnit = unit;
                }
            }

            return optimalAttackableUnit;
        }
Exemple #17
0
        //       IEnumerable<UnitInfo> attackableUnits = new IEnumerable<UnitInfo>();
        protected override bool CanAttackUnit(UnitInfo unit)
        {
            if (this.Id==unit.Id)
            {
                return false;
            }

            //  The target’s Power should be less than or equal to the Marine’s Aggression
            if (unit.Power <= this.Aggression)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
 protected override UnitInfo GetOptimalAttackableUnit(IEnumerable<UnitInfo> attackableUnits)
 {
     UnitInfo optimalAttackableUnit = new UnitInfo(null, UnitClassification.Unknown, 0, int.MaxValue, 0);
     List<UnitInfo> diffTypeOdUnits = new List<UnitInfo>();
     foreach (var unit in attackableUnits)
     {
         if (unit.GetType().Name != this.GetType().Name)
         {
             diffTypeOdUnits.Add(unit);
         }
     }
     if (diffTypeOdUnits.Count >= 1)
     {
         diffTypeOdUnits.OrderBy(m => m.Health);
     }
     optimalAttackableUnit = diffTypeOdUnits[0];
     return optimalAttackableUnit;
     //To implement infestation to the attacked unit!
 }
Exemple #19
0
        protected override UnitInfo GetOptimalAttackableUnit(IEnumerable<UnitInfo> attackableUnits)
        {
            IEnumerable<UnitInfo> lesPowerUnits = from unit in attackableUnits
                                                  where (unit.Power <= this.Aggression)&&(unit.Id!=this.Id)
                                                  select unit;

            UnitInfo optimalAttackableUnit = new UnitInfo(null, UnitClassification.Unknown, 0, int.MaxValue, 0);
            int maxHealth = int.MinValue;

            foreach (var unit in lesPowerUnits)
            {
                if (unit.Health > maxHealth)
                {
                    optimalAttackableUnit = unit;
                    maxHealth = unit.Health;
                }
            }

            return optimalAttackableUnit;
        }
        public override Interaction DecideInteraction(IEnumerable<UnitInfo> units)
        {
            var candidateUnits = units.Where((unit) => unit.Id != this.Id && this.UnitClassification == InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification));

            UnitInfo optimalInfestableUnit = new UnitInfo(null, Infestation.UnitClassification.Unknown, int.MaxValue, 0, 0);

            foreach (var unit in candidateUnits)
            {
                if (unit.Health < optimalInfestableUnit.Health)
                {
                    optimalInfestableUnit = unit;
                }
            }

            if (optimalInfestableUnit.Id != null)
            {
                return new Interaction(new UnitInfo(this), optimalInfestableUnit, InteractionType.Infest);
            }

            return Interaction.PassiveInteraction;
        }
 protected override UnitInfo GetOptimalAttackableUnit(IEnumerable<UnitInfo> attackableUnits)
 {
     UnitInfo optimalAttackableUnit = new UnitInfo(null, UnitClassification.Unknown, 0, int.MaxValue, 0);
     List<UnitInfo> lessOrEqualPowerUnits = new List<UnitInfo>();
     foreach (var unit in attackableUnits)
     {
         if (unit.Power <= optimalAttackableUnit.Power)
         {
             lessOrEqualPowerUnits.Add(unit);
         }
     }
     if (lessOrEqualPowerUnits.Count >= 1 )
     {
         lessOrEqualPowerUnits.OrderBy(m => m.Health);
         optimalAttackableUnit = lessOrEqualPowerUnits[lessOrEqualPowerUnits.Count - 1];
     }
     else
     {
         optimalAttackableUnit = lessOrEqualPowerUnits[0];
     }
     return optimalAttackableUnit;
 }
Exemple #22
0
 protected override bool CanAttackUnit(UnitInfo unit)
 {
     bool attackUnit = this.Id != unit.Id &&
     InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification) == this.UnitClassification;
     return attackUnit;
 }
Exemple #23
0
 protected virtual bool CanAttackUnit(UnitInfo unit)
 {
     var attackUnit = false;
     if (this.Id != unit.Id)
     {
         if (this.Aggression >= unit.Power)
         {
             attackUnit = true;
         }
     }
     return attackUnit;
 }
Exemple #24
0
 public Interaction(UnitInfo sourceUnitInfo, UnitInfo targetUnitInfo, InteractionType type)
 {
     this.SourceUnit      = sourceUnitInfo;
     this.TargetUnit      = targetUnitInfo;
     this.InteractionType = type;
 }
Exemple #25
0
 protected Unit GetUnit(UnitInfo unitInfo)
 {
     return(this.GetUnit(unitInfo.Id));
 }
 protected override bool CanAttackUnit(UnitInfo unit)
 {
     return this.Id != unit.Id && (unit.UnitClassification == this.UnitClassification || unit.UnitClassification == UnitClassification.Mechanical);
 }
Exemple #27
0
        protected override bool CanAttackUnit(UnitInfo unit)
        {
            bool attackUnit = this.Id != unit.Id;

            return attackUnit;
        }
Exemple #28
0
        protected virtual UnitInfo GetOptimalAttackableUnit(IEnumerable<UnitInfo> attackableUnits)
        {
            //This method finds the unit with the least power and attacks it
            var optimalAttackableUnit = new UnitInfo(null, UnitClassification.Unknown, 0, int.MaxValue, 0);

            foreach (var unit in attackableUnits)
            {
                if (unit.Power < optimalAttackableUnit.Power)
                {
                    optimalAttackableUnit = unit;
                }
            }

            return optimalAttackableUnit;
        }
 protected Unit GetUnit(UnitInfo unitInfo)
 {
     return this.GetUnit(unitInfo.Id);
     //return this.containedUnits.FirstOrDefault((unit) => unit.Id == unitInfo.Id);
 }
 public Interaction(UnitInfo sourceUnitInfo, UnitInfo targetUnitInfo, InteractionType type)
 {
     this.SourceUnit = sourceUnitInfo;
     this.TargetUnit = targetUnitInfo;
     this.InteractionType = type;
 }
Exemple #31
0
 public bool CanInfest(UnitInfo unit)
 {
     return (InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification)
             == this.UnitClassification);
 }
Exemple #32
0
 protected override bool CanAttackUnit(UnitInfo unit)
 {
     return this.Id != unit.Id &&
         InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification) == this.UnitClassification ? true : false;
 }
Exemple #33
0
        protected virtual Unit GetUnit(UnitInfo unitInfo)
        {
            return(this.GetUnit(unitInfo.Id));

            // return this.containedUnits.FirstOrDefault((unit) => unit.Id == unitInfo.Id);
        }