Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Gloompashcy
Copy link
Contributor

Introduces various features that expand upon the functionality provided by #994, including:

  • The ability to define the default level up behaviour of all hands and scoring parameters
  • Re-implementation of the level_up_hand function in scoring parameters, allowing scoring params to have their own default behaviour
  • Addition of level_up_hand function to Poker Hands, which has the same functionality as the same function in Scoring Parameters, but takes priority over it
  • Restructuring of SMODS.upgrade_poker_hands to use default upgrade behaviour if no args.func function is defined
  • SMODS.upgrade_poker_hands now passes args.level_up as a parameter into args.func
  • New util function SMODS.change_default_hand_upgrade_func which changes the default behaviour for all hands/scoring params
  • New util function SMODS.get_default_hand_upgrade_func which creates a function based on the level_up_hand functions from a given hand and scoring param
  • This created function takes four params: base, the initial value of the parameter being upgraded, hand, the name of the hand being upgraded, parameter, the name of the scoring parameter being upgraded, and amount, the number the level is being increased by
  • SMODS.hand_upgrade_func is the default behaviour of all poker hands and scoring parameters without a defined level_up_hand function; by default it is the following function:
SMODS.hand_upgrade_func = function(base, hand, parameter, amount)
    return math.max(base + G.GAME.hands[hand]['l_' .. parameter] * amount, 0)
end

Additional Info:

  • I didn't modify api's or I've made a PR to the wiki repo.
  • 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.

Adds the ability to alter the default behaviour of the `level_up_hand` function by changing the function that it passes into `SMODS.upgrade_poker_hands`
To facilitate this, the functions `SMODS.get_default_level_up(poker_hand, _parameter)` and `SMODS.change_default_level_up(_func, poker_hand, _parameter)` have been added, which return and replace the value of `SMODS.level_up_hand_func` respectively
Renamed Functions
`SMODS.get_default_hand_upgrade_func` now creates a function from `PokerHand:level_up_hand` or `Scoring_Parameter:level_up_hand`
If args.func is not defined in `SMODS.upgrade_poker_hands`, it now uses the result of `SMODS.get_default_hand_upgrade_func`
`agrs.func` is no longer defined in `level_up_hand` calls
Changes the `behaviour` param in `SMODS.get_default_hand_upgrade_func` to `default` that is returned instead of `SMODS.hand_upgrade_func` if the provided hand and scoring parameter do not have a defined `level_up_hand`
@Gloompashcy
Copy link
Contributor Author

Currently a draft because the changes to level_up_hand will probably cause compatibility problems

The initial `SMODS.PokerHand` `SMODS.gameobject:extend()` call no longer defines level_up_hand
`SMODS.Scoring_Parameter.level_up_hand` and `SMODS.upgrade_hand_func` now set the new value of the parameter, rather than returning the new value
`math.max` on the value in `SMODS.Scoring_Parameter.level_up_hand`
@Gloompashcy Gloompashcy marked this pull request as ready for review December 21, 2025 08:16
@Gloompashcy
Copy link
Contributor Author

Changed from returning new values to setting them to match with #994
However, the amount parameter passed into SMODS.Scoring_Parameter.level_up_hand is now the number of level ups rather than the change in the scoring param value

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