Prowl is a Keyword now

This commit is contained in:
Hanmac
2018-09-02 14:45:56 +02:00
parent a1ebb1f3df
commit 6ec0dd49d7
8 changed files with 45 additions and 60 deletions

View File

@@ -812,8 +812,7 @@ public class AiController {
}
// use Surge and Prowl costs when able to
if (sa.isSurged() ||
(sa.getRestrictions().getProwlTypes() != null && !sa.getRestrictions().getProwlTypes().isEmpty())) {
if (sa.isSurged() || sa.isProwl()) {
p += 9;
}
// sort planeswalker abilities with most costly first

View File

@@ -3791,13 +3791,12 @@ public class CardFactoryUtil {
sa.setTemporary(!intrinsic);
inst.addSpellAbility(sa);
} else if (keyword.startsWith("Evoke")) {
final String[] k = keyword.split(":");
final Cost evokedCost = new Cost(k[1], false);
final SpellAbility sa = card.getFirstSpellAbility();
final SpellAbility newSA = sa.copy();
final Cost evokedCost = new Cost(k[1], false);
final SpellAbility newSA = sa.copyWithDefinedCost(evokedCost);
final StringBuilder desc = new StringBuilder();
desc.append("Evoke ").append(evokedCost.toSimpleString()).append(" (");
@@ -3810,14 +3809,11 @@ public class CardFactoryUtil {
sb.append(card.getName()).append(" (Evoked)");
newSA.setStackDescription(sb.toString());
newSA.setBasicSpell(false);
newSA.setPayCosts(evokedCost);
newSA.setEvoke(true);
newSA.setIntrinsic(intrinsic);
newSA.setTemporary(!intrinsic);
inst.addSpellAbility(newSA);
} else if (keyword.startsWith("Fortify")) {
String[] k = keyword.split(":");
// Get cost string
@@ -3840,8 +3836,6 @@ public class CardFactoryUtil {
sa.setTemporary(!intrinsic);
inst.addSpellAbility(sa);
} else if (keyword.startsWith("Fuse") && card.getCurrentStateName().equals(CardStateName.Original)) {
final SpellAbility sa = AbilityFactory.buildFusedAbility(card);
card.addSpellAbility(sa);
@@ -3882,8 +3876,6 @@ public class CardFactoryUtil {
sa.setTemporary(!intrinsic);
inst.addSpellAbility(sa);
} else if (keyword.startsWith("Monstrosity")) {
final String[] k = keyword.split(":");
final String magnitude = k[1];
@@ -4015,6 +4007,29 @@ public class CardFactoryUtil {
sa.setTemporary(!intrinsic);
inst.addSpellAbility(sa);
} else if (keyword.startsWith("Prowl")) {
final String[] k = keyword.split(":");
final Cost prowlCost = new Cost(k[1], false);
final SpellAbility newSA = card.getFirstSpellAbility().copyWithDefinedCost(prowlCost);
if (card.isInstant() || card.isSorcery()) {
newSA.getMapParams().put("Secondary", "True");
}
newSA.getMapParams().put("PrecostDesc", "Prowl");
newSA.getMapParams().put("CostDesc", ManaCostParser.parse(k[1]));
// makes new SpellDescription
final StringBuilder sb = new StringBuilder();
sb.append(newSA.getCostDescription());
sb.append("(" + inst.getReminderText() + ")");
newSA.setDescription(sb.toString());
newSA.setBasicSpell(false);
newSA.setProwl(true);
newSA.setIntrinsic(intrinsic);
newSA.setTemporary(!intrinsic);
inst.addSpellAbility(newSA);
} else if (keyword.startsWith("Reinforce")) {
final String[] k = keyword.split(":");
final String n = k[1];
@@ -4163,8 +4178,6 @@ public class CardFactoryUtil {
sa.setTemporary(!intrinsic);
inst.addSpellAbility(sa);
} else if (keyword.startsWith("Unearth")) {
final String[] k = keyword.split(":");
final String manacost = k[1];

View File

@@ -1609,10 +1609,6 @@ public class CardProperty {
if (property.equals("pseudokicked")) {
if (!card.isOptionalCostPaid(OptionalCost.Generic)) return false;
}
} else if (property.startsWith("notpseudokicked")) {
if (property.equals("pseudokicked")) {
if (card.isOptionalCostPaid(OptionalCost.Generic)) return false;
}
} else if (property.startsWith("surged")) {
if (card.getCastSA() == null) {
return false;
@@ -1623,6 +1619,11 @@ public class CardProperty {
return false;
}
return card.getCastSA().isEvoke();
} else if (property.startsWith("prowled")) {
if (card.getCastSA() == null) {
return false;
}
return card.getCastSA().isProwl();
} else if (property.equals("HasDevoured")) {
if (card.getDevouredCards().isEmpty()) {
return false;

View File

@@ -109,7 +109,7 @@ public enum Keyword {
PROTECTION(Protection.class, false, "This creature can't be blocked, targeted, dealt damage, or equipped/enchanted by %s."),
PROVOKE(SimpleKeyword.class, false, "Whenever this creature attacks, you may have target creature defending player controls untap and block it if able."),
PROWESS(SimpleKeyword.class, false, "Whenever you cast a noncreature spell, this creature gets +1/+1 until end of turn."),
PROWL(KeywordWithCost.class, false, "You may cast this card by paying %s rather than paying its mana cost if you dealt combat damage to a player this turn with a creature that shares any of this spell's creature types."),
PROWL(KeywordWithCost.class, false, "You may pay %s rather than pay this spells mana cost if a player was dealt combat damage this turn by a source that, at the time it dealt that damage, was under your control and had any of this spells creature types."),
RAMPAGE(KeywordWithAmount.class, false, "Whenever this creature becomes blocked, it gets +%1$d/+%1$d until end of turn for each creature blocking it beyond the first."),
REACH(SimpleKeyword.class, true, "This creature can block creatures with flying."),
REBOUND(SimpleKeyword.class, true, "If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost."),

View File

@@ -32,7 +32,6 @@ import forge.game.card.CardPredicates.Presets;
import forge.game.event.*;
import forge.game.keyword.Keyword;
import forge.game.keyword.KeywordCollection;
import forge.game.keyword.KeywordInterface;
import forge.game.keyword.KeywordCollection.KeywordCollectionView;
import forge.game.keyword.KeywordsChange;
import forge.game.mana.ManaPool;
@@ -131,7 +130,7 @@ public class Player extends GameEntity implements Comparable<Player> {
private final Map<ZoneType, PlayerZone> zones = Maps.newEnumMap(ZoneType.class);
private CardCollection currentPlanes = new CardCollection();
private List<String> prowl = Lists.newArrayList();
private Set<String> prowl = Sets.newHashSet();
private PlayerStatistics stats = new PlayerStatistics();
private PlayerController controller;
@@ -588,7 +587,7 @@ public class Player extends GameEntity implements Comparable<Player> {
if (isCombat) {
old = assignedCombatDamage.containsKey(source) ? assignedCombatDamage.get(source) : 0;
assignedCombatDamage.put(source, old + amount);
for (final String type : source.getType()) {
for (final String type : source.getType().getCreatureTypes()) {
source.getController().addProwlType(type);
}
}

View File

@@ -97,6 +97,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
private boolean cycling = false;
private boolean dash = false;
private boolean evoke = false;
private boolean prowl = false;
private boolean surge = false;
private boolean offering = false;
private boolean emerge = false;
@@ -1069,6 +1070,14 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
evoke = isEvoke;
}
public final boolean isProwl() {
return prowl;
}
public final void setProwl(final boolean isProwl) {
prowl = isProwl;
}
public final boolean isSurged() {
return surge;
}

View File

@@ -93,14 +93,6 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
if (value.equals("Blessing")) {
this.setBlessing(true);
}
if (value.startsWith("Prowl")) {
final List<String> prowlTypes = Lists.newArrayList();
prowlTypes.add("Rogue");
if (value.split("Prowl").length > 1) {
prowlTypes.add(value.split("Prowl")[1]);
}
this.setProwlTypes(prowlTypes);
}
}
if (params.containsKey("ActivationZone")) {
@@ -439,11 +431,9 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
return false;
}
}
if (this.getProwlTypes() != null && !this.getProwlTypes().isEmpty()) {
// only true if the activating player has damaged the opponent with
// one of the specified types
if (sa.isProwl()) {
boolean prowlFlag = false;
for (final String type : this.getProwlTypes()) {
for (final String type : c.getType().getCreatureTypes()) {
if (activator.hasProwl(type)) {
prowlFlag = true;
}

View File

@@ -76,7 +76,6 @@ public class SpellAbilityVariables implements Cloneable {
this.hellbent = sav.isHellbent();
this.allTargetsLegal = sav.isAllTargetsLegal();
this.shareAllColors = sav.getShareAllColors();
this.prowlTypes = Lists.newArrayList(sav.getProwlTypes());
this.isPresent = sav.getIsPresent();
this.presentCompare = sav.getPresentCompare();
this.presentDefined = sav.getPresentDefined();
@@ -158,9 +157,6 @@ public class SpellAbilityVariables implements Cloneable {
private boolean allTargetsLegal = false;
/** The prowl. */
private List<String> prowlTypes = Lists.newArrayList();
/** The s is present. */
private String isPresent = null;
@@ -497,19 +493,6 @@ public class SpellAbilityVariables implements Cloneable {
this.allTargetsLegal = allTargets;
}
/**
* <p>
* Setter for the field <code>prowl</code>.
* </p>
*
* @param types
* the new prowl
*/
public final void setProwlTypes(final List<String> types) {
this.prowlTypes = types;
}
// IsPresent for Valid battlefield stuff
/**
@@ -719,15 +702,6 @@ public class SpellAbilityVariables implements Cloneable {
return this.playerTurn;
}
/**
* Gets the prowl.
*
* @return the prowl
*/
public final List<String> getProwlTypes() {
return this.prowlTypes;
}
/**
* Gets the present compare.
*