Slay the Spire

Slay the Spire

Halation
sadoni 16 Feb, 2019 @ 10:06pm
Crash when picking up Jar of Greed card with Smart Phone
Just had a crash after selecting a Smart Phone card and picking up a new copy of Jar of Greed. Relevant crash log attached.

06:04:11.506 INFO unlock.UnlockTracker> Already seen: MadScienceMod:NowOrNever
06:04:11.506 INFO unlock.UnlockTracker> Already seen: MadScienceMod:ExploreOptions
06:04:11.509 INFO unlock.UnlockTracker> Already seen: MadScienceMod:PowerArmor
06:04:14.007 INFO helpers.CardHelper> Obtained MadScienceMod:ExploreOptions (UNCOMMON). Creating new map entry.
06:04:14.007 INFO unlock.UnlockTracker> Already seen: MadScienceMod:ExploreOptions
06:04:14.025 INFO unlock.UnlockTracker> Already seen: Pot Of Greed
06:04:14.025 INFO helpers.CardHelper> No need to track rarity type: SPECIAL
06:04:14.028 INFO basemod.BaseMod> publish on post obtain card
06:04:14.031 DEBUG the_gatherer.GathererMod> COUNT_TEST = 25
Exception: java.lang.NullPointerException
06:04:14.541 ERROR core.CardCrawlGame> Exception caught
java.lang.NullPointerException: null
at HalationCode.relics.aobuta.SmartPhone.onObtainCard(SmartPhone.java:78) ~[Halation.jar:?]
at com.megacrit.cardcrawl.vfx.cardManip.ShowCardAndObtainEffect.update(ShowCardAndObtainEffect.java:101) ~[?:?]
at com.megacrit.cardcrawl.dungeons.AbstractDungeon.update(AbstractDungeon.java:2630) ~[?:?]
at com.megacrit.cardcrawl.core.CardCrawlGame.update(CardCrawlGame.java:878) ~[?:?]
at com.megacrit.cardcrawl.core.CardCrawlGame.render(CardCrawlGame.java:429) [?:?]
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225) [?:?]
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126) [desktop-1.0.jar:?]
Controllers: removed manager for application, 0 managers active
Game closed.
Last edited by sadoni; 16 Feb, 2019 @ 10:07pm
< >
Showing 1-4 of 4 comments
sadoni 16 Feb, 2019 @ 10:12pm 
Just repeated it. Relevant crash log.

06:11:24.722 INFO unlock.UnlockTracker> Already seen: MadScienceMod:Bombardment
06:11:24.722 INFO unlock.UnlockTracker> Already seen: MadScienceMod:Poke
06:11:24.724 INFO unlock.UnlockTracker> Already seen: MadScienceMod:BandageBot
06:11:25.773 INFO core.CardCrawlGame> PAUSE()
06:11:26.675 INFO core.CardCrawlGame> RESUME()
06:11:32.637 INFO helpers.CardHelper> Obtained MadScienceMod:Poke (UNCOMMON). Creating new map entry.
06:11:32.637 INFO unlock.UnlockTracker> Already seen: MadScienceMod:Poke
06:11:32.655 INFO unlock.UnlockTracker> Already seen: Pot Of Greed
06:11:32.655 INFO helpers.CardHelper> No need to track rarity type: SPECIAL
06:11:32.657 INFO basemod.BaseMod> publish on post obtain card
06:11:32.658 DEBUG the_gatherer.GathererMod> COUNT_TEST = 22
Exception: java.lang.NullPointerException
06:11:33.170 ERROR core.CardCrawlGame> Exception caught
java.lang.NullPointerException: null
at HalationCode.relics.aobuta.SmartPhone.onObtainCard(SmartPhone.java:78) ~[Halation.jar:?]
at com.megacrit.cardcrawl.vfx.cardManip.ShowCardAndObtainEffect.update(ShowCardAndObtainEffect.java:101) ~[?:?]
at com.megacrit.cardcrawl.dungeons.AbstractDungeon.update(AbstractDungeon.java:2630) ~[?:?]
at com.megacrit.cardcrawl.core.CardCrawlGame.update(CardCrawlGame.java:878) ~[?:?]
at com.megacrit.cardcrawl.core.CardCrawlGame.render(CardCrawlGame.java:429) [?:?]
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225) [?:?]
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126) [desktop-1.0.jar:?]
Controllers: removed manager for application, 0 managers active
Game closed.06:11:24.722 INFO unlock.UnlockTracker> Already seen: MadScienceMod:Bombardment
06:11:24.722 INFO unlock.UnlockTracker> Already seen: MadScienceMod:Poke
06:11:24.724 INFO unlock.UnlockTracker> Already seen: MadScienceMod:BandageBot
06:11:25.773 INFO core.CardCrawlGame> PAUSE()
06:11:26.675 INFO core.CardCrawlGame> RESUME()
06:11:32.637 INFO helpers.CardHelper> Obtained MadScienceMod:Poke (UNCOMMON). Creating new map entry.
06:11:32.637 INFO unlock.UnlockTracker> Already seen: MadScienceMod:Poke
06:11:32.655 INFO unlock.UnlockTracker> Already seen: Pot Of Greed
06:11:32.655 INFO helpers.CardHelper> No need to track rarity type: SPECIAL
06:11:32.657 INFO basemod.BaseMod> publish on post obtain card
06:11:32.658 DEBUG the_gatherer.GathererMod> COUNT_TEST = 22
Exception: java.lang.NullPointerException
06:11:33.170 ERROR core.CardCrawlGame> Exception caught
java.lang.NullPointerException: null
at HalationCode.relics.aobuta.SmartPhone.onObtainCard(SmartPhone.java:78) ~[Halation.jar:?]
at com.megacrit.cardcrawl.vfx.cardManip.ShowCardAndObtainEffect.update(ShowCardAndObtainEffect.java:101) ~[?:?]
at com.megacrit.cardcrawl.dungeons.AbstractDungeon.update(AbstractDungeon.java:2630) ~[?:?]
at com.megacrit.cardcrawl.core.CardCrawlGame.update(CardCrawlGame.java:878) ~[?:?]
at com.megacrit.cardcrawl.core.CardCrawlGame.render(CardCrawlGame.java:429) [?:?]
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225) [?:?]
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126) [desktop-1.0.jar:?]
Controllers: removed manager for application, 0 managers active
Game closed.
sadoni 24 Feb, 2019 @ 8:53pm 
Found another fun one. Also crashes with Rhapsodic Nightmare curse.

04:51:36.410 INFO elementalist_mod.ElementalistMod> ElemLog: CardRewardPatch>Prefix(...)
04:51:36.410 INFO elementalist_mod.ElementalistMod> ElemLog: rarity: UNCOMMON
04:51:36.414 INFO elementalist_mod.ElementalistMod> ElemLog: relics: false, false, false, false
04:51:36.417 INFO elementalist_mod.ElementalistMod> ElemLog: Strike from Beyond
04:51:36.421 INFO elementalist_mod.ElementalistMod> ElemLog: relics: false, false, false, false
04:51:36.425 INFO unlock.UnlockTracker> Already seen: Strike_from_Beyond
04:51:36.426 INFO helpers.CardHelper> Obtained Strike_from_Beyond (UNCOMMON). Creating new map entry.
04:51:36.426 INFO unlock.UnlockTracker> Already seen: Strike_from_Beyond
04:51:36.443 INFO basemod.BaseMod> publishPostExhaust
Exception: java.lang.NullPointerException
04:51:36.911 ERROR core.CardCrawlGame> Exception caught
java.lang.NullPointerException: null
at HalationCode.relics.aobuta.SmartPhone.onObtainCard(SmartPhone.java:78) ~[Halation.jar:?]
at com.megacrit.cardcrawl.vfx.cardManip.ShowCardAndObtainEffect.update(ShowCardAndObtainEffect.java:101) ~[?:?]
at com.megacrit.cardcrawl.dungeons.AbstractDungeon.update(AbstractDungeon.java:2640) ~[?:?]
at com.megacrit.cardcrawl.core.CardCrawlGame.update(CardCrawlGame.java:878) ~[?:?]
at com.megacrit.cardcrawl.core.CardCrawlGame.render(CardCrawlGame.java:429) [?:?]
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225) [?:?]
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126) [desktop-1.0.jar:?]
Controllers: removed manager for application, 0 managers active
Game closed.
Aphid 30 May, 2019 @ 4:32am 
Also crashes with any effect that lets you obtain a card in combat. For example, when using the Disciple's 'Tempo' card:


11:07:16.301 ERROR core.CardCrawlGame> Exception caught
java.lang.NullPointerException: null
at HalationCode.relics.aobuta.SmartPhone.onObtainCard(SmartPhone.java:78) ~[Halation.jar:?]
at com.megacrit.cardcrawl.vfx.cardManip.ShowCardAndObtainEffect.update(ShowCardAndObtainEffect.java:101) ~[?:?]
at com.megacrit.cardcrawl.dungeons.AbstractDungeon.update(AbstractDungeon.java:2640) ~[?:?]
at com.megacrit.cardcrawl.core.CardCrawlGame.update(CardCrawlGame.java:878) ~[?:?]
at com.megacrit.cardcrawl.core.CardCrawlGame.render(CardCrawlGame.java:429) [?:?]
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225) [?:?]
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126) [desktop-1.0.jar:?]
Controllers: removed manager for application, 0 managers active

Suggestion to fixing all these crashes: @Smartphone.java;78: Check whether SmartPhonePatch exists? It extends "RewardItem" which may not exist outside of card rewards. SmartPhone should only trigger if there's a card reward, so just doing nothing instead (doTheThing = False, return) seems fine here.

In addition to this, SmartPhone seems a little buggy. It sometimes appears to deal damage to me even if I click on a card that has the phone over it. Sometimes two phones will appear in card rewards. Other times the SmartPhone, because of after-combat effects/card rewards from cards that happen while a card choice happens to be visible (e.g. from Scar in the Animator), will decide to deal 10 damage to you randomly. I've gotten killed a few times by it already.

If I may direct the reader's attention to src/main/java/HalationCode/patches/SmartPhonePatch.java,lines 28-31.

The variable RNG is set twice and over-written, thus the Smart Phone will never pick the Singing bowl.

Now look at the lines below. when smartCard was set previously, it is not un-set. The same holds for smartSkip and smartBowl. I suggest doing the following instead;


if (rng == __instance.cards.size()) {
smartSkip = true;
smartBowl = false;
smartCard = null;
} else if (rng == __instance.cards.size() + 1) {
smartSkip = false;
smartBowl = true;
smartCard = null;
} else {
smartCard = __instance.cards.get(rng);
smartSkip = false;
smartBowl = false;
}

Fixing the random-damage-from-card-rewards-of-other-types issue is perhaps a little more complicated. I do not know whether it's possible to access the reward instance from the AbstractCard. What you can perhaps do is a sanity check.

When SmartPhonePatch randomizes the 'card that does not deal damage', do not only store this card ID. Also store the card IDs of the cards that actually do deal damage. If the obtained card is not one of these cards, then obviously smart phone was not meant to activate here.

This leaves a rare scenario where the random obtained card just happens to be the same. Not sure how to catch that. If you could access the rewardItem instance from the AbstractCard you might. (I.e. actually rigorously check whether the obtained card was from a card choice)

Other mods may include additional alternate choices that are not cards as well (like singing bowl). These appear unhandled; so the phone will never pick them. But it also won't ever deal damage. I'll post a followup if I find any.

Edit: Alternatively, you can perhaps fix some of these issues by setting isCombat = true only Post-battle, not Pre-battle.

That reminds me; I'll have to check whether or not the smart phone triggers on card rewards from Shrines and the like (e.g. a shrine that says 'pick a rare card' should trigger the phone, but I have a feeling that it won't, as there's no PreBattle event fired. The same applies to the Library event). I have a suspicion the earlier bugfix (it triggering in stores) might have over-done it; the phone can now wrongly not trigger in situations.
Last edited by Aphid; 30 May, 2019 @ 4:37am
Aphid 30 May, 2019 @ 4:49am 
List of cases where smartphone does not trigger, but it should:

<currently empty>

List of cases where smartphone does trigger, but it should not:

1) The "Transmogrifier" shrine. (Transform a card). Base game event. Smart phone damage triggers upon receiving the card when the card received does not happen to be the card randomized in the last card choice offered.
< >
Showing 1-4 of 4 comments
Per page: 1530 50