mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
CardEdition: add collector number for other (#7504)
* CardEdition: add collector number for other * EditionEntry record * Add getOtherImageKey * Update StaticData.java * use getOtherImageKey in getFacedownImageKey * Update CardEdition.java Remove findOther in favor of getOtherSet * Update CardEdition.java return findOther, but with Aggregates.random * ~ move more helper images to ImageKeys
This commit is contained in:
@@ -958,9 +958,9 @@ public class Game {
|
||||
// if the player who lost was the Monarch, someone else will be the monarch
|
||||
// TODO need to check rules if it should try the next player if able
|
||||
if (p.equals(getPhaseHandler().getPlayerTurn())) {
|
||||
getAction().becomeMonarch(getNextPlayerAfter(p), null);
|
||||
getAction().becomeMonarch(getNextPlayerAfter(p), p.getMonarchSet());
|
||||
} else {
|
||||
getAction().becomeMonarch(getPhaseHandler().getPlayerTurn(), null);
|
||||
getAction().becomeMonarch(getPhaseHandler().getPlayerTurn(), p.getMonarchSet());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -970,9 +970,9 @@ public class Game {
|
||||
// If the player who has the initiative leaves the game on their own turn,
|
||||
// or the active player left the game at the same time, the next player in turn order takes the initiative.
|
||||
if (p.equals(getPhaseHandler().getPlayerTurn())) {
|
||||
getAction().takeInitiative(getNextPlayerAfter(p), null);
|
||||
getAction().takeInitiative(getNextPlayerAfter(p), p.getInitiativeSet());
|
||||
} else {
|
||||
getAction().takeInitiative(getPhaseHandler().getPlayerTurn(), null);
|
||||
getAction().takeInitiative(getPhaseHandler().getPlayerTurn(), p.getInitiativeSet());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.google.common.collect.Lists;
|
||||
import forge.StaticData;
|
||||
import forge.card.CardDb;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.CardEdition.CardInSet;
|
||||
import forge.card.CardEdition.EditionEntry;
|
||||
import forge.card.CardRarity;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
@@ -226,9 +226,9 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
for (String setCode : allowedSetCodes_ro) {
|
||||
CardEdition edition = StaticData.instance().getEditions().get(setCode);
|
||||
if (edition != null) {
|
||||
for (CardInSet card : edition.getAllCardsInSet()) {
|
||||
if (!bannedCardNames_ro.contains(card.name)) {
|
||||
PaperCard pc = commonCards.getCard(card.name, setCode, card.collectorNumber);
|
||||
for (EditionEntry card : edition.getAllCardsInSet()) {
|
||||
if (!bannedCardNames_ro.contains(card.name())) {
|
||||
PaperCard pc = commonCards.getCard(card.name(), setCode, card.collectorNumber());
|
||||
if (pc != null) {
|
||||
cards.add(pc);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class GameSnapshot {
|
||||
newPlayer.setDamageReceivedThisTurn(origPlayer.getDamageReceivedThisTurn());
|
||||
newPlayer.setLandsPlayedThisTurn(origPlayer.getLandsPlayedThisTurn());
|
||||
newPlayer.setCounters(Maps.newHashMap(origPlayer.getCounters()));
|
||||
newPlayer.setBlessing(origPlayer.hasBlessing());
|
||||
newPlayer.setBlessing(origPlayer.hasBlessing(), null);
|
||||
newPlayer.setRevolt(origPlayer.hasRevolt());
|
||||
newPlayer.setLibrarySearched(origPlayer.getLibrarySearched());
|
||||
newPlayer.setSpellsCastLastTurn(origPlayer.getSpellsCastLastTurn());
|
||||
|
||||
@@ -1366,7 +1366,7 @@ public class AbilityUtils {
|
||||
|
||||
// do blessing there before condition checks
|
||||
if (source.hasKeyword(Keyword.ASCEND) && controller.getZone(ZoneType.Battlefield).size() >= 10) {
|
||||
controller.setBlessing(true);
|
||||
controller.setBlessing(true, source.getSetCode());
|
||||
}
|
||||
|
||||
if (source.hasKeyword(Keyword.GIFT) && sa.isGiftPromised()) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class AscendEffect extends SpellAbilityEffect {
|
||||
}
|
||||
// Player need 10+ permanents on the battlefield
|
||||
if (p.getZone(ZoneType.Battlefield).size() >= 10) {
|
||||
p.setBlessing(true);
|
||||
p.setBlessing(true, sa.getOriginalHost().getSetCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class BecomeMonarchEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
public void resolve(SpellAbility sa) {
|
||||
// TODO: improve ai and fix corner cases
|
||||
final String set = sa.getHostCard().getSetCode();
|
||||
final String set = sa.getOriginalHost().getSetCode();
|
||||
|
||||
for (final Player p : getTargetPlayers(sa)) {
|
||||
if (!p.isInGame()) {
|
||||
|
||||
@@ -71,7 +71,7 @@ public class RestartGameEffect extends SpellAbilityEffect {
|
||||
p.resetRingTemptedYou();
|
||||
p.clearRingBearer();
|
||||
p.clearTheRing();
|
||||
p.setBlessing(false);
|
||||
p.setBlessing(false, null);
|
||||
p.clearController();
|
||||
|
||||
CardCollection newLibrary = new CardCollection(p.getCardsIn(restartZones, false));
|
||||
|
||||
@@ -23,10 +23,9 @@ public class RingTemptsYouEffect extends EffectEffect {
|
||||
public void resolve(SpellAbility sa) {
|
||||
Player p = sa.getActivatingPlayer();
|
||||
Game game = p.getGame();
|
||||
Card card = sa.getHostCard();
|
||||
|
||||
if (p.getTheRing() == null)
|
||||
p.createTheRing(card);
|
||||
p.createTheRing(sa.getOriginalHost().getSetCode());
|
||||
|
||||
//increment ring tempted you for property
|
||||
p.incrementRingTemptedYou();
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TakeInitiativeEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
public void resolve(SpellAbility sa) {
|
||||
// TODO: improve ai and fix corner cases
|
||||
final String set = sa.getHostCard().getSetCode();
|
||||
final String set = sa.getOriginalHost().getSetCode();
|
||||
|
||||
for (final Player p : getTargetPlayers(sa)) {
|
||||
if (!p.isInGame()) {
|
||||
|
||||
@@ -6549,28 +6549,31 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
|
||||
public final String getFacedownImageKey() {
|
||||
if (isInZone(ZoneType.Exile)) {
|
||||
return isForetold() ? ImageKeys.FORETELL_IMAGE : ImageKeys.HIDDEN_CARD;
|
||||
if (isForetold()) {
|
||||
return StaticData.instance().getOtherImageKey(ImageKeys.FORETELL_IMAGE, null);
|
||||
}
|
||||
return ImageKeys.getTokenKey(ImageKeys.HIDDEN_CARD);
|
||||
}
|
||||
|
||||
if (isManifested()) {
|
||||
String set = getManifestedSA().getCardState().getSetCode();
|
||||
return ImageKeys.MANIFEST_IMAGE + "_" + set;
|
||||
return StaticData.instance().getOtherImageKey(ImageKeys.MANIFEST_IMAGE, set);
|
||||
}
|
||||
if (isCloaked()) {
|
||||
String set = getCloakedSA().getCardState().getSetCode();
|
||||
return ImageKeys.CLOAKED_IMAGE + "_" + set;
|
||||
return StaticData.instance().getOtherImageKey(ImageKeys.CLOAKED_IMAGE, set);
|
||||
}
|
||||
if (getCastSA() != null) {
|
||||
String set = getCastSA().getCardState().getSetCode();
|
||||
if (getCastSA().isKeyword(Keyword.DISGUISE)) {
|
||||
return ImageKeys.CLOAKED_IMAGE + "_" + set;
|
||||
return StaticData.instance().getOtherImageKey(ImageKeys.CLOAKED_IMAGE, set);
|
||||
} else if (getCastSA().isKeyword(Keyword.MORPH) || getCastSA().isKeyword(Keyword.MEGAMORPH)) {
|
||||
return ImageKeys.MORPH_IMAGE + "_" + set;
|
||||
return StaticData.instance().getOtherImageKey(ImageKeys.MORPH_IMAGE, set);
|
||||
}
|
||||
}
|
||||
// TODO add face-down SA to key
|
||||
|
||||
return ImageKeys.HIDDEN_CARD;
|
||||
return ImageKeys.getTokenKey(ImageKeys.HIDDEN_CARD);
|
||||
}
|
||||
|
||||
public final boolean isTributed() { return tributed; }
|
||||
|
||||
@@ -1313,7 +1313,7 @@ public class CardView extends GameEntityView {
|
||||
}
|
||||
public String getImageKey(Iterable<PlayerView> viewers) {
|
||||
if (getState() == CardStateName.FaceDown) {
|
||||
return ImageKeys.getTokenKey(getCard().getFacedownImageKey());
|
||||
return getCard().getFacedownImageKey();
|
||||
}
|
||||
if (canBeShownToAny(viewers)) {
|
||||
if (isCloned() && StaticData.instance().useSourceImageForClone()) {
|
||||
|
||||
@@ -20,6 +20,7 @@ package forge.game.player;
|
||||
import com.google.common.collect.*;
|
||||
import forge.ImageKeys;
|
||||
import forge.LobbyPlayer;
|
||||
import forge.StaticData;
|
||||
import forge.card.*;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.mana.ManaCostShard;
|
||||
@@ -3303,18 +3304,15 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
this.updateZoneForView(com);
|
||||
}
|
||||
|
||||
public void createTheRing(Card host) {
|
||||
public void createTheRing(String set) {
|
||||
final PlayerZone com = getZone(ZoneType.Command);
|
||||
if (theRing == null) {
|
||||
theRing = new Card(game.nextCardId(), null, game);
|
||||
theRing.setOwner(this);
|
||||
theRing.setGamePieceType(GamePieceType.EFFECT);
|
||||
String image = ImageKeys.getTokenKey("the_ring");
|
||||
if (host != null) {
|
||||
theRing.setImageKey("t:the_ring_" + host.getSetCode().toLowerCase());
|
||||
theRing.setSetCode(host.getSetCode());
|
||||
} else {
|
||||
theRing.setImageKey(image);
|
||||
theRing.setImageKey(StaticData.instance().getOtherImageKey(ImageKeys.THE_RING_IMAGE, set));
|
||||
if (set != null) {
|
||||
theRing.setSetCode(set);
|
||||
}
|
||||
theRing.setName("The Ring");
|
||||
theRing.updateStateForView();
|
||||
@@ -3444,18 +3442,18 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
return equals(game.getMonarch());
|
||||
}
|
||||
|
||||
public String getMonarchSet() {
|
||||
return monarchEffect == null ? monarchEffect.getSetCode() : null;
|
||||
}
|
||||
|
||||
public void createMonarchEffect(final String set) {
|
||||
final PlayerZone com = getZone(ZoneType.Command);
|
||||
if (monarchEffect == null) {
|
||||
monarchEffect = new Card(game.nextCardId(), null, game);
|
||||
monarchEffect.setOwner(this);
|
||||
monarchEffect.setGamePieceType(GamePieceType.EFFECT);
|
||||
if (set != null) {
|
||||
monarchEffect.setImageKey("t:monarch_" + set.toLowerCase());
|
||||
monarchEffect.setSetCode(set);
|
||||
} else {
|
||||
monarchEffect.setImageKey("t:monarch");
|
||||
}
|
||||
monarchEffect.setImageKey(StaticData.instance().getOtherImageKey(ImageKeys.MONARCH_IMAGE, set));
|
||||
monarchEffect.setSetCode(set);
|
||||
monarchEffect.setName("The Monarch");
|
||||
|
||||
{
|
||||
@@ -3496,18 +3494,18 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
return !StaticAbilityCantBecomeMonarch.anyCantBecomeMonarch(this);
|
||||
}
|
||||
|
||||
public String getInitiativeSet() {
|
||||
return initiativeEffect != null ? initiativeEffect.getSetCode() : null;
|
||||
}
|
||||
|
||||
public void createInitiativeEffect(final String set) {
|
||||
final PlayerZone com = getZone(ZoneType.Command);
|
||||
if (initiativeEffect == null) {
|
||||
initiativeEffect = new Card(game.nextCardId(), null, game);
|
||||
initiativeEffect.setOwner(this);
|
||||
initiativeEffect.setGamePieceType(GamePieceType.EFFECT);
|
||||
if (set != null) {
|
||||
initiativeEffect.setImageKey("t:initiative_" + set.toLowerCase());
|
||||
initiativeEffect.setSetCode(set);
|
||||
} else {
|
||||
initiativeEffect.setImageKey("t:initiative");
|
||||
}
|
||||
initiativeEffect.setImageKey(StaticData.instance().getOtherImageKey(ImageKeys.INITIATIVE_IMAGE, set));
|
||||
initiativeEffect.setSetCode(set);
|
||||
initiativeEffect.setName("The Initiative");
|
||||
|
||||
//Set up damage trigger
|
||||
@@ -3574,7 +3572,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
radiationEffect = new Card(game.nextCardId(), null, game);
|
||||
radiationEffect.setOwner(this);
|
||||
radiationEffect.setGamePieceType(GamePieceType.EFFECT);
|
||||
radiationEffect.setImageKey("t:radiation");
|
||||
radiationEffect.setImageKey(StaticData.instance().getOtherImageKey(ImageKeys.RADIATION_IMAGE, setCode));
|
||||
radiationEffect.setName("Radiation");
|
||||
if (setCode != null) {
|
||||
radiationEffect.setSetCode(setCode);
|
||||
@@ -3684,7 +3682,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
public boolean hasBlessing() {
|
||||
return blessingEffect != null;
|
||||
}
|
||||
public void setBlessing(boolean bless) {
|
||||
public void setBlessing(boolean bless, String setCode) {
|
||||
// no need to to change
|
||||
if ((blessingEffect != null) == bless) {
|
||||
return;
|
||||
@@ -3695,9 +3693,12 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
if (bless) {
|
||||
blessingEffect = new Card(game.nextCardId(), null, game);
|
||||
blessingEffect.setOwner(this);
|
||||
blessingEffect.setImageKey("t:blessing");
|
||||
blessingEffect.setImageKey(StaticData.instance().getOtherImageKey(ImageKeys.BLESSING_IMAGE, setCode));
|
||||
blessingEffect.setName("City's Blessing");
|
||||
blessingEffect.setGamePieceType(GamePieceType.EFFECT);
|
||||
if (setCode != null) {
|
||||
blessingEffect.setSetCode(setCode);
|
||||
}
|
||||
|
||||
blessingEffect.updateStateForView();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user