1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-10 17:00:08 -09:00
This commit is contained in:
Jeff Wadsworth 2021-10-05 15:48:39 -05:00
parent f3d643a351
commit f0b31dd585

View file

@ -34,7 +34,9 @@ public final class Willbreaker extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// Whenever a creature an opponent controls becomes the target of a spell or ability you control, gain control of that creature for as long as you control Willbreaker. // Whenever a creature an opponent controls becomes the target of a spell or ability you control, gain control of that creature for as long as you control Willbreaker.
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new GainControlTargetEffect(Duration.Custom), new SourceOnBattlefieldControlUnchangedCondition(), null); ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
new GainControlTargetEffect(Duration.EndOfGame),
new SourceOnBattlefieldControlUnchangedCondition(), null);
effect.setText("gain control of that creature for as long as you control {this}"); effect.setText("gain control of that creature for as long as you control {this}");
this.addAbility(new WillbreakerTriggeredAbility(effect), new LostControlWatcher()); this.addAbility(new WillbreakerTriggeredAbility(effect), new LostControlWatcher());
} }
@ -68,10 +70,13 @@ class WillbreakerTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (isControlledBy(event.getPlayerId())) { if (isControlledBy(event.getPlayerId())) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isCreature(game)) { if (permanent != null
&& permanent.isCreature(game)) {
Player controller = game.getPlayer(getControllerId()); Player controller = game.getPlayer(getControllerId());
if (controller != null && controller.hasOpponent(permanent.getControllerId(), game)) { if (controller != null
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); && controller.hasOpponent(permanent.getControllerId(), game)) {
// always call this method for FixedTargets in case it is blinked
getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true; return true;
} }
} }
@ -81,7 +86,7 @@ class WillbreakerTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public String getTriggerPhrase() { public String getTriggerPhrase() {
return "Whenever a creature an opponent controls becomes the target of a spell or ability you control, " ; return "Whenever a creature an opponent controls becomes the target of a spell or ability you control, ";
} }
@Override @Override