- refactored Ethereal Valkyrie to work with Split/MDFC/Adventure cards as per weirddan455 commit.

This commit is contained in:
jeffwadsworth 2021-02-05 16:37:44 -06:00
parent 3af5cb9514
commit aa13b06af9
2 changed files with 110 additions and 71 deletions

View file

@ -1,56 +1,55 @@
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.keyword.ForetellAbility;
import mage.cards.Card;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
* @author jeffwadsworth
*/
public class ForetellSourceControllerTriggeredAbility extends TriggeredAbilityImpl {
public ForetellSourceControllerTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
}
public ForetellSourceControllerTriggeredAbility(final ForetellSourceControllerTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TAKEN_SPECIAL_ACTION;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
//UUID specialAction = event.getTargetId();
Card card = game.getCard(event.getSourceId());
Player player = game.getPlayer(event.getPlayerId());
if (card == null || player == null) {
return false;
}
if (!isControlledBy(player.getId())) {
return false;
}
return card.getAbilities(game).containsClass(ForetellAbility.class);
}
@Override
public String getRule() {
return "Whenever you foretell a card, " + super.getRule();
}
@Override
public ForetellSourceControllerTriggeredAbility copy() {
return new ForetellSourceControllerTriggeredAbility(this);
}
}
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.keyword.ForetellAbility;
import mage.cards.Card;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
* @author jeffwadsworth
*/
public class ForetellSourceControllerTriggeredAbility extends TriggeredAbilityImpl {
public ForetellSourceControllerTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
}
public ForetellSourceControllerTriggeredAbility(final ForetellSourceControllerTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TAKEN_SPECIAL_ACTION;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Card card = game.getCard(event.getSourceId());
Player player = game.getPlayer(event.getPlayerId());
if (card == null || player == null) {
return false;
}
if (!isControlledBy(player.getId())) {
return false;
}
return card.getAbilities(game).containsClass(ForetellAbility.class);
}
@Override
public String getRule() {
return "Whenever you foretell a card, " + super.getRule();
}
@Override
public ForetellSourceControllerTriggeredAbility copy() {
return new ForetellSourceControllerTriggeredAbility(this);
}
}