Merge pull request #2533 from magefree/issue-2492-emrakul-extra-turn

* Emrakul, the Promised End - Fix that extra turn is not giving when …
This commit is contained in:
LevelX2 2016-10-31 07:36:11 +01:00 committed by GitHub
commit de28ea797e
4 changed files with 95 additions and 8 deletions

View file

@ -34,9 +34,9 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.common.turn.ControlTargetPlayerNextTurnEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.abilities.keyword.TrampleAbility;
@ -143,10 +143,10 @@ class EmrakulThePromisedEndCostReductionEffect extends CostModificationEffectImp
}
}
class EmrakulThePromisedEndGainControlEffect extends ControlTargetPlayerNextTurnEffect {
class EmrakulThePromisedEndGainControlEffect extends OneShotEffect {
EmrakulThePromisedEndGainControlEffect() {
super();
super(Outcome.GainControl);
this.staticText = "you gain control of target opponent during that player's next turn. After that turn, that player takes an extra turn";
}
@ -164,8 +164,12 @@ class EmrakulThePromisedEndGainControlEffect extends ControlTargetPlayerNextTurn
Player controller = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (controller != null && targetPlayer != null) {
game.getState().getTurnMods().add(new TurnMod(targetPlayer.getId(), false));
TurnMod controlPlayerTurnMod = new TurnMod(targetPlayer.getId(), controller.getId());
TurnMod extraTurnMod = new TurnMod(targetPlayer.getId(), false);
controlPlayerTurnMod.setSubsequentTurnMod(extraTurnMod);
game.getState().getTurnMods().add(controlPlayerTurnMod);
return true;
}
return super.apply(game, source);
return false;
}
}