forked from External/mage
[M21] Implement more cards (#6730)
* EnthrallingHold * ArchfiendsVessel * ConspicuousSnoop * HoodedBlightfang * commit set updates * fix text * fix Archfiend's Vessel cast from graveyard trigger and Enthralling Hold text
This commit is contained in:
parent
8906f3be7b
commit
6fa1ad3aaa
11 changed files with 465 additions and 104 deletions
|
|
@ -76,9 +76,9 @@ public class AttacksCreatureYouControlTriggeredAbility extends TriggeredAbilityI
|
|||
public String getRule() {
|
||||
String an;
|
||||
String who = filter.getMessage();
|
||||
if (who.startsWith("another")) {
|
||||
if (who.startsWith("another") || who.startsWith("a ")) {
|
||||
an = "";
|
||||
} else if (who.startsWith("a")) {
|
||||
} else if (who.length() > 0 && "aeiou".contains(who.charAt(0) + "")) {
|
||||
an = "an ";
|
||||
} else {
|
||||
an = "a ";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
public class DestroyPlaneswalkerWhenDamagedTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public DestroyPlaneswalkerWhenDamagedTriggeredAbility() {
|
||||
this((FilterPermanent) null);
|
||||
}
|
||||
|
||||
public DestroyPlaneswalkerWhenDamagedTriggeredAbility(FilterPermanent filter) {
|
||||
super(Zone.BATTLEFIELD, null);
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
private DestroyPlaneswalkerWhenDamagedTriggeredAbility(final DestroyPlaneswalkerWhenDamagedTriggeredAbility effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DestroyPlaneswalkerWhenDamagedTriggeredAbility copy() {
|
||||
return new DestroyPlaneswalkerWhenDamagedTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = getSourcePermanentIfItStillExists(game);
|
||||
if (permanent != null) {
|
||||
boolean applies = filter != null ?
|
||||
filter.match(permanent, game) : event.getSourceId().equals(getSourceId());
|
||||
if (applies) {
|
||||
Effect effect = new DestroyTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
this.getEffects().clear();
|
||||
this.addEffect(effect);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever " + (filter != null ? filter.getMessage() : "this creature") + " deals damage to a planeswalker, destroy that planeswalker.";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue