Fix Grip of Chaos

This commit is contained in:
tool4EvEr
2022-10-27 21:57:40 +02:00
parent 524ce08a5e
commit eb4b4a6adb

View File

@@ -28,7 +28,6 @@ import forge.game.Game;
import forge.game.GameEntity; import forge.game.GameEntity;
import forge.game.GameObject; import forge.game.GameObject;
import forge.game.ability.AbilityKey; import forge.game.ability.AbilityKey;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CardCollection; import forge.game.card.CardCollection;
import forge.game.card.CardLists; import forge.game.card.CardLists;
@@ -203,16 +202,6 @@ public class TriggerSpellAbilityCastOrCopy extends Trigger {
} }
} }
if (hasParam("AmountManaSpent")) {
String value = getParam("AmountManaSpent");
int manaSpent = spellAbility.getTotalManaSpent();
String comparator = value.substring(0, 2);
int y = AbilityUtils.calculateAmount(spellAbility.getHostCard(), value.substring(2), spellAbility);
if (!Expressions.compare(manaSpent, comparator, y)) {
return false;
}
}
if (hasParam("Outlast")) { if (hasParam("Outlast")) {
if (!spellAbility.isOutlast()) { if (!spellAbility.isOutlast()) {
return false; return false;
@@ -225,6 +214,7 @@ public class TriggerSpellAbilityCastOrCopy extends Trigger {
} }
} }
// use numTargets instead?
if (hasParam("IsSingleTarget")) { if (hasParam("IsSingleTarget")) {
Set<GameObject> targets = Sets.newHashSet(); Set<GameObject> targets = Sets.newHashSet();
for (TargetChoices tc : spellAbility.getAllTargetChoices()) { for (TargetChoices tc : spellAbility.getAllTargetChoices()) {
@@ -263,22 +253,6 @@ public class TriggerSpellAbilityCastOrCopy extends Trigger {
} }
} }
if (hasParam("ManaFrom")) {
boolean found = false;
for (Mana m : spellAbility.getPayingMana()) {
Card source = m.getSourceCard();
if (source != null) {
if (matchesValidParam("ManaFrom", source)) {
found = true;
break;
}
}
}
if (!found) {
return false;
}
}
if (hasParam("SnowSpentForCardsColor")) { if (hasParam("SnowSpentForCardsColor")) {
boolean found = false; boolean found = false;
for (Mana m : spellAbility.getPayingMana()) { for (Mana m : spellAbility.getPayingMana()) {
@@ -304,7 +278,7 @@ public class TriggerSpellAbilityCastOrCopy extends Trigger {
final SpellAbilityStackInstance si = sa.getHostCard().getGame().getStack().getInstanceFromSpellAbility(castSA); final SpellAbilityStackInstance si = sa.getHostCard().getGame().getStack().getInstanceFromSpellAbility(castSA);
final SpellAbility saForTargets = si != null ? si.getSpellAbility(true) : castSA; final SpellAbility saForTargets = si != null ? si.getSpellAbility(true) : castSA;
sa.setTriggeringObject(AbilityKey.Card, castSA.getHostCard()); sa.setTriggeringObject(AbilityKey.Card, castSA.getHostCard());
sa.setTriggeringObject(AbilityKey.SpellAbility, castSA.copy(castSA.getHostCard(), true)); sa.setTriggeringObject(AbilityKey.SpellAbility, castSA.isWrapper() ? castSA : castSA.copy(castSA.getHostCard(), true));
sa.setTriggeringObject(AbilityKey.StackInstance, si); sa.setTriggeringObject(AbilityKey.StackInstance, si);
if (!saForTargets.getTargets().isEmpty()) { if (!saForTargets.getTargets().isEmpty()) {
sa.setTriggeringObject(AbilityKey.SpellAbilityTarget, saForTargets.getTargets().get(0)); sa.setTriggeringObject(AbilityKey.SpellAbilityTarget, saForTargets.getTargets().get(0));