Should damaged items have a standard activation failure rate, and odd formula for a set of cases
Is your feature request related to a problem? Please describe.
There's a number of use_action effect_on_conditions item activations that have this odd formula to determine the chance to succeed:
{ "math": [ "rng(0, 10) - n_damage_level() > 5" ] }. As far as I can tell, damage level goes from 0 (undamaged) to 5 (XX level damage), and my interpretation of the formula is that you have a 5/11 chance to activate an undamaged item (roll 6-10), and a 0/11 chance for an XX item, with the range in between for the other damage levels.
While it makes sense that a destroyed item shoudln't work, a pristine one should work every time.
I would rework the formula to rng(0, 4)- damage level >= 0 for 100% chance at pristine, 80% at first damage level, etc. down to 0% at XX. An alternative formula would e.g. be rng (0, 16) - damage_level * damage_level >= 0 for 100% at pristine, then 16/17, 13/17, 8/17, 1/17, and 0% chance for an accelerating decay.
The first question is whether this kind of logic should be incorporated into the standard use_action item transformation, so e.g. damaged flashlights would also have a failure chance, without the need invoke EOC magic for every item individually. This ought to be accompanied with a standard failure message in the vein of "Activation of the %s failed." (where %s would include the damage level, providing a clue as to the cause, although you could also explicitly say "damaged" to drive it home).
Solution you would like.
Implement a linear activation failure risk for damaged item using the standard item transformation use action (you'd still have to make individual decisions for the specialized ones, such as "mp3").
Describe alternatives you have considered.
- Do nothing.
- Use a different formula.
Additional context
No response
If it stays in EOC format it should use test_eoc to standardize it
Otherwise there can be a hardcoded function call which determines the damage level and elides these problems.
I agree a standard item operation to determine whether an item activation succeeds or not based on damage would be useful, as it could be called by multiple operations trying to activate items (like "mp3", as well as direct action ones such as for pickaxes and tazers). However, that "only" deals with the issue of using a consistent formula. You still have to apply it and issue messages when appropriate, which would have to be done by the callers of that operation. We also have a lot of cases where failures are already implemented, such as guns, where you'd probably have to revise the code to use the new operation to handle the failure due to damage part (I believe guns can fail for a lot of other reasons, so you probably can't just replace the current logic there).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.