mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 12:31:59 -08:00
[WOE] Implement Icewrought Sentry (#10879)
* [WOE] Implement Icewrought Sentry * add tests for the new trigger --------- Co-authored-by: Evan Kranzler <theelk801@gmail.com>
This commit is contained in:
parent
4af977289e
commit
ecbc1dfa81
4 changed files with 245 additions and 0 deletions
|
|
@ -0,0 +1,48 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class TapUntappedPermanentTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public TapUntappedPermanentTriggeredAbility(Effect effect, FilterPermanent filter) {
|
||||
super(Zone.BATTLEFIELD, effect);
|
||||
this.filter = filter.copy();
|
||||
setTriggerPhrase("Whenever you tap an untapped " + filter.getMessage() + ", ");
|
||||
}
|
||||
|
||||
protected TapUntappedPermanentTriggeredAbility(final TapUntappedPermanentTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.filter = ability.filter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.TAPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
return getControllerId().equals(event.getPlayerId())
|
||||
&& filter.match(permanent, getControllerId(), this, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TapUntappedPermanentTriggeredAbility copy() {
|
||||
return new TapUntappedPermanentTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue