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

Conversation

commanderson
Copy link

Hey there,
I saw this mod in the workshop, and I was quite excited by it; however, updates have not been kind to it, breaking many mechanics and culminating on the current beta branch (which many people are playing due to the forthcoming 4th character) where it crashes ModTheSpire. I decided to see if I could fix it up as a project to get into spire modding, and I have now gotten it to a point where everything is in working order, including fixing Issue #1 . I'm wondering if you'd be interested in updating with my code, or possibly consent to me taking over maintenance of the mod.
You can see a summary of my changes in my commit message on the branch I created. Note that this version actually requires the beta branch, since it patches one of the new actions and I'm not sure at present how to tell SpirePatch to only patch a class if it exists and not error out if it doesn't. It might be appropriate to create a new branch for that reason.

ModTheSpire.json, pom.xml: Incremented minor version number since this is a bugfix release. Additionally, added a compoonent version numbers section to make updating external library version numbers easier and a Steam.path value so location of mod components can easily be changed.

SneckoMod.java: updates
com.megacrit.cardcrawl.helpers.CardHelper.getColor now takes 3 int parameters  instead of 3 doubles; this call has been adjusted accordingly.

SneckoCharacter.java: updates
AbstractCharacter has been updated, so SneckoCharacter required certain changes; it needed to implement getPortraitImageName().

There is no longer a damageFlash member in the AbstractPlayer or CustomPlayer class, so lines referencing it in the render function of SneckoCharacter have been commented out pending replacement or removal. I'm not sure what it used to do, and it seems to work fine without them, so if anyone knows more feel free to get in touch.

MasterEyePower.java, ReduceCostRelic.java,  ReduceMostExpensiveCardAction.java: bugfixing cost reducers
modifyCostForTurn is no longer a supported method for the AbstractCard class and the atStartOfTurnPostDraw() method of cards are called after draw actions have been put on the action manager stack, but not before those draw actions have been processed. Because of this, MasterEyePower and ReduceCostRelic now add a new ReduceMostExpensiveCardAction to the bottom of the action manager in their atStartOfTurnPostDraw() methods, which uses modifyCostForCombat(-1) on a randomly selected card in hand with max cost. This modification of cost for combat is more consistent with overall snecko mechanics.

SnekproofRandomizeHandCostPatch.java, SnekproofConfusionPatch.java: Fixing Snekproof mechanic
Sneckproof cards are set up to un-randomize cost via logic in their a triggerWhenDrawn() method which is currently called before ConfusionPower.onCardDraw(card) randomizes costs; this rendered the snekproof mechanic non-functional. I have added SnekproofConfusionPatch to return early in ConfusionPower.onCardDraw(card) if card has the SNEKPROOF tag, preventing confusion from randomizing these cards at all. Additionally, RandomizeHandCostAction (called with the new beta branch snecko potion) is patched to not randomize the cost of cards with the snekproof tag.

AbstractSneckoCard.java: Major Bugfix

Issue:
When unknown cards generated a card which was previously generated by an unknown card and then exhausted, it would be almost (or entirely) invisible, apparently reflecting the final frame of the exhaust animation.
Additionally, when multiple unknown cards in the deck generated the same card, those cards were actually the _same_card_, in that they only existed once in your hand if you drew both and two number keys would play them, which led to some crazy UI bugs in both hand and draw/discard pile display.
Exhausting invisible cards "fixed" their rendering in exhaust pile; Save and quit->continue run didn't fix either of these problems, fully exiting the game fixed invisible cards but not duplicate cards.

Explanation:
Cards generated by Unknown Cards are all pointing to same instance of that card, which is returned by CardLibrary.cards.get(tmp.get(AbstractDungeon.cardRng.random(0, tmp.size() - 1))). They have the same UUID, exhausted cards were still exhausted causing invisibility bug, and duplicate cards were literally the same card at 2 places in your draw pile, causing all manner of havoc.
using a more robust standard gitignore for maven-based java projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant