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.";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
public class GainActivatedAbilitiesOfTopCardEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final FilterCard filter;
|
||||
|
||||
public GainActivatedAbilitiesOfTopCardEffect(FilterCard filter) {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
staticText = "As long as the top card of your library is " + filter.getMessage() + ", {this} has all activated abilities of that card";
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public GainActivatedAbilitiesOfTopCardEffect(final GainActivatedAbilitiesOfTopCardEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GainActivatedAbilitiesOfTopCardEffect copy() {
|
||||
return new GainActivatedAbilitiesOfTopCardEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
if (card != null && filter.match(card, game)) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
for (Ability ability : card.getAbilities(game)) {
|
||||
if (ability instanceof ActivatedAbility) {
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue