Merge pull request #2305 from tool4ever/pathfix

Path of Ancestry fix
This commit is contained in:
Anthony Calosa
2023-01-24 20:51:31 +08:00
committed by GitHub
7 changed files with 13 additions and 19 deletions

View File

@@ -32,6 +32,7 @@ import forge.card.mana.ManaCost;
import forge.card.mana.ManaCostParser;
import forge.game.ability.AbilityFactory;
import forge.game.ability.ApiType;
import forge.game.ability.SpellAbilityEffect;
import forge.game.card.CardPlayOption.PayManaCost;
import forge.game.cost.Cost;
import forge.game.cost.CostPayment;
@@ -46,7 +47,6 @@ import forge.game.replacement.ReplacementLayer;
import forge.game.spellability.*;
import forge.game.staticability.StaticAbilityLayer;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerHandler;
import forge.game.trigger.TriggerType;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
@@ -799,19 +799,8 @@ public final class GameActionUtil {
eff.addReplacementEffect(re);
// Forgot Trigger
String trig = "Mode$ ChangesZone | ValidCard$ Card.IsRemembered | Origin$ Stack | Destination$ Any | TriggerZones$ Command | Static$ True";
String forgetEffect = "DB$ Pump | ForgetObjects$ TriggeredCard";
String exileEffect = "DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile"
+ " | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ EQ0";
SpellAbilityEffect.addForgetOnMovedTrigger(eff, "Stack");
SpellAbility saForget = AbilityFactory.getAbility(forgetEffect, eff);
AbilitySub saExile = (AbilitySub) AbilityFactory.getAbility(exileEffect, eff);
saForget.setSubAbility(saExile);
final Trigger parsedTrigger = TriggerHandler.parseTrigger(trig, eff, true);
parsedTrigger.setOverridingAbility(saForget);
eff.addTrigger(parsedTrigger);
eff.updateStateForView();
// TODO: Add targeting to the effect so it knows who it's dealing with

View File

@@ -373,7 +373,7 @@ public abstract class SpellAbilityEffect {
return saForget;
}
protected static void addForgetOnMovedTrigger(final Card card, final String zone) {
public static void addForgetOnMovedTrigger(final Card card, final String zone) {
String trig = "Mode$ ChangesZone | ValidCard$ Card.IsRemembered | Origin$ " + zone + " | ExcludedDestinations$ Stack | Destination$ Any | TriggerZones$ Command | Static$ True";
final Trigger parsedTrigger = TriggerHandler.parseTrigger(trig, card, true);

View File

@@ -741,6 +741,12 @@ public class CardProperty {
case "Commander":
final List<Card> cmdrs = sourceController.getCommanders();
for (Card cmdr : cmdrs) {
cmdr = game.getCardState(cmdr);
// if your commander is in a hidden zone or phased out
// it's considered to have no creature types
if (cmdr.getZone().getZoneType().isHidden() || cmdr.isPhasedOut()) {
continue;
}
if (card.sharesCreatureTypeWith(cmdr)) {
return true;
}

View File

@@ -2710,8 +2710,7 @@ public class Player extends GameEntity implements Comparable<Player> {
}
public int getCommanderCast(Card commander) {
Integer cast = commanderCast.get(commander);
return cast == null ? 0 : cast.intValue();
return commanderCast.getOrDefault(commander, 0);
}
public void incCommanderCast(Card commander) {
commanderCast.put(commander, getCommanderCast(commander) + 1);

View File

@@ -7,4 +7,4 @@ T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.S
SVar:TrigInvestigate:DB$ Investigate
S:Mode$ Continuous | Affected$ Card.Self | AddPower$ 2 | IsPresent$ Card.token+YouCtrl | Description$ As long as you control a token, CARDNAME gets +2/+0.
DeckHas:Ability$Token|Sacrifice
Oracle:Vigilance/nWhen Briarbridge Tracker enters the battlefield, investigate. (Create a colorless Clue artifact token with "{2}, Sacrifice this artifact: Draw a card.")\nAs long as you control a token, Briarbridge Tracker gets +2/+0.
Oracle:Vigilance\nWhen Briarbridge Tracker enters the battlefield, investigate. (Create a colorless Clue artifact token with "{2}, Sacrifice this artifact: Draw a card.")\nAs long as you control a token, Briarbridge Tracker gets +2/+0.

View File

@@ -1,7 +1,7 @@
Name:Jeweled Lotus
ManaCost:0
Types:Artifact
A:AB$ Mana | Cost$ T Sac<1/CARDNAME> | Produced$ Any | Amount$ 3 | RestrictValid$ Spell.IsCommander | SpellDescription$ Add three mana of any one color. Spend this mana only to cast your commander.
A:AB$ Mana | Cost$ T Sac<1/CARDNAME> | Produced$ Any | Amount$ 3 | RestrictValid$ Spell.IsCommander+YouOwn | SpellDescription$ Add three mana of any one color. Spend this mana only to cast your commander.
DeckHas:Ability$Sacrifice
AI:RemoveDeck:NonCommander
Oracle:{T}, Sacrifice Jeweled Lotus: Add three mana of any one color. Spend this mana only to cast your commander.

View File

@@ -2,7 +2,7 @@ Name:Opal Palace
ManaCost:no cost
Types:Land
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}.
A:AB$ Mana | Cost$ 1 T | Produced$ Combo ColorIdentity | AddsCounters$ Card.IsCommander_P1P1_ManaAddsCounterNum | SpellDescription$ Add one mana of any color in your commander's color identity. If you spend this mana to cast your commander, it enters the battlefield with a number of additional +1/+1 counters on it equal to the number of times it's been cast from the command zone this game.
A:AB$ Mana | Cost$ 1 T | Produced$ Combo ColorIdentity | AddsCounters$ Card.YouOwn+IsCommander_P1P1_ManaAddsCounterNum | SpellDescription$ Add one mana of any color in your commander's color identity. If you spend this mana to cast your commander, it enters the battlefield with a number of additional +1/+1 counters on it equal to the number of times it's been cast from the command zone this game.
SVar:ManaAddsCounterNum:Count$CommanderCastFromCommandZone
AI:RemoveDeck:NonCommander
Oracle:{T}: Add {C}.\n{1}, {T}: Add one mana of any color in your commander's color identity. If you spend this mana to cast your commander, it enters the battlefield with a number of additional +1/+1 counters on it equal to the number of times it's been cast from the command zone this game.