forked from External/mage
[MKC] Implement Watcher of Hours (#11808)
This commit is contained in:
parent
c470598080
commit
4e648a29a9
3 changed files with 66 additions and 3 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
|
@ -14,20 +13,29 @@ import mage.game.events.GameEvent;
|
|||
public class CounterRemovedFromSourceWhileExiledTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final CounterType counterType;
|
||||
private final boolean onlyController;
|
||||
|
||||
public CounterRemovedFromSourceWhileExiledTriggeredAbility(CounterType counterType, Effect effect) {
|
||||
this(counterType, effect, false);
|
||||
}
|
||||
|
||||
public CounterRemovedFromSourceWhileExiledTriggeredAbility(CounterType counterType, Effect effect, boolean optional) {
|
||||
this(counterType, effect, optional, false);
|
||||
}
|
||||
|
||||
public CounterRemovedFromSourceWhileExiledTriggeredAbility(CounterType counterType, Effect effect, boolean optional, boolean onlyController) {
|
||||
super(Zone.EXILED, effect, optional);
|
||||
this.counterType = counterType;
|
||||
setTriggerPhrase("Whenever a " + counterType.getName() + " counter is removed from {this} while it's exiled, ");
|
||||
this.onlyController = onlyController;
|
||||
setTriggerPhrase("Whenever " + (
|
||||
onlyController ? ("you remove a " + counterType.getName() + " counter") : ("a " + counterType.getName() + " counter is removed")
|
||||
) + " from {this} while it's exiled, ");
|
||||
}
|
||||
|
||||
private CounterRemovedFromSourceWhileExiledTriggeredAbility(final CounterRemovedFromSourceWhileExiledTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.counterType = ability.counterType;
|
||||
this.onlyController = ability.onlyController;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -42,6 +50,8 @@ public class CounterRemovedFromSourceWhileExiledTriggeredAbility extends Trigger
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getData().equals(counterType.getName()) && event.getTargetId().equals(this.getSourceId());
|
||||
return event.getData().equals(counterType.getName())
|
||||
&& event.getTargetId().equals(this.getSourceId())
|
||||
&& (!onlyController || event.getPlayerId().equals(getControllerId()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue