Beispiel #1
0
 private void ReleaseCrusade(Crusade crusade)
 {
     //Debug.WriteLine("Release crusade against " + crusade.mSectorX + ", " + crusade.mSectorY + " with " + crusade.mWarriors.Count + " warriors.");
     Debug.Assert(mCrusades.Contains(crusade));
     for (int i = crusade.mWarriors.Count-1; i >= 0; i--)
     {
         IMovable warrior = crusade.mWarriors[i];
         crusade.mWarriors.RemoveAt(i);
         RemoveExercise(warrior);
     }
     mCrusades.Remove(crusade);
 }
Beispiel #2
0
 private void AttackSector(int sectorX, int sectorY, int needed)
 {
     // TODO
     foreach(Crusade c in mCrusades) {
         Debug.Assert(c.mSectorX != sectorX || c.mSectorY != sectorY, "AI cannot attack same sector twice!");
     }
     Debug.Assert(needed > 0);
     //Debug.WriteLine("AI: Crusade against sector "+sectorX+", "+sectorY+" with "+needed+" ships started.");
     Crusade crusade = new Crusade(this, sectorX, sectorY);
     mCrusades.Add(crusade);
     Crusading crusading = new Crusading(this, crusade);
     crusading.AssignVolunteers(needed);
     foreach (IMovable warrior in crusade.mWarriors)
     {
         Debug.Assert(!mCurrentIdleUnits.Contains(warrior));
         Debug.Assert(mUnitToServant.ContainsKey(warrior));
         Crusading c = (Crusading)((Servant) mUnitToServant[warrior]).mExercise;
         Debug.Assert(c != null);
         Debug.Assert(c.mCrusade == crusade);
     }
 }