luciensadi / AwakeMUD

The Community Edition fork of the 'Awakened Worlds' Shadowrun 3 MUD codebase.
Other
55 stars 30 forks source link

Drug system fixes #711

Closed jdevnull closed 10 months ago

jdevnull commented 10 months ago

To prevent drug tolerance and edge values from spiraling out of control, this PR blocks edge/tolerance increases from involuntary doses, and caps tolerance and edge to MAX_DRUG_TOLERANCE and MAX_DRUG_EDGE (both currently set to 10).

Involuntary dosing can only occur if addicted, so this creates what is essentially an addiction+ state, IS_TAKING_INVOLUNTARY, that can be returned by GET_DRUG_ADDICT(ch, drug_id). When we're in this state, then the code that increases tolerance/edge is skipped. It can take multiple doses to activate drug effects. IS_TAKING_INVOLUNTARY is only set/kept if no other doses for the current activation are deliberately taken.

jdevnull commented 10 months ago

We don't want to count involuntary doses in lifetime doses, otherwise that screws with the calculation of edge_delta (which is what is added to edge/tolerance) the next time deliberate doses are taken.

jdevnull commented 10 months ago

For now, let's put the edge reduction and testing / chem usage on the same timing.

The condition that I commented out tries to use fix_factor but is broken, since that value stays constant. So once days_since_last_fix exceeded the the fix_factor, that condition would cause testing / chem usage to happen every 2 minutes. We would be testing 24 times (if they managed to succeed every time) or use chems 48 times for every point of edge.

jdevnull commented 10 months ago

Using fix_factorfor the initial GET_DRUG_LAST_WITHDRAWAL_TICK for guided withdrawal lets the days_since_last_fix >= GET_DRUG_LAST_WITHDRAWAL_TICK condition match what I believe was intended for the testing / chem usage timing.

Setting GET_DRUG_ADDICTION_EDGE = 2 when transitioning from "NOT_ADDICTED" to "IS_ADDICTED" ensures that forced withdrawal will always face at least one test (since it is decremented before proceeding to testing).

High penalties when undergoing withdrawal makes a strong case for just letting such characters idle until withdrawal is complete. Reducing the penalties for undergoing withdrawal lets them continue playing and strengthens the argument to pay for guided withdrawal,