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)); } }
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); }