forked from External/mage
[KHM] foretell improves (related to bc25c3d60a):
* reverted code format of AsThoughEffectType; * fixed disabled test; * added test for Dream Devourer; * simplified some code;
This commit is contained in:
parent
bc25c3d60a
commit
df98cc3e62
5 changed files with 88 additions and 39 deletions
|
|
@ -1,14 +1,8 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpecialAction;
|
||||
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;
|
||||
|
|
@ -16,7 +10,6 @@ import mage.game.events.GameEvent;
|
|||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class ForetellSourceControllerTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
|
@ -39,22 +32,15 @@ public class ForetellSourceControllerTriggeredAbility extends TriggeredAbilityIm
|
|||
//UUID specialAction = event.getTargetId();
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
Player player = game.getPlayer(event.getPlayerId());
|
||||
for (Ability a : card.getAbilities()) {
|
||||
if (player.getId() == controllerId
|
||||
&& (a instanceof SpecialAction)
|
||||
&& a.getRule().endsWith("and exile this card from your hand face down. Cast it on a later turn for its foretell cost.)</i>")) {
|
||||
return true;
|
||||
}
|
||||
if (card == null || player == null) {
|
||||
return false;
|
||||
}
|
||||
// if the ability is added to cards via effect
|
||||
for (Ability a : game.getState().getAllOtherAbilities(card.getId())) {
|
||||
if (player.getId() == controllerId
|
||||
&& (a instanceof SpecialAction)
|
||||
&& a.getRule().endsWith("and exile this card from your hand face down. Cast it on a later turn for its foretell cost.)</i>")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isControlledBy(player.getId())) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
return card.getAbilities(game).containsClass(ForetellAbility.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue