VBUnitAI GetNextPlayerActive(VBUnitAI LastPlayer) { VBUnitAI newUnit = LastPlayer; activeEnt = null; //Get the next player if (combatants.Find(newUnit) == combatants.Last) { newUnit = combatants.First.Value; } else { newUnit = combatants.Find(newUnit).Next.Value; } if (newUnit == null || newUnit.IsSetForDeletion) { return(GetNextPlayerActive(newUnit)); } else { return(newUnit); } }
public void TurnEnded() { //set next player activeEnt = GetNextPlayerActive(activeEnt); //FIXME: set cam here activeEnt.InitiatetTurn(); turnNumber += 1; }
public static void StartCombat(VBUnitAI starter) { if (CombatManager.Instance != null) { return; } CombatManager i = (CombatManager)Entities.Instance.Create("CombatManager", Map.Instance); i.PostCreate(); i.CreateCombatantList(starter); }
public bool InCombat(VBUnitAI u) { foreach (VBUnitAI unit in combatants) { if (unit != null && !unit.IsSetForDeletion) { if (u == unit) { return(true); } } } return(false); }
public void CreateCombatantList(VBUnitAI ch) { Map.Instance.GetObjects(new Sphere(ch.ControlledObject.Position, ch.ControlledObject.ViewRadius + 30), MapObjectSceneGraphGroups.UnitGroupMask, delegate(MapObject mapObject) { VBCharacter c = mapObject as VBCharacter; if (c != null) { combatants.AddLast(c.Intellect); } }); //reset all tasks foreach (VBUnitAI combatant in combatants) { combatant.ResetForCombat(); } starter = activeEnt = ch; ch.InitiatetTurn(); //TODO: ARRANGE LIST BY SEQUENCE }
bool FoesAlive() { VBUnitAI toCheck = null; foreach (VBUnitAI u in combatants) { if (u != null && !u.IsSetForDeletion) { if (toCheck != null) { if (u.IsEnemy(toCheck)) { return(true); } } else { toCheck = u; } } } return(false); }
public void JoinCombat(VBUnitAI u) { combatants.AddLast(u); }