public IEnumerator winTest() { THHGame game = TestGameflow.initStandardGame(); _ = game.run(); yield return(new WaitForSeconds(.1f)); game.players[0].cmdInitReplace(game); game.players[1].cmdInitReplace(game); yield return(new WaitForSeconds(.1f)); game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[0], 0); yield return(new WaitForSeconds(.1f)); for (int i = 0; i < 15; i++) { game.sortedPlayers[0].cmdTurnEnd(game); yield return(new WaitForSeconds(.1f)); game.sortedPlayers[1].cmdTurnEnd(game); yield return(new WaitForSeconds(.1f)); game.sortedPlayers[0].cmdAttack(game, game.sortedPlayers[0].field[0], game.sortedPlayers[1].master); yield return(new WaitForSeconds(.1f)); } THHCard.AttackEventArg attack = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHCard.AttackEventArg) as THHCard.AttackEventArg; Assert.NotNull(attack); THHGame.GameEndEventArg gameEnd = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHGame.GameEndEventArg) as THHGame.GameEndEventArg; Assert.AreEqual(game.sortedPlayers[0], gameEnd.winners[0]); game.Dispose(); }
public IEnumerator attackTest() { THHGame game = TestGameflow.initStandardGame(); _ = game.run(); yield return(new WaitForSeconds(.2f)); game.players[0].cmdInitReplace(game); game.players[1].cmdInitReplace(game); yield return(new WaitForSeconds(.1f)); game.sortedPlayers[0].cmdUse(game, game.sortedPlayers[0].hand[0], 0); yield return(new WaitForSeconds(.1f)); game.sortedPlayers[0].cmdTurnEnd(game); yield return(new WaitForSeconds(.1f)); game.sortedPlayers[1].cmdUse(game, game.sortedPlayers[1].hand[0], 0); yield return(new WaitForSeconds(.1f)); game.sortedPlayers[1].cmdTurnEnd(game); yield return(new WaitForSeconds(.1f)); game.sortedPlayers[0].cmdAttack(game, game.sortedPlayers[0].field[0], game.sortedPlayers[1].field[0]); yield return(new WaitForSeconds(.1f)); THHCard.AttackEventArg attack = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHCard.AttackEventArg) as THHCard.AttackEventArg; Assert.NotNull(attack); THHCard.DamageEventArg d1 = attack.children[0] as THHCard.DamageEventArg; Assert.NotNull(d1); Assert.AreEqual(2, d1.value); THHCard.DamageEventArg d2 = attack.children[1] as THHCard.DamageEventArg; Assert.NotNull(d2); Assert.AreEqual(2, d2.value); THHCard.DeathEventArg d3 = game.triggers.getRecordedEvents().LastOrDefault(e => e is THHCard.DeathEventArg) as THHCard.DeathEventArg; Assert.NotNull(d3); Assert.AreEqual(2, d3.infoDic.Count); game.Dispose(); }