Skip to content

Commit

Permalink
Compatibility with ModTheSpire v3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
twanvl committed Aug 27, 2018
1 parent 99a717d commit 864c7f4
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 34 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>hybridcharacter</groupId>
<artifactId>HybridCharacter</artifactId>
<version>0.1.4</version>
<version>0.1.5</version>

<name>HybridCharacter</name>
<description>Adds an Ironclad/Silent hybrid character</description>
Expand Down
20 changes: 9 additions & 11 deletions src/main/java/hybridcharacter/HybridCharacterMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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();
}

Expand All @@ -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",
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand All @@ -35,4 +35,3 @@ public static void Insert(Object __obj_instance, Object tmpPoolObj) {
}

}

Original file line number Diff line number Diff line change
@@ -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")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/hybridcharacter/patches/RelicLibraryPatches.java
Original file line number Diff line number Diff line change
@@ -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<AbstractRelic> relicPool, Object _redRelics, Object _greenRelics) {
Expand All @@ -40,7 +40,7 @@ public static void Insert(ArrayList<AbstractRelic> 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<String> pool, AbstractRelic.RelicTier tier, AbstractPlayer.PlayerClass chosenClass, Object _redRelics, Object _greenRelics) {
Expand All @@ -63,5 +63,5 @@ public static void Insert(ArrayList<String> pool, AbstractRelic.RelicTier tier,
}
}
}

}
6 changes: 3 additions & 3 deletions src/main/resources/ModTheSpire.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 864c7f4

Please sign in to comment.