protected override bool CanAttackUnit(UnitInfo unit) { if (this.Id != unit.Id && InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification).Equals(this.UnitClassification)) { return true; } return false; }
protected override bool CanAttackUnit(UnitInfo unit) { if (unit.Id != this.Id) { return true; } return false; }
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; }
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; }
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; }
protected override bool CanAttackUnit(UnitInfo unit) { bool attackUnit = false; if (this.Id != unit.Id) { if (this.Aggression >= unit.Power) { attackUnit = true; } } return attackUnit; }
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; } }
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); }
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; }
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; }
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; }
//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; }
// 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! }
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; }
protected override bool CanAttackUnit(UnitInfo unit) { bool attackUnit = this.Id != unit.Id && InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification) == this.UnitClassification; return attackUnit; }
protected virtual bool CanAttackUnit(UnitInfo unit) { var attackUnit = false; if (this.Id != unit.Id) { if (this.Aggression >= unit.Power) { attackUnit = true; } } return attackUnit; }
public Interaction(UnitInfo sourceUnitInfo, UnitInfo targetUnitInfo, InteractionType type) { this.SourceUnit = sourceUnitInfo; this.TargetUnit = targetUnitInfo; this.InteractionType = type; }
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); }
protected override bool CanAttackUnit(UnitInfo unit) { bool attackUnit = this.Id != unit.Id; return attackUnit; }
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 bool CanInfest(UnitInfo unit) { return (InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification) == this.UnitClassification); }
protected override bool CanAttackUnit(UnitInfo unit) { return this.Id != unit.Id && InfestationRequirements.RequiredClassificationToInfest(unit.UnitClassification) == this.UnitClassification ? true : false; }
protected virtual Unit GetUnit(UnitInfo unitInfo) { return(this.GetUnit(unitInfo.Id)); // return this.containedUnits.FirstOrDefault((unit) => unit.Id == unitInfo.Id); }