add 'set_cost' and 'set_sell_cost' contexts#1114
add 'set_cost' and 'set_sell_cost' contexts#1114vitellaryjr wants to merge 3 commits intoSteamodded:mainfrom
Conversation
There was a problem hiding this comment.
Similarly to other calculation keys, it might be preferred to send the card's current/expected cost in the context and then update the value in the context via SMODS.update_context_flags(), since currently any consequent calculation returns will simply override the value rather than modify it afaik
|
aye, good call; have done that now |
Eremel
left a comment
There was a problem hiding this comment.
Been taking a look at this today and my main issue with this is how frequently Card:set_cost is called, and the timing of it being called allowing no way to check why the function is running. I'm not sure on if there is a better place to move this too or not, but I think it needs a bit more thought. There are also a couple of changes to the flag updating that I would like to do before merging if we can find a better place for it (I'm also not against merging if there isn't a better place fyi)
Some examples I've found briefly:
Opening the collection calls set_cost on every collection card (this is easy to fix, but a common mod like TooManyJokers has the same issue and no easy identifier)
Redeeming a voucher calls set_cost three times - once on a "base" card and twice on a voucher card
Opening standard packs calls set_cost on eaxch included card even though they can't be sold
Starting a new run calls it on every initial card in the deck
Changing the edition of a card
these contexts can be used to create effects that alter the cost and sell value of cards dynamically. needs to be 2 contexts, so that the original sell value can be based on the new cost, while also allowing new sell values to be based on the original sell value. 'tis a little ugly (and will be mildly annoying to document in a concise way), but it's the best way i could find to do it and make it sufficiently flexible
Additional Info: