Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New fork #16

Open
doctorpangloss opened this issue Oct 16, 2017 · 0 comments
Open

New fork #16

doctorpangloss opened this issue Oct 16, 2017 · 0 comments

Comments

@doctorpangloss
Copy link

I've merged and fixed your latest into my private fork that I'm slowly preparing for release. The fork has diverged pretty significantly from the demilich1 master, but has substantially more rules bugs fixed.

For example, here is a test for Sir Finley Mrrgglton:

@Test(description =
		"Tests Sir Finley Mrrgglton and also confirms that players can do stuff to discovered cards besides receive them.")
public void testSirFinleyMrrgglton() {
	GameContext context = createContext(HeroClass.PRIEST, HeroClass.PRIEST);
	Player player = context.getActivePlayer();
	int oldId = player.getHero().getHeroPower().getId();
	final DiscoverAction[] action = {null};
	final HeroPowerCard[] discoveryCard = new HeroPowerCard[1];
	final int[] handSize = new int[1];
	// Set up a trick to catch the discover action.
	player.setBehaviour(new TestBehaviour() {
		boolean shouldIntercept = true;

		@Override
		public GameAction requestAction(GameContext context, Player player, List<GameAction> validActions) {
			if (shouldIntercept) {
				Assert.assertTrue(validActions.stream()
						.allMatch(ga -> ga.getActionType() == ActionType.DISCOVER));
				action[0] = (DiscoverAction) validActions.get(0);
				HeroPowerCard original = (HeroPowerCard) action[0].getCard();
				discoveryCard[0] = original;
				handSize[0] = player.getHand().size();
			}
			// We should only intercept once
			shouldIntercept = false;
			return super.requestAction(context, player, validActions);
		}
	});
	MinionCard sirFinley = (MinionCard) CardCatalogue.getCardById("minion_sir_finley_mrrgglton");
	playCard(context, player, sirFinley);
	// Control flow will first go to request action above, then proceed.
	Assert.assertEquals(player.getHand().size(), handSize[0],
			"Nothing should be added to the hand.");
	Assert.assertEquals(player.getDiscoverZone().size(), 0,
			"The discover zone should be empty");
	Assert.assertEquals(player.getGraveyard().size(), 1,
			"The graveyard should only Sir Finley's source card.");
	Assert.assertEquals(discoveryCard[0].getZone(), Zones.REMOVED_FROM_PLAY,
			"The discovered card should be removed from play");
	HeroPowerCard currentHeroPower = player.getHeroPowerZone().get(0);
	Assert.assertEquals(discoveryCard[0].getCardId(), currentHeroPower.getCardId(),
			"But the hero power card should be the discovered hero power.");
	Assert.assertNotEquals(currentHeroPower.getId(), oldId,
			"The old hero power should not be the current one");
}

You can get a sense for some of the major feature reworks that have happened.

Please reach out to me on my profile e-mail if you're interested in learning more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant