non-stacking typed bonuses

Game engine, mechanics, coding

Moderators: creator, avatar

Post Reply
User avatar
wedex
Posts: 38
Joined: 01 Sep 2020, 05:35

non-stacking typed bonuses

Post by wedex »

(List of bonuses at the end of the post.)

while study monster still settles n gets more feedback, i have been cooking some code to add non-stacking typed bonuses

So bassically im adding a daemon "typed_bonus_d" with a few functions like:
add_typed_bonus(object myplayer, string source, string mycategory, string mytype, int value)
examples: (this code should go into the spell)
add_typed_bonus(TP, "/cmds/spells/a/armor#9137", "ac", "armor", 4)
add_typed_bonus(TP, "/cmds/spells/h/
haste#9257", "ac", "dodge", 1)
resulting in a mapping like this:
typed_ac_bonus (["total":9,"natural":(["sources":(["random_spell3":2,"random_spell2":4,"random_spell":3,]),"subtotal":4,]),"armor":(["sources":(["/cmds/spells/a/armor#9137":4,]),"subtotal":4,]),"dodge":(["sources":(["/cmds/spells/h/haste#9257":1,]),"subtotal":1,]),])

so far i have this working for ac but it should be working for dmg, att, and hp very soon.
stats, skills, saves and resistances might take me a bit more time cuz it nests once again for the subcategory (str, dex, con for example)

for now im gonna consider this 8 categories, but any help adding more or optimizing the code will be appreciated.

on add typed bonuses, if the value is higher than a subtotal, it updates the subtotal and total with the difference and updates add_ac_bonus accordingly.
on remove typed bonuses it do needs to recalculate the type subtotal, then the total and then updates add_ac_bonus accordingly. (im still improving this logic)

so what do u think about performance n use?

so according to pfsrd there are the following bonuses:
alchemical
armor
bab
circumstance
competence
deflection
dodge
enhancement
inherent
insight
luck
morale
natural
profane
racial
resistance
sacred
shield
size
trait

User avatar
wedex
Posts: 38
Joined: 01 Sep 2020, 05:35

Re: non-stacking typed bonuses

Post by wedex »

to explain why: this would allow to cast heroism on top of resistance, without them stacking, but using the higher bonus while is active (heroism has duration while resistance is until dispelled)

hades
Posts: 35
Joined: 08 Jul 2020, 02:28

Re: non-stacking typed bonuses

Post by hades »

I whole kindheartedly agree.

Been an advocate on limiting stacking 100%.

Though word of warning... if AC is likely going to be the biggest headache. I'd suggest leaving that for last as AC will likely require a huge audit of not only spells but also shapeshifting / gear / spells.

tsera
Posts: 10
Joined: 16 Jun 2020, 18:06

Re: non-stacking typed bonuses

Post by tsera »

I think spells should not stack with each other, but to keep items and feats worthwhile, spells should stack with them. Each type such as spell, gear, or feat shouldn’t stack like bonuses within their own type, but should stack with other types to keep aligned with how attack and dmg bonuses are able, and to keep the items and feats ‘useful’

User avatar
wedex
Posts: 38
Joined: 01 Sep 2020, 05:35

Re: non-stacking typed bonuses

Post by wedex »

hades wrote: 23 Jan 2021, 18:35

I whole kindheartedly agree.

Been an advocate on limiting stacking 100%.

Though word of warning... if AC is likely going to be the biggest headache. I'd suggest leaving that for last as AC will likely require a huge audit of not only spells but also shapeshifting / gear / spells.

just to be clear, im not touching anything inside of add_ac_bonus, instead, each spell has to be fixed.
in heroism and resistance for example:
they both have add_saving_bonus and the flag target->set_property("morale-boost", 1); and they block the casting of each other.
the idea is to get rid of the flag and use add_typed_bonus(target, file_name(TO), "save", "morale", "all", thacobonus) instead of add_saving_bonus("all", thacobonus)
im already evaluating inside add_typed_bonus if i should do a add_saving_bonus or not.

current scenario is:
i cast resistance spell, i get +1 to all saves
i try to cast heroism but i cant cuz its of the same family as resistance, despite heroism being stronger.

with new mechanics the scenario will be:
i cast resistance spell, i get +1 morale to all saves
i cast heroism and get (based on my current level) +2 morale to all saves and attack. (the saves wont stack with resistance cuz both are morale bonus)
once heroism worns off, i keep +1 to saves cuz i still have resistance active.

tsera wrote: 23 Jan 2021, 18:45

I think spells should not stack with each other, but to keep items and feats worthwhile, spells should stack with them. Each type such as spell, gear, or feat shouldn’t stack like bonuses within their own type, but should stack with other types to keep aligned with how attack and dmg bonuses are able, and to keep the items and feats ‘useful’

this doesnt mean heroism stacks with resistance, it means i can cast both and the stronger one gets precedence. this can also be used in features (like bards granting morale bonuses). for now im not getting item bonuses into it cuz i havent considered it yet. also, items laready are worked in a way they dont stack, so i dont want to mess with that (yet).
what can be considered is to have some items give buffs to the user, for example a holy weapon giving a sacred bonus, but this mechanic (as im coding it) should not replace set_item_bonus
few spells and most feats have unnamed bonuses so they usually stack with everything (like weapon focus) this leads to 2 conclusions:
most passive stuff wont be touched.
mos activable stuff will need revision to check if it grants unnamed bonus (no action required) or a typed bonus (replace some of the code).

and this will also allow to block stuff like undead having morale bonuses centralized in a single block of code

User avatar
ilmarinen
Posts: 180
Joined: 21 Mar 2019, 22:32

Re: non-stacking typed bonuses

Post by ilmarinen »

There is a cheaper path to this feature: severely limiting number of allowed concentration spells.

User avatar
wedex
Posts: 38
Joined: 01 Sep 2020, 05:35

Re: non-stacking typed bonuses

Post by wedex »

i took a break for some personal stuff, but the patch is at about 70%. i might need 1-2 more weeks maybe to make sure nothing crashes

User avatar
draem
Posts: 2
Joined: 03 Apr 2021, 22:27

Re: non-stacking typed bonuses

Post by draem »

Poke?

User avatar
wedex
Posts: 38
Joined: 01 Sep 2020, 05:35

Re: non-stacking typed bonuses

Post by wedex »

i had some issues irl that delayed its advance. when i finish NB i will continue.
current progress is:
damage ok
attack ok
saves ok
skills ok
stats ok
damage resistance ok
ac "omg so many spells not yet"

User avatar
draem
Posts: 2
Joined: 03 Apr 2021, 22:27

Re: non-stacking typed bonuses

Post by draem »

Maybe push it to a branch so we can look?
AC spells can be massedited.

Post Reply