private static VectorAI PrincessTowerCharacterDeploymentCorrection(VectorAI position, Playfield p, Handcard hc) { //Logger.Debug("PT Characer Position Correction: Name und Typ {0} " + cardToDeploy.Name, (cardToDeploy as CardCharacter).Type); VectorAI result = new VectorAI(0, 0); if (hc.card.type == boardObjType.MOB) { if (hc.card.MaxHP >= Apollo.Settings.MinHealthAsTank) { position.SubtractYInDirection(p); return(position); } else { position.AddYInDirection(p); return(position); } } else if (hc.card.type == boardObjType.BUILDING) { return(GetPositionOfTheBestBuildingDeploy(p)); } //else // Logger.Debug("Tower Correction: No Correction!!!"); return(position); }
private static VectorAI AKT(Playfield p, Handcard hc) { Logger.Debug("AKT"); if (p.enemyPrincessTowers.Count == 2) { if (p.enemyPrincessTower1.HP < p.enemyPrincessTower2.HP) { return(APTL1(p, hc)); } else { return(APTL2(p, hc)); } } if (p.enemyPrincessTower1.HP == 0 && p.enemyPrincessTower2.HP > 0) { return(APTL1(p, hc)); } if (p.enemyPrincessTower2.HP == 0 && p.enemyPrincessTower1.HP > 0) { return(APTL2(p, hc)); } VectorAI position = p.enemyKingsTower?.Position; //if (Decision.SupportDeployment(p, 1)) // position = p.getDeployPosition(position, deployDirectionRelative.Down, 500); return(position); }
public static VectorAI GetPositionOfTheBestBuildingDeploy(Playfield p, Handcard hc, FightState currentSituation) { // ToDo: Find the best position VectorAI betweenBridges = p.getDeployPosition(deployDirectionAbsolute.betweenBridges); //switch (currentSituation) //{ // case FightState.UAPTL1: // case FightState.DPTL1: // return p.getDeployPosition(p.ownPrincessTower1.Position, deployDirectionRelative.RightDown); // case FightState.UAPTL2: // case FightState.DPTL2: // return p.getDeployPosition(p.ownPrincessTower2.Position, deployDirectionRelative.LeftDown); // case FightState.UAKTL1: // case FightState.UAKTL2: // return p.getDeployPosition(p.ownKingsTower.Position, deployDirectionRelative.Down); // case FightState.APTL1: // return p.getDeployPosition(betweenBridges, deployDirectionRelative.Left, 1000); // case FightState.APTL2: // return p.getDeployPosition(betweenBridges, deployDirectionRelative.Right, 1000); // case FightState.AKT: // return p.getDeployPosition(p.enemyKingsTower, deployDirectionRelative.Down, 500); //} return(p.getDeployPosition(betweenBridges, deployDirectionRelative.Down, 4000)); }
private static Handcard SpellMagic(Playfield p, FightState currentSituation, out VectorAI choosedPosition) { choosedPosition = null; switch (currentSituation) { case FightState.UAKTL1: case FightState.UAKTL2: case FightState.UAPTL1: case FightState.UAPTL2: case FightState.DKT: case FightState.DPTL1: case FightState.DPTL2: case FightState.AKT: case FightState.APTL1: case FightState.APTL2: return(CardChoosing.All(p, currentSituation, out choosedPosition)); case FightState.START: return(null); case FightState.WAIT: return(null); default: return(CardChoosing.All(p, currentSituation, out choosedPosition)); } }
private static VectorAI PrincessTowerCharacterDeploymentCorrection(VectorAI position, Playfield p, Handcard hc) { if (hc?.card == null || position == null) { return(null); } //Logger.Debug("PT Characer Position Correction: Name und Typ {0} " + cardToDeploy.Name, (cardToDeploy as CardCharacter).Type); if (hc.card.type == boardObjType.MOB) { if (hc.card.MaxHP >= Setting.MinHealthAsTank) { return(p.getDeployPosition(position, deployDirectionRelative.Up, 100)); } if (Classification.GetSpecificCardType(hc) == SpecificCardType.MobsAOEGround) { return(p.getDeployPosition(position, deployDirectionRelative.Up, 4000)); } if (Classification.GetSpecificCardType(hc) == SpecificCardType.MobsRanger) { return(p.getDeployPosition(position, deployDirectionRelative.Down, 2000)); } return(p.getDeployPosition(position, deployDirectionRelative.Up, 100)); } else { Logger.Debug("Tower Correction: No Correction!!!"); } return(position); }
private static VectorAI ARPT(Playfield p) { //Logger.Debug("ARPT"); VectorAI rPT = p.enemyTowers.FirstOrDefault(n => n.Line == 2)?.Position; return(rPT); }
public override Cast GetBestCast(Playfield p) { //DebugThings(p); Cast bc = null; Logger.Debug("Home = {Home}", p.home); #region Apollo Magic // Highest priority -> Can we kill the enemy with a spell BoardObj finisherTower = Decision.IsEnemyKillWithSpellPossible(p, out Handcard hc); if (finisherTower != null && (hc?.manacost > p.ownMana)) { return(new Cast(hc.name, finisherTower.Position, hc)); } // ------------------------------------------------------ PlayfieldAnalyse.AnalyseLines(p); // Danger- and Chancelevel currentSituation = GetCurrentFightState(p); // Attack, Defense or UnderAttack (and where it is) hc = CardChoosing.GetOppositeCard(p, currentSituation) ?? CardChoosing.GetMobInPeace(p, currentSituation); //hc = CardChoosing.GetMobInPeace(p, currentSituation); if (hc == null) { Logger.Debug("Part: SpellApolloWay"); Handcard hcApollo = SpellMagic(p, currentSituation, out VectorAI choosedPosition); if (hcApollo != null) { hc = hcApollo; if (choosedPosition != null && !(hc?.manacost > p.ownMana)) { return(new Cast(hcApollo.name, choosedPosition, hcApollo)); } } } if (hc == null) { return(null); } Logger.Debug("Part: GetSpellPosition"); VectorAI nextPosition = SpecialPositionHandling.GetPosition(p, hc); if (nextPosition == null) { nextPosition = PositionChoosing.GetNextSpellPosition(currentSituation, hc, p); } bc = new Cast(hc.name, nextPosition, hc); #endregion Logger.Debug("BestCast:" + bc.SpellName + " " + bc.Position.ToString()); if (bc?.hc?.manacost > p.ownMana) { return(null); } return(bc); }
public static VectorAI GetPositionOfTheBestDamagingSpellDeploy(Playfield p) { // Prio1: Hit Enemy King Tower if health is low // Prio2: Every damaging spell if there is a big group of enemies Logger.Debug("GetPositionOfTheBestDamaingSpellDeploy"); if (p.enemyKingsTower?.HP < Setting.KingTowerSpellDamagingHealth || (p.enemyMinions.Count + p.enemyBuildings.Count) < 1) { return(p.enemyKingsTower?.Position); } BoardObj enemy = Helper.EnemyCharacterWithTheMostEnemiesAround(p, out int count, transportType.NONE); if (enemy?.Position != null) { // Debugging: try - catch is just for debugging try { // ToDo: Use a mix of the HP and count of the Enemy Units // How fast are the enemy units, needed for a better correction if (Helper.HowManyNFCharactersAroundCharacter(p, enemy) >= Setting.SpellCorrectionConditionCharCount) { Logger.Debug("With correction; enemy.Name = {Name}", enemy.Name); if (enemy.Position != null) { Logger.Debug("enemy.Position = {position}", enemy.Position); return(p.getDeployPosition(enemy.Position, deployDirectionRelative.Down, 500)); } } else { Logger.Debug("No correction; enemy.Name = {Name}", enemy.Name); if (enemy.Position != null) { Logger.Debug("enemy.Position = {position}", enemy.Position); return(enemy.Position); } } } catch (Exception) { //enemy.Position.AddYInDirection(p, 3000); // Position Correction VectorAI result = p.getDeployPosition(enemy.Position, deployDirectionRelative.Down, 500); Logger.Debug("enemy.Name = {Name}", enemy.Name); if (enemy.Position != null) { Logger.Debug("enemy.Position = {position}", enemy.Position); } Logger.Debug("result = {position}", result); return(result); } } Logger.Debug("enemy = null?{enemy} ; enemy.position = null?{position}", enemy == null, enemy.Position == null); Logger.Debug("Error: 0/0"); return(new VectorAI(0, 0)); }
public static VectorAI GetPositionOfTheBestBuildingDeploy(Playfield p) { // ToDo: Find the best position VectorAI nextPosition = p.ownKingsTower.Position; nextPosition.AddYInDirection(p, 3000); return(nextPosition); }
public static bool IsPositionInArea(this BoardObj bo, Playfield p, VectorAI position) { bool isInArea = position.X >= bo.Position.X - bo.Range && position.X <= bo.Position.X + bo.Range && position.Y >= bo.Position.Y - bo.Range && position.Y <= bo.Position.Y + bo.Range; return(isInArea); }
private static VectorAI DKT(Playfield p, Handcard hc) { if (hc.card.type == boardObjType.MOB) { if (hc.card.MaxHP >= Apollo.Settings.MinHealthAsTank) { //Logger.Debug("DKT Troop-Name {0} ; CartType GroundAttack, Flying or Tank", cardToDeploy.Name); if (GetNearestEnemy(p)?.Line == 2) { VectorAI v = new VectorAI(p.enemyKingsTower.Position.X + 1000, p.enemyKingsTower.Position.Y); return(v); } else { VectorAI v = new VectorAI(p.enemyKingsTower.Position.X - 1000, p.enemyKingsTower.Position.Y); return(v); } } else { p.ownKingsTower.Position.AddYInDirection(p); VectorAI position = p.ownKingsTower.Position; if (GetNearestEnemy(p).Line == 2) { position = new VectorAI(position.X + 300, position.Y); return(position); } else { position = new VectorAI(position.X - 300, position.Y); return(position); } } } else if (hc.card.type == boardObjType.BUILDING) { //switch ((cardToDeploy as CardBuilding).Type) //{ // case BuildingType.BuildingDefense: // case BuildingType.BuildingSpawning: return(GetPositionOfTheBestBuildingDeploy(p)); //} } if (GetNearestEnemy(p).Line == 2) { VectorAI v = new VectorAI(p.ownKingsTower.Position.X + 1000, p.ownKingsTower.Position.Y); return(v); } else { VectorAI v = new VectorAI(p.ownKingsTower.Position.X - 1000, p.ownKingsTower.Position.Y); return(v); } }
public static bool IsPositionInArea(this BoardObj bo, Playfield p, VectorAI position) { int buildingSizeAddition = 1000; long a = ((bo.Position.X + buildingSizeAddition - position.X) * (bo.Position.X + buildingSizeAddition - position.X)); long b = ((bo.Position.Y + buildingSizeAddition - position.Y) * (bo.Position.Y + buildingSizeAddition - position.Y)); long c = (bo.Range * bo.Range); return((a + b) < c); }
private static VectorAI APT(Playfield p, Handcard hc, int line) { Logger.Debug("ALPT"); if (hc.card.type == boardObjType.BUILDING) { return(line == 1 ? GetPositionOfTheBestBuildingDeploy(p, hc, FightState.APTL1) : GetPositionOfTheBestBuildingDeploy(p, hc, FightState.APTL2)); } if (hc.card.MaxHP >= Setting.MinHealthAsTank) { VectorAI tankInFront = Helper.DeployTankInFront(p, line); if (tankInFront != null) { return(tankInFront); } } else { VectorAI behindTank = Helper.DeployBehindTank(p, line); if (behindTank != null) { return(behindTank); } } VectorAI PT; if (PlayfieldAnalyse.lines[line - 1].OwnMobSide) { PT = p.getDeployPosition(deployDirectionAbsolute.ownPrincessTowerLine1); if (Decision.SupportDeployment(p, line, true)) { PT = p.getDeployPosition(PT, deployDirectionRelative.Down); } } else { PT = p.getDeployPosition(deployDirectionAbsolute.enemyPrincessTowerLine1); if (Decision.SupportDeployment(p, line, false)) { PT = p.getDeployPosition(PT, deployDirectionRelative.Down); } } return(PT); }
private static VectorAI DRPT(Playfield p, Handcard hc) { BoardObj rPT = p.ownTowers.FirstOrDefault(n => n.Line == 2); if (rPT == null) { return(DKT(p, hc)); } VectorAI rPTP = rPT.Position; VectorAI correctedPosition = PrincessTowerCharacterDeploymentCorrection(rPTP, p, hc); return(correctedPosition); }
private static VectorAI DLPT(Playfield p, Handcard hc) { BoardObj lPT = p.ownTowers.FirstOrDefault(n => n.Line == 1); if (lPT == null) { return(DKT(p, hc)); } //Logger.Debug("DLPT: LeftPrincessTower = " + lPT.ToString()); VectorAI lPTP = lPT.Position; VectorAI correctedPosition = PrincessTowerCharacterDeploymentCorrection(lPTP, p, hc); return(correctedPosition); }
private static VectorAI APTL1(Playfield p, Handcard hc) { Logger.Debug("ALPT"); if (hc.card.MaxHP >= Setting.MinHealthAsTank) { VectorAI tankInFront = Helper.DeployTankInFront(p, 1); if (tankInFront != null) { return(tankInFront); } } else { VectorAI behindTank = Helper.DeployBehindTank(p, 1); if (behindTank != null) { return(behindTank); } } VectorAI lPT; if (PlayfieldAnalyse.lines[0].OwnMobSide) { lPT = p.getDeployPosition(deployDirectionAbsolute.ownPrincessTowerLine1); if (Decision.SupportDeployment(p, 1, true)) { lPT = p.getDeployPosition(lPT, deployDirectionRelative.Down); } } else { lPT = p.getDeployPosition(deployDirectionAbsolute.enemyPrincessTowerLine1); if (Decision.SupportDeployment(p, 1, false)) { lPT = p.getDeployPosition(lPT, deployDirectionRelative.Down); } } return(lPT); }
public static bool IsAnEnemyObjectInArea(Playfield p, VectorAI position, int areaSize, boardObjType type) { bool WhereClause(BoardObj n) => n.Position.X >= position.X - areaSize && n.Position.X <= position.X + areaSize && n.Position.Y >= position.Y - areaSize && n.Position.Y <= position.Y + areaSize; if (type == boardObjType.MOB) { return(p.enemyMinions.Where(WhereClause).Any()); } else if (type == boardObjType.BUILDING) { return(p.enemyBuildings.Where(WhereClause).Any()); } else if (type == boardObjType.AOE) { return(p.enemyAreaEffects.Where(WhereClause).Any()); } return(false); }
public override Cast GetBestCast(Playfield p) { Cast bc = null; // Peros: Contains mobs, buildings and towers group ownGroup = p.getGroup(true, 85, boPriority.byTotalNumber, 3000); #region Apollo Magic FightState currentSituation = CurrentFightState(p); Handcard hc = SpellMagic(p, currentSituation); if (hc == null) { return(null); } VectorAI nextPosition = GetNextSpellPosition(currentSituation, hc, p); bc = new Cast(hc.name, nextPosition, hc); #endregion Logger.Information("BestCast: {SpellName} {Position}", bc?.SpellName, bc?.Position); return(bc); }
public static Handcard All(Playfield p, FightState currentSituation, out VectorAI choosedPosition) { // TODO: Use more current situation Logger.Debug("Path: Spell - All"); Logger.Debug("FightState: " + currentSituation); Handcard damagingSpell = DamagingSpellDecision(p, out choosedPosition); if (damagingSpell != null) { return(damagingSpell); } Handcard aoeCard = AOEDecision(p); if (aoeCard != null) { return(aoeCard); } if (p.enemyMinions.Any(n => n.Transport == transportType.AIR)) { Logger.Debug("AttackFlying Needed"); Handcard atkFlying = Classification.GetOwnHandCards(p, boardObjType.MOB, SpecificCardType.MobsFlyingAttack).FirstOrDefault(); if (atkFlying != null) { return(atkFlying); } } if (DeployBuildingDecision(p, out Handcard buildingCard, currentSituation)) { if (buildingCard != null) { return(new Handcard(buildingCard.name, buildingCard.lvl)); } } // ToDo: Don´t play a tank, if theres already one on this side if ((int)currentSituation < 3 || (int)currentSituation > 6) // Just not at Under Attack { var tank = Classification.GetOwnHandCards(p, boardObjType.MOB, SpecificCardType.MobsTank).OrderBy(n => n.card.MaxHP); var lt = tank.LastOrDefault(); if (lt != null && lt.manacost <= p.ownMana) { return(lt); } } // ToDo: Decision for building attacker if ((int)currentSituation > 6 && (int)currentSituation < 10) { var buildingAtkCard = Classification.GetOwnHandCards(p, boardObjType.MOB, SpecificCardType.MobsBuildingAttacker).FirstOrDefault(); if (buildingAtkCard != null && buildingAtkCard.manacost <= p.ownMana) { return(buildingAtkCard); } } if ((int)currentSituation < 3) { var highestHP = Classification.GetOwnHandCards(p, boardObjType.MOB, SpecificCardType.All) .Where(n => n.manacost - p.ownMana <= 0) .OrderBy(n => n.card.MaxHP).LastOrDefault(); return(highestHP); } var rangerCard = Classification.GetOwnHandCards(p, boardObjType.MOB, SpecificCardType.MobsRanger).FirstOrDefault(); if (rangerCard != null && rangerCard.manacost <= p.ownMana) { return(rangerCard); } var damageDealerCard = Classification.GetOwnHandCards(p, boardObjType.MOB, SpecificCardType.MobsDamageDealer).FirstOrDefault(); if (damageDealerCard != null && damageDealerCard.manacost <= p.ownMana) { return(damageDealerCard); } if ((int)currentSituation >= 3 && (int)currentSituation <= 6) { return(Classification.GetOwnHandCards(p, boardObjType.MOB, SpecificCardType.MobsNoTank).FirstOrDefault()); } Logger.Debug("Wait - No card selected..."); return(null); }
// TODO: Check this out public static Handcard DamagingSpellDecision(Playfield p, out VectorAI choosedPosition) { choosedPosition = null; var damagingSpellsSource = Classification.GetOwnHandCards(p, boardObjType.PROJECTILE, SpecificCardType.SpellsDamaging); var damagingSpells = damagingSpellsSource as Handcard[] ?? damagingSpellsSource.ToArray(); var fds = damagingSpells.FirstOrDefault(); if (fds == null) { return(null); } #region Tower var ds5 = damagingSpells.FirstOrDefault(n => (n.card.towerDamage >= p.enemyKingsTower.HP)); if (ds5 != null) { Logger.Debug("towerDamage: {td} ; kt.hp: {kthp}", ds5.card.towerDamage, p.enemyKingsTower.HP); choosedPosition = p.enemyKingsTower.Position; return(ds5); } if (p.suddenDeath) { var ds3 = damagingSpells.FirstOrDefault(n => (n.card.towerDamage >= p.enemyPrincessTower1.HP)); var ds4 = damagingSpells.FirstOrDefault(n => (n.card.towerDamage >= p.enemyPrincessTower2.HP)); if (ds3 != null && p.enemyPrincessTower1.HP > 0) { Logger.Debug("towerDamage: {td} ; pt1.hp: {pt1hp}", ds3.card.towerDamage, p.enemyPrincessTower1.HP); choosedPosition = p.enemyPrincessTower1.Position; return(ds3); } if (ds4 != null && p.enemyPrincessTower2.HP > 0) { Logger.Debug("towerDamage: {td} ; pt1.hp: {pt1hp}", ds4.card.towerDamage, p.enemyPrincessTower2.HP); choosedPosition = p.enemyPrincessTower2.Position; return(ds4); } } #endregion var radiusOrderedDS = damagingSpells.OrderBy(n => n.card.DamageRadius).LastOrDefault(); if (radiusOrderedDS == null) { return(null); } var Group = p.getGroup(false, 200, boPriority.byTotalNumber, radiusOrderedDS.card.DamageRadius); if (Group == null) { return(null); } var grpCount = Group.lowHPbo.Count() + Group.avgHPbo.Count() + Group.hiHPbo.Count(); var hpSum = Group.lowHPboHP + Group.hiHPboHP + Group.avgHPboHP; var ds1 = damagingSpells.FirstOrDefault(n => n.card.DamageRadius > 3 && grpCount > 4); if (ds1 != null) { Logger.Debug("Damaging-Spell-Decision: HP-Sum of group = " + hpSum); choosedPosition = p.getDeployPosition(Group.Position, deployDirectionRelative.Down, 1000); return(ds1); } var ds2 = damagingSpells.FirstOrDefault(n => n.card.DamageRadius <= 3 && grpCount > 1 && hpSum >= n.card.Atk * 2); if (ds2 != null) { Logger.Debug("Damaging-Spell-Decision: HP-Sum of group = " + hpSum); choosedPosition = p.getDeployPosition(Group.Position, deployDirectionRelative.Down, 1000); return(ds2); } return(null); }
private static VectorAI DKT(Playfield p, Handcard hc, int line) { // ToDo: Improve if (line == 0) { line = p.enemyPrincessTower1.HP < p.enemyPrincessTower2.HP ? 1 : 2; } if (hc.card.type == boardObjType.MOB) { if (hc.card.MaxHP >= Setting.MinHealthAsTank) { // TODO: Analyse which is the most dangerous line if (line == 2) { Logger.Debug("KT RightUp"); VectorAI v = p.getDeployPosition(p.ownKingsTower.Position, deployDirectionRelative.RightUp, 100); return(v); } else { Logger.Debug("KT LeftUp"); VectorAI v = p.getDeployPosition(p.ownKingsTower.Position, deployDirectionRelative.LeftUp, 100); return(v); } } if (hc.card.Transport == transportType.AIR) { return(p.getDeployPosition(line == 2 ? deployDirectionAbsolute.ownPrincessTowerLine2 : deployDirectionAbsolute.ownPrincessTowerLine1)); } else { if (line == 2) { Logger.Debug("BehindKT: Line2"); VectorAI position = p.getDeployPosition(deployDirectionAbsolute.behindKingsTowerLine2); return(position); } else { Logger.Debug("BehindKT: Line1"); VectorAI position = p.getDeployPosition(deployDirectionAbsolute.behindKingsTowerLine1); return(position); } } } else if (hc.card.type == boardObjType.BUILDING) { //switch ((cardToDeploy as CardBuilding).Type) //{ // case BuildingType.BuildingDefense: // case BuildingType.BuildingSpawning: return(GetPositionOfTheBestBuildingDeploy(p, hc, FightState.DKT)); //} } else if (hc.card.type == boardObjType.AOE || hc.card.type == boardObjType.PROJECTILE) { return(GetPositionOfTheBestDamagingSpellDeploy(p)); } else { Logger.Debug("DKT: Handcard equals NONE!"); return(p.ownKingsTower?.Position); } }
public static VectorAI GetNextSpellPosition(FightState gameState, Handcard hc, Playfield p) { if (hc?.card == null) { return(null); } VectorAI choosedPosition = null; if (hc.card.type == boardObjType.AOE || hc.card.type == boardObjType.PROJECTILE) { Logger.Debug("AOE or PROJECTILE"); return(GetPositionOfTheBestDamagingSpellDeploy(p)); } // ToDo: Handle Defense Gamestates switch (gameState) { case FightState.UAKTL1: choosedPosition = UAKT(p, hc, 1); break; case FightState.UAKTL2: choosedPosition = UAKT(p, hc, 2); break; case FightState.UAPTL1: choosedPosition = UAPTL1(p, hc); break; case FightState.UAPTL2: choosedPosition = UAPTL2(p, hc); break; case FightState.AKT: choosedPosition = AKT(p, hc); break; case FightState.APTL1: choosedPosition = APTL1(p, hc); break; case FightState.APTL2: choosedPosition = APTL2(p, hc); break; case FightState.DKT: choosedPosition = DKT(p, hc, 0); break; case FightState.DPTL1: choosedPosition = DPTL1(p, hc); break; case FightState.DPTL2: choosedPosition = DPTL2(p, hc); break; default: //Logger.Debug("GameState unknown"); break; } //Logger.Debug("GameState: {GameState}", gameState.ToString()); //Logger.Debug("nextPosition: " + nextPosition); return(choosedPosition); }
public static VectorAI GetNextSpellPosition(FightState gameState, Handcard hc, Playfield p) { #region Randomise Random rnd = new Random(); int rndX = rnd.Next(-Apollo.Settings.RandomDeploymentValue, Apollo.Settings.RandomDeploymentValue); int rndY = rnd.Next(-Apollo.Settings.RandomDeploymentValue, Apollo.Settings.RandomDeploymentValue); VectorAI rndAddVector = new VectorAI(rndX, rndY); #endregion if (hc == null || hc.card == null) { return(null); } VectorAI choosedPosition = new VectorAI(0, 0), nextPosition; if (hc.card.type == boardObjType.AOE) { return(GetPositionOfTheBestDamagingSpellDeploy(p)); } // ToDo: Handle Defense Gamestates switch (gameState) { case FightState.UAKT: choosedPosition = UAKT(p, hc); break; case FightState.UALPT: choosedPosition = UALPT(p, hc); break; case FightState.UARPT: choosedPosition = UARPT(p, hc); break; case FightState.AKT: choosedPosition = AKT(p); break; case FightState.ALPT: choosedPosition = ALPT(p); break; case FightState.ARPT: choosedPosition = ARPT(p); break; case FightState.DKT: choosedPosition = DKT(p, hc); break; case FightState.DLPT: choosedPosition = DLPT(p, hc); break; case FightState.DRPT: choosedPosition = DRPT(p, hc); break; case FightState.START: break; case FightState.WAIT: break; default: //Logger.Debug("GameState unknown"); break; } if (choosedPosition == null) { return(null); } //Logger.Debug("GameState: {GameState}", gameState.ToString()); Vector2 v = (choosedPosition.ToVector2() + rndAddVector.ToVector2()); nextPosition = new VectorAI(v.X, v.Y); //Logger.Debug("nextPosition: " + nextPosition); return(nextPosition); }