public static BoardObj IsEnemyKillWithSpellPossible(Playfield p, out Handcard resultHc) { IEnumerable <Handcard> hcs = Classification.GetOwnHandCards(p, boardObjType.PROJECTILE, SpecificCardType.SpellsDamaging); resultHc = null; if (!hcs.Any()) { return(null); } foreach (Handcard hc in hcs) { resultHc = hc; if (hc.card.towerDamage >= p.enemyKingsTower.HP) { return(p.enemyKingsTower); } if (p.suddenDeath) { if (hc.card.towerDamage >= p.enemyPrincessTower1.HP) { return(p.enemyPrincessTower1); } if (hc.card.towerDamage >= p.enemyPrincessTower2.HP) { return(p.enemyPrincessTower2); } } } return(null); }
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); }
// erhält jedes mal +1/+1, wenn ihr eine karte ausspielt. public override void onCardIsGoingToBePlayed(Playfield p, Handcard hc, bool wasOwnCard, Minion triggerEffectMinion) { if (triggerEffectMinion.own == wasOwnCard) { p.minionGetBuffed(triggerEffectMinion, 1, 1); } }
private static VectorAI DPTL1(Playfield p, Handcard hc) { BoardObj lPT = p.ownPrincessTower1; if (lPT?.Position == null) { return(DKT(p, hc, 1)); } switch (hc.card.type) { case boardObjType.MOB: return(PrincessTowerCharacterDeploymentCorrection(lPT.Position, p, hc)); case boardObjType.BUILDING: //switch ((cardToDeploy as CardBuilding).Type) //{ // case BuildingType.BuildingDefense: // case BuildingType.BuildingSpawning: return(GetPositionOfTheBestBuildingDeploy(p, hc, FightState.DPTL1)); //} case boardObjType.AOE: case boardObjType.PROJECTILE: return(GetPositionOfTheBestDamagingSpellDeploy(p)); } return(lPT.Position); }
private void setCardChoices(List <CardDB.cardIDEnum> crdchcs) { this.handcardchoices.Clear(); foreach (CardDB.cardIDEnum cid in crdchcs) { CardDB.Card cardc = CardDB.Instance.getCardDataFromID(cid); Handcard nehc = new Handcard(cardc) { entity = 54321, manacost = cardc.cost }; this.handcardchoices.Add(nehc); Helpfunctions.Instance.ErrorLog("choices " + cardc.name); } CardDB.Card tempcard = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.CS2_029);//=fireball, just to make sure its not a mob (movegen will ignore mobs if own minions >= 7) tempcard.name = CardDB.cardName.placeholdercard; Handcard newhc = new Handcard(tempcard) { entity = 54321, isChoiceTemp = true, manacost = 0 }; this.handCards.Add(newhc); }
public Handcard(Handcard hc) { this.position = hc.position; this.entity = hc.entity; this.manacost = hc.manacost; this.card = hc.card; }
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)); }
// After you play a Secret, put another random Hunter secret into play. public override void onCardIsGoingToBePlayed(Playfield p, Handcard hc, bool ownplay, Minion m) { if (hc.card.Secret) { p.evaluatePenality -= 9; } }
//Whenether you Overloaded, gain +1 Attack per locked Mana Crystal. public override void onCardIsGoingToBePlayed(Playfield p, Handcard hc, bool wasOwnCard, Minion triggerEffectMinion) { if (wasOwnCard == triggerEffectMinion.own && hc.card.Overload > 0) { p.minionGetBuffed(triggerEffectMinion, hc.card.Overload, 0); } }
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); }
private static VectorAI DPTL2(Playfield p, Handcard hc) { BoardObj rPT = p.ownPrincessTower2; if (rPT == null && rPT.Position == null) { return(DKT(p, hc, 2)); } if (hc.card.type == boardObjType.MOB) { return(PrincessTowerCharacterDeploymentCorrection(rPT.Position, p, hc)); } else if (hc.card.type == boardObjType.BUILDING) { //switch ((cardToDeploy as CardBuilding).Type) //{ // case BuildingType.BuildingDefense: // case BuildingType.BuildingSpawning: return(GetPositionOfTheBestBuildingDeploy(p, hc, FightState.DPTL2)); //} } else if (hc.card.type == boardObjType.AOE || hc.card.type == boardObjType.PROJECTILE) { return(GetPositionOfTheBestDamagingSpellDeploy(p)); } return(rPT.Position); }
// Whenever a Secret: is played, gain +1/+1. public override void onCardIsGoingToBePlayed(Playfield p, Handcard hc, bool ownplay, Minion m) { if (hc.card.Secret) { p.minionGetBuffed(m, 1, 1); } }
public static MoreSpecificMobCardType GetMoreSpecificCardType(Handcard hc, SpecificCardType specificCardType) { switch (specificCardType) { case SpecificCardType.MobsRanger: return((IsShortDistance(hc)) ? MoreSpecificMobCardType.ShortDistance : MoreSpecificMobCardType.LongDistance); case SpecificCardType.MobsTank: return(IsMobsBuildingAttacker(hc) ? MoreSpecificMobCardType.BuildingAttacker : IsFlying(hc) ? MoreSpecificMobCardType.Flying : MoreSpecificMobCardType.NotFlying); case SpecificCardType.MobsFlying: return(IsMobsDamageDealer(hc) ? MoreSpecificMobCardType.DamageDealer : MoreSpecificMobCardType.Flying); case SpecificCardType.MobsDamageDealer: return((IsMobsAOE(hc)) ? MoreSpecificMobCardType.AOEGround : (IsMobsFlyingAttack(hc)) ? MoreSpecificMobCardType.FlyingAttack : (IsFlying(hc)) ? MoreSpecificMobCardType.Flying : MoreSpecificMobCardType.NotFlying); case SpecificCardType.MobsBigGroup: break; case SpecificCardType.MobsAOE: return((IsAOEAll(hc)) ? MoreSpecificMobCardType.AOEAll : MoreSpecificMobCardType.AOEGround); case SpecificCardType.MobsBuildingAttacker: break; case SpecificCardType.MobsFlyingAttack: break; } return(MoreSpecificMobCardType.None); }
public void setHCtoHC(Handcard hc) { this.manacost = hc.manacost; this.addattack = hc.addattack; this.addHp = hc.addHp; this.card = hc.card; this.elemPoweredUp = hc.elemPoweredUp; }
public Handcard(Handcard hc) { this.position = hc.position; this.lvl = hc.lvl; this.card = hc.card; this.manacost = hc.manacost; this.name = hc.name; }
//After you play a <b>Secret</b>, deal 2 damage to all enemy minions. //在你使用一张<b>奥秘</b>牌后,对所有敌方随从造成2点伤害。 public override void onCardIsGoingToBePlayed(Playfield p, Handcard hc, bool ownplay, Minion m) { var dmg = ownplay ? p.getSpellDamageDamage(2) : p.getEnemySpellDamageDamage(2); if (m.own == ownplay && hc.card.Secret) { p.allMinionOfASideGetDamage(!ownplay, dmg, true); } }
public void transformTo(Handcard hc) { this.position = hc.position; this.lvl = hc.lvl; this.card = hc.card; this.manacost = hc.manacost; this.name = hc.name; this.mirror = hc.mirror; }
public Handcard(Handcard hc) { this.position = hc.position; this.entity = hc.entity; this.manacost = hc.manacost; this.card = hc.card; this.addattack = hc.addattack; this.addHp = hc.addHp; }
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 Handcard(Handcard hc) { this.permCostChange = hc.permCostChange; this.position = hc.position; this.entity = hc.entity; this.manacost = hc.manacost; this.card = hc.card; this.addattack = hc.addattack; this.addHp = hc.addHp; this.playProb = hc.playProb; }
public override void onCardIsGoingToBePlayed(Playfield p, Handcard hc, bool ownplay, Handcard triggerhc) { if (ownplay) { p.ownAbilityReady = true; } else { p.enemyAbilityReady = true; } }
public Action(Action a) { this.actionType = a.actionType; this.card = a.card; this.place = a.place; this.own = a.own; this.target = a.target; this.druidchoice = a.druidchoice; this.penalty = a.penalty; this.prevHpOwn = a.prevHpOwn; this.prevHpTarget = a.prevHpTarget; }
public Handcard(Handcard hc) { this.position = hc.position; this.entity = hc.entity; this.manacost = hc.manacost; this.card = hc.card; this.addattack = hc.addattack; this.addHp = hc.addHp; this.isChoiceTemp = hc.isChoiceTemp; this.elemPoweredUp = hc.elemPoweredUp; this.powerup = hc.powerup; }
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); }
public static VectorAI GetPosition(Playfield p, Handcard hc) { if (hc.name == "Goblin Barrel") { return((p.enemyKingsTower.HP < p.enemyPrincessTower1.HP && p.enemyKingsTower.HP < p.enemyPrincessTower2.HP) ? p.enemyKingsTower.Position : (p.enemyPrincessTower1.HP < p.enemyPrincessTower2.HP) ? p.enemyPrincessTower1.Position : p.enemyPrincessTower2.Position); } return(null); }
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); }
//Whenever you discard a card, gain +1/+1. //Only on the board public override bool onCardDicscard(Playfield p, Handcard hc, Minion own, int num, bool checkBonus) { if (own == null) { return(false); } if (checkBonus) { return(false); } p.minionGetBuffed(own, num, num); return(false); }
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 Action(actionEnum type, Handcard hc, Minion ownM, int place, Minion targetM, int pen, int choice) { this.actionType = type; this.card = hc; this.own = ownM; this.place = place; this.target = targetM; this.penalty = pen; this.druidchoice = choice; if (ownM != null) { this.prevHpOwn = ownM.Hp; } if (targetM != null) { this.prevHpTarget = targetM.Hp; } }
private static Handcard AOEDecision(Playfield p) { Handcard aoeGround = null, aoeAir = null; var objGround = Helper.EnemyCharacterWithTheMostEnemiesAround(p, out int biggestEnemieGroupCount, transportType.GROUND); if (biggestEnemieGroupCount > 3) { aoeGround = Classification.GetOwnHandCards(p, boardObjType.MOB, SpecificCardType.MobsAOEGround).FirstOrDefault(); } var objAir = Helper.EnemyCharacterWithTheMostEnemiesAround(p, out biggestEnemieGroupCount, transportType.AIR); if (biggestEnemieGroupCount > 3) { aoeAir = Classification.GetOwnHandCards(p, boardObjType.MOB, SpecificCardType.MobsAOEAll).FirstOrDefault(); } return(aoeAir ?? aoeGround); }
private void setCardChoices(List<CardDB.cardIDEnum> crdchcs) { this.handcardchoices.Clear(); foreach (CardDB.cardIDEnum cid in crdchcs) { CardDB.Card cardc = CardDB.Instance.getCardDataFromID(cid); Handcard nehc = new Handcard(cardc); nehc.entity = 54321; nehc.manacost = cardc.cost; this.handcardchoices.Add(nehc); Helpfunctions.Instance.ErrorLog("choices " + cardc.name); } CardDB.Card tempcard = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.CS2_029);//=fireball, just to make sure its not a mob (movegen will ignore mobs if own minions >= 7) Handcard newhc = new Handcard(tempcard); newhc.entity = 54321; newhc.isChoiceTemp=true; newhc.manacost = 0; this.handCards.Add(newhc); }
public void loadPreparedBattlefield(int bfield) { this.handCards.Clear(); if (bfield == 0) { enemyAnzCards = 0; this.handCards.Clear(); Handcard hc1 = new Handcard(); hc1.position = 1; hc1.card = cdb.getCardDataFromID("EX1_564");//gesichtsloser manipulator this.handCards.Add(hc1); } if (bfield == 1) { enemyAnzCards = 0; this.handCards.Clear(); Handcard hc1 = new Handcard(); hc1.position = 1; //hc1.card = cdb.getCardDataFromID("CS2_029"); //feuerball hc1.card = cdb.getCardDataFromID("NEW1_007"); //feuerball this.handCards.Add(hc1); } if (bfield == 2) { enemyAnzCards = 0; this.handCards.Clear(); Handcard hc1 = new Handcard(); hc1.position = 1; hc1.card = cdb.getCardDataFromID("CS1_113"); //gedankenkontrolle this.handCards.Add(hc1); } if (bfield == 3) { enemyAnzCards = 0; this.handCards.Clear(); Handcard hc1 = new Handcard(); hc1.position = 1; hc1.card = cdb.getCardDataFromID("CS2_122");//schlachtzugsleiter this.handCards.Add(hc1); } if (bfield == 4) { enemyAnzCards = 0; this.handCards.Clear(); Handcard hc1 = new Handcard(); hc1.position = 1; hc1.card = cdb.getCardDataFromID("EX1_246");//frogg this.handCards.Add(hc1); } if (bfield == 5) { // test silence enemyAnzCards = 0; this.handCards.Clear(); Handcard hc1 = new Handcard(); hc1.position = 1; hc1.card = cdb.getCardData("ironbeakowl"); this.handCards.Add(hc1); /*hc1 = new Handcard(); hc1.position = 2; hc1.card = cdb.getCardData("frostblitz"); this.handCards.Add(hc1);*/ } if (bfield == 6) { enemyAnzCards = 0; this.handCards.Clear(); Handcard hc1 = new Handcard(); hc1.position = 1; hc1.card = cdb.getCardData("azuredrake"); this.handCards.Add(hc1); hc1 = new Handcard(); hc1.position = 2; hc1.card = cdb.getCardData("gurubashiberserker"); this.handCards.Add(hc1); hc1 = new Handcard(); hc1.position = 3; hc1.card = cdb.getCardData("flamestrike"); this.handCards.Add(hc1); } if (bfield == 10) { enemyAnzCards = 0; this.handCards.Clear(); Handcard hc1 = new Handcard(); hc1.position = 1; hc1.card = cdb.getCardDataFromID("NEW1_036");//befehlsruf this.handCards.Add(hc1); hc1 = new Handcard(); hc1.position = 2; hc1.card = cdb.getCardDataFromID("EX1_392");//kampfeswut this.handCards.Add(hc1); } }
public void setHandcards(List<Handcard> hc, int anzown, int anzenemy) { this.handCards.Clear(); foreach (Handcard h in hc) { Handcard h1 = new Handcard(); h1.card = new CardDB.Card(h.card); h1.entity = h.entity; h1.position = h.position; h1.card.entityID = h.entity; this.handCards.Add(h1); } //this.handCards.AddRange(hc); this.handCards.Sort((a, b) => a.position.CompareTo(b.position)); this.anzcards = anzown; this.enemyAnzCards = anzenemy; this.currentCarddata = this.getCardposi(this.anzcards); }