Skip to content

Conversation

@vitellaryjr
Copy link
Contributor

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:

  • I didn't modify api's or I've made a PR to the wiki repo.
    • contexts need to be documented later
  • I didn't modify api's or I've updated lsp definitions.
  • I didn't make new lovely files or all new lovely files have appropriate priority.

Copy link
Contributor

@VivianGiacobbi VivianGiacobbi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@vitellaryjr
Copy link
Contributor Author

aye, good call; have done that now

Copy link
Member

@Eremel Eremel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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.

3 participants