BaseMod icon indicating copy to clipboard operation
BaseMod copied to clipboard

OnSmith method for Relics should be called on different moment

Open Problembeloeser opened this issue 7 years ago • 3 comments

Right now, OnSmith is called, when you click the Smith button at a rest room. But u can just go back and click it again to trigger the method infinitely at one singular restroom. It should be called, when a card is actually upgraded.

Problembeloeser avatar Apr 18 '18 14:04 Problembeloeser

onSmith is part of the base game so I won't be changing it's function. Should BaseMod add a separate hook for card upgrades, for example a onUpgrade event that mods could subscribe to?

daviscook477 avatar Apr 19 '18 03:04 daviscook477

Since the method upgrade in AbstractCard is an abstract method it can't be directly patched so instead I've patched upgradeName. Currently every card calls it when upgraded but if in the future a card doesn't call upgradeName this hook would break for that card in particular. Here's my idea on how to fix this (https://github.com/daviscook477/BaseMod/tree/feature/upgrade-hook) but it has some issues. Namely that this is called any time a card instance is upgraded and since the game likes to duplicate card instance and upgrade them when displaying potential upgrades this event would fire way too often,

daviscook477 avatar Apr 19 '18 04:04 daviscook477

Yeah, a seperate hook would be nice. Although i don't know why this onSmith hook is placed there in the first place. I don't think it is even used in StS.

Problembeloeser avatar Apr 19 '18 16:04 Problembeloeser