mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Merge branch 'token_phase_two' into 'master'
Add more support for migrating Editions to TokenScripts See merge request core-developers/forge!885
This commit is contained in:
@@ -199,17 +199,15 @@ public class TokenEffect extends SpellAbilityEffect {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private Card loadTokenPrototype(SpellAbility sa) {
|
||||
String script = sa.getParamOrDefault("TokenScript", null);
|
||||
|
||||
PaperToken token = null;
|
||||
try {
|
||||
String edition = sa.getHostCard().getPaperCard().getEdition();
|
||||
token = StaticData.instance().getAllTokens().getToken(script, edition);
|
||||
} catch(NullPointerException e) {
|
||||
// A non-PaperCard creates a new token. We probably want to delegate to the original creator
|
||||
System.out.println("Token created by: " + sa.getHostCard() + " has no PaperCard associated to it.");
|
||||
public Card loadTokenPrototype(SpellAbility sa) {
|
||||
if (!sa.hasParam("TokenScript")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String script = sa.getParam("TokenScript");
|
||||
String edition = sa.getHostCard().getSetCode();
|
||||
PaperToken token = StaticData.instance().getAllTokens().getToken(script, edition);
|
||||
|
||||
if (token != null) {
|
||||
tokenName = token.getName();
|
||||
return Card.fromPaperCard(token, null, sa.getHostCard().getGame());
|
||||
@@ -275,7 +273,10 @@ public class TokenEffect extends SpellAbilityEffect {
|
||||
tokenInfo = new TokenInfo(substitutedName, imageName,
|
||||
cost, substitutedTypes, this.tokenKeywords, finalPower, finalToughness);
|
||||
} else {
|
||||
tokenInfo = new TokenInfo(prototype);
|
||||
// TODO: Substitute type name for Chosen tokens
|
||||
// TODO: If host has has it's color/type altered make sure that's appropriately applied
|
||||
// TODO: Lock down final power and toughness if it's actually X values
|
||||
tokenInfo = new TokenInfo(prototype, host);
|
||||
}
|
||||
|
||||
for (final Player controller : AbilityUtils.getDefinedPlayers(host, this.tokenOwner, sa)) {
|
||||
|
||||
@@ -42,6 +42,7 @@ public class TokenInfo {
|
||||
}
|
||||
|
||||
public TokenInfo(Card c) {
|
||||
// TODO: Figure out how to handle legacy images?
|
||||
this.name = c.getName();
|
||||
this.imageName = ImageKeys.getTokenImageName(c.getImageKey());
|
||||
this.manaCost = c.getManaCost().toString();
|
||||
@@ -58,6 +59,12 @@ public class TokenInfo {
|
||||
this.baseToughness = c.getBaseToughness();
|
||||
}
|
||||
|
||||
public TokenInfo(Card c, Card source) {
|
||||
// TODO If Source has type/color changes on it, apply them now.
|
||||
// Permanently apply them for casccading tokens? Reef Worm?
|
||||
this(c);
|
||||
}
|
||||
|
||||
public TokenInfo(String str) {
|
||||
final String[] tokenInfo = str.split(",");
|
||||
int power = 0;
|
||||
|
||||
Reference in New Issue
Block a user