* Path of Ancestry - Fixed that the triggered ability did not work when it was copied by Thespian's Stage (fixes
*/
package mage.cards.p;
+import java.util.Iterator;
+import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.keyword.ScryEffect;
-import mage.abilities.mana.CommanderColorIdentityManaAbility;
import mage.abilities.keyword.ChangelingAbility;
+import mage.abilities.mana.CommanderColorIdentityManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@@ -43,12 +45,10 @@ import mage.constants.SubTypeSet;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
+import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
-import java.util.Iterator;
-import java.util.UUID;
-
/**
*
* @author TheElk801
@@ -66,8 +66,7 @@ public class PathOfAncestry extends CardImpl {
this.addAbility(ability);
// When that mana is spent to cast a creature spell that shares a creature type with your commander, scry 1.
- Effect effect = new ScryEffect(1);
- this.addAbility(new PathOfAncestryTriggeredAbility(ability.getOriginalId(), effect));
+ this.addAbility(new PathOfAncestryTriggeredAbility(new ScryEffect(1)));
}
public PathOfAncestry(final PathOfAncestry card) {
@@ -82,16 +81,12 @@ public class PathOfAncestry extends CardImpl {
class PathOfAncestryTriggeredAbility extends TriggeredAbilityImpl {
- String abilityOriginalId;
-
- public PathOfAncestryTriggeredAbility(UUID abilityOriginalId, Effect effect) {
+ public PathOfAncestryTriggeredAbility(Effect effect) {
super(Zone.ALL, effect, true);
- this.abilityOriginalId = abilityOriginalId.toString();
}
public PathOfAncestryTriggeredAbility(final PathOfAncestryTriggeredAbility ability) {
super(ability);
- this.abilityOriginalId = ability.abilityOriginalId;
}
@Override
@@ -106,7 +101,17 @@ class PathOfAncestryTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
- if (event.getData().equals(abilityOriginalId)) {
+ if (event.getSourceId().equals(getSourceId())) {
+ Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getSourceId());
+ if (sourcePermanent != null) {
+ boolean found = false;
+ for (Ability ability : sourcePermanent.getAbilities()) {
+ if (ability instanceof CommanderColorIdentityManaAbility && ability.getOriginalId().toString().equals(event.getData())) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.isCreature()) {
Player controller = game.getPlayer(getControllerId());
@@ -143,6 +148,8 @@ class PathOfAncestryTriggeredAbility extends TriggeredAbilityImpl {
}
}
}
+ }
+ }
return false;
}
