From 864c7f42754a93a87ace837f718a590427937435 Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Mon, 27 Aug 2018 22:41:38 +0200 Subject: [PATCH] Compatibility with ModTheSpire v3.0.0 --- CHANGELOG.md | 3 +++ pom.xml | 2 +- .../hybridcharacter/HybridCharacterMod.java | 20 +++++++++---------- .../AbstractDungeon/InitializeCardPools.java | 3 +-- .../ReturnEndRandomRelicKey.java | 4 +--- .../AbstractDungeon/ReturnRandomRelicKey.java | 3 +-- .../patches/BackToBasicsPatch.java | 2 +- .../RelicObtainLogic.java | 2 +- .../patches/RelicLibraryPatches.java | 20 +++++++++---------- src/main/resources/ModTheSpire.json | 6 +++--- 10 files changed, 31 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb4e590..e60baf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +0.1.5: + * Compatibility with recent versions of ModTheSpire and BaseMod (v3.0.0) + 0.1.4: * Compatibility with recent versions of Slay the Spire (week 31) diff --git a/pom.xml b/pom.xml index 674bf18..975d661 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ hybridcharacter HybridCharacter - 0.1.4 + 0.1.5 HybridCharacter Adds an Ironclad/Silent hybrid character diff --git a/src/main/java/hybridcharacter/HybridCharacterMod.java b/src/main/java/hybridcharacter/HybridCharacterMod.java index c3e3cb7..de5624e 100644 --- a/src/main/java/hybridcharacter/HybridCharacterMod.java +++ b/src/main/java/hybridcharacter/HybridCharacterMod.java @@ -8,6 +8,7 @@ import com.megacrit.cardcrawl.localization.RelicStrings; import com.evacipated.cardcrawl.modthespire.lib.SpireInitializer; import basemod.BaseMod; +import basemod.ModLabel; import basemod.ModPanel; import basemod.interfaces.*; import org.apache.logging.log4j.LogManager; @@ -26,7 +27,7 @@ public class HybridCharacterMod implements EditStringsSubscriber { public static final String MODNAME = "Hybrid Character"; public static final String AUTHOR = "twanvl"; - public static final String DESCRIPTION = "v0.1.4\nAdds an Ironclad/Silent hybrid character with a combined card pool."; + public static final String DESCRIPTION = "Adds an Ironclad/Silent hybrid character with a combined card pool."; // card trail effect private static final Color RED_GREEN = new Color(0.7f, 0.7f, 0.1f, 1.0f); @@ -36,10 +37,7 @@ public class HybridCharacterMod implements public HybridCharacterMod() { logger.info("Initialize hybrid character mod."); - BaseMod.subscribeToPostInitialize(this); - BaseMod.subscribeToEditStrings(this); - BaseMod.subscribeToEditCharacters(this); - BaseMod.subscribeToEditRelics(this); + BaseMod.subscribe(this); receiveEditColors(); } @@ -52,13 +50,13 @@ public void receivePostInitialize() { // Mod badge Texture badgeTexture = new Texture("images/HybridCharacterBadge.png"); ModPanel settingsPanel = new ModPanel(); - settingsPanel.addLabel("This mod does not have any settings.", 400.0f, 700.0f, (me) -> {}); + settingsPanel.addUIElement(new ModLabel("This mod does not have any settings.", 400.0f, 700.0f, settingsPanel, (me) -> {})); BaseMod.registerModBadge(badgeTexture, MODNAME, AUTHOR, DESCRIPTION, settingsPanel); } public void receiveEditColors() { BaseMod.addColor( - CardColorEnum.HYBRID_COLOR.toString(), + CardColorEnum.HYBRID_COLOR, RED_GREEN, RED_GREEN, RED_GREEN, RED_GREEN, RED_GREEN, RED_GREEN, RED_GREEN, "images/cardui/512/bg_attack_hybrid.png", "images/cardui/512/bg_skill_hybrid.png", @@ -76,17 +74,17 @@ public void receiveEditCharacters() { HybridCharacter.class, "The Hybrid",//HybridCharacter.NAMES[1], "Hybrid class string", - CardColorEnum.HYBRID_COLOR.toString(), + CardColorEnum.HYBRID_COLOR, "Hybrid",//HybridCharacter.NAMES[0], "images/charSelect/hybridButton.png", "images/charSelect/hybridPortrait.jpg", - PlayerClassEnum.HYBRID.toString()); + PlayerClassEnum.HYBRID); } @Override public void receiveEditRelics() { - BaseMod.addRelicToCustomPool(new BurningSnakeRing(), CardColorEnum.HYBRID_COLOR.toString()); - BaseMod.addRelicToCustomPool(new BlackendSnakeRing(), CardColorEnum.HYBRID_COLOR.toString()); + BaseMod.addRelicToCustomPool(new BurningSnakeRing(), CardColorEnum.HYBRID_COLOR); + BaseMod.addRelicToCustomPool(new BlackendSnakeRing(), CardColorEnum.HYBRID_COLOR); } @Override diff --git a/src/main/java/hybridcharacter/patches/AbstractDungeon/InitializeCardPools.java b/src/main/java/hybridcharacter/patches/AbstractDungeon/InitializeCardPools.java index 787cb55..0b0a0e0 100644 --- a/src/main/java/hybridcharacter/patches/AbstractDungeon/InitializeCardPools.java +++ b/src/main/java/hybridcharacter/patches/AbstractDungeon/InitializeCardPools.java @@ -11,7 +11,7 @@ import java.util.Map; import hybridcharacter.patches.PlayerClassEnum; -@SpirePatch(cls="com.megacrit.cardcrawl.dungeons.AbstractDungeon", method="initializeCardPools") +@SpirePatch(clz=com.megacrit.cardcrawl.dungeons.AbstractDungeon.class, method="initializeCardPools") public class InitializeCardPools { @SpireInsertPatch(rloc=26, localvars={"tmpPool"}) @@ -35,4 +35,3 @@ public static void Insert(Object __obj_instance, Object tmpPoolObj) { } } - diff --git a/src/main/java/hybridcharacter/patches/AbstractDungeon/ReturnEndRandomRelicKey.java b/src/main/java/hybridcharacter/patches/AbstractDungeon/ReturnEndRandomRelicKey.java index 5401e81..79ae554 100644 --- a/src/main/java/hybridcharacter/patches/AbstractDungeon/ReturnEndRandomRelicKey.java +++ b/src/main/java/hybridcharacter/patches/AbstractDungeon/ReturnEndRandomRelicKey.java @@ -1,12 +1,10 @@ package hybridcharacter.patches.AbstractDungeon; -import com.evacipated.cardcrawl.modthespire.lib.SpireInsertPatch; import com.evacipated.cardcrawl.modthespire.lib.SpirePatch; - import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.relics.AbstractRelic; -@SpirePatch(cls="com.megacrit.cardcrawl.dungeons.AbstractDungeon", method="returnEndRandomRelicKey") +@SpirePatch(clz=com.megacrit.cardcrawl.dungeons.AbstractDungeon.class, method="returnEndRandomRelicKey") public class ReturnEndRandomRelicKey { public static String Postfix(String retVal, Object tier) { if (retVal.equals("Blackend Snake Ring") && !AbstractDungeon.player.hasRelic("Burning Snake Ring")) { diff --git a/src/main/java/hybridcharacter/patches/AbstractDungeon/ReturnRandomRelicKey.java b/src/main/java/hybridcharacter/patches/AbstractDungeon/ReturnRandomRelicKey.java index d7d6423..e2c9d3c 100644 --- a/src/main/java/hybridcharacter/patches/AbstractDungeon/ReturnRandomRelicKey.java +++ b/src/main/java/hybridcharacter/patches/AbstractDungeon/ReturnRandomRelicKey.java @@ -1,11 +1,10 @@ package hybridcharacter.patches.AbstractDungeon; import com.evacipated.cardcrawl.modthespire.lib.SpirePatch; - import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.relics.AbstractRelic; -@SpirePatch(cls="com.megacrit.cardcrawl.dungeons.AbstractDungeon", method="returnRandomRelicKey") +@SpirePatch(clz=com.megacrit.cardcrawl.dungeons.AbstractDungeon.class, method="returnRandomRelicKey") public class ReturnRandomRelicKey { public static String Postfix(String retVal, Object tier) { if (retVal.equals("Blackend Snake Ring") && !AbstractDungeon.player.hasRelic("Burning Snake Ring")) { diff --git a/src/main/java/hybridcharacter/patches/BackToBasicsPatch.java b/src/main/java/hybridcharacter/patches/BackToBasicsPatch.java index cf8a8ff..1d0b52d 100644 --- a/src/main/java/hybridcharacter/patches/BackToBasicsPatch.java +++ b/src/main/java/hybridcharacter/patches/BackToBasicsPatch.java @@ -11,7 +11,7 @@ import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.vfx.cardManip.ShowCardBrieflyEffect; -@SpirePatch(cls = "com.megacrit.cardcrawl.events.thecity.BackToBasics", method = "buttonEffect") +@SpirePatch(clz = com.megacrit.cardcrawl.events.city.BackToBasics.class, method = "buttonEffect") public class BackToBasicsPatch { @SpireInsertPatch(rloc = 30) diff --git a/src/main/java/hybridcharacter/patches/BossRelicSelectionScreen/RelicObtainLogic.java b/src/main/java/hybridcharacter/patches/BossRelicSelectionScreen/RelicObtainLogic.java index 43e252e..b9b1712 100644 --- a/src/main/java/hybridcharacter/patches/BossRelicSelectionScreen/RelicObtainLogic.java +++ b/src/main/java/hybridcharacter/patches/BossRelicSelectionScreen/RelicObtainLogic.java @@ -5,7 +5,7 @@ import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.relics.AbstractRelic; -@SpirePatch(cls="com.megacrit.cardcrawl.screens.select.BossRelicSelectScreen", method="relicObtainLogic") +@SpirePatch(clz=com.megacrit.cardcrawl.screens.select.BossRelicSelectScreen.class, method="relicObtainLogic") public class RelicObtainLogic { public static void Postfix(Object _self, Object _r) { AbstractRelic r = (AbstractRelic)_r; diff --git a/src/main/java/hybridcharacter/patches/RelicLibraryPatches.java b/src/main/java/hybridcharacter/patches/RelicLibraryPatches.java index 12948fb..3eb22b1 100644 --- a/src/main/java/hybridcharacter/patches/RelicLibraryPatches.java +++ b/src/main/java/hybridcharacter/patches/RelicLibraryPatches.java @@ -1,25 +1,25 @@ package hybridcharacter.patches; -import com.evacipated.cardcrawl.modthespire.lib.SpirePatch; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + import com.evacipated.cardcrawl.modthespire.lib.SpireInsertPatch; +import com.evacipated.cardcrawl.modthespire.lib.SpirePatch; import com.megacrit.cardcrawl.characters.AbstractPlayer; +import com.megacrit.cardcrawl.core.Settings; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.relics.AbstractRelic; import com.megacrit.cardcrawl.unlock.UnlockTracker; -import com.megacrit.cardcrawl.core.Settings; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import basemod.BaseMod; -import hybridcharacter.patches.PlayerClassEnum; // Add red and green relics to the Hybrid's relic library public class RelicLibraryPatches { public static final Logger logger = LogManager.getLogger(RelicLibraryPatches.class.getName()); - @SpirePatch(cls = "com.megacrit.cardcrawl.helpers.RelicLibrary", method = "addClassSpecificRelics") + @SpirePatch(clz=com.megacrit.cardcrawl.helpers.RelicLibrary.class, method = "addClassSpecificRelics") public static class RelicLibrary { @SpireInsertPatch(rloc=0, localvars={"redRelics","greenRelics"}) public static void Insert(ArrayList relicPool, Object _redRelics, Object _greenRelics) { @@ -40,7 +40,7 @@ public static void Insert(ArrayList relicPool, Object _redRelics, } } - @SpirePatch(cls="com.megacrit.cardcrawl.helpers.RelicLibrary", method="populateRelicPool") + @SpirePatch(clz=com.megacrit.cardcrawl.helpers.RelicLibrary.class, method="populateRelicPool") public static class PopulateRelicPool { @SpireInsertPatch(rloc=0, localvars={"redRelics","greenRelics"}) public static void Insert(ArrayList pool, AbstractRelic.RelicTier tier, AbstractPlayer.PlayerClass chosenClass, Object _redRelics, Object _greenRelics) { @@ -63,5 +63,5 @@ public static void Insert(ArrayList pool, AbstractRelic.RelicTier tier, } } } - + } diff --git a/src/main/resources/ModTheSpire.json b/src/main/resources/ModTheSpire.json index 14e9254..859a835 100644 --- a/src/main/resources/ModTheSpire.json +++ b/src/main/resources/ModTheSpire.json @@ -3,8 +3,8 @@ "name": "Hybrid Character", "author_list": ["twanvl"], "description": "Adds an Ironclad/Silent hybrid character with a combined card pool.", - "version": "0.1.4", - "sts_version": "06-28-2018", - "mts_version": "2.6.0", + "version": "0.1.5", + "sts_version": "08-23-2018", + "mts_version": "3.0.0", "update_json": "https://api.github.com/repos/twanvl/sts-hybrid-character/releases/latest" }