public void TestRenderFieldGrid_PlayerAtStartPosition() { int[,] labyrinthGrid = new int[7, 7] { {0, 0, 1, 1, 0, 1, 1}, {1, 1, 1, 0, 0, 0, 1}, {0, 0, 0, 0, 1, 0, 0}, {1, 0, 1, 0, 1, 1, 1}, {1, 0, 0, 1, 0, 0, 0}, {1, 0, 1, 0, 0, 1, 1}, {1, 0, 0, 1, 0, 1, 0} }; Playfield playfield = new Playfield(labyrinthGrid); string actualOutput = Renderer.RenderField(playfield.LabyrinthGrid, playfield.PlayerPosition.Row, playfield.PlayerPosition.Col); StringBuilder expectedOutput = new StringBuilder(); expectedOutput.AppendLine("--XX-XX"); expectedOutput.AppendLine("XXX---X"); expectedOutput.AppendLine("----X--"); expectedOutput.AppendLine("X-X*XXX"); expectedOutput.AppendLine("X--X---"); expectedOutput.AppendLine("X-X--XX"); expectedOutput.AppendLine("X--X-X-"); bool areEqual = actualOutput == expectedOutput.ToString(); Assert.IsTrue(areEqual); }
public static void PrintTable(Playfield playfield) { string columnHeader = " "; for (int i = 0; i < playfield.Width; i++) { columnHeader += i.ToString().PadLeft(3); } Console.WriteLine(columnHeader); Console.WriteLine(" " + new String('-', playfield.Width * 3)); for (int row = 0; row < playfield.Height; row++) { Console.Write(row.ToString().PadLeft(2) + " | "); for (int col = 0; col < playfield.Width; col++) { Console.Write(playfield.Field[row, col].ToString().PadLeft(2) + " "); } Console.WriteLine("| "); } Console.WriteLine(" " + new String('-', playfield.Width * 3)); }
public void TestIsValidMove_CanMoveDown() { int[,] labyrinthGrid = new int[7, 7] { {0, 1, 1, 0, 1, 1, 1}, {0, 0, 0, 0, 0, 0, 1}, {1, 0, 1, 0, 1, 0, 1}, {1, 0, 1, 0, 1, 0, 0}, {0, 1, 1, 1, 1, 1, 0}, {0, 0, 1, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0} }; Playfield playfield = new Playfield(labyrinthGrid); //Moving playerPosition at row=5 and col=2 playfield.PlayerPosition.MoveAtDirection(Direction.Up); playfield.PlayerPosition.MoveAtDirection(Direction.Up); playfield.PlayerPosition.MoveAtDirection(Direction.Right); playfield.PlayerPosition.MoveAtDirection(Direction.Right); playfield.PlayerPosition.MoveAtDirection(Direction.Down); Direction directionDown = Direction.Down; bool expected = true; bool actual = MovesChecker.IsValidMove(playfield, directionDown); Assert.AreEqual(expected, actual); }
public void TestGetTopResults() { Playfield playfield = new Playfield(); GameEngine engine = new GameEngine(playfield); string expected = engine.GetTopResults(); string actual = new ScoreBoard().ShowScoreboard(); Assert.AreEqual(expected, actual); }
public void TestInitializeField_IsCorrectStartPosition() { Playfield playfield = new Playfield(); playfield.InitializeField(); Position expected = new Position(3, 3); Position actual = playfield.PlayerPosition; Assert.AreEqual(expected.Row, actual.Row); Assert.AreEqual(expected.Col, actual.Col); }
public void TestInitializeNewGame_ScoreIsUpdated() { Playfield playfield = new Playfield(); GameEngine engine = new GameEngine(playfield); engine.MoveAtDirection(Direction.Down, engine.MoveDown); engine.InitializeNewGame(); int expected = 0; int actual = engine.Score; Assert.AreEqual(expected, actual); }
public void TestMoveAtDirection_MoveAtUp() { Playfield playfield = new Playfield(); GameEngine engine = new GameEngine(playfield); engine.MoveAtDirection(Direction.Up, engine.MoveUp); Position expected = new Position(2, 3); Position actual = playfield.PlayerPosition; Assert.AreEqual(expected.Row, actual.Row); Assert.AreEqual(expected.Col, actual.Col); }
public void TestProcessInput_OnWriteExit() { Playfield playfield = new Playfield(); GameEngine engine = new GameEngine(playfield); AssignEvents(engine, engine.UserInput); engine.UserInput.ProcessInput("exit"); bool expected = true; bool actual = engine.HasGameQuit; Assert.AreEqual(expected, actual); }
public void TestProcessInput_OnWriteRestart() { Playfield playfield = new Playfield(); GameEngine engine = new GameEngine(playfield); AssignEvents(engine, engine.UserInput); engine.UserInput.ProcessInput("restart"); int expected = 0; int actual = engine.Score; Assert.AreEqual(expected, actual); }
public void TestProcessInput_OnWriteR() { Playfield playfield = new Playfield(); GameEngine engine = new GameEngine(playfield); AssignEvents(engine, engine.UserInput); engine.UserInput.ProcessInput("R"); Position expected = new Position(3, 4); Position actual = playfield.PlayerPosition; Assert.AreEqual(expected.Row, actual.Row); Assert.AreEqual(expected.Col, actual.Col); }
public void TestInitializeField_IsClearPlayerPosition() { Playfield playfield = new Playfield(); playfield.InitializeField(); int expectedRow = 3; int expectedCol = 3; int actualRow = playfield.PlayerPosition.Row; int actualCol = playfield.PlayerPosition.Col; Position actual = playfield.PlayerPosition; Assert.AreEqual(expectedRow, actualRow); Assert.AreEqual(expectedCol, actualCol); }
public void TestIsVictory_NorthEastCornerExit() { int[,] labyrinthGrid = new int[7, 7] { {0, 0, 1, 1, 1, 1, 0}, {1, 1, 1, 1, 0, 0, 1}, {0, 0, 0, 1, 0, 1, 0}, {1, 0, 1, 0, 0, 1, 1}, {0, 1, 0, 1, 1, 0, 0}, {0, 0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 1, 0, 0} }; Position customPosition = new Position(0, 6); Playfield playfield = new Playfield(labyrinthGrid, customPosition); bool expected = true; bool actual = playfield.IsVictory(); Assert.AreEqual(expected, actual); }
public void TestIsValidMove_CanMoveRight() { int[,] labyrinthGrid = new int[7, 7] { {0, 0, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1}, {0, 0, 0, 0, 0, 0, 0}, {1, 0, 1, 0, 0, 1, 1}, {0, 1, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0} }; Playfield playfield = new Playfield(labyrinthGrid); Direction directionRight = Direction.Right; bool expected = true; bool actual = MovesChecker.IsValidMove(playfield, directionRight); Assert.AreEqual(expected, actual); }
public void TestRenderFieldGrid_PlayerAtOtherPosition() { int[,] labyrinthGrid = new int[7, 7] { {0, 0, 1, 1, 0, 1, 1}, {1, 1, 1, 0, 0, 0, 1}, {0, 0, 0, 0, 1, 0, 0}, {1, 0, 1, 0, 1, 1, 1}, {1, 0, 0, 1, 0, 0, 0}, {1, 0, 1, 0, 0, 1, 1}, {1, 0, 0, 1, 0, 1, 0} }; Playfield playfield = new Playfield(labyrinthGrid); //Moving playerPosition at row=2 and col=6 (start index=0) playfield.PlayerPosition.MoveAtDirection(Direction.Up); playfield.PlayerPosition.MoveAtDirection(Direction.Up); playfield.PlayerPosition.MoveAtDirection(Direction.Right); playfield.PlayerPosition.MoveAtDirection(Direction.Right); playfield.PlayerPosition.MoveAtDirection(Direction.Down); playfield.PlayerPosition.MoveAtDirection(Direction.Right); string actualOutput = Renderer.RenderField(playfield.LabyrinthGrid, playfield.PlayerPosition.Row, playfield.PlayerPosition.Col); StringBuilder expectedOutput = new StringBuilder(); expectedOutput.AppendLine("--XX-XX"); expectedOutput.AppendLine("XXX---X"); expectedOutput.AppendLine("----X-*"); expectedOutput.AppendLine("X-X-XXX"); expectedOutput.AppendLine("X--X---"); expectedOutput.AppendLine("X-X--XX"); expectedOutput.AppendLine("X--X-X-"); bool areEqual = actualOutput == expectedOutput.ToString(); Assert.IsTrue(areEqual); }
//Battlecry: Adapt, then Adapt. public override void GetBattlecryEffect(Playfield p, Minion own, Minion target, int choice) { p.getBestAdapt(own); p.getBestAdapt(own); }
public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice) { p.drawACard(CardDB.cardName.unknown, own.own, true); }
public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice) { }
public int getManaCost(Playfield p) { return(this.card.getManaCost(p, this.manacost)); }
CardDB.Card wcard = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_398t); //battleaxe public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice) { p.equipWeapon(wcard, own.own); }
public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice) { p.equipWeapon(weapon, ownplay); }
public virtual void onTurnStartTrigger(Playfield p, Minion triggerEffectMinion, bool turnStartOfOwner) { return; }
public override int getPlayfieldValue(Playfield p) { if (p.value >= -2000000) { return(p.value); } int retval = 0; retval -= p.evaluatePenality; retval += p.owncards.Count * 1; retval += p.ownHeroHp + p.ownHeroDefence; retval += -(p.enemyHeroHp + p.enemyHeroDefence); retval += p.ownMaxMana * 15 - p.enemyMaxMana * 15; if (p.ownWeaponAttack >= 1) { retval += p.ownWeaponAttack * p.ownWeaponDurability; } if (!p.enemyHeroFrozen) { retval -= p.enemyWeaponDurability * p.enemyWeaponAttack; } else { if (p.enemyHeroName != HeroEnum.mage && p.enemyHeroName != HeroEnum.priest) { retval += 11; } } retval += p.owncarddraw * 5; retval -= p.enemycarddraw * 15; bool useAbili = false; bool usecoin = false; foreach (Action a in p.playactions) { if (a.heroattack && p.enemyHeroHp <= p.attackFaceHP) { retval++; } if (a.useability) { useAbili = true; } if (p.ownHeroName == HeroEnum.warrior && a.heroattack && useAbili) { retval -= 1; } if (a.useability && a.handcard.card.name == CardDB.cardName.lesserheal && ((a.enemytarget >= 10 && a.enemytarget <= 20) || a.enemytarget == 200)) { retval -= 5; } if (!a.cardplay) { continue; } if ((a.handcard.card.name == CardDB.cardName.thecoin || a.handcard.card.name == CardDB.cardName.innervate)) { usecoin = true; } if (a.handcard.card.name == CardDB.cardName.flamestrike && a.numEnemysBeforePlayed <= 2) { retval -= 20; } } if (usecoin && useAbili && p.ownMaxMana <= 2) { retval -= 40; } //if (usecoin && p.mana >= 1) retval -= 20; foreach (Minion m in p.ownMinions) { retval += m.Hp * 1; retval += m.Angr * 2; retval += m.handcard.card.rarity; if (m.windfury) { retval += m.Angr; } if (m.taunt) { retval += 1; } if (!m.taunt && m.stealth && penman.specialMinions.ContainsKey(m.name)) { retval += 20; } if (m.handcard.card.name == CardDB.cardName.silverhandrecruit && m.Angr == 1 && m.Hp == 1) { retval -= 5; } if (m.handcard.card.name == CardDB.cardName.direwolfalpha || m.handcard.card.name == CardDB.cardName.flametonguetotem || m.handcard.card.name == CardDB.cardName.stormwindchampion || m.handcard.card.name == CardDB.cardName.raidleader) { retval += 10; } } foreach (Minion m in p.enemyMinions) { retval -= this.getEnemyMinionValue(m, p); } retval -= p.enemySecretCount; retval -= p.lostDamage;//damage which was to high (like killing a 2/1 with an 3/3 -> => lostdamage =2 retval -= p.lostWeaponDamage; if (p.ownMinions.Count == 0) { retval -= 20; } if (p.enemyMinions.Count >= 4) { retval -= 20; } if (p.enemyHeroHp <= 0) { retval = 10000; } //soulfire etc int deletecardsAtLast = 0; foreach (Action a in p.playactions) { if (!a.cardplay) { continue; } if (a.handcard.card.name == CardDB.cardName.soulfire || a.handcard.card.name == CardDB.cardName.doomguard || a.handcard.card.name == CardDB.cardName.succubus) { deletecardsAtLast = 1; } if (deletecardsAtLast == 1 && !(a.handcard.card.name == CardDB.cardName.soulfire || a.handcard.card.name == CardDB.cardName.doomguard || a.handcard.card.name == CardDB.cardName.succubus)) { retval -= 20; } } if (p.enemyHeroHp >= 1 && p.guessingHeroHP <= 0) { retval += p.owncarddraw * 500; retval -= 1000; } if (p.ownHeroHp <= 0) { retval = -10000; } p.value = retval; return(retval); }
// Give each player a Mana Crystal. public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice) { p.drawACard(CardDB.cardIDEnum.None, true); p.drawACard(CardDB.cardIDEnum.None, false); }
CardDB.Card kid = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_160t); //panther // ruft einen panther (3/2) herbei. public override void OnCardPlay(Playfield p, bool ownplay, Minion target, int choice) { int posi = (ownplay) ? p.ownMinions.Count : p.enemyMinions.Count; p.callKid(kid, posi, true); }
//Give a friendly minion Charge. It can't attack heroes this turn. public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice) { p.minionGetCharge(target); target.cantAttackHeroes = true; }
// +5 angriff. public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice) { p.minionGetBuffed(own, 5, 0); }
public virtual void onAuraEnds(Playfield p, Minion m) { return; }
// Start is called before the first frame update void Start() { Playfield.insertLines(8, Brick); }
public virtual void onAHeroGotHealedTrigger(Playfield p, Minion triggerEffectMinion, bool ownerOfHeroGotHealed) { return; }
// bringt alle feindlichen diener zum schweigen/. zieht eine karte. public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice) { p.allMinionsGetSilenced(!ownplay); p.drawACard(CardDB.cardName.unknown, ownplay); }
// Deal 4 damage. Costs (1) less for each minion that died this turn. public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice) { int dmg = (ownplay) ? p.getSpellDamageDamage(4) : p.getEnemySpellDamageDamage(4); p.minionGetDamageOrHeal(target, dmg); }
// Deal $2 damage to all enemy minions and Freeze them. public override void OnCardPlay(Playfield p, bool ownplay, Minion target, int choice) { int dmg = (ownplay) ? p.getSpellDamageDamage(2) : p.getEnemySpellDamageDamage(2); p.allMinionOfASideGetDamage(!ownplay, dmg, true); }
//Battlecry: Reveal a minion in each deck. If yours costs more, gain +1/+1. public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice) { //we assume we get the buff! p.minionGetBuffed(own, 1, 1); }
//Battlecry: Reveal a minion in each deck.If yours costs more, gain Charge. public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice) { p.minionGetCharge(own); // optimistic }
public bool canplayCard(Playfield p, bool own) { return(this.card.canplayCard(p, this.manacost, own)); }
public virtual void onMinionDiedTrigger(Playfield p, Minion triggerEffectMinion, Minion diedMinion) { return; }
// kampfschrei:/ fügt allen anderen charakteren 1 schaden zu. public override void GetBattlecryEffect(Playfield p, Minion own, Minion target, int choice) { int dmg = 1; p.allCharsGetDamage(dmg); // dreadinfernal is not on board yet! }
public virtual void onDeathrattle(Playfield p, Minion m) { return; }
// Taunt public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice) { }
public override float getPlayfieldValue(Playfield p) { if (p.value >= -2000000) return p.value; int retval = 0; retval -= p.evaluatePenality; retval += p.owncards.Count * 3; retval += p.ownHero.Hp + p.ownHero.armor; retval += -(p.enemyHero.Hp + p.enemyHero.armor); retval += p.ownMaxMana * 15 - p.enemyMaxMana * 15; if (p.ownWeaponAttack >= 1) { retval += p.ownWeaponAttack * p.ownWeaponDurability; } if (!p.enemyHero.frozen) { retval -= p.enemyWeaponDurability * p.enemyWeaponAttack; } else { if (p.enemyHeroName != HeroEnum.mage && p.enemyHeroName != HeroEnum.priest) { retval += 11; } } //RR card draw value depending on the turn and distance to lethal //RR if lethal is close, carddraw value is increased if (sf.Ai.lethalMissing <= 5) //RR { retval += p.owncarddraw * 100; } if (p.ownMaxMana < 4) { retval += p.owncarddraw * 2; } else { retval += p.owncarddraw * 5; } retval += p.owncarddraw * 5; retval -= p.enemycarddraw * 15; bool useAbili = false; bool usecoin = false; foreach (Action a in p.playactions) { if (a.actionType == actionEnum.attackWithHero && p.enemyHero.Hp <= p.attackFaceHP) retval++; if (a.actionType == actionEnum.useHeroPower) useAbili = true; if (p.ownHeroName == HeroEnum.warrior && a.actionType == actionEnum.attackWithHero && useAbili) retval -= 1; //if (a.actionType == actionEnum.useHeroPower && a.card.card.name == CardDB.cardName.lesserheal && (!a.target.own)) retval -= 5; if (a.actionType != actionEnum.playcard) continue; if ((a.card.card.name == CardDB.cardName.thecoin || a.card.card.name == CardDB.cardName.innervate)) usecoin = true; } if (usecoin && useAbili && p.ownMaxMana <= 2) retval -= 40; if (usecoin) retval -= 5 * p.manaTurnEnd; if (p.manaTurnEnd >= 2 && !useAbili) { retval -= 10; if (p.ownHeroName == HeroEnum.thief && (p.ownWeaponDurability >= 2 || p.ownWeaponAttack >= 2)) retval += 10; } //if (usecoin && p.mana >= 1) retval -= 20; foreach (Minion m in p.ownMinions) { retval += m.Hp * 1; retval += m.Angr * 2; retval += m.handcard.card.rarity; if (m.windfury) retval += m.Angr; if (m.taunt) retval += 1; if (!m.taunt && m.stealth && m.handcard.card.isSpecialMinion) retval += 20; if (m.handcard.card.name == CardDB.cardName.silverhandrecruit && m.Angr == 1 && m.Hp == 1) retval -= 5; if (m.handcard.card.name == CardDB.cardName.direwolfalpha || m.handcard.card.name == CardDB.cardName.flametonguetotem || m.handcard.card.name == CardDB.cardName.stormwindchampion || m.handcard.card.name == CardDB.cardName.raidleader) retval += 10; if (m.handcard.card.name == CardDB.cardName.nerubianegg) { if (m.Angr >= 1) retval += 2; if ((!m.taunt && m.Angr == 0) && (m.divineshild || m.maxHp > 2)) retval -= 10; } } foreach (Minion m in p.enemyMinions) { retval -= this.getEnemyMinionValue(m, p); } retval -= p.enemySecretCount; retval -= p.lostDamage;//damage which was to high (like killing a 2/1 with an 3/3 -> => lostdamage =2 retval -= p.lostWeaponDamage; if (p.ownMinions.Count == 0) retval -= 20; if (p.enemyMinions.Count >= 4) retval -= 20; if (p.enemyHero.Hp <= 0) retval = 10000; //soulfire etc int deletecardsAtLast = 0; foreach (Action a in p.playactions) { if (a.actionType != actionEnum.playcard) continue; if (a.card.card.name == CardDB.cardName.soulfire || a.card.card.name == CardDB.cardName.doomguard || a.card.card.name == CardDB.cardName.succubus) deletecardsAtLast = 1; if (deletecardsAtLast == 1 && !(a.card.card.name == CardDB.cardName.soulfire || a.card.card.name == CardDB.cardName.doomguard || a.card.card.name == CardDB.cardName.succubus)) retval -= 20; } if (p.enemyHero.Hp >= 1 && p.guessingHeroHP <= 0) { if (p.turnCounter < 2) retval += p.owncarddraw * 500; retval -= 1000; } if (p.ownHero.Hp <= 0) retval = -10000; p.value = retval; return retval; }
public override void OnAdaptChoice(Playfield p, bool ownplay, Minion target, CardDB.cardIDEnum choice) { List <Minion> temp = p.ownMinions; switch (choice) { case CardDB.cardIDEnum.UNG_999t3: // 3attack { p.minionGetBuffed(target, 3, 0); break; } case CardDB.cardIDEnum.UNG_999t8: //divine shield { target.divineshild = true; break; } case CardDB.cardIDEnum.UNG_999t13: //poisonous { target.poisonous = true; break; } case CardDB.cardIDEnum.UNG_999t14: // +1/+1 { p.minionGetBuffed(target, 1, 1); break; } case CardDB.cardIDEnum.UNG_999t4: // 3hp { p.minionGetBuffed(target, 0, 3); break; } case CardDB.cardIDEnum.UNG_999t2: //deathrattle 2 1/1 plants { target.livingspores++; break; } case CardDB.cardIDEnum.UNG_999t7: //windfury { p.minionGetWindfurry(target); break; } case CardDB.cardIDEnum.UNG_999t6: //taunt { target.taunt = true; break; } case CardDB.cardIDEnum.UNG_999t10: //stealth { target.stealth = true; break; } case CardDB.cardIDEnum.UNG_999t5: //can't be targeted { target.AdaptedCantBeTargetedBySpellsOrHeroPowers++; break; } default: break; } }
/// <summary> /// Creates the playfield matrix with the balloons in it /// </summary> public override Playfield CreatePlayfield() { var smallPlayfield = new Playfield(Width, Height); return smallPlayfield; }
CardDB.Card c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_534t);//hyena public override void onDeathrattle(Playfield p, Minion m) { p.callKid(c, m.zonepos - 1, m.own); p.callKid(c, m.zonepos - 1, m.own); }
public override int getEnemyMinionValue(Minion m, Playfield p) { int retval = 5; retval += m.Hp * 2; if (!m.frozen && !((m.name == CardDB.cardName.ancientwatcher || m.name == CardDB.cardName.ragnarosthefirelord) && !m.silenced)) { retval += m.Angr * 2; if (m.windfury) retval += m.Angr * 2; if (m.Angr >= 4) retval += 10; if (m.Angr >= 7) { //this might be faster, than creating new lists, use findall and loop over them int enemyAttackerscount = 0; int ownTauntCount = 0; int ownTauntHP = 0; int enemyTotalAttack = 0; foreach (Minion min in p.enemyMinions) { if (min.Angr >= 1) { enemyTotalAttack += min.Angr; enemyAttackerscount++; } } foreach (Minion min in p.ownMinions) { if (min.taunt) { ownTauntCount++; ownTauntHP += min.Hp; } } if (ownTauntCount < enemyAttackerscount && ownTauntHP <= enemyTotalAttack) retval += 30; } } if (m.Angr == 0) retval -= 7; retval += m.handcard.card.rarity; if (m.taunt) retval += 5; if (m.divineshild) retval += m.Angr; if (m.divineshild && m.taunt) retval += 5; if (m.stealth) retval += 1; if (m.poisonous) retval += 4; if (m.handcard.card.targetPriority >= 1 && !m.silenced) { retval += m.handcard.card.targetPriority; } if (m.name == CardDB.cardName.nerubianegg && m.Angr <= 3 && !m.taunt) retval = 0; return retval; }
public virtual void onEnrageStop(Playfield p, Minion m) { return; }
public new void AddNested(Playfield playfield) { AddInternal(playfield); base.AddNested(playfield); }
public virtual void onSecretPlay(Playfield p, bool ownplay, Minion attacker, Minion target, out int number) { number = 0; }
//Deathrattle: Copy a card from your opponent's deck and add it to your hand. public override void onDeathrattle(Playfield p, Minion m) { p.drawACard(SimCard.None, m.own, true); }
public virtual void onMinionGotDmgTrigger(Playfield p, Minion triggerEffectMinion, bool ownDmgdMinion) { return; }
public override float getPlayPenalty(Playfield p, Handmanager.Handcard hc, Minion target, int choice, bool isLethal) { return(0); }
public virtual void onMinionWasSummoned(Playfield p, Minion triggerEffectMinion, Minion summonedMinion) { return; }
CardDB.Card kid = CardDB.Instance.getCardDataFromID(CardIdEnum.KAR_030);//Cellar Spider public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice) { p.CallKid(kid, own.zonepos, own.own); }
public override int getEnemyMinionValue(Minion m, Playfield p) { int retval = 0; if (p.enemyMinions.Count >= 4 || m.taunt || (m.handcard.card.targetPriority >= 1 && !m.silenced) || m.Angr >= 5) { retval += m.Hp; if (!m.frozen && !((m.name == CardDB.cardName.ancientwatcher || m.name == CardDB.cardName.ragnarosthefirelord) && !m.silenced)) { retval += m.Angr * 2; if (m.windfury) retval += 2 * m.Angr; } if (m.taunt) retval += 5; if (m.divineshild) retval += m.Angr; if (m.frozen) retval -= 1; // because its bad for enemy :D if (m.poisonous) retval += 4; retval += m.handcard.card.rarity; } if (m.handcard.card.targetPriority >= 1 && !m.silenced) retval += m.handcard.card.targetPriority; if (m.Angr >= 4) retval += 20; if (m.Angr >= 7) retval += 50; if (m.name == CardDB.cardName.nerubianegg && m.Angr <= 3 && !m.taunt) retval = 0; return retval; }
// kampfschrei:/ stellt 3 leben wieder her. public override int getPlayPenalty(Playfield p, Minion m, Minion target, int choice, bool isLethal) { return(0); }
/// <summary> /// Creates the playfield matrix with the balloons in it /// </summary> public override Playfield CreatePlayfield() { var largePlayfield = new Playfield(Width, Height); return largePlayfield; }
// Add a random Demon to your hand. public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice) { p.drawACard(CardDB.cardIDEnum.CFM_621_m4, ownplay, true); }
//other value of the board for enemys turn? (currently the same as getplayfield value) public override float getPlayfieldValueEnemy(Playfield p) { return getPlayfieldValue(p); }
// Deathrattle: Deal 2 damage to all minions. public override void onDeathrattle(Playfield p, Minion m) { p.allMinionsGetDamage(2); }
public override float getPlayfieldValue(Playfield p) { if (p.value >= -2000000) return p.value; int retval = 0; int hpboarder = 10; if (p.ownHeroName == HeroEnum.warlock && p.enemyHeroName != HeroEnum.mage) hpboarder = 6; int aggroboarder = 11; retval -= p.evaluatePenality; retval += p.owncards.Count * 5; retval += p.ownMaxMana; retval -= p.enemyMaxMana; retval += p.ownMaxMana * 20 - p.enemyMaxMana * 20; if (p.enemyHeroName == HeroEnum.mage || p.enemyHeroName == HeroEnum.druid) retval -= 2 * p.enemyspellpower; if (p.ownHero.Hp + p.ownHero.armor > hpboarder) { retval += p.ownHero.Hp + p.ownHero.armor; } else { retval -= 2 * (hpboarder + 1 - p.ownHero.Hp - p.ownHero.armor) * (hpboarder + 1 - p.ownHero.Hp - p.ownHero.armor); } if (p.enemyHero.Hp + p.enemyHero.armor > aggroboarder) { retval += -p.enemyHero.Hp - p.enemyHero.armor; } else { retval += 3 * (aggroboarder + 1 - p.enemyHero.Hp - p.enemyHero.armor); } if (p.ownWeaponAttack >= 1) { retval += p.ownWeaponAttack * p.ownWeaponDurability; } if (!p.enemyHero.frozen) { retval -= p.enemyWeaponDurability * p.enemyWeaponAttack; } else { if (p.enemyWeaponDurability >= 1) { retval += 12; } } //RR card draw value depending on the turn and distance to lethal //RR if lethal is close, carddraw value is increased if (Ai.Instance.lethalMissing <= 5 && p.turnCounter ==0) //RR { retval += p.owncarddraw * 100; } if (p.ownMaxMana <= 4) { retval += p.owncarddraw * 2; } else { //retval += p.owncarddraw * 5; // value card draw this turn > card draw next turn (the sooner the better) retval += (p.turnCounter < 2 ? p.owncarddraw * 5 : p.owncarddraw * 3); } //retval += p.owncarddraw * 5; retval -= (p.enemycarddraw-p.anzEnemyCursed) * 10; //int owntaunt = 0; int readycount = 0; int ownMinionsCount = 0; bool enemyhaspatron = false; // bool canPingMinions = (p.ownHeroAblility.card.name == CardDB.cardName.fireblast); bool hasPingedMinion = false; foreach (Minion m in p.enemyMinions) { if (m.name == CardDB.cardName.grimpatron && !m.silenced) enemyhaspatron = true; int currMinionValue = this.getEnemyMinionValue(m, p); // Give a bonus for 1 hp minions as a mage, since we can remove it easier in the future with ping. // But we make sure we only give this bonus once among all enemies. We also give another +1 bonus once if the atk >= 4. if (canPingMinions && !hasPingedMinion && currMinionValue > 2 && m.Hp == 1) { currMinionValue -= 1; canPingMinions = false; // only 1 per turn (-1 bonus regardless of atk) hasPingedMinion = true; } if (hasPingedMinion && currMinionValue > 2 && m.Hp == 1 && m.Angr >= 4) { currMinionValue -= 1; hasPingedMinion = false; // only 1 per turn (-1 bonus additional for atk >= 4) } retval -= currMinionValue; //hasTank = hasTank || m.taunt; } foreach (Minion m in p.ownMinions) { retval += 5; retval += m.Hp * 2; retval += m.Angr * 2; retval += m.handcard.card.rarity; if (!m.playedThisTurn && m.windfury) retval += m.Angr; if (m.divineshild) retval += 1; if (m.stealth) retval += 1; if (m.handcard.card.isSpecialMinion) { retval += 1; if (!m.taunt && m.stealth) retval += 20; } else { if (m.Angr <= 2 && m.Hp <= 2 && !m.divineshild) retval -= 5; } //if (m.Angr <= m.Hp + 1) retval += m.Angr; //if (!m.taunt && m.stealth && penman.specialMinions.ContainsKey(m.name)) retval += 20; //if (m.poisonous) retval += 1; if (m.divineshild && m.taunt) retval += 4; //if (m.taunt && m.handcard.card.name == CardDB.cardName.frog) owntaunt++; //if (m.handcard.card.isToken && m.Angr <= 2 && m.Hp <= 2) retval -= 5; //if (!penman.specialMinions.ContainsKey(m.name) && m.Angr <= 2 && m.Hp <= 2) retval -= 5; if (m.handcard.card.name == CardDB.cardName.direwolfalpha || m.handcard.card.name == CardDB.cardName.flametonguetotem || m.handcard.card.name == CardDB.cardName.stormwindchampion || m.handcard.card.name == CardDB.cardName.raidleader) retval += 10; if (m.handcard.card.name == CardDB.cardName.bloodmagethalnos) retval += 10; if (m.handcard.card.name == CardDB.cardName.nerubianegg) { if (m.Angr >= 1) retval += 2; if (m.divineshild || (m.maxHp > 2 && !m.destroyOnOwnTurnEnd)) retval -= 10; if (p.ownMinions.Count >= 3) retval += 15; } if (m.Ready) readycount++; if (m.maxHp >= 4 && (m.Angr > 2 || m.Hp > 3)) ownMinionsCount++; } /*if (p.enemyMinions.Count >= 0) { int anz = p.enemyMinions.Count; if (owntaunt == 0) retval -= 10 * anz; retval += owntaunt * 10 - 11 * anz; }*/ bool useAbili = false; int usecoin = 0; //bool lastCoin = false; foreach (Action a in p.playactions) { //lastCoin = false; if (a.actionType == actionEnum.attackWithHero && p.enemyHero.Hp <= p.attackFaceHP) retval++; if (a.actionType == actionEnum.useHeroPower) useAbili = true; if (p.ownHeroName == HeroEnum.warrior && a.actionType == actionEnum.attackWithHero && useAbili) retval -= 1; //if (a.actionType == actionEnum.useHeroPower && a.card.card.name == CardDB.cardName.lesserheal && (!a.target.own)) retval -= 5; if (a.actionType != actionEnum.playcard) continue; if (a.card.card.name == CardDB.cardName.thecoin) { usecoin = 1; } if (a.card.card.name == CardDB.cardName.innervate) { usecoin = 2; } //save spell for all classes: (except for rouge if he has no combo) if (a.target == null) continue; if (p.ownHeroName != HeroEnum.thief && a.card.card.type == CardDB.cardtype.SPELL && (!a.target.own && a.target.isHero) && a.card.card.name != CardDB.cardName.shieldblock) retval -= 11; if (p.ownHeroName == HeroEnum.thief && a.card.card.type == CardDB.cardtype.SPELL && (a.target.isHero && !a.target.own)) retval -= 11; } //dont waste mana!! if (usecoin>=1 && useAbili && p.ownMaxMana <= 2) retval -= 40; if (usecoin >= 1 && p.manaTurnEnd >= usecoin && p.owncards.Count <= 8) retval -= 100 * p.manaTurnEnd; int heropowermana = p.ownHeroAblility.card.getManaCost(p, 2); if (p.manaTurnEnd >= heropowermana && !useAbili && p.ownAbilityReady) { if (!(p.ownHeroName == HeroEnum.thief && (p.ownWeaponDurability >= 2 || p.ownWeaponAttack >= 2))) retval -= 20; if (p.ownHeroName == HeroEnum.pala && enemyhaspatron) retval += 20; } if (useAbili && usecoin == 2) retval -= 5; //if (usecoin && p.manaTurnEnd >= 1 && p.owncards.Count <= 8) retval -= 100; int mobsInHand = 0; int bigMobsInHand = 0; foreach (Handmanager.Handcard hc in p.owncards) { if (hc.card.type == CardDB.cardtype.MOB) { mobsInHand++; if (hc.card.Attack >= 3 && hc.card.Health >= 3) bigMobsInHand++; } } //stuff for not flooding board int mobsturnbegin = Hrtprozis.Instance.ownMinions.Count; if (ownMinionsCount > mobsturnbegin) { if (ownMinionsCount - p.enemyMinions.Count >= 3) { retval += bigMobsInHand * 50 + mobsInHand * 10; } if (p.turnCounter <= 1 && p.ownMinions.Count - p.enemyMinions.Count >= 4) { retval -= (p.ownMinions.Count - p.enemyMinions.Count - 3) * 10; } } //bool hasTank = false; /*foreach (SecretItem si in p.enemySecretList) { if (readycount >= 1 && !hasTank && si.canbeTriggeredWithAttackingHero) { retval -= 100; } if (readycount >= 1 && p.enemyMinions.Count >= 1 && si.canbeTriggeredWithAttackingMinion) { retval -= 100; } if (si.canbeTriggeredWithPlayingMinion && mobsInHand >= 1) { retval -= 25; } }*/ retval -= p.enemySecretCount; retval -= p.numEnemySecretsTurnEnd*50; //Helpfunctions.Instance.ErrorLog("sc:" + p.enemySecretCount+ " " + p.numEnemySecretsTurnEnd); retval -= p.lostDamage;//damage which was to high (like killing a 2/1 with an 3/3 -> => lostdamage =2 retval -= p.lostWeaponDamage; //if (p.ownMinions.Count == 0) retval -= 20; //if (p.enemyMinions.Count == 0) retval += 20; if (p.enemyHero.Hp <= 0) { if (p.turnCounter <= 1) { retval = 10000; } else { retval += 50;//10000 if (p.numPlayerMinionsAtTurnStart == 0) retval += 50; // if we can kill the enemy even after a board clear, bigger bonus if (p.loathebLastTurn > 0) retval += 50; // give a bonus to turn 2 sims where we played loatheb in turn 1 to protect our lethal board } } else if (p.ownHero.Hp > 0) { // if our damage on board is lethal, give a strong bonus so enemy AI avoids this outcome in its turn (i.e. AI will clear our minions if it can instead of ignoring them) if (p.turnCounter == 1 && p.guessHeroDamage(true) >= p.enemyHero.Hp + p.enemyHero.armor) retval += 100; } //soulfire etc int deletecardsAtLast = 0; foreach (Action a in p.playactions) { if (a.actionType != actionEnum.playcard) continue; if (a.card.card.name == CardDB.cardName.soulfire || a.card.card.name == CardDB.cardName.doomguard || a.card.card.name == CardDB.cardName.succubus) deletecardsAtLast = 1; if (deletecardsAtLast == 1 && !(a.card.card.name == CardDB.cardName.soulfire || a.card.card.name == CardDB.cardName.doomguard || a.card.card.name == CardDB.cardName.succubus)) retval -= 20; } if (p.enemyHero.Hp >= 1 && p.ownHero.Hp <= 0) { //Helpfunctions.Instance.ErrorLog("turncounter " + p.turnCounter + " " + retval); if (p.turnCounter == 0) // own turn { //worst case: we die on own turn retval += p.owncarddraw * 100; retval = -10000; } else { if (p.turnCounter == 1) // enemys first turn { retval += p.owncarddraw * 100; retval -= 1000; } if (p.turnCounter >= 2) { //carddraw next turn doesnt count this turn :D retval -= 100; } } } //if (p.ownHero.Hp <= 0 && p.turnCounter < 2) retval = -10000; // give a bonus for making the enemy spend more mana dealing with our board, so boards where the enemy makes different plays // aren't considered as equal value (i.e. attacking the enemy and making him spend mana to heal vs not attacking at all) if (p.turnCounter == 1 || p.turnCounter == 3) retval += p.enemyMaxMana - p.mana; p.value = retval; return retval; }
//Deathrattle: Restore 8 Health to the enemy hero. public override void onDeathrattle(Playfield p, Minion m) { var heal = m.own ? p.getMinionHeal(8) : p.getEnemyMinionHeal(8); p.minionGetDamageOrHeal(m.own ? p.enemyHero : p.ownHero, -heal); }