mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
AttractionsYouVisitedThisTurn and Squirrel Squatters
Untangled some oracle text methods in Card and CardState Sly Spy, Everythingamajig, and two Garbage Elementals Visit card text fix. 2 more Attractions
This commit is contained in:
@@ -2649,6 +2649,10 @@ public class AbilityUtils {
|
||||
return game.getPhaseHandler().getPlanarDiceSpecialActionThisTurn();
|
||||
}
|
||||
|
||||
if (sq[0].startsWith("AttractionsYouVisitedThisTurn")) {
|
||||
return doXMath(player.getAttractionsVisitedThisTurn(), expr, c, ctb);
|
||||
}
|
||||
|
||||
if (sq[0].equals("AllTypes")) {
|
||||
List<Card> cards = getDefinedCards(c, sq[1], ctb);
|
||||
|
||||
|
||||
@@ -221,6 +221,12 @@ public class RollDiceEffect extends SpellAbilityEffect {
|
||||
List<Integer> rolls = new ArrayList<>();
|
||||
int total = rollDiceForPlayer(sa, player, amount, sides, ignore, modifier, rolls);
|
||||
|
||||
if (sa.hasParam("UseHighestRoll")) {
|
||||
total = Collections.max(rolls);
|
||||
} else if (sa.hasParam("UseDifferenceBetweenRolls")) {
|
||||
total = Collections.max(rolls) - Collections.min(rolls);
|
||||
}
|
||||
|
||||
if (sa.hasParam("StoreResults")) {
|
||||
host.addStoredRolls(rolls);
|
||||
}
|
||||
@@ -243,9 +249,6 @@ public class RollDiceEffect extends SpellAbilityEffect {
|
||||
sa.setSVar(sa.getParam("OtherSVar"), Integer.toString(other));
|
||||
}
|
||||
}
|
||||
if (sa.hasParam("UseHighestRoll")) {
|
||||
total = Collections.max(rolls);
|
||||
}
|
||||
|
||||
if (sa.hasParam("SubsForEach")) {
|
||||
for (Integer roll : rolls) {
|
||||
|
||||
@@ -277,8 +277,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
private Table<Long, Long, Pair<Integer,Integer>> newPT = TreeBasedTable.create(); // Layer 7b
|
||||
private Table<Long, Long, Pair<Integer,Integer>> boostPT = TreeBasedTable.create(); // Layer 7c
|
||||
|
||||
private String oracleText = "";
|
||||
|
||||
private final Map<Card, Integer> assignedDamageMap = Maps.newTreeMap();
|
||||
private Map<Integer, Integer> damage = Maps.newHashMap();
|
||||
private boolean hasBeenDealtDeathtouchDamage;
|
||||
@@ -2506,7 +2504,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
|| keyword.startsWith("Class") || keyword.startsWith("Blitz")
|
||||
|| keyword.startsWith("Specialize") || keyword.equals("Ravenous")
|
||||
|| keyword.equals("For Mirrodin") || keyword.startsWith("Craft")
|
||||
|| keyword.startsWith("Landwalk")) {
|
||||
|| keyword.startsWith("Landwalk") || keyword.startsWith("Visit")) {
|
||||
// keyword parsing takes care of adding a proper description
|
||||
} else if (keyword.equals("Read ahead")) {
|
||||
sb.append(Localizer.getInstance().getMessage("lblReadAhead")).append(" (").append(Localizer.getInstance().getMessage("lblReadAheadDesc"));
|
||||
@@ -3498,7 +3496,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
public final void setCopiedPermanent(final Card c) {
|
||||
if (copiedPermanent == c) { return; }
|
||||
copiedPermanent = c;
|
||||
currentState.getView().updateOracleText(this);
|
||||
currentState.setOracleText(c.getOracleText());
|
||||
}
|
||||
|
||||
public final boolean isCopiedSpell() {
|
||||
@@ -7244,7 +7242,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
public void setRules(CardRules r) {
|
||||
cardRules = r;
|
||||
currentState.getView().updateRulesText(r, getType());
|
||||
currentState.getView().updateOracleText(this);
|
||||
}
|
||||
|
||||
public boolean isCommander() {
|
||||
@@ -7573,15 +7570,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
}
|
||||
|
||||
public String getOracleText() {
|
||||
CardRules rules = cardRules;
|
||||
if (copiedPermanent != null) { //return oracle text of copied permanent if applicable
|
||||
rules = copiedPermanent.getRules();
|
||||
}
|
||||
return rules != null ? rules.getOracleText() : oracleText;
|
||||
return currentState.getOracleText();
|
||||
}
|
||||
public void setOracleText(final String oracleText0) {
|
||||
oracleText = oracleText0;
|
||||
currentState.getView().updateOracleText(this);
|
||||
public void setOracleText(final String oracleText) {
|
||||
currentState.setOracleText(oracleText);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -346,9 +346,9 @@ public class CardFactory {
|
||||
card.setColor(combinedColor);
|
||||
card.setType(new CardType(rules.getType()));
|
||||
|
||||
// Combined text based on Oracle text - might not be necessary, temporarily disabled.
|
||||
//String combinedText = String.format("%s: %s\n%s: %s", rules.getMainPart().getName(), rules.getMainPart().getOracleText(), rules.getOtherPart().getName(), rules.getOtherPart().getOracleText());
|
||||
//card.setText(combinedText);
|
||||
// Combined text based on Oracle text - might not be necessary
|
||||
String combinedText = String.format("(%s) %s\r\n\r\n(%s) %s", rules.getMainPart().getName(), rules.getMainPart().getOracleText(), rules.getOtherPart().getName(), rules.getOtherPart().getOracleText());
|
||||
card.getState(CardStateName.Original).setOracleText(combinedText);
|
||||
}
|
||||
return card;
|
||||
}
|
||||
@@ -377,7 +377,7 @@ public class CardFactory {
|
||||
c.getCurrentState().setBaseLoyalty(face.getInitialLoyalty());
|
||||
c.getCurrentState().setBaseDefense(face.getDefense());
|
||||
|
||||
c.setOracleText(face.getOracleText());
|
||||
c.getCurrentState().setOracleText(face.getOracleText());
|
||||
|
||||
// Super and 'middle' types should use enums.
|
||||
c.setType(new CardType(face.getType()));
|
||||
@@ -454,7 +454,7 @@ public class CardFactory {
|
||||
c.getCurrentState().setBaseDefense(variant.getDefense());
|
||||
|
||||
if (variant.getOracleText() != null)
|
||||
c.setOracleText(variant.getOracleText());
|
||||
c.getCurrentState().setOracleText(variant.getOracleText());
|
||||
|
||||
if (variant.getType() != null) {
|
||||
for(String type : variant.getType())
|
||||
|
||||
@@ -58,6 +58,7 @@ public class CardState extends GameObject implements IHasSVars {
|
||||
private CardType type = new CardType(false);
|
||||
private ManaCost manaCost = ManaCost.NO_COST;
|
||||
private byte color = MagicColor.COLORLESS;
|
||||
private String oracleText = "";
|
||||
private int basePower = 0;
|
||||
private int baseToughness = 0;
|
||||
private String basePowerString = null;
|
||||
@@ -194,6 +195,15 @@ public class CardState extends GameObject implements IHasSVars {
|
||||
view.updateColors(card);
|
||||
}
|
||||
|
||||
public String getOracleText() {
|
||||
return oracleText;
|
||||
}
|
||||
public void setOracleText(final String oracleText) {
|
||||
this.oracleText = oracleText;
|
||||
view.setOracleText(oracleText);
|
||||
}
|
||||
|
||||
|
||||
public final int getBasePower() {
|
||||
return basePower;
|
||||
}
|
||||
@@ -595,6 +605,7 @@ public class CardState extends GameObject implements IHasSVars {
|
||||
setType(source.type);
|
||||
setManaCost(source.getManaCost());
|
||||
setColor(source.getColor());
|
||||
setOracleText(source.getOracleText());
|
||||
setBasePower(source.getBasePower());
|
||||
setBaseToughness(source.getBaseToughness());
|
||||
setBaseLoyalty(source.getBaseLoyalty());
|
||||
|
||||
@@ -1298,8 +1298,8 @@ public class CardView extends GameEntityView {
|
||||
public String getOracleText() {
|
||||
return get(TrackableProperty.OracleText);
|
||||
}
|
||||
void updateOracleText(Card c) {
|
||||
set(TrackableProperty.OracleText, c.getOracleText().replace("\\n", "\r\n\r\n").trim());
|
||||
void setOracleText(String oracleText) {
|
||||
set(TrackableProperty.OracleText, oracleText.replace("\\n", "\r\n\r\n").trim());
|
||||
}
|
||||
|
||||
public String getRulesText() {
|
||||
|
||||
Reference in New Issue
Block a user