Trample over PW as Variant of Trample

This commit is contained in:
Hans Mackowiak
2021-07-31 10:58:36 +02:00
parent fd03367ac4
commit c7e6076f8b
8 changed files with 52 additions and 6 deletions

View File

@@ -2035,6 +2035,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
sbx.append(" (").append(inst.getReminderText()).append(")");
sbLong.append(sbx).append("\r\n");
}
} else if (keyword.startsWith("Trample:")) {
sbLong.append("Trample over planeswalkers").append(" (").append(inst.getReminderText()).append(")").append("\r\n");
} else if (keyword.startsWith("Hexproof:")) {
final String[] k = keyword.split(":");
sbLong.append("Hexproof from ").append(k[2])
@@ -2061,7 +2063,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|| keyword.equals("Suspend") // for the ones without amount
|| keyword.equals("Foretell") // for the ones without cost
|| keyword.equals("Hideaway") || keyword.equals("Ascend")
|| keyword.equals("Trample over planeswalkers")
|| keyword.equals("Totem armor") || keyword.equals("Battle cry")
|| keyword.equals("Devoid") || keyword.equals("Riot")){
sbLong.append(keyword).append(" (").append(inst.getReminderText()).append(")");

View File

@@ -518,6 +518,7 @@ public class CardFactoryUtil {
final Set<String> protectionkw = Sets.newHashSet();
final Set<String> protectionColorkw = Sets.newHashSet();
final Set<String> hexproofkw = Sets.newHashSet();
final Set<String> tramplekw = Sets.newHashSet();
final Set<String> allkw = Sets.newHashSet();
for (Card c : CardLists.getValidCards(cardlist, restrictions, p, host, null)) {
@@ -535,6 +536,8 @@ public class CardFactoryUtil {
}
} else if (k.startsWith("Hexproof")) {
hexproofkw.add(k);
} else if (k.startsWith("Trample")) {
tramplekw.add(k);
}
allkw.add(k);
}
@@ -548,6 +551,8 @@ public class CardFactoryUtil {
filteredkw.addAll(landkw);
} else if (keyword.equals("Hexproof")) {
filteredkw.addAll(hexproofkw);
} else if (keyword.equals("Trample")) {
filteredkw.addAll(tramplekw);
} else if (allkw.contains(keyword)) {
filteredkw.add(keyword);
}

View File

@@ -97,6 +97,9 @@ public class CounterType implements Comparable<CounterType>, Serializable {
final String[] k = sVal.split(":");
return "Hexproof from " + k[2];
}
if (sVal.startsWith("Trample:")) {
return "Trample over Planeswalkers";
}
return sVal;
}
@@ -119,6 +122,9 @@ public class CounterType implements Comparable<CounterType>, Serializable {
if (sVal.startsWith("Hexproof:")) {
return true;
}
if (sVal.startsWith("Trample:")) {
return true;
}
return keywordCounter.contains(sVal);
}

View File

@@ -779,7 +779,7 @@ public class Combat {
assignedDamage = true;
GameEntity defender = getDefenderByAttacker(band);
// If the Attacker is unblocked, or it's a trampler and has 0 blockers, deal damage to defender
if (defender instanceof Card && attacker.hasKeyword("Trample over planeswalkers")) {
if (defender instanceof Card && attacker.hasKeyword("Trample:Planeswalker")) {
if (orderedBlockers == null || orderedBlockers.isEmpty()) {
CardCollection cc = new CardCollection();
cc.add((Card)defender);

View File

@@ -152,8 +152,7 @@ public enum Keyword {
SURGE("Surge", KeywordWithCost.class, false, "You may cast this spell for its surge cost if you or a teammate has cast another spell this turn."),
SUSPEND("Suspend", Suspend.class, false, "Rather than cast this card from your hand, you may pay %s and exile it with {%d:time counter} on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost."),
TOTEM_ARMOR("Totem armor", SimpleKeyword.class, true, "If enchanted permanent would be destroyed, instead remove all damage marked on it and destroy this Aura."),
TRAMPLE("Trample", SimpleKeyword.class, true, "This creature can deal excess combat damage to the player or planeswalker it's attacking."),
TRAMPLE_OVER_PLANESWALKERS("Trample over planeswalkers", SimpleKeyword.class, true, "This creature can deal excess combat damage to the controller of the planeswalker its attacking."),
TRAMPLE("Trample", Trample.class, true, "This creature can deal excess combat damage to the player or planeswalker it's attacking."),
TRANSFIGURE("Transfigure", KeywordWithCost.class, false, "%s, Sacrifice this creature: Search your library for a creature card with the same mana value as this creature and put that card onto the battlefield, then shuffle. Transfigure only as a sorcery."),
TRANSMUTE("Transmute", KeywordWithCost.class, false, "%s, Discard this card: Search your library for a card with the same mana value as this card, reveal it, and put it into your hand, then shuffle. Transmute only as a sorcery."),
TRIBUTE("Tribute", KeywordWithAmount.class, false, "As this creature enters the battlefield, an opponent of your choice may put {%d:+1/+1 counter} on it."),

View File

@@ -0,0 +1,35 @@
package forge.game.keyword;
import java.util.Collection;
public class Trample extends KeywordInstance<Trample> {
private String type = "";
@Override
protected void parse(String details) {
if (!details.isEmpty()) {
type = details.split(":")[0];
}
}
@Override
protected String formatReminderText(String reminderText) {
if (!type.isEmpty()) {
return "This creature can deal excess combat damage to the controller of the planeswalker its attacking.";
}
return reminderText;
}
/* (non-Javadoc)
* @see forge.game.keyword.KeywordInstance#redundant(java.util.Collection)
*/
@Override
public boolean redundant(Collection<KeywordInterface> list) {
for (KeywordInterface i : list) {
if (i.getOriginal().equals(getOriginal())) {
return true;
}
}
return false;
}
}

View File

@@ -6,6 +6,6 @@ S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ X | EffectZone
SVar:X:Count$ThisTurnCast_Card.Other/Times.3
K:Trample
K:Haste
K:Trample over planeswalkers
K:Trample:Planeswalker
S:Mode$ Continuous | Affected$ Card.Self+ThisTurnEntered | AddKeyword$ Hexproof | Description$ CARDNAME has hexproof as long as it entered the battlefield this turn.
Oracle:This spell costs {3} less to cast for each other spell cast this turn.\nTrample, haste\nTrample over planeswalkers (This creature can deal excess combat damage to the controller of the planeswalker it's attacking.)\nThrasta, Tempest's Roar has hexproof as long as it entered the battlefield this turn.

View File

@@ -361,7 +361,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
if ((attacker.hasKeyword(Keyword.TRAMPLE) && defender != null) || (blockers.size() > 1)
|| ((attacker.hasKeyword("You may assign CARDNAME's combat damage divided as you choose among " +
"defending player and/or any number of creatures they control.")) && overrideOrder &&
blockers.size() >0) || (attacker.hasKeyword("Trample over planeswalkers") && defender instanceof Card)) {
blockers.size() >0) || (attacker.hasKeyword("Trample:Planeswalker") && defender instanceof Card)) {
GameEntityViewMap<Card, CardView> gameCacheBlockers = GameEntityView.getMap(blockers);
final CardView vAttacker = CardView.get(attacker);
final GameEntityView vDefender = GameEntityView.get(defender);