mirror of
https://github.com/correl/mage.git
synced 2025-04-08 09:11:04 -09:00
corrected implementation of Answered Prayers
This commit is contained in:
parent
2f8518c61c
commit
dddc47fedc
1 changed files with 32 additions and 16 deletions
|
@ -3,8 +3,7 @@ package mage.cards.a;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
@ -12,6 +11,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
|
@ -29,17 +29,9 @@ public final class AnsweredPrayers extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}");
|
||||
|
||||
// Whenever a creature enters the battlefield under your control, you gain 1 life. If Answered Prayers isn't a creature, it becomes a 3/3 Angel creature with flying in addition to its other types until end of turn.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldControlledTriggeredAbility(
|
||||
new GainLifeEffect(1), StaticFilters.FILTER_PERMANENT_CREATURE
|
||||
), AnsweredPrayersCondition.instance, "Whenever a creature enters the battlefield " +
|
||||
"under your control, you gain 1 life. If {this} isn't a creature, " +
|
||||
"it becomes a 3/3 Angel creature with flying in addition to its other types until end of turn."
|
||||
);
|
||||
ability.addEffect(new BecomesCreatureSourceEffect(
|
||||
new AnsweredPrayersToken(), "enchantment", Duration.EndOfTurn
|
||||
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
|
||||
new AnsweredPrayersEffect(), StaticFilters.FILTER_PERMANENT_CREATURE
|
||||
));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private AnsweredPrayers(final AnsweredPrayers card) {
|
||||
|
@ -52,13 +44,37 @@ public final class AnsweredPrayers extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
enum AnsweredPrayersCondition implements Condition {
|
||||
instance;
|
||||
class AnsweredPrayersEffect extends OneShotEffect {
|
||||
|
||||
AnsweredPrayersEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "you gain 1 life. If {this} isn't a creature, it becomes a " +
|
||||
"3/3 Angel creature with flying in addition to its other types until end of turn.";
|
||||
}
|
||||
|
||||
private AnsweredPrayersEffect(final AnsweredPrayersEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnsweredPrayersEffect copy() {
|
||||
return new AnsweredPrayersEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
return permanent != null && !permanent.isCreature();
|
||||
new GainLifeEffect(1).apply(game, source);
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
if (permanent.isCreature()) {
|
||||
return true;
|
||||
}
|
||||
game.addEffect(new BecomesCreatureSourceEffect(
|
||||
new AnsweredPrayersToken(), "enchantment", Duration.EndOfTurn
|
||||
), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue