|
Britbot
|
00001 namespace Britbot.Simulator 00002 { 00006 internal class BattleEvent : SimulatedEvent 00007 { 00008 #region Fields & Properies 00009 00010 //first group 00011 private SimulatedGroup _groupA; 00012 //second group 00013 private SimulatedGroup _groupB; 00014 00015 #endregion 00016 00017 #region Constructors & Initializers 00018 00025 public BattleEvent(int turn, SimulatedGroup g1, SimulatedGroup g2) 00026 : base(turn) 00027 { 00028 this._groupA = g1; 00029 this._groupB = g2; 00030 } 00031 00032 #endregion 00033 00039 public override bool Activate(SimulatedGame sg) 00040 { 00041 //check if the groups are oposing 00042 if (this._groupA.Owner != this._groupB.Owner) 00043 { 00044 //check fire power 00045 if (this._groupA.ActualFirePower() < this._groupB.ActualFirePower()) 00046 { 00047 this._groupA.Kill(sg); 00048 } 00049 else if (this._groupA.ActualFirePower() == this._groupB.ActualFirePower()) 00050 { 00051 this._groupA.Kill(sg); 00052 this._groupB.Kill(sg); 00053 } 00054 else 00055 { 00056 this._groupB.Kill(sg); 00057 } 00058 } 00059 00060 return false; 00061 } 00062 } 00063 }
1.7.6.1