mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Refactor Offering (#8199)
This commit is contained in:
@@ -495,8 +495,8 @@ public final class GameActionUtil {
|
|||||||
String[] k = keyword.split(":");
|
String[] k = keyword.split(":");
|
||||||
final Cost cost = new Cost(k[1], false);
|
final Cost cost = new Cost(k[1], false);
|
||||||
costs.add(new OptionalCostValue(OptionalCost.Flash, cost));
|
costs.add(new OptionalCostValue(OptionalCost.Flash, cost));
|
||||||
} else if (keyword.endsWith(" offering")) {
|
} else if (keyword.startsWith("Offering")) {
|
||||||
final String type = keyword.split(" ")[0];
|
final String type = keyword.split(":")[1];
|
||||||
final Cost cost = new Cost("Sac<1/" + type + ">", false);
|
final Cost cost = new Cost("Sac<1/" + type + ">", false);
|
||||||
costs.add(new OptionalCostValue(OptionalCost.Offering, cost));
|
costs.add(new OptionalCostValue(OptionalCost.Offering, cost));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2726,13 +2726,13 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
|||||||
sbLong.append(onlyMana? "" : ".").append(extra);
|
sbLong.append(onlyMana? "" : ".").append(extra);
|
||||||
sbLong.append(!complex ? " (" + (inst.getReminderText()) + ")" : "");
|
sbLong.append(!complex ? " (" + (inst.getReminderText()) + ")" : "");
|
||||||
sbLong.append("\r\n");
|
sbLong.append("\r\n");
|
||||||
} else if (keyword.endsWith(" offering")) {
|
} else if (keyword.startsWith("Offering")) {
|
||||||
String offeringType = keyword.split(" ")[0];
|
String type = keyword.split(":")[1];
|
||||||
if (sb.length() != 0) {
|
if (sb.length() != 0) {
|
||||||
sb.append("\r\n");
|
sb.append("\r\n");
|
||||||
}
|
}
|
||||||
sbLong.append(keyword);
|
sbLong.append(type).append(" offering");
|
||||||
sbLong.append(" (").append(Keyword.getInstance("Offering:" + offeringType).getReminderText()).append(")");
|
sbLong.append(" (").append(inst.getReminderText()).append(")");
|
||||||
} else if (keyword.startsWith("Equip") || keyword.startsWith("Fortify") || keyword.startsWith("Outlast")
|
} else if (keyword.startsWith("Equip") || keyword.startsWith("Fortify") || keyword.startsWith("Outlast")
|
||||||
|| keyword.startsWith("Unearth") || keyword.startsWith("Scavenge")
|
|| keyword.startsWith("Unearth") || keyword.startsWith("Scavenge")
|
||||||
|| keyword.startsWith("Spectacle") || keyword.startsWith("Evoke")
|
|| keyword.startsWith("Spectacle") || keyword.startsWith("Evoke")
|
||||||
|
|||||||
@@ -59,11 +59,8 @@ public final class CardUtil {
|
|||||||
"Fortify", "Transfigure", "Champion", "Evoke", "Prowl", "Freerunning",
|
"Fortify", "Transfigure", "Champion", "Evoke", "Prowl", "Freerunning",
|
||||||
"Reinforce", "Unearth", "Level up", "Miracle", "Overload", "Cleave",
|
"Reinforce", "Unearth", "Level up", "Miracle", "Overload", "Cleave",
|
||||||
"Scavenge", "Encore", "Bestow", "Outlast", "Dash", "Surge", "Emerge", "Hexproof:",
|
"Scavenge", "Encore", "Bestow", "Outlast", "Dash", "Surge", "Emerge", "Hexproof:",
|
||||||
"Bands with other", "Landwalk",
|
"Bands with other", "Landwalk", "Offering",
|
||||||
"etbCounter", "Reflect", "Ward").build();
|
"etbCounter", "Reflect", "Ward").build();
|
||||||
/** List of keyword endings of keywords that could be modified by text changes. */
|
|
||||||
public static final ImmutableList<String> modifiableKeywordEndings = ImmutableList.<String>builder().add(
|
|
||||||
"cycling", "offering").build();
|
|
||||||
|
|
||||||
public static boolean isKeywordModifiable(final String kw) {
|
public static boolean isKeywordModifiable(final String kw) {
|
||||||
for (final String modKw : modifiableKeywords) {
|
for (final String modKw : modifiableKeywords) {
|
||||||
@@ -71,11 +68,6 @@ public final class CardUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (final String end : modifiableKeywordEndings) {
|
|
||||||
if (kw.endsWith(end)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ public class CostAdjustment {
|
|||||||
String offeringType = "";
|
String offeringType = "";
|
||||||
for (KeywordInterface inst : sa.getHostCard().getKeywords(Keyword.OFFERING)) {
|
for (KeywordInterface inst : sa.getHostCard().getKeywords(Keyword.OFFERING)) {
|
||||||
final String kw = inst.getOriginal();
|
final String kw = inst.getOriginal();
|
||||||
offeringType = kw.split(" ")[0];
|
offeringType = kw.split(":")[1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -253,20 +253,6 @@ public enum Keyword {
|
|||||||
details = "";
|
details = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyword == Keyword.UNDEFINED) {
|
|
||||||
//check for special keywords that have a prefix before the keyword enum name
|
|
||||||
int idx = k.indexOf(' ');
|
|
||||||
String enumName = k.replace(" ", "_").toUpperCase(Locale.ROOT);
|
|
||||||
String firstWord = idx == -1 ? enumName : enumName.substring(0, idx);
|
|
||||||
if (idx != -1) {
|
|
||||||
idx = k.indexOf(' ', idx + 1);
|
|
||||||
String secondWord = idx == -1 ? enumName.substring(firstWord.length() + 1) : enumName.substring(firstWord.length() + 1, idx);
|
|
||||||
if (secondWord.equalsIgnoreCase("OFFERING")) {
|
|
||||||
keyword = Keyword.OFFERING;
|
|
||||||
details = firstWord;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
KeywordInstance<?> inst;
|
KeywordInstance<?> inst;
|
||||||
try {
|
try {
|
||||||
inst = keyword.type.getConstructor().newInstance();
|
inst = keyword.type.getConstructor().newInstance();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Name:Blast-Furnace Hellkite
|
|||||||
ManaCost:7 R R
|
ManaCost:7 R R
|
||||||
Types:Creature Dragon
|
Types:Creature Dragon
|
||||||
PT:5/5
|
PT:5/5
|
||||||
K:Artifact offering
|
K:Offering:Artifact
|
||||||
K:Flying
|
K:Flying
|
||||||
K:Double Strike
|
K:Double Strike
|
||||||
S:Mode$ Continuous | Affected$ Creature.attacking Opponent | AddKeyword$ Double Strike | Description$ Creatures attacking your opponents have double strike.
|
S:Mode$ Continuous | Affected$ Creature.attacking Opponent | AddKeyword$ Double Strike | Description$ Creatures attacking your opponents have double strike.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Name:Patron of the Akki
|
|||||||
ManaCost:4 R R
|
ManaCost:4 R R
|
||||||
Types:Legendary Creature Spirit
|
Types:Legendary Creature Spirit
|
||||||
PT:5/5
|
PT:5/5
|
||||||
K:Goblin offering
|
K:Offering:Goblin
|
||||||
T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigPump | TriggerDescription$ Whenever CARDNAME attacks, creatures you control get +2/+0 until end of turn.
|
T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigPump | TriggerDescription$ Whenever CARDNAME attacks, creatures you control get +2/+0 until end of turn.
|
||||||
SVar:TrigPump:DB$ PumpAll | ValidCards$ Creature.YouCtrl | NumAtt$ +2
|
SVar:TrigPump:DB$ PumpAll | ValidCards$ Creature.YouCtrl | NumAtt$ +2
|
||||||
AI:RemoveDeck:All
|
AI:RemoveDeck:All
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Name:Patron of the Kitsune
|
|||||||
ManaCost:4 W W
|
ManaCost:4 W W
|
||||||
Types:Legendary Creature Spirit
|
Types:Legendary Creature Spirit
|
||||||
PT:5/6
|
PT:5/6
|
||||||
K:Fox offering
|
K:Offering:Fox
|
||||||
T:Mode$ Attacks | ValidCard$ Creature | TriggerZones$ Battlefield | Execute$ PatronLife | OptionalDecider$ You | TriggerDescription$ Whenever a creature attacks, you gain 1 life.
|
T:Mode$ Attacks | ValidCard$ Creature | TriggerZones$ Battlefield | Execute$ PatronLife | OptionalDecider$ You | TriggerDescription$ Whenever a creature attacks, you gain 1 life.
|
||||||
SVar:PatronLife:DB$ GainLife | LifeAmount$ 1
|
SVar:PatronLife:DB$ GainLife | LifeAmount$ 1
|
||||||
AI:RemoveDeck:All
|
AI:RemoveDeck:All
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Name:Patron of the Moon
|
|||||||
ManaCost:5 U U
|
ManaCost:5 U U
|
||||||
Types:Legendary Creature Spirit
|
Types:Legendary Creature Spirit
|
||||||
PT:5/4
|
PT:5/4
|
||||||
K:Moonfolk offering
|
K:Offering:Moonfolk
|
||||||
K:Flying
|
K:Flying
|
||||||
A:AB$ ChangeZone | Cost$ 1 | ChangeNum$ 2 | Origin$ Hand | Destination$ Battlefield | Tapped$ True | ChangeType$ Land.YouCtrl | SpellDescription$ Put up to two land cards from your hand onto the battlefield tapped.
|
A:AB$ ChangeZone | Cost$ 1 | ChangeNum$ 2 | Origin$ Hand | Destination$ Battlefield | Tapped$ True | ChangeType$ Land.YouCtrl | SpellDescription$ Put up to two land cards from your hand onto the battlefield tapped.
|
||||||
AI:RemoveDeck:All
|
AI:RemoveDeck:All
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Name:Patron of the Nezumi
|
|||||||
ManaCost:5 B B
|
ManaCost:5 B B
|
||||||
Types:Legendary Creature Spirit
|
Types:Legendary Creature Spirit
|
||||||
PT:6/6
|
PT:6/6
|
||||||
K:Rat offering
|
K:Offering:Rat
|
||||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | TriggerZones$ Battlefield | ValidCard$ Card.OppOwn | Execute$ TrigLoseLife | TriggerDescription$ Whenever a permanent is put into an opponent's graveyard, that player loses 1 life.
|
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | TriggerZones$ Battlefield | ValidCard$ Card.OppOwn | Execute$ TrigLoseLife | TriggerDescription$ Whenever a permanent is put into an opponent's graveyard, that player loses 1 life.
|
||||||
SVar:TrigLoseLife:DB$ LoseLife | Defined$ TriggeredCardOwner | LifeAmount$ 1
|
SVar:TrigLoseLife:DB$ LoseLife | Defined$ TriggeredCardOwner | LifeAmount$ 1
|
||||||
AI:RemoveDeck:All
|
AI:RemoveDeck:All
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Name:Patron of the Orochi
|
|||||||
ManaCost:6 G G
|
ManaCost:6 G G
|
||||||
Types:Legendary Creature Spirit
|
Types:Legendary Creature Spirit
|
||||||
PT:7/7
|
PT:7/7
|
||||||
K:Snake offering
|
K:Offering:Snake
|
||||||
A:AB$ UntapAll | Cost$ T | ValidCards$ Forest,Creature.Green | ActivationLimit$ 1 | SpellDescription$ Untap all Forests and all green creatures. Activate only once each turn.
|
A:AB$ UntapAll | Cost$ T | ValidCards$ Forest,Creature.Green | ActivationLimit$ 1 | SpellDescription$ Untap all Forests and all green creatures. Activate only once each turn.
|
||||||
AI:RemoveDeck:All
|
AI:RemoveDeck:All
|
||||||
Oracle:Snake offering (You may cast this card any time you could cast an instant by sacrificing a Snake and paying the difference in mana costs between this and the sacrificed Snake. Mana cost includes color.)\n{T}: Untap all Forests and all green creatures. Activate only once each turn.
|
Oracle:Snake offering (You may cast this card any time you could cast an instant by sacrificing a Snake and paying the difference in mana costs between this and the sacrificed Snake. Mana cost includes color.)\n{T}: Untap all Forests and all green creatures. Activate only once each turn.
|
||||||
|
|||||||
Reference in New Issue
Block a user