mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
* Loyal Cathar - Fixed that dies triggered ability also triggered for the night side card.
This commit is contained in:
parent
a7211a30d0
commit
fd8a18129b
8 changed files with 56 additions and 38 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -112,4 +112,25 @@ public class TwoFacedCardEffectsTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerB, "Howlpack Alpha", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that triggered abilities of the frontside do not trigger if the card is transformed
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testTransformedDOesNotTriggerFrontsideAbilities() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Loyal Cathar");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt",2);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Loyal Cathar");
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", "Unhallowed Cathar");
|
||||
|
||||
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 2);
|
||||
assertPermanentCount(playerA, "Unhallowed Cathar", 0);
|
||||
assertGraveyardCount(playerA, "Loyal Cathar", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ManaEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
|
|
|
@ -105,16 +105,16 @@ public class TriggeredAbilities extends ConcurrentHashMap<String, TriggeredAbili
|
|||
}
|
||||
}
|
||||
|
||||
private MageObject getMageObject(GameEvent event, Game game, TriggeredAbility ability) {
|
||||
MageObject object = game.getPermanent(ability.getSourceId());
|
||||
if (object == null) {
|
||||
object = game.getLastKnownInformation(ability.getSourceId(), event.getZone());
|
||||
if (object == null) {
|
||||
object = game.getObject(ability.getSourceId());
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
// private MageObject getMageObject(GameEvent event, Game game, TriggeredAbility ability) {
|
||||
// MageObject object = game.getPermanent(ability.getSourceId());
|
||||
// if (object == null) {
|
||||
// object = game.getLastKnownInformation(ability.getSourceId(), event.getZone());
|
||||
// if (object == null) {
|
||||
// object = game.getObject(ability.getSourceId());
|
||||
// }
|
||||
// }
|
||||
// return object;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Adds a by sourceId gained triggered ability
|
||||
|
|
|
@ -72,6 +72,11 @@ public class DiesTriggeredAbility extends ZoneChangeTriggeredAbility {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (super.checkTrigger(event, game)) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getTarget().canTransform()) {
|
||||
if (!zEvent.getTarget().getAbilities().contains(this)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (Effect effect: getEffects()) {
|
||||
effect.setValue("diedPermanent", zEvent.getTarget());
|
||||
}
|
||||
|
|
|
@ -208,8 +208,9 @@ public class Spell implements StackObject, Card {
|
|||
return result;
|
||||
}
|
||||
//20091005 - 608.2b
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(getName() + " has been fizzled.");
|
||||
}
|
||||
counter(null, game);
|
||||
return false;
|
||||
} else if (this.getCardType().contains(CardType.ENCHANTMENT) && this.getSubtype().contains("Aura")) {
|
||||
|
@ -250,8 +251,9 @@ public class Spell implements StackObject, Card {
|
|||
return result;
|
||||
} else {
|
||||
//20091005 - 608.2b
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(getName() + " has been fizzled.");
|
||||
}
|
||||
counter(null, game);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue