Merge pull request #3721 from tool4ever/fix99

CardRules: fix specialize faces on regular cards
This commit is contained in:
kevlahnota
2023-09-01 19:44:34 +08:00
committed by GitHub
13 changed files with 27 additions and 15 deletions

View File

@@ -210,7 +210,6 @@ public class GameStateEvaluator {
// excess mana is valued less than getting enough to use everything // excess mana is valued less than getting enough to use everything
value += max(0, max_total - statistics.maxCost) * 5; value += max(0, max_total - statistics.maxCost) * 5;
return value; return value;
} }

View File

@@ -395,6 +395,11 @@ public final class CardRules implements ICardCharacteristics {
this.curFace = 0; this.curFace = 0;
this.faces[0] = null; this.faces[0] = null;
this.faces[1] = null; this.faces[1] = null;
this.faces[2] = null;
this.faces[3] = null;
this.faces[4] = null;
this.faces[5] = null;
this.faces[6] = null;
this.handLife = null; this.handLife = null;
this.altMode = CardSplitType.None; this.altMode = CardSplitType.None;

View File

@@ -362,16 +362,14 @@ public class DigEffect extends SpellAbilityEffect {
if (p == chooser) { // the digger can still see all the dug cards when choosing if (p == chooser) { // the digger can still see all the dug cards when choosing
chooser.getController().tempShowCards(top); chooser.getController().tempShowCards(top);
} }
List<Card> chosen = new ArrayList<>();
int max = anyNumber ? valid.size() : Math.min(valid.size(), destZone1ChangeNum); int max = anyNumber ? valid.size() : Math.min(valid.size(), destZone1ChangeNum);
int min = (anyNumber || optional) ? 0 : max; int min = (anyNumber || optional) ? 0 : max;
if (max > 0) { // if max is 0 don't make a choice if (max > 0) { // if max is 0 don't make a choice
chosen = chooser.getController().chooseEntitiesForEffect(valid, min, max, delayedReveal, sa, prompt, p, null); movedCards.addAll(chooser.getController().chooseEntitiesForEffect(valid, min, max, delayedReveal, sa, prompt, p, null));
} }
chooser.getController().endTempShowCards(); chooser.getController().endTempShowCards();
movedCards.addAll(chosen);
} }
if (!changeValid.isEmpty() && !sa.hasParam("ExileFaceDown") && !sa.hasParam("NoReveal")) { if (!changeValid.isEmpty() && !sa.hasParam("ExileFaceDown") && !sa.hasParam("NoReveal")) {

View File

@@ -38,6 +38,9 @@ public abstract class TokenEffectBase extends SpellAbilityEffect {
protected TokenCreateTable createTokenTable(Iterable<Player> players, String[] tokenScripts, final int finalAmount, final SpellAbility sa) { protected TokenCreateTable createTokenTable(Iterable<Player> players, String[] tokenScripts, final int finalAmount, final SpellAbility sa) {
TokenCreateTable tokenTable = new TokenCreateTable(); TokenCreateTable tokenTable = new TokenCreateTable();
for (final Player owner : players) { for (final Player owner : players) {
if (!owner.isInGame()) {
continue;
}
for (String script : tokenScripts) { for (String script : tokenScripts) {
final Card result = TokenInfo.getProtoType(script, sa, owner); final Card result = TokenInfo.getProtoType(script, sa, owner);

View File

@@ -6377,7 +6377,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
} }
public final boolean canBeControlledBy(final Player newController) { public final boolean canBeControlledBy(final Player newController) {
return !(hasKeyword("Other players can't gain control of CARDNAME.") && !getController().equals(newController)); return newController.isInGame() && !(hasKeyword("Other players can't gain control of CARDNAME.") && !getController().equals(newController));
} }
@Override @Override

View File

@@ -43,7 +43,7 @@ public class StaticAbilityActivateAbilityAsIfHaste {
return false; return false;
} }
public static boolean applyCanActivateAbility(final StaticAbility stAb, final Card card) { private static boolean applyCanActivateAbility(final StaticAbility stAb, final Card card) {
if (!stAb.matchesValidParam("ValidCard", card)) { if (!stAb.matchesValidParam("ValidCard", card)) {
return false; return false;
} }

View File

@@ -38,7 +38,7 @@ public class StaticAbilityAssignCombatDamageAsUnblocked {
return false; return false;
} }
public static boolean applyAssignCombatDamageAsUnblocked(final StaticAbility stAb, final Card card) { private static boolean applyAssignCombatDamageAsUnblocked(final StaticAbility stAb, final Card card) {
if (!stAb.matchesValidParam("ValidCard", card)) { if (!stAb.matchesValidParam("ValidCard", card)) {
return false; return false;
} }

View File

@@ -43,7 +43,7 @@ public class StaticAbilityCantBeCopied {
return false; return false;
} }
public static boolean cantBeCopiedCheck(final StaticAbility stAb, final Card card) { private static boolean cantBeCopiedCheck(final StaticAbility stAb, final Card card) {
if (stAb.matchesValidParam("ValidCard", card)) { if (stAb.matchesValidParam("ValidCard", card)) {
return true; return true;
} }

View File

@@ -23,7 +23,8 @@ public class StaticAbilityCantBecomeMonarch {
} }
return false; return false;
} }
public static boolean applyCantBecomeMonarchAbility(final StaticAbility stAb, final Player player) {
private static boolean applyCantBecomeMonarchAbility(final StaticAbility stAb, final Player player) {
if (!stAb.matchesValidParam("ValidPlayer", player)) { if (!stAb.matchesValidParam("ValidPlayer", player)) {
return false; return false;
} }

View File

@@ -24,7 +24,7 @@ public class StaticAbilityIgnoreLegendRule {
return false; return false;
} }
public static boolean applyIgnoreLegendRuleAbility(final StaticAbility stAb, final Card card) { private static boolean applyIgnoreLegendRuleAbility(final StaticAbility stAb, final Card card) {
if (!stAb.matchesValidParam("ValidCard", card)) { if (!stAb.matchesValidParam("ValidCard", card)) {
return false; return false;
} }

View File

@@ -30,7 +30,7 @@ public class StaticAbilityUnspentMana {
return result; return result;
} }
public static void applyUnspentManaAbility(final StaticAbility stAb, final Player player, Set<Byte> result) { private static void applyUnspentManaAbility(final StaticAbility stAb, final Player player, Set<Byte> result) {
if (!stAb.matchesValidParam("ValidPlayer", player)) { if (!stAb.matchesValidParam("ValidPlayer", player)) {
return; return;
} }

View File

@@ -184,7 +184,7 @@ public class FCardImageRenderer {
if (!card.isSplitCard() && !card.isFlipCard()) { if (!card.isSplitCard() && !card.isFlipCard()) {
final CardStateView state = card.getState(card.isAdventureCard() ? false : altState); final CardStateView state = card.getState(card.isAdventureCard() ? false : altState);
if ((state.isCreature() && !state.getKeywordKey().contains("Level up")) if ((state.isCreature() && !state.getKeywordKey().contains("Level up"))
|| state.isPlaneswalker() || state.isVehicle()) || state.isPlaneswalker() || state.isBattle() || state.isVehicle())
hasPTBox = true; hasPTBox = true;
} }
if (hasPTBox) { if (hasPTBox) {
@@ -294,7 +294,7 @@ public class FCardImageRenderer {
int headerHeight = NAME_SIZE + 2 * HEADER_PADDING; int headerHeight = NAME_SIZE + 2 * HEADER_PADDING;
int typeBoxHeight = TYPE_SIZE + 2 * TYPE_PADDING; int typeBoxHeight = TYPE_SIZE + 2 * TYPE_PADDING;
int ptBoxHeight = 0; int ptBoxHeight = 0;
if (state.isCreature() || state.isPlaneswalker() || state.isVehicle()) { if (state.isCreature() || state.isPlaneswalker() | state.isBattle() || state.isVehicle()) {
//if P/T box needed, make room for it //if P/T box needed, make room for it
ptBoxHeight = headerHeight; ptBoxHeight = headerHeight;
} }
@@ -839,6 +839,12 @@ public class FCardImageRenderer {
TEXT_COLOR = Color.WHITE; TEXT_COLOR = Color.WHITE;
pieces.add(String.valueOf(state.getLoyalty())); pieces.add(String.valueOf(state.getLoyalty()));
} }
else if (state.isBattle()) {
Color [] pwColor = { Color.BLACK };
colors = pwColor;
TEXT_COLOR = Color.WHITE;
pieces.add(String.valueOf(state.getDefense()));
}
else if (state.isVehicle()) { else if (state.isVehicle()) {
Color [] vhColor = { new Color(128, 96, 64) }; Color [] vhColor = { new Color(128, 96, 64) };
colors = vhColor; colors = vhColor;
@@ -865,7 +871,7 @@ public class FCardImageRenderer {
int arcWidth = h / 3; int arcWidth = h / 3;
fillRoundColorBackground(g, colors, x, y, w, h, arcWidth, h); fillRoundColorBackground(g, colors, x, y, w, h, arcWidth, h);
g.setStroke(new BasicStroke(BOX_LINE_THICKNESS)); g.setStroke(new BasicStroke(BOX_LINE_THICKNESS));
g.setColor(state.isPlaneswalker() ? Color.WHITE : Color.BLACK); g.setColor(state.isPlaneswalker() || state.isBattle() ? Color.WHITE : Color.BLACK);
g.drawRoundRect(x, y, w, h, arcWidth, h); g.drawRoundRect(x, y, w, h, arcWidth, h);
x += (PT_BOX_WIDTH - totalPieceWidth) / 2; x += (PT_BOX_WIDTH - totalPieceWidth) / 2;