mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
Added attraction light icons (#5663)
Refactored functional variants to be merged in the card face rather than the card factory Some variant characteristics now show in deck builder columns Fixed loading progress amount "[card] has neither ManaCost nor Color" warning now actually displays when these are missing. Co-authored-by: Jetz <Jetz722@gmail.com> Co-authored-by: tool4ever <therealtoolkit@hotmail.com>
This commit is contained in:
@@ -357,6 +357,18 @@ public class CardFactory {
|
||||
}
|
||||
|
||||
private static void readCardFace(Card c, ICardFace face) {
|
||||
//If it's a functional variant card, switch to that first.
|
||||
if(face.hasFunctionalVariants()) {
|
||||
String variantName = c.getPaperCard().getFunctionalVariant();
|
||||
if (!IPaperCard.NO_FUNCTIONAL_VARIANT.equals(variantName)) {
|
||||
ICardFace variant = face.getFunctionalVariant(variantName);
|
||||
if (variant != null)
|
||||
face = variant;
|
||||
else
|
||||
System.err.printf("Tried to apply unknown or unsupported variant - Card: \"%s\"; Variant: %s\n", face.getName(), variantName);
|
||||
}
|
||||
}
|
||||
|
||||
// Build English oracle and translated oracle mapping
|
||||
if (c.getId() >= 0) {
|
||||
CardTranslation.buildOracleMapping(face.getName(), face.getOracleText());
|
||||
@@ -417,73 +429,6 @@ public class CardFactory {
|
||||
}
|
||||
|
||||
CardFactoryUtil.addAbilityFactoryAbilities(c, face.getAbilities());
|
||||
|
||||
if (face.hasFunctionalVariants()) {
|
||||
applyFunctionalVariant(c, face);
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyFunctionalVariant(Card c, ICardFace originalFace) {
|
||||
String variantName = c.getPaperCard().getFunctionalVariant();
|
||||
if (IPaperCard.NO_FUNCTIONAL_VARIANT.equals(variantName))
|
||||
return;
|
||||
ICardFace variant = originalFace.getFunctionalVariant(variantName);
|
||||
if (variant == null) {
|
||||
System.out.printf("Tried to apply unknown or unsupported variant - Card: \"%s\"; Variant: %s\n", originalFace.getName(), variantName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (variant.getVariables() != null)
|
||||
for (Entry<String, String> v : variant.getVariables())
|
||||
c.setSVar(v.getKey(), v.getValue());
|
||||
if (variant.getReplacements() != null)
|
||||
for (String r : variant.getReplacements())
|
||||
c.addReplacementEffect(ReplacementHandler.parseReplacement(r, c, true, c.getCurrentState()));
|
||||
if (variant.getStaticAbilities() != null)
|
||||
for (String s : variant.getStaticAbilities())
|
||||
c.addStaticAbility(s);
|
||||
if (variant.getTriggers() != null)
|
||||
for (String t : variant.getTriggers())
|
||||
c.addTrigger(TriggerHandler.parseTrigger(t, c, true, c.getCurrentState()));
|
||||
|
||||
if (variant.getKeywords() != null)
|
||||
c.addIntrinsicKeywords(variant.getKeywords(), false);
|
||||
|
||||
if (variant.getManaCost() != ManaCost.NO_COST)
|
||||
c.setManaCost(variant.getManaCost());
|
||||
if (variant.getNonAbilityText() != null)
|
||||
c.setText(variant.getNonAbilityText());
|
||||
|
||||
if (!"".equals(variant.getInitialLoyalty()))
|
||||
c.getCurrentState().setBaseLoyalty(variant.getInitialLoyalty());
|
||||
if (!"".equals(variant.getDefense()))
|
||||
c.getCurrentState().setBaseDefense(variant.getDefense());
|
||||
|
||||
if (variant.getOracleText() != null)
|
||||
c.getCurrentState().setOracleText(variant.getOracleText());
|
||||
|
||||
if (variant.getType() != null) {
|
||||
for(String type : variant.getType())
|
||||
c.addType(type);
|
||||
}
|
||||
|
||||
if (variant.getColor() != null)
|
||||
c.setColor(variant.getColor().getColor());
|
||||
|
||||
if (variant.getIntPower() != Integer.MAX_VALUE) {
|
||||
c.setBasePower(variant.getIntPower());
|
||||
c.setBasePowerString(variant.getPower());
|
||||
}
|
||||
if (variant.getIntToughness() != Integer.MAX_VALUE) {
|
||||
c.setBaseToughness(variant.getIntToughness());
|
||||
c.setBaseToughnessString(variant.getToughness());
|
||||
}
|
||||
|
||||
if (variant.getAttractionLights() != null)
|
||||
c.setAttractionLights(variant.getAttractionLights());
|
||||
|
||||
if (variant.getAbilities() != null)
|
||||
CardFactoryUtil.addAbilityFactoryAbilities(c, variant.getAbilities());
|
||||
}
|
||||
|
||||
public static void copySpellAbility(SpellAbility from, SpellAbility to, final Card host, final Player p, final boolean lki, final boolean keepTextChanges) {
|
||||
|
||||
Reference in New Issue
Block a user