Skip to content

Commit

Permalink
Merge pull request daviscook477#56 from daviscook477/patch/21
Browse files Browse the repository at this point in the history
Patch/21
  • Loading branch information
daviscook477 authored Apr 20, 2018
2 parents 86578d4 + 7c0c365 commit 1acb808
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 11 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,12 @@ This is a fast forward to v1.6.3 of daviscook477's fork with a few additional ch
* Fix multiple bugs with start act, pre start game, and start game subscribers
* Add support for per-card energy orb graphics (BlankTheEvil)

#### dev ####
#### v2.5.0 ####
* Support week 20 patch (kiooeht)
* Add support for custom dynamic variables (kiooeht)
* Merge CustomCardWithRender features into CustomCard - **breaking change** - should only affect BlackMageMod
* Merge CustomCardWithRender features into CustomCard - breaking change - should only affect BlackMageMod
* Add feature CardBasic (1st functional version) (DemoXinMC)
* Add support for per-card banners (BlankTheEvil)
* Add support for per-card banners (BlankTheEvil)

#### v2.6.0 ####
* Support week 21 patch
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# BaseMod #
BaseMod provides a number of hooks and a console.

Currently supported version of Slay The Spire: `[EARLY_ACCESS_015]` (non beta)
Currently supported version of Slay The Spire: `[EARLY_ACCESS_021]` (non beta)

![Developer Console](github_resources/console.png)

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>basemod</groupId>
<artifactId>BaseMod</artifactId>
<version>1.6.5</version>
<version>2.6.0</version>
<packaging>jar</packaging>

<name>BaseMod</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
package basemod.patches.com.megacrit.cardcrawl.actions.GameActionManager;

import java.util.ArrayList;

import com.evacipated.cardcrawl.modthespire.lib.LineFinder;
import com.evacipated.cardcrawl.modthespire.lib.Matcher;
import com.evacipated.cardcrawl.modthespire.lib.SpireInsertLocator;
import com.evacipated.cardcrawl.modthespire.lib.SpireInsertPatch;
import com.evacipated.cardcrawl.modthespire.lib.SpirePatch;
import com.evacipated.cardcrawl.modthespire.patcher.PatchingException;
import com.megacrit.cardcrawl.actions.GameActionManager;
import com.megacrit.cardcrawl.cards.CardQueueItem;

import basemod.BaseMod;
import javassist.CannotCompileException;
import javassist.CtBehavior;

@SpirePatch(cls="com.megacrit.cardcrawl.actions.GameActionManager", method="getNextAction")
public class GetNextActionHook {
@SpireInsertPatch(rloc=49)


@SpireInsertPatch()
public static void Insert(Object __obj_instance) {
GameActionManager actionManager = (GameActionManager) __obj_instance;
BaseMod.publishOnCardUse(((CardQueueItem)actionManager.cardQueue.get(0)).card);
}

public static class Locator extends SpireInsertLocator
{
public int[] Locate(CtBehavior ctMethodToPatch) throws CannotCompileException, PatchingException
{
ArrayList<Matcher> prevMatches = new ArrayList<>();
prevMatches.add(
new Matcher.FieldAccessMatcher(
"com.megacrit.cardcrawl.actions.GameActionManager",
"cardsPlayedThisTurn"));

Matcher finalMatcher = new Matcher.MethodCallMatcher("java.util.ArrayList", "add");

return LineFinder.findInOrder(ctMethodToPatch, new ArrayList<Matcher>(), finalMatcher);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static class Locator extends SpireInsertLocator
{
public int[] Locate(CtBehavior ctMethodToPatch) throws CannotCompileException, PatchingException
{
Matcher finalMatcher = new Matcher.MethodCallMatcher(InputHelper.class.getName(), "updateFirst");
Matcher finalMatcher = new Matcher.MethodCallMatcher("com.megacrit.cardcrawl.helpers.InputHelper", "updateFirst");

int[] beforeLines = LineFinder.findInOrder(ctMethodToPatch, new ArrayList<Matcher>(), finalMatcher);

Expand All @@ -58,7 +58,7 @@ public static class Locator extends SpireInsertLocator
{
public int[] Locate(CtBehavior ctMethodToPatch) throws CannotCompileException, PatchingException
{
Matcher finalMatcher = new Matcher.MethodCallMatcher(InputHelper.class.getName(), "updateLast");
Matcher finalMatcher = new Matcher.MethodCallMatcher("com.megacrit.cardcrawl.helpers.InputHelper", "updateLast");

return LineFinder.findInOrder(ctMethodToPatch, new ArrayList<Matcher>(), finalMatcher);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package basemod.patches.com.megacrit.cardcrawl.helpers.InputHelper;

import com.evacipated.cardcrawl.modthespire.lib.SpirePatch;

import javassist.CannotCompileException;
import javassist.expr.ExprEditor;
import javassist.expr.MethodCall;

public class QuickSelectConsoleDisable {

@SpirePatch(cls="com.megacrit.cardcrawl.helpers.InputHelper", method="getCardSelectedByHotkey")
public static class GetCardSelectedByHotkeyFix {

public static ExprEditor Instrument() {
return new ExprEditor() {

public void edit(MethodCall m) throws CannotCompileException {
if (m.getClassName().equals("com.badlogic.gdx.Input") && m.getMethodName().equals("isKeyJustPressed")) {
m.replace("{ $_ = !basemod.DevConsole.visible && $proceed($$); }");
}
}

};
}

}

}
7 changes: 4 additions & 3 deletions src/main/resources/ModTheSpire.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"name": "BaseMod",
"author_list": ["t-larson", "test447", "Haashi", "kiooeht", "Blank The Evil", "FlipskiZ", "DemoXinMC"],
"description": "Unofficial modding API for Slay the Spire. Also a Dev Console.",
"version": "2.4.0",
"sts_version": "03-29-2018",
"mts_version": "2.6.0"
"version": "2.6.0",
"sts_version": "04-19-2018",
"mts_version": "2.6.0",
"update_json": "https://api.github.com/repos/daviscook477/BaseMod/releases/latest"
}

0 comments on commit 1acb808

Please sign in to comment.