mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Fixed a bug that abilities of creatures weren't applied correct after the creature was controlled by opponent and the controll effect ended. Test for this bug.
This commit is contained in:
parent
6f78a55e01
commit
1263607862
2 changed files with 37 additions and 0 deletions
|
@ -110,4 +110,36 @@ public class MasterOfThePearlTridentTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Merfolk of the Pearl Trident", 0);
|
||||
assertPermanentCount(playerB, "Llanowar Elves", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Control of Master changes to player B in turn 2, after
|
||||
*/
|
||||
@Test
|
||||
public void testLooseAndGainControl() {
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Master of the Pearl Trident");
|
||||
addCard(Constants.Zone.HAND, playerA, "Merfolk of the Pearl Trident");
|
||||
|
||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Mountain", 5);
|
||||
addCard(Constants.Zone.HAND, playerB, "Zealous Conscripts");
|
||||
|
||||
castSpell(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "Zealous Conscripts");
|
||||
|
||||
castSpell(3, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Merfolk of the Pearl Trident");
|
||||
setStopAt(3, Constants.PhaseStep.POSTCOMBAT_MAIN);
|
||||
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Master of the Pearl Trident", 1);
|
||||
assertPermanentCount(playerA, "Merfolk of the Pearl Trident", 1);
|
||||
assertPowerToughness(playerA, "Merfolk of the Pearl Trident", 2, 2);
|
||||
|
||||
assertPermanentCount(playerB, "Zealous Conscripts", 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -486,6 +486,11 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
|
|||
public void checkControlChanged(Game game) {
|
||||
if (this.controllerChanged) {
|
||||
game.fireEvent(new GameEvent(EventType.LOST_CONTROL, objectId, objectId, beforeResetControllerId));
|
||||
// reset the original controller to abilities and ContinuousEffects
|
||||
if (controllerId.equals(originalControllerId)) {
|
||||
this.abilities.setControllerId(controllerId);
|
||||
game.getContinuousEffects().setController(this.objectId, controllerId);
|
||||
}
|
||||
game.fireEvent(new GameEvent(EventType.GAINED_CONTROL, objectId, objectId, controllerId));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue