Merge pull request #1531 from Northmoc/40k_squad

40K – Squad keyword and cards
This commit is contained in:
Anthony Calosa
2022-09-25 13:24:46 +08:00
committed by GitHub
11 changed files with 94 additions and 2 deletions

View File

@@ -635,6 +635,27 @@ public final class GameActionUtil {
tr.setSVar("ReplicateAmount", String.valueOf(v));
tr.getOverridingAbility().setSVar("ReplicateAmount", String.valueOf(v));
for (int i = 0; i < v; i++) {
if (result == null) {
result = sa.copy();
}
result.getPayCosts().add(cost);
reset = true;
}
}
} else if (o.startsWith("Squad")) {
Trigger tr = Iterables.getFirst(ki.getTriggers(), null);
if (tr != null) {
String costStr = o.split(":")[1];
final Cost cost = new Cost(costStr, false);
String str = "Choose amount for Squad: " + cost.toSimpleString();
int v = pc.chooseNumberForKeywordCost(sa, cost, ki, str, Integer.MAX_VALUE);
tr.setSVar("SquadAmount", String.valueOf(v));
tr.getOverridingAbility().setSVar("SquadAmount", String.valueOf(v));
for (int i = 0; i < v; i++) {
if (result == null) {
result = sa.copy();

View File

@@ -2036,7 +2036,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
} else if (keyword.startsWith("Morph") || keyword.startsWith("Megamorph")
|| keyword.startsWith("Escape") || keyword.startsWith("Foretell:")
|| keyword.startsWith("Disturb") || keyword.startsWith("Madness:")
|| keyword.startsWith("Reconfigure")) {
|| keyword.startsWith("Reconfigure") || keyword.startsWith("Squad")
|| keyword.startsWith("Miracle")) {
String[] k = keyword.split(":");
sbLong.append(k[0]);
if (k.length > 1) {

View File

@@ -1791,6 +1791,19 @@ public class CardFactoryUtil {
parsedTrigger.setOverridingAbility(sp);
inst.addTrigger(parsedTrigger);
} else if (keyword.startsWith("Squad")) {
final String trigScript = "Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | " +
"ValidCard$ Card.Self+wasCast | CheckSVar$ SquadAmount | Secondary$ True | " +
"TriggerDescription$ When this creature enters the battlefield, create that many tokens that " +
"are copies of it.";
final String abString = "DB$ CopyPermanent | Defined$ TriggeredCard | NumCopies$ SquadAmount";
final Trigger squadTrigger = TriggerHandler.parseTrigger(trigScript, card, intrinsic);
final SpellAbility squadAbility = AbilityFactory.getAbility(abString, card);
squadAbility.setSVar("SquadAmount", "0");
squadTrigger.setOverridingAbility(squadAbility);
squadTrigger.setSVar("SquadAmount", "0");
inst.addTrigger(squadTrigger);
} else if (keyword.equals("Storm")) {
final String actualTrigger = "Mode$ SpellCast | ValidCard$ Card.Self | TriggerZones$ Stack | Secondary$ True"
+ "| TriggerDescription$ Storm (" + inst.getReminderText() + ")";

View File

@@ -62,7 +62,7 @@ public final class CardUtil {
"Enchant", "Protection", "Cumulative upkeep", "Equip", "Buyback",
"Cycling", "Echo", "Kicker", "Flashback", "Madness", "Morph",
"Affinity", "Entwine", "Splice", "Ninjutsu", "Presence",
"Transmute", "Replicate", "Recover", "Suspend", "Aura swap",
"Transmute", "Replicate", "Recover", "Squad", "Suspend", "Aura swap",
"Fortify", "Transfigure", "Champion", "Evoke", "Prowl", "IfReach",
"Reinforce", "Unearth", "Level up", "Miracle", "Overload", "Cleave",
"Scavenge", "Encore", "Bestow", "Outlast", "Dash", "Surge", "Emerge", "Hexproof:",

View File

@@ -159,6 +159,7 @@ public enum Keyword {
SPECTACLE("Spectacle", KeywordWithCost.class, false, "You may cast this spell for its spectacle cost rather than its mana cost if an opponent lost life this turn."),
SPLICE("Splice", KeywordWithCostAndType.class, false, "As you cast an %2$s spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card's effects to that spell."),
SPLIT_SECOND("Split second", SimpleKeyword.class, true, "As long as this spell is on the stack, players can't cast other spells or activate abilities that aren't mana abilities."),
SQUAD("Squad", KeywordWithCost.class, false, "As an additional cost to cast this spell, you may pay %s any number of times. When this creature enters the battlefield, create that many tokens that are copies of it."),
STARTING_INTENSITY("Starting intensity", KeywordWithAmount.class, true, null),
STORM("Storm", SimpleKeyword.class, false, "When you cast this spell, copy it for each other spell that was cast before it this turn. You may choose new targets for the copies."),
STRIVE("Strive", KeywordWithCost.class, false, "CARDNAME costs %s more to cast for each target beyond the first."),