private static bool CorrectForSummonAndEquip(Card card, TyState ownerState, TyState opponentState) { var text = card.Text; bool success = true; if (text.Contains("Equip")) { int dmg = 0; int durability = 0; if (FindNumberValues(text, ref dmg, ref durability)) { EquipWeapon(ownerState, dmg, durability); success = true; } } if (text.Contains("Summon")) { int dmg = 0; int health = 0; if (FindNumberValues(text, ref dmg, ref health)) { ownerState.MinionValues += TyMinionUtil.ComputeMinionValue(health, dmg, 1); //just assume that the minion has some sort of (unknown) ability: //Testing.TyDebug.LogInfo("Summoned " + dmg + "/" + health); ownerState.MinionValues += 3; success = true; } } return(success); }
//After your opponent plays a minion, transform it into a 1/1 Sheep. private static void PotionOfPolymorph(TyState playerState, TyState opponentState, Controller player, Controller opponent, Spell secret) { int opponentMana = opponent.GetAvailableMana(); //punish playing early: playerState.BiasValue += TyStateUtility.LateReward(opponentMana, 5, 5.0f); //value is the difference between an average minion and the sheep: float sheepValue = TyMinionUtil.ComputeMinionValue(1, 1, 1); float averageMinionValue = TyMinionUtil.EstimatedValueFromMana(opponentMana); float polymorphedValue = (sheepValue - averageMinionValue); opponentState.MinionValues += polymorphedValue; }
private static void RemoveMinion(Minion minion, TyState ownerState, TyState opponentState, PlayerTask task) { //remove the minion value from the overall minion values and remove it from the board ownerState.MinionValues -= TyMinionUtil.ComputeMinionValue(minion); ownerState.NumMinionsOnBoard--; if (minion.HasDeathrattle) { if (!CorrectForSummonAndEquip(minion.Card, ownerState, opponentState) && TyConst.LOG_UNKNOWN_CORRECTIONS) { TyDebug.LogError("Unknown deathrattle from " + minion.Card.FullPrint()); TyDebug.LogWarning("After task " + task.FullPrint()); } } }