Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RDY] Enhancement - Extinguishers reduce chance of machines exploding #1648

Merged
merged 12 commits into from Jul 17, 2020

Conversation

lewri
Copy link
Member

@lewri lewri commented Jun 16, 2020

Would resolve #994

PR will implement a variable saved_by_extinguisher to each machine/object defaulted at 0.
When machine threshold falls <1, the variable is recalculated by math.random(0,1) to see if an extinguisher in the room will save the room (saved_by_extinguisher == 1 is a success). Variable is saved until the machine is next used (inc. earthquake tick), in which case it sets back to 0.

The addition of self.saved_by_extinguisher may not be needed in object.lua... it was added more as a safeguard.

As for machine_dialog.lua nothing needs to be changed. The health marker in the dialogue is not affected if the number of times a machine is used is higher than its strength.

50/50 if there is an extinguisher present in the room with a machine about to break
@lewri lewri requested a review from TheCycoONE June 16, 2020 20:15
@TheCycoONE
Copy link
Member

I feel that 50% is too generous given how inexpensive and small extinguishers are. Maybe 10-25% Thoughts?

@lewri
Copy link
Member Author

lewri commented Jun 17, 2020

I don't have a problem per se reducing percentage but given the catastrophic nature of earthquakes I would say reducing it too much would nullify any effect of this enhancement.

There's something that I just posted in #1649 with mugmuggy that might be of relevance here with this enhancement (if we acted on it at all). probably not acting on it in the same way now.

@lewri
Copy link
Member Author

lewri commented Jun 18, 2020

What about 33%?

If it survives one use, it's second use puts the chance at ~11%. (Even though that's technically not real maths)

@mugmuggy
Copy link
Contributor

This is why I indicated what the original code does as the chance starts out say between 11% and 25% of crashing, to 80-90% and then guaranteed. The stronger a machine is - the more researched it is - the more likely its to survive. Could have something like 20% chance for each use above the strength value and potentially additional extinguishers, reduce that by 5%, maybe or diminishing return for each extinquisher. Obviously have to track additional information to record this.

@lewri
Copy link
Member Author

lewri commented Jun 19, 2020

Do we want a calculation of that complexity these days? That's my own concern.
(It's not technically that complex, just would a simple flat value not suffice?)

@TheCycoONE
Copy link
Member

I like the escalating chance for all machines with a slight reduction for extinguishers. As I said, I don't think the effect of extinguishers should be nearly as pronounced as this PR makes them; and that would also help balance against earthquakes a bit.

@lewri

This comment has been minimized.

As to be more accurate to original game.
@lewri
Copy link
Member Author

lewri commented Jun 20, 2020

I have implemented the old TH method as above.
I made one change, in that I think an extinguisher must be present to benefit from any chance of a room not exploding. No extinguisher in room = it will explode.

I think we might need to cap the grant from extinguishers in the room; as currently it reduces explosion chance by 5% for every extinguisher in the room.

Maybe it should be capped at 4, so there is still 5% chance of exploding minimum.

@mugmuggy
Copy link
Contributor

That looks like a reasonable compromise between the too harsh now and the original, that was my suggestion and not exactly how TH works - there appears increased surivability chances with TH as strength is used in the calculation. An approximation to that would be to change the 0.25 constant to roughly 2 / strength instead.

@lewri
Copy link
Member Author

lewri commented Jun 21, 2020

Sounds like a good consideration to me (a constant of 0.05 is still needed to offset the first extinguisher).

I would also like to ensure that explosion_chance can never get to 0 though. So I would suggest there's a minimum value of 0.05 at all times. And maybe also maxing out at 0.95 until we reach the guaranteed explosion conditions...

Calculation now 2/strength
Also explosion_chance capped to not go below 0.05 or exceed 0.95. Guaranteed explosion reserved for the must explode criteria.
@lewri
Copy link
Member Author

lewri commented Jun 22, 2020

This is ready for review again

Noticed they weren't matching up with coding change
@lewri lewri added this to In progress in 0.65 Release Jul 13, 2020
@lewri lewri changed the title [RFC] Enhancement - Extinguishers reduce chance of machines exploding [RDY] Enhancement - Extinguishers reduce chance of machines exploding Jul 17, 2020
@lewri
Copy link
Member Author

lewri commented Jul 17, 2020

Marking as ready as I don't perceive we need any more changes here

@TheCycoONE TheCycoONE merged commit 08a0493 into CorsixTH:master Jul 17, 2020
0.65 Release automation moved this from In progress to Done Jul 17, 2020
@lewri lewri deleted the patch-2 branch May 28, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.65 Release
  
Done
Development

Successfully merging this pull request may close these issues.

Fire extinguishers don't impact explosion chance
3 participants