@Test public void testCheckLegalityAfterBrawlVictory() { World world = new WorldImpl(10, 10, null, null); world.addListener(new BrawlListener()); WorldObject villagersOrganization = createVillagersOrganization(world); WorldObject performer = TestUtils.createSkilledWorldObject( 2, Constants.GROUP, new IdList().add(villagersOrganization)); MockMetaInformation.setMetaInformation(performer, Goals.BRAWL_GOAL); WorldObject actionTarget = TestUtils.createSkilledWorldObject( 3, Constants.GROUP, new IdList().add(villagersOrganization)); world.addWorldObject(performer); world.addWorldObject(actionTarget); world.addWorldObject(TestUtils.createIntelligentWorldObject(4, "observer")); villagersOrganization = createVillagersOrganization(world); BrawlPropertyUtils.startBrawl(performer, actionTarget, 20); actionTarget.setProperty(Constants.HIT_POINTS, 1); new OperationInfo(performer, actionTarget, Args.EMPTY, Actions.NON_LETHAL_MELEE_ATTACK_ACTION) .perform(world); assertEquals(1, performer.getProperty(Constants.GROUP).size()); assertEquals(true, BrawlPropertyUtils.isBrawling(performer)); assertEquals(true, BrawlPropertyUtils.isBrawling(actionTarget)); BrawlPropertyUtils.completelyEndBrawling(performer); BrawlPropertyUtils.completelyEndBrawling(actionTarget); assertEquals(false, BrawlPropertyUtils.isBrawling(performer)); assertEquals(false, BrawlPropertyUtils.isBrawling(actionTarget)); }
@Test public void testCheckLegality() { World world = new WorldImpl(10, 10, null, null); WorldObject villagersOrganization = createVillagersOrganization(world); WorldObject performer = TestUtils.createIntelligentWorldObject( 2, Constants.GROUP, new IdList().add(villagersOrganization)); MockMetaInformation.setMetaInformation(performer, Goals.BRAWL_GOAL); WorldObject actionTarget = TestUtils.createIntelligentWorldObject( 3, Constants.GROUP, new IdList().add(villagersOrganization)); world.addWorldObject(performer); world.addWorldObject(TestUtils.createIntelligentWorldObject(3, "observer")); villagersOrganization = createVillagersOrganization(world); new DefaultGoalObstructedHandler() .checkLegality(performer, actionTarget, Actions.FIRE_BOLT_ATTACK_ACTION, Args.EMPTY, world); assertEquals(200, BountyPropertyUtils.getBounty(performer, world)); assertEquals(0, performer.getProperty(Constants.GROUP).size()); }