* Loyal Cathar - Fixed that dies triggered ability also triggered for the night side card.

This commit is contained in:
LevelX2 2015-04-07 23:39:38 +02:00
parent a7211a30d0
commit fd8a18129b
8 changed files with 56 additions and 38 deletions

View file

@ -28,9 +28,6 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
@ -40,7 +37,9 @@ import mage.abilities.keyword.TransformAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;

View file

@ -138,11 +138,6 @@ class AngelsGraceReplacementEffect extends ReplacementEffectImpl {
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return false;

View file

@ -53,10 +53,8 @@ public class AngelicChorus extends CardImpl {
super(ownerId, 3, "Angelic Chorus", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}");
this.expansionSetCode = "USG";
this.color.setWhite(true);
Ability ability = new AngelicChorusTriggeredAbility();
this.addAbility(ability);
// Whenever a creature enters the battlefield under your control, you gain life equal to its toughness.
this.addAbility(new AngelicChorusTriggeredAbility());
}
public AngelicChorus(final AngelicChorus card) {
@ -79,16 +77,18 @@ class AngelicChorusTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.getCardType().contains(CardType.CREATURE)
&& permanent.getControllerId().equals(this.controllerId)) {
Effect effect = this.getEffects().get(0);
effect.setValue("lifeSource", event.getTargetId());
return true;
}
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.getCardType().contains(CardType.CREATURE)
&& permanent.getControllerId().equals(this.controllerId)) {
this.getEffects().get(0).setValue("lifeSource", event.getTargetId());
return true;
}
return false;
}
@ -123,15 +123,12 @@ class AngelicChorusEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
UUID creatureId = (UUID) getValue("lifeSource");
Permanent creature = game.getPermanent(creatureId);
if (creature == null) {
creature = (Permanent) game.getLastKnownInformation(creatureId, Zone.BATTLEFIELD);
}
Permanent creature = game.getPermanentOrLKIBattlefield(creatureId);
if (creature != null) {
int amount = creature.getToughness().getValue();
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.gainLife(amount, game);
player.gainLife(amount, game);
}
return true;
}