Merge branch 'master' of https://git.cardforge.org/core-developers/forge into ui-card-translation

This commit is contained in:
Peter
2019-08-06 08:46:45 +02:00
21 changed files with 55 additions and 47 deletions

View File

@@ -1339,7 +1339,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
});
for (Card pw : aiPlaneswalkers) {
int curLoyalty = pw.getCounters(CounterType.LOYALTY);
int freshLoyalty = pw.getCurrentState().getBaseLoyalty();
int freshLoyalty = Integer.valueOf(pw.getCurrentState().getBaseLoyalty());
if (freshLoyalty - curLoyalty >= loyaltyDiff && curLoyalty <= maxLoyaltyToConsider) {
return pw;
}

View File

@@ -38,7 +38,7 @@ final class CardFace implements ICardFace {
private int iToughness = Integer.MAX_VALUE;
private String power = null;
private String toughness = null;
private int initialLoyalty = -1;
private String initialLoyalty = "";
private String nonAbilityText = null;
private List<String> keywords = null;
@@ -56,7 +56,7 @@ final class CardFace implements ICardFace {
@Override public int getIntToughness() { return iToughness; }
@Override public String getPower() { return power; }
@Override public String getToughness() { return toughness; }
@Override public int getInitialLoyalty() { return initialLoyalty; }
@Override public String getInitialLoyalty() { return initialLoyalty; }
@Override public String getName() { return this.name; }
@Override public CardType getType() { return this.type; }
@Override public ManaCost getManaCost() { return this.manaCost; }
@@ -84,7 +84,7 @@ final class CardFace implements ICardFace {
void setManaCost(ManaCost manaCost0) { this.manaCost = manaCost0; }
void setColor(ColorSet color0) { this.color = color0; }
void setOracleText(String text) { this.oracleText = text; }
void setInitialLoyalty(int value) { this.initialLoyalty = value; }
void setInitialLoyalty(String value) { this.initialLoyalty = value; }
void setPtText(String value) {
final String k[] = value.split("/");

View File

@@ -186,7 +186,7 @@ public final class CardRules implements ICardCharacteristics {
@Override public int getIntToughness() { return mainPart.getIntToughness(); }
@Override public String getPower() { return mainPart.getPower(); }
@Override public String getToughness() { return mainPart.getToughness(); }
@Override public int getInitialLoyalty() { return mainPart.getInitialLoyalty(); }
@Override public String getInitialLoyalty() { return mainPart.getInitialLoyalty(); }
@Override
public String getOracleText() {
@@ -409,7 +409,7 @@ public final class CardRules implements ICardCharacteristics {
case 'L':
if ("Loyalty".equals(key)) {
this.faces[this.curFace].setInitialLoyalty(Integer.valueOf(value));
this.faces[this.curFace].setInitialLoyalty(value);
}
break;

View File

@@ -12,7 +12,7 @@ public interface ICardCharacteristics {
int getIntToughness();
String getPower();
String getToughness();
int getInitialLoyalty();
String getInitialLoyalty();
String getOracleText();
}

View File

@@ -376,6 +376,9 @@ public class GameAction {
copied.clearEtbCounters();
}
// update state for view
copied.updateStateForView();
if (fromBattlefield) {
c.setDamage(0); //clear damage after a card leaves the battlefield
c.setHasBeenDealtDeathtouchDamage(false);

View File

@@ -539,8 +539,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
public final void updatePowerToughnessForView() {
currentState.getView().updatePower(this);
currentState.getView().updateToughness(this);
view.updateCounters(this);
}
public final void updateTypesForView() {

View File

@@ -325,9 +325,6 @@ public class CardFactory {
// ******************************************************************
// ************** Link to different CardFactories *******************
if (card.isPlaneswalker()) {
buildPlaneswalkerAbilities(card);
}
if (state == CardStateName.LeftSplit || state == CardStateName.RightSplit) {
for (final SpellAbility sa : card.getSpellAbilities()) {
@@ -383,18 +380,6 @@ public class CardFactory {
card.addSpellAbility(planarRoll);
}
private static void buildPlaneswalkerAbilities(Card card) {
CardState state = card.getCurrentState();
// etbCounter only for Original Card
if (state.getBaseLoyalty() > 0) {
final String loyalty = Integer.toString(state.getBaseLoyalty());
// keyword need to be added to state directly, so init can be disabled
if (state.addIntrinsicKeyword("etbCounter:LOYALTY:" + loyalty + ":no Condition:no desc", false) != null) {
card.updateKeywords();
}
}
}
private static Card readCard(final CardRules rules, final IPaperCard paperCard, int cardId, Game game) {
final Card card = new Card(cardId, paperCard, game);

View File

@@ -53,7 +53,7 @@ public class CardState extends GameObject {
private byte color = MagicColor.COLORLESS;
private int basePower = 0;
private int baseToughness = 0;
private int baseLoyalty = 0;
private String baseLoyalty = "";
private KeywordCollection intrinsicKeywords = new KeywordCollection();
private final FCollection<SpellAbility> nonManaAbilities = new FCollection<SpellAbility>();
@@ -72,6 +72,8 @@ public class CardState extends GameObject {
private final CardStateView view;
private final Card card;
private ReplacementEffect loyaltyRep = null;
public CardState(Card card, CardStateName name) {
this(card.getView().createAlternateState(name), card);
}
@@ -174,11 +176,11 @@ public class CardState extends GameObject {
view.updateToughness(this);
}
public int getBaseLoyalty() {
public String getBaseLoyalty() {
return baseLoyalty;
}
public final void setBaseLoyalty(final int loyalty) {
baseLoyalty = loyalty;
public final void setBaseLoyalty(final String string) {
baseLoyalty = string;
view.updateLoyalty(this);
}
@@ -400,6 +402,14 @@ public class CardState extends GameObject {
public FCollectionView<ReplacementEffect> getReplacementEffects() {
FCollection<ReplacementEffect> result = new FCollection<>(replacementEffects);
if (getTypeWithChanges().isPlaneswalker()) {
if (loyaltyRep == null) {
loyaltyRep = CardFactoryUtil.makeEtbCounter("etbCounter:LOYALTY:" + this.baseLoyalty, card, true);
}
result.add(loyaltyRep);
}
card.updateReplacementEffects(result, this);
return result;
}

View File

@@ -678,6 +678,8 @@ public class CardView extends GameEntityView {
if (c.getGame() != null) {
currentStateView.updateColors(currentState);
}
} else {
currentStateView.updateLoyalty(currentState);
}
currentState.getView().updateKeywords(c, currentState); //update keywords even if state doesn't change
@@ -704,6 +706,8 @@ public class CardView extends GameEntityView {
if (c.getGame() != null) {
alternateStateView.updateColors(alternateState);
}
} else {
alternateStateView.updateLoyalty(alternateState);
}
alternateState.getView().updateKeywords(c, alternateState);
}
@@ -908,13 +912,17 @@ public class CardView extends GameEntityView {
set(TrackableProperty.Toughness, c.getBaseToughness());
}
public int getLoyalty() {
public String getLoyalty() {
return get(TrackableProperty.Loyalty);
}
void updateLoyalty(Card c) {
updateLoyalty(c.getCurrentLoyalty());
if (c.isInZone(ZoneType.Battlefield)) {
updateLoyalty(String.valueOf(c.getCurrentLoyalty()));
} else {
updateLoyalty(c.getCurrentState().getBaseLoyalty());
}
void updateLoyalty(int loyalty) {
}
void updateLoyalty(String loyalty) {
set(TrackableProperty.Loyalty, loyalty);
}
void updateLoyalty(CardState c) {
@@ -930,7 +938,7 @@ public class CardView extends GameEntityView {
return;
}
}
set(TrackableProperty.Loyalty, 0); //alternates don't need loyalty
set(TrackableProperty.Loyalty, "0"); //alternates don't need loyalty
}
public String getSetCode() {

View File

@@ -77,7 +77,7 @@ public enum TrackableProperty {
RulesText(TrackableTypes.StringType),
Power(TrackableTypes.IntegerType),
Toughness(TrackableTypes.IntegerType),
Loyalty(TrackableTypes.IntegerType),
Loyalty(TrackableTypes.StringType),
ChangedColorWords(TrackableTypes.StringMapType),
ChangedTypes(TrackableTypes.StringMapType),
HasDeathtouch(TrackableTypes.BooleanType),

View File

@@ -437,7 +437,7 @@ public class VAssignDamage {
}
else if (defender instanceof CardView) { // planeswalker
final CardView pw = (CardView)defender;
lethalDamage = pw.getCurrentState().getLoyalty();
lethalDamage = Integer.valueOf(pw.getCurrentState().getLoyalty());
}
}
else {

View File

@@ -706,7 +706,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
String sPt = "";
if (state.isCreature() && state.isPlaneswalker()) {
sPt = state.getPower() + "/" + state.getToughness() +
" (" + String.valueOf(state.getLoyalty()) + ")";
" (" + state.getLoyalty() + ")";
}
else if (state.isCreature()) {
sPt = state.getPower() + "/" + state.getToughness();
@@ -715,7 +715,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
sPt = "[" + state.getPower() + "/" + state.getToughness() + "]";
}
else if (state.isPlaneswalker()) {
sPt = String.valueOf(state.getLoyalty());
sPt = state.getLoyalty();
}
ptText.setText(sPt);
}

View File

@@ -273,7 +273,7 @@ public class CardRenderer {
state.getLoyalty(), count, suffix, x, y, w, h, compactMode);
}
public static void drawCardListItem(Graphics g, FSkinFont font, FSkinColor foreColor, FImageComplex cardArt, CardView card, String set, CardRarity rarity, int power, int toughness, int loyalty, int count, String suffix, float x, float y, float w, float h, boolean compactMode) {
public static void drawCardListItem(Graphics g, FSkinFont font, FSkinColor foreColor, FImageComplex cardArt, CardView card, String set, CardRarity rarity, int power, int toughness, String loyalty, int count, String suffix, float x, float y, float w, float h, boolean compactMode) {
float cardArtHeight = h + 2 * FList.PADDING;
float cardArtWidth = cardArtHeight * CARD_ART_RATIO;
if (cardArt != null) {

View File

@@ -446,7 +446,7 @@ public class VAssignDamage extends FDialog {
}
else if (defender instanceof CardView) { // planeswalker
CardView pw = (CardView)defender;
lethalDamage = pw.getCurrentState().getLoyalty();
lethalDamage = Integer.valueOf(pw.getCurrentState().getLoyalty());
}
}
else {

View File

@@ -1,7 +1,7 @@
Name:Chance for Glory
ManaCost:1 R W
Types:Instant
A:SP$ PumpAll | Cost$ 1 R W | ValidCards$ Creature.YouCtrl | KW$ Indestructible | Permanent$ True | SubAbility$ DBAddTurn | SpellDescription$ Creatures you control gain indestructible. Take an extra turn after this one. At the beginning of that turn's end step, you lose the game.
A:SP$ PumpAll | Cost$ 1 R W | ValidCards$ Creature.YouCtrl | KW$ Indestructible | Permanent$ True | SubAbility$ DBAddTurn | SpellDescription$ Creatures you control gain indestructible.
SVar:DBAddTurn:DB$ AddTurn | NumTurns$ 1 | ExtraTurnDelayedTrigger$ DBDelTrig | ExtraTurnDelayedTriggerExcute$ TrigLose | References$ DBDelTrig,TrigLose | SpellDescription$ Take an extra turn after this one. At the beginning of that turn's end step, you lose the game.
SVar:DBDelTrig:ThisTurn$ True | Mode$ Phase | Phase$ End of Turn | TriggerDescription$ At the beginning of that turn's end step, you lose the game.
SVar:TrigLose:DB$ LosesGame | Defined$ You

View File

@@ -2,8 +2,8 @@ Name:Cruel Celebrant
ManaCost:W B
Types:Creature Vampire
PT:1/2
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.Other+YouCtrl,Planeswalker.YouCtrl+Other | TriggerZones$ Battlefield | Execute$ TrigDrain | TriggerDescription$ Whenever CARDNAME or another creature you control dies, each opponent loses 1 life and you gain 1 life.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | TriggerController$ TriggeredCardController | Execute$ TrigDrain | Secondary$ True | TriggerDescription$ Whenever CARDNAME or another creature you control dies, each opponent loses 1 life and you gain 1 life.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.Other+YouCtrl,Planeswalker.YouCtrl+Other | TriggerZones$ Battlefield | Execute$ TrigDrain | TriggerDescription$ Whenever CARDNAME or another creature or planeswalker you control dies, each opponent loses 1 life and you gain 1 life.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | TriggerController$ TriggeredCardController | Execute$ TrigDrain | Secondary$ True | TriggerDescription$ Whenever CARDNAME or another creature or planeswalker you control dies, each opponent loses 1 life and you gain 1 life.
SVar:TrigDrain:DB$ LoseLife | Defined$ Player.Opponent | LifeAmount$ 1 | SubAbility$ DBGainLife
SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ 1
DeckHas:Ability$LifeGain

View File

@@ -5,7 +5,7 @@ PT:5/5
K:Kicker:3
K:etbCounter:P1P1:5:CheckSVar$ WasKicked:If CARDNAME was kicked, it enters the battlefield with five +1/+1 counters on it.
SVar:WasKicked:Count$Kicked.1.0
T:Mode$ Attacks | ValidCard$ Card.Self | Alone$ True | TriggerZones$ Battlefield | Execute$ TrigPump | TriggerDescription$ Whenever CARDNAMRE attacks alone, double its power and toughness until end of turn.
T:Mode$ Attacks | ValidCard$ Card.Self | Alone$ True | TriggerZones$ Battlefield | Execute$ TrigPump | TriggerDescription$ Whenever CARDNAME attacks alone, double its power and toughness until end of turn.
SVar:TrigPump:DB$ Pump | Defined$ Self | NumAtt$ +X | NumDef$ +Y | References$ X,Y
SVar:X:Count$CardPower
SVar:Y:Count$CardToughness

View File

@@ -1,8 +1,7 @@
Name:Nissa, Steward of Elements
ManaCost:X G U
Types:Legendary Planeswalker Nissa
Loyalty:0
K:etbCounter:LOYALTY:X
Loyalty:X
SVar:X:Count$xPaid
A:AB$ Scry | Cost$ AddCounter<2/LOYALTY> | Planeswalker$ True | ScryNum$ 2 | SpellDescription$ Scry 2.
A:AB$ Dig | Cost$ AddCounter<0/LOYALTY> | Planeswalker$ True | DigNum$ 1 | ChangeNum$ 1 | Optional$ True | ChangeValid$ Land,Creature.cmcLEY | ForceRevealToController$ True | PromptToSkipOptionalAbility$ True | References$ Y | AILogic$ AlwaysConfirm | OptionalAbilityPrompt$ Would you like to put the permanent onto the battlefield? | DestinationZone$ Battlefield | LibraryPosition2$ 0 | SpellDescription$ Look at the top card of your library. If it's a land card or a creature card with converted mana cost less than or equal to the number of loyalty counters on Nissa, Steward of Elements, you may put that card onto the battlefield.

View File

@@ -2,7 +2,8 @@ Name:Yanling's Harbinger
ManaCost:3 U U
Types:Creature Bird
PT:2/4
K:Flying
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSearch | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library and/or graveyard for a card named Mu Yanling, Celestial Wind, reveal it, and put it into your hand. If you search your library this way, shuffle it.
SVar:TrigSearch:DB$ ChangeZone | Origin$ Library,Graveyard | Destination$ Hand | ChangeType$ Card.namedMu Yanling; Celestial Wind | ChangeNum$ 1 | Optional$ True
DeckHints:Name$Mu Yanling, Celestial Wind
Oracle:When Yanling's Harbinger enters the battlefield, you may search your library and/or graveyard for a card named Mu Yanling, Celestial Wind, reveal it, and put it into your hand. If you search your library this way, shuffle it.
Oracle:Flying\nWhen Yanling's Harbinger enters the battlefield, you may search your library and/or graveyard for a card named Mu Yanling, Celestial Wind, reveal it, and put it into your hand. If you search your library this way, shuffle it.

View File

@@ -3,5 +3,5 @@ Name:Brawl
Order:101
Type:Casual
Subtype:Commander
Sets:XLN, RIX, DOM, M19, G18, GRN, RNA, WAR
Sets:XLN, RIX, DOM, M19, G18, GRN, RNA, WAR, M20
Banned:Sorcerous Spyglass

View File

@@ -35,6 +35,8 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
public enum ColumnDef {
/**The column containing the inventory item name.*/
STRING("", "", 0, false, SortState.ASC,
@@ -512,7 +514,8 @@ public enum ColumnDef {
result = ((IPaperCard) i).getRules().getIntPower();
if (result == Integer.MAX_VALUE) {
if (((IPaperCard)i).getRules().getType().isPlaneswalker()) {
result = ((IPaperCard) i).getRules().getInitialLoyalty();
String loy = ((IPaperCard) i).getRules().getInitialLoyalty();
result = StringUtils.isNumeric(loy) ? Integer.valueOf(loy) : 0;
}
}
}