mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Merge branch 'fixCyclingZero' into 'master'
GameActionUtil: fix CyclingForZero Closes #1341 See merge request core-developers/forge!2662
This commit is contained in:
@@ -31,6 +31,7 @@ import forge.game.ability.ApiType;
|
|||||||
import forge.game.card.*;
|
import forge.game.card.*;
|
||||||
import forge.game.card.CardPlayOption.PayManaCost;
|
import forge.game.card.CardPlayOption.PayManaCost;
|
||||||
import forge.game.cost.Cost;
|
import forge.game.cost.Cost;
|
||||||
|
import forge.game.keyword.Keyword;
|
||||||
import forge.game.keyword.KeywordInterface;
|
import forge.game.keyword.KeywordInterface;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.player.PlayerController;
|
import forge.game.player.PlayerController;
|
||||||
@@ -218,23 +219,34 @@ public final class GameActionUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sa.isBasicSpell()) {
|
// below are for some special cases of activated abilities
|
||||||
return alternatives;
|
if (sa.isCycling() && activator.hasKeyword("CyclingForZero")) {
|
||||||
|
|
||||||
|
for (final KeywordInterface inst : source.getKeywords()) {
|
||||||
|
// need to find the correct Keyword from which this Ability is from
|
||||||
|
if (!inst.getAbilities().contains(sa)) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.isCycling() && activator.hasKeyword("CyclingForZero")) {
|
|
||||||
// set the cost to this directly to buypass non mana cost
|
// set the cost to this directly to buypass non mana cost
|
||||||
final SpellAbility newSA = sa.copyWithDefinedCost("Discard<1/CARDNAME>");
|
final SpellAbility newSA = sa.copyWithDefinedCost("Discard<1/CARDNAME>");
|
||||||
newSA.setActivatingPlayer(activator);
|
newSA.setActivatingPlayer(activator);
|
||||||
newSA.setBasicSpell(false);
|
|
||||||
newSA.getMapParams().put("CostDesc", ManaCostParser.parse("0"));
|
newSA.getMapParams().put("CostDesc", ManaCostParser.parse("0"));
|
||||||
|
|
||||||
|
// need to build a new Keyword to get better Reminder Text
|
||||||
|
String data[] = inst.getOriginal().split(":");
|
||||||
|
data[1] = "0";
|
||||||
|
KeywordInterface newKi = Keyword.getInstance(StringUtils.join(data, ":"));
|
||||||
|
|
||||||
// makes new SpellDescription
|
// makes new SpellDescription
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append(newSA.getCostDescription());
|
sb.append(newSA.getCostDescription());
|
||||||
sb.append(newSA.getParam("SpellDescription"));
|
sb.append("(").append(newKi.getReminderText()).append(")");
|
||||||
newSA.setDescription(sb.toString());
|
newSA.setDescription(sb.toString());
|
||||||
|
|
||||||
alternatives.add(newSA);
|
alternatives.add(newSA);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("Equip") && activator.hasKeyword("EquipInstantSpeed")) {
|
if (sa.hasParam("Equip") && activator.hasKeyword("EquipInstantSpeed")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user