Updated lose ability test and corresponding effects.

This commit is contained in:
magenoxx 2012-05-25 19:00:05 +04:00
parent 24b1b95b54
commit 1bb1df32b5
3 changed files with 8 additions and 5 deletions

View file

@ -74,7 +74,7 @@ public class LoseAbilityTest extends CardTestPlayerBase {
@Test
public void testMultiGainVsLoseAbility() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Air Elemental");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 5);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Forest", 10);
addCard(Constants.Zone.HAND, playerA, "Grounded");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 10);
addCard(Constants.Zone.HAND, playerA, "Drake Umbra", 2);
@ -83,7 +83,7 @@ public class LoseAbilityTest extends CardTestPlayerBase {
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Drake Umbra", "Air Elemental");
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Grounded", "Air Elemental");
setStopAt(2, Constants.PhaseStep.END_TURN);
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
@ -92,7 +92,7 @@ public class LoseAbilityTest extends CardTestPlayerBase {
Permanent airElemental = getPermanent("Air Elemental", playerA.getId());
Assert.assertNotNull(airElemental);
Assert.assertTrue(airElemental.getAttachments().size() == 3);
Assert.assertEquals(3, airElemental.getAttachments().size());
// should NOT have flying
Assert.assertFalse(airElemental.getAbilities().contains(FlyingAbility.getInstance()));
}

View file

@ -70,8 +70,9 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl<GainAbilityA
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(equipment.getAttachedTo());
if (creature != null)
if (creature != null) {
creature.addAbility(ability, game);
}
}
return true;
}

View file

@ -67,7 +67,9 @@ public class LoseAbilityAttachedEffect extends ContinuousEffectImpl<LoseAbilityA
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent creature = game.getPermanent(equipment.getAttachedTo());
if (creature != null) {
creature.getAbilities().remove(ability);
while (creature.getAbilities().contains(ability)) {
creature.getAbilities().remove(ability);
}
}
}
return true;