This commit is contained in:
tool4EvEr
2023-01-15 23:01:46 +01:00
parent 429434a240
commit aad5f6ce93
7 changed files with 10 additions and 26 deletions

View File

@@ -17,7 +17,6 @@ public abstract class TriggerReplacementBase extends CardTraitBase implements II
/** The overriding ability. */
private SpellAbility overridingAbility = null;
private CardTraitBase linkedAbility = null;
@Override
public void setHostCard(final Card c) {
@@ -77,12 +76,5 @@ public abstract class TriggerReplacementBase extends CardTraitBase implements II
this.overridingAbility = overridingAbility0;
}
public CardTraitBase getLinkedAbility() {
return this.linkedAbility;
}
public void setLinkedAbility(final CardTraitBase linked) {
this.linkedAbility = linked;
}
abstract public SpellAbility ensureAbility();
}

View File

@@ -5789,13 +5789,12 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
return exertThisTurn;
}
public void exert(StaticAbility host) {
public void exert() {
exertedByPlayer.add(getController());
exertThisTurn++;
view.updateExertedThisTurn(this, true);
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(this);
runParams.put(AbilityKey.Player, getController());
runParams.put(AbilityKey.Source, host);
game.getTriggerHandler().runTrigger(TriggerType.Exerted, runParams, false);
}

View File

@@ -17,13 +17,13 @@
*/
package forge.game.cost;
import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerHandler;
import forge.game.zone.ZoneType;
/**
@@ -99,12 +99,11 @@ public class CostExert extends CostPartWithList {
@Override
protected Card doPayment(SpellAbility ability, Card targetCard, final boolean effect) {
if (trigger != null) {
TriggerHandler handler = targetCard.getGame().getTriggerHandler();
Trigger trig = TriggerHandler.parseTrigger(trigHost.getSVar(trigger), trigHost.getHostCard(), false);
trig.setLinkedAbility(trigHost);
handler.registerOneTrigger(trig);
SpellAbility trig = AbilityFactory.getAbility(targetCard.getSVar(trigger), targetCard);
trig.setActivatingPlayer(ability.getActivatingPlayer());
AbilityUtils.resolve(trig);
}
targetCard.exert(trigHost);
targetCard.exert();
return targetCard;
}

View File

@@ -27,7 +27,6 @@ import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.staticability.StaticAbility;
/**
* The Class CostPart.
@@ -43,7 +42,6 @@ public abstract class CostPart implements Comparable<CostPart>, Cloneable, Seria
private String typeDescription, type;
protected String trigger;
protected transient StaticAbility trigHost;
/**
* Instantiates a new cost part.
@@ -158,9 +156,8 @@ public abstract class CostPart implements Comparable<CostPart>, Cloneable, Seria
return AbilityUtils.calculateAmount(ability.getHostCard(), getAmount(), ability);
}
public void setTrigger(String trig, StaticAbility host) {
public void setTrigger(String trig) {
trigger = trig;
trigHost = host;
}
/**

View File

@@ -188,7 +188,7 @@ public class StaticAbilityCantAttackBlock {
Cost cost = new Cost(costString, true);
if (stAb.hasParam("Trigger")) {
cost.getCostParts().get(0).setTrigger(stAb.getParam("Trigger"), stAb);
cost.getCostParts().get(0).setTrigger(stAb.getParam("Trigger"));
}
return cost;

View File

@@ -27,9 +27,6 @@ public class TriggerExerted extends Trigger {
if (!matchesValidParam("ValidCard", runParams.get(AbilityKey.Card))) {
return false;
}
if (hasParam("Linked") && !runParams.get(AbilityKey.Source).equals(getLinkedAbility())) {
return false;
}
return true;
}

View File

@@ -4,6 +4,6 @@ Types:Creature Minotaur Warrior
PT:3/2
K:Haste
S:Mode$ CantAttackUnless | ValidCard$ Card.Self | Trigger$ TrigExert | Cost$ Exert<1/CARDNAME> | Description$ You may exert CARDNAME as it attacks. When you do, target creature can't block this turn.
SVar:TrigExert:Mode$ Exerted | ValidCard$ Card.Self | Linked$ True | Execute$ TrigCanNotBlock | TriggerDescription$ When you exert CARDNAME, target creature can't block this turn.
SVar:TrigExert:DB$ ImmediateTrigger | Execute$ TrigCanNotBlock | TriggerDescription$ When you exert CARDNAME, target creature can't block this turn.
SVar:TrigCanNotBlock:DB$ Pump | ValidTgts$ Creature | KW$ HIDDEN CARDNAME can't block. | TgtPrompt$ Select target creature. | IsCurse$ True | SpellDescription$ Target creature can't block this turn.
Oracle:Haste\nYou may exert Ahn-Crop Crasher as it attacks. When you do, target creature can't block this turn. (An exerted creature won't untap during your next untap step.)