Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I've tuned up the mod! #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 79 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,79 @@
/target/
*.class

# IntelliJ
.idea/
out/
*.iml

# Eclipse
.classpath
.project
.settings/

# maven build target
target/

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# Spriter files
*.autosave.scml
58 changes: 37 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,92 @@

<groupId>sneckomod</groupId>
<artifactId>sneckomod</artifactId>
<version>v0.0.19</version>
<version>v0.0.20</version>
<packaging>jar</packaging>

<name>Snecko Mod</name>
<description>A new silly character for Slay the Spire: The Snek</description>

<properties>
<!--adjust version numbers of components here-->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<SlayTheSpire.version>12-17-2019</SlayTheSpire.version>
<basemod.version>5.16.0-beta.3</basemod.version>
<ModTheSpire.version>3.14.1</ModTheSpire.version>
<stslib.version>1.17.1</stslib.version>
<yohane.version>1.4.5</yohane.version>
<hubris.version>0.24.0</hubris.version>
<replaythespire.version>1.5.3</replaythespire.version>
<infintespire.version>0.20.0</infintespire.version>
<chronomuncher.version>0.10.11</chronomuncher.version>
<!--CHANGE THIS TO THE STEAMAPPS DIR IN YOUR STEAM INSTALL-->
<Steam.path>D:\Program Files (x86)\Steam\steamapps</Steam.path>
</properties>

<dependencies>
<dependency>
<groupId>com.megacrit.cardcrawl</groupId>
<artifactId>slaythespire</artifactId>
<version>051</version>
<version>${SlayTheSpire.version}</version>
<scope>system</scope>
<systemPath>${basedir}/../lib/desktop-1.0.jar</systemPath>
<systemPath>${Steam.path}/common/SlayTheSpire/desktop-1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>basemod</groupId>
<artifactId>basemod</artifactId>
<version>5.4.0</version>
<version>${basemod.version}</version>
<scope>system</scope>
<systemPath>${basedir}/../lib/BaseMod.jar</systemPath>
<systemPath>${Steam.path}/workshop/content/646570/1605833019/BaseMod.jar</systemPath>
</dependency>
<dependency>
<groupId>com.evacipated.cardcrawl</groupId>
<artifactId>ModTheSpire</artifactId>
<version>3.6.3</version>
<version>${ModTheSpire.version}</version>
<scope>system</scope>
<systemPath>${basedir}/../lib/ModTheSpire.jar</systemPath>
<systemPath>${Steam.path}/workshop/content/646570/1605060445/ModTheSpire.jar</systemPath>
</dependency>
<dependency>
<groupId>com.evacipated.cardcrawl</groupId>
<artifactId>stslib</artifactId>
<version>1.9.0</version>
<version>${stslib.version}</version>
<scope>system</scope>
<systemPath>${basedir}/../lib/STSLib.jar</systemPath>
<systemPath>${Steam.path}/workshop/content/646570/1609158507/StSLib.jar</systemPath>
</dependency>
<dependency>
<groupId>yohane</groupId>
<artifactId>yohane</artifactId>
<version>1.9.0</version>
<version>${yohane.version}</version>
<scope>system</scope>
<systemPath>${basedir}/../lib/Yohane.jar</systemPath>
<systemPath>${Steam.path}/workshop/content/646570/1612593526/Yohane.jar</systemPath>
</dependency>
<dependency>
<groupId>hubris</groupId>
<artifactId>hubris</artifactId>
<version>0.19.1</version>
<version>${hubris.version}</version>
<scope>system</scope>
<systemPath>${basedir}/../lib/Hubris.jar</systemPath>
<systemPath>${Steam.path}/workshop/content/646570/1609159603/Hubris.jar</systemPath>
</dependency>
<dependency>
<groupId>replaythespire</groupId>
<artifactId>replaythespire</artifactId>
<version>1.3.15</version>
<version>${replaythespire.version}</version>
<scope>system</scope>
<systemPath>${basedir}/../lib/ReplayTheSpireMod.jar</systemPath>
<systemPath>${Steam.path}/workshop/content/646570/1610173938/ReplayTheSpireMod.jar</systemPath>
</dependency>
<dependency>
<groupId>infinitespire</groupId>
<artifactId>infinitespire</artifactId>
<version>0.12.0</version>
<version>${infintespire.version}</version>
<scope>system</scope>
<systemPath>${basedir}/../lib/InfiniteSpire.jar</systemPath>
<systemPath>${Steam.path}/workshop/content/646570/1610128058/InfiniteSpire.jar</systemPath>
</dependency>
<dependency>
<groupId>chronomuncher</groupId>
<artifactId>chronomuncher</artifactId>
<version>0.12.0</version>
<version>${chronomuncher.version}</version>
<scope>system</scope>
<systemPath>${basedir}/../lib/TheDisciple.jar</systemPath>
<systemPath>${Steam.path}/workshop/content/646570/1609846039/TheDisciple.jar</systemPath>
</dependency>
</dependencies>

Expand All @@ -97,8 +114,7 @@
<configuration>
<target>

<copy file="target\SneckoMod.jar" tofile="C:\Program Files (x86)\Steam\steamapps\common\SlayTheSpire\mods\SneckoMod.jar"/>
<copy file="target\SneckoMod.jar" tofile="C:\Users\Computer\IdeaProjects\packsnecko\content\SneckoMod.jar"/>
<copy file="target/${project.artifactId}.jar" tofile="${Steam.path}/common/SlayTheSpire/mods/${project.artifactId}.jar"/>

</target>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/sneckomod/SneckoMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@com.evacipated.cardcrawl.modthespire.lib.SpireInitializer
public class SneckoMod implements basemod.interfaces.PostBattleSubscriber, basemod.interfaces.OnStartBattleSubscriber, basemod.interfaces.PostInitializeSubscriber, basemod.interfaces.EditCharactersSubscriber, basemod.interfaces.EditRelicsSubscriber, basemod.interfaces.EditCardsSubscriber, basemod.interfaces.EditKeywordsSubscriber, basemod.interfaces.EditStringsSubscriber
{
private static final com.badlogic.gdx.graphics.Color SNECKO_COLOR = com.megacrit.cardcrawl.helpers.CardHelper.getColor(220.0F, 55.0F, 220.0F);
private static final com.badlogic.gdx.graphics.Color SNECKO_COLOR = com.megacrit.cardcrawl.helpers.CardHelper.getColor(220, 55, 220);

private static final String SneckoMOD_ASSETS_FOLDER = "SneckoImages";

Expand Down
39 changes: 39 additions & 0 deletions src/main/java/sneckomod/actions/ReduceMostExpensiveCardAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package sneckomod.actions;

import com.badlogic.gdx.graphics.Color;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import sneckomod.SneckoMod;
import java.util.ArrayList;
import java.util.Collections;

public class ReduceMostExpensiveCardAction extends AbstractGameAction {
public ReduceMostExpensiveCardAction() {
}
public void update() {
ArrayList<AbstractCard> mostExpensive = new ArrayList();
int mostExpensiveCost = -1;
SneckoMod.logger.info("AbstractDungeon.player.hand.group.size() = " + AbstractDungeon.player.hand.group.size());
for (AbstractCard c : AbstractDungeon.player.hand.group) {
SneckoMod.logger.info("Card" +c.name +"has cost"+c.cost);
if (c.cost > mostExpensiveCost) {
mostExpensive.clear();
mostExpensive.add(c) ;
mostExpensiveCost = c.cost;
} else if (c.cost == mostExpensiveCost) {
mostExpensive.add(c);
}
}
if (mostExpensive.size() == 0) {
SneckoMod.logger.info("Tried to reduce most expensive cost with no cards in hand.");
} else {
Collections.shuffle(mostExpensive, AbstractDungeon.cardRandomRng.random);
AbstractCard mostExpensiveCard = mostExpensive.get(0);
mostExpensiveCard.modifyCostForCombat(-1);
mostExpensiveCard.isCostModified = true;
mostExpensiveCard.superFlash(Color.PURPLE.cpy());
}
tickDuration();
}
}
2 changes: 1 addition & 1 deletion src/main/java/sneckomod/cards/AbstractSneckoCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void replaceUnknown(boolean toHand) {
SneckoMod.logger.info("Attempting to create new Unknown: " + this.name);

AbstractCard cUnknown; if (tmp.size() > 0) {
cUnknown = CardLibrary.cards.get(tmp.get(AbstractDungeon.cardRng.random(0, tmp.size() - 1)));
cUnknown = CardLibrary.cards.get(tmp.get(AbstractDungeon.cardRng.random(0, tmp.size() - 1))).makeStatEquivalentCopy();
}
else {
cUnknown = new com.megacrit.cardcrawl.cards.colorless.Madness();
Expand Down
23 changes: 13 additions & 10 deletions src/main/java/sneckomod/characters/SneckoCharacter.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ public void render(SpriteBatch sb) {
}

if (!(AbstractDungeon.getCurrRoom() instanceof RestRoom)) {
if (this.damageFlash) {
ShaderHelper.setShader(sb, ShaderHelper.Shader.WHITE_SILHOUETTE);
}
// if (this.damageFlash) {
// ShaderHelper.setShader(sb, ShaderHelper.Shader.WHITE_SILHOUETTE);
// }

Boolean renderCorpse = (Boolean)ReflectionHacks.getPrivate(this,AbstractPlayer.class,"renderCorpse");

Expand All @@ -248,13 +248,13 @@ public void render(SpriteBatch sb) {
sb.draw(this.img, this.drawX - (float)this.img.getWidth() * Settings.scale / 2.0F + this.animX, this.drawY, (float)this.img.getWidth() * Settings.scale, (float)this.img.getHeight() * Settings.scale, 0, 0, this.img.getWidth(), this.img.getHeight(), this.flipHorizontal, this.flipVertical);
}

if (this.damageFlash) {
ShaderHelper.setShader(sb, ShaderHelper.Shader.DEFAULT);
--this.damageFlashFrames;
if (this.damageFlashFrames == 0) {
this.damageFlash = false;
}
}
// if (this.damageFlash) {
// ShaderHelper.setShader(sb, ShaderHelper.Shader.DEFAULT);
// --this.damageFlashFrames;
// if (this.damageFlashFrames == 0) {
// this.damageFlash = false;
// }
// }

this.hb.render(sb);
this.healthHb.render(sb);
Expand All @@ -276,6 +276,9 @@ public void render(SpriteBatch sb) {

}

@Override
public String getPortraitImageName(){return "That Sneaky Snake";}

private static final com.megacrit.cardcrawl.localization.CharacterStrings charStrings = CardCrawlGame.languagePack.getCharacterString("Snecko");
public static final String NAME = charStrings.NAMES[0];
public static final String DESCRIPTION = charStrings.TEXT[0];
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/sneckomod/patches/SnekproofConfusionPatch.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package sneckomod.patches;

import com.evacipated.cardcrawl.modthespire.lib.*;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.powers.ConfusionPower;
import static sneckomod.SneckoMod.SNEKPROOF;


public class SnekproofConfusionPatch {
//Patches ConfusionPower to not randomize costs on Snekproof cards
@SpirePatch(
clz=ConfusionPower.class,
method = "onCardDraw"
)
public static class ConfusionPower_onCardDraw {
@SpirePrefixPatch
public static SpireReturn prefix(ConfusionPower __this, AbstractCard card) {

if (card.hasTag(SNEKPROOF)) {
return SpireReturn.Return(null);
}
return SpireReturn.Continue();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package sneckomod.patches;

import com.evacipated.cardcrawl.modthespire.lib.*;
import com.evacipated.cardcrawl.modthespire.patcher.PatchingException;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.actions.unique.RandomizeHandCostAction;
import com.megacrit.cardcrawl.random.Random;
import javassist.CannotCompileException;
import javassist.CtBehavior;
import sneckomod.SneckoMod;

import java.util.ArrayList;

import static sneckomod.SneckoMod.SNEKPROOF;

public class SnekproofRandomizeHandCostPatch {
//Patches the RandomizeHandCostAction to not randomize costs on Snekproof cards
@SpirePatch(
clz= RandomizeHandCostAction.class,
method = "update"
)
public static class DoNotRandomizeSnekproofCosts {

@SpireInsertPatch(
locator = Locator.class,
localvars = {"card","newCost"}
)
//This method will be inserted after the RandomizeHandAction gets a newCost from the AbstractDungeon.cardRandomRng.random(3)
public static void Insert (RandomizeHandCostAction __this, AbstractCard card, @ByRef int[] newCost) {//
if (card.hasTag(SNEKPROOF)) {
SneckoMod.logger.info("Not randomizing cost of " + card.name + "since it has snekproof.");
newCost[0]=card.cost;
}
}

// ModTheSpire searches for a nested class that extends SpireInsertLocator
// This class will be the Locator for the @SpireInsertPatch
// When a Locator is not specified, ModTheSpire uses the default behavior for the @SpireInsertPatch
private static class Locator extends SpireInsertLocator {
// This is the abstract method from SpireInsertLocator that will be used to find the line
// numbers you want this patch inserted at
public int[] Locate(CtBehavior ctMethodToPatch) throws CannotCompileException, PatchingException {
// finalMatcher is the line that we want to insert our patch before -
// in this example we are using a `MethodCallMatcher` which is a type
// of matcher that matches a method call based on the type of the calling
// object and the name of the method being called. Here you can see that
// we're expecting the `end` method to be called on a `SpireBatch`
Matcher finalMatcher = new Matcher.MethodCallMatcher(Random.class, "random");

// the `new ArrayList<Matcher>()` specifies the prerequisites before the line can be matched -
// the LineFinder will search for all the prerequisites in order before it will match the finalMatcher -
// since we didn't specify any prerequisites here, the LineFinder will simply find the first expression
// that matches the finalMatcher.
int[] result = LineFinder.findInOrder(ctMethodToPatch, new ArrayList<Matcher>(), finalMatcher);
//we actually want the immediate next line, after the value has been assigned to newCost
result[0]++;
return result;
}
}

}
}
Loading