Keyword: add 'Bands with other' keyword (#5950)

This commit is contained in:
Hans Mackowiak
2024-08-19 06:32:44 +02:00
committed by GitHub
parent bb07351d4e
commit 492ff16c12
16 changed files with 40 additions and 43 deletions

View File

@@ -2479,6 +2479,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
sb.append("exile it haunting target creature.");
}
sb.append(")");
} else if (keyword.startsWith("Bands with other")) {
final String[] k = keyword.split(":");
String desc = k.length > 2 ? k[2] : CardType.getPluralType(k[1]);
sbLong.append(k[0]).append(" ").append(desc).append(" (").append(inst.getReminderText()).append(")");
} else if (keyword.equals("Convoke") || keyword.equals("Dethrone")|| keyword.equals("Fear")
|| keyword.equals("Melee") || keyword.equals("Improvise")|| keyword.equals("Shroud")
|| keyword.equals("Banding") || keyword.equals("Intimidate")|| keyword.equals("Evolve")

View File

@@ -60,6 +60,7 @@ public final class CardUtil {
"Fortify", "Transfigure", "Champion", "Evoke", "Prowl", "Freerunning",
"Reinforce", "Unearth", "Level up", "Miracle", "Overload", "Cleave",
"Scavenge", "Encore", "Bestow", "Outlast", "Dash", "Surge", "Emerge", "Hexproof:",
"Bands with other",
"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(

View File

@@ -5,6 +5,7 @@ import forge.game.card.CardCollection;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
import forge.game.keyword.Keyword;
import forge.game.keyword.KeywordInterface;
import java.util.List;
@@ -39,28 +40,20 @@ public class AttackingBand {
return true;
}
// Legends lands, Master of the Hunt, Old Fogey (just in case)
// Since Bands With Other is a dead keyword, no major reason to make this more generic
// But if someone is super motivated, feel free to do it. Just make sure you update Tolaria and Shelkie Brownie
String[] bandsWithString = { "Bands with Other Legendary Creatures", "Bands with Other Creatures named Wolves of the Hunt",
"Bands with Other Dinosaurs" };
String[] validString = { "Legendary.Creature", "Creature.namedWolves of the Hunt", "Dinosaur" };
for (Card c : CardLists.getKeyword(band, Keyword.BANDSWITH)) {
for (KeywordInterface kw : c.getKeywords(Keyword.BANDSWITH)) {
String o = kw.getOriginal();
String m[] = o.split(":");
Card source = band.get(0);
for (int i = 0; i < bandsWithString.length; i++) {
String keyword = bandsWithString[i];
String valid = validString[i];
// Check if a bands with other keyword exists in band, and each creature in the band fits the valid quality
if (!CardLists.getKeyword(band, keyword).isEmpty() &&
CardLists.getValidCards(band, valid, source.getController(), source, null).size() == band.size()) {
return true;
if (CardLists.getValidCards(band, m[1], c.getController(), c, null).size() == band.size()) {
return true;
}
}
}
return false;
}
public boolean canJoinBand(Card card) {
// Trying to join an existing band, attackers should be non-empty and card should exist
CardCollection newBand = new CardCollection(attackers);

View File

@@ -22,6 +22,7 @@ public enum Keyword {
AWAKEN("Awaken", KeywordWithCostAndAmount.class, false, "If you cast this spell for %s, also put {%d:+1/+1 counter} on target land you control and it becomes a 0/0 Elemental creature with haste. It's still a land."),
BACKUP("Backup", KeywordWithAmount.class, false, "When this creature enters, put {%1$d:+1/+1 counter} on target creature. If that's another creature, it gains the following ability until end of turn."),
BANDING("Banding", SimpleKeyword.class, true, "Any creatures with banding, and up to one without, can attack in a band. Bands are blocked as a group. If any creatures with banding you control are blocking or being blocked by a creature, you divide that creature's combat damage, not its controller, among any of the creatures it's being blocked by or is blocking."),
BANDSWITH("Bands with other", KeywordWithType.class, false, "can attack in a band with another %s"),
BARGAIN("Bargain", SimpleKeyword.class, false, "You may sacrifice an artifact, enchantment, or token as you cast this spell."),
BATTLE_CRY("Battle cry", SimpleKeyword.class, false, "Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn."),
BESTOW("Bestow", KeywordWithCost.class, false, "If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature."),

View File

@@ -20,6 +20,7 @@ public class KeywordWithType extends KeywordInstance<KeywordWithType> {
type = "artifact, legendary, and/or Saga permanent";
}
break;
case BANDSWITH:
case HEXPROOF:
case LANDWALK:
type = details.split(":")[1];