keeperfx icon indicating copy to clipboard operation
keeperfx copied to clipboard

Small Refactor for thing_stats.c

Open walt253 opened this issue 1 year ago • 1 comments

Reordered stuff in thing_stats.c.

Removed boolean argument on compute_creature_max_armour the buff is now checked on calculate_correct_creature_armour.

Added calculate_correct_creature_defense and calculate_correct_creature_dexterity and change few functions accordingly (see creature_states_combt.c - thing_creature.c - thing_shots.c).

Removed dungeon modifier on project_creature_attack_melee_damage and compute_creature_attack_melee_damage as it's no longer required since calculate_correct_creature_strength is now used where it should be (see thing_creature.c).

walt253 avatar Oct 04 '24 03:10 walt253

Note: calculate_correct_creature_defense and calculate_correct_creature_dexterity added because I plan to add a dungeon modifier for them.

walt253 avatar Oct 04 '24 03:10 walt253

Regarding last commit, for modifiers I use TbBool is_neutral_thing to check if owner is neutral, so I added on this function an extra check for case when owner is player 9 so it doesn't try to get its dungeon.

I could add another function if you think it's more appropriate but then I would need to update all the conditions and one could consider player 9 (all players) to be same as neutral. Let me know!

walt253 avatar Oct 23 '24 02:10 walt253

Disregard my last comment, I had to make a new check anyway to avoid potentials problems with unrelated functions using is_neutral_thing so I made a is_valid_player_id for dungeons modifiers.

walt253 avatar Oct 23 '24 19:10 walt253

I merged in the cosmetic stuff from #3653

Loobinex avatar Nov 15 '24 01:11 Loobinex