-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Liquid attacks can do damage, apply flags, apply effects #71584
Conversation
This sounds pretty cool! The only issue I'm seeing is that it might not be immediately obvious that low breathability contributes to liquid attack protection, but I'm drawing a blank on how to communicate this to the player. |
There will be messaging in the logs that should help. This is also a change worth writing/editing helpfiles over. |
Please go through mattacks, not the hardcoded monattack stuff - that keeps the dodge calcs etc consistent and much more flexible. |
Can do. |
I'd factor out the poncho change to a separate, simple PR. It doesn't really fit into this PR apart from being a mitigation avenue. A separate PR would probably be approved well before this PR is ready. Water proof materials aren't breathable, as far as I understand, but many water resistant ones are, and there's no such property in the game, which I guess is why we end up with water proof + breathable. |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@@ -1945,6 +1950,171 @@ void outfit::absorb_damage( Character &guy, damage_unit &elem, bodypart_id bp, | |||
} | |||
} | |||
|
|||
std::string outfit::get_liquid_descriptor( int liquid_remaining ) | |||
{ | |||
std::string liquid_descriptor = "some"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of this is extracted for translation, you'll need to use the call to translation function, e.g.
liquid_descriptor += string_format( _( "%s", liquid_descriptor ) );
if( !destroy ) { | ||
// The roll here is 0 because we already rolled to see if the attack hurts the armor. | ||
// Not -1 so that we can't splash items with 0 coverage. | ||
if( secondary_sbp != sub_bodypart_id() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither secondary_sbp
nor sbp
is guaranteed to be non-null at this point, this whole if block will likely result in a crash or undefined behavior.
} | ||
// If this is an armor-damaging liquid, the damage is relative to fluid_remaining | ||
// and the coverage of the item. | ||
if( damage.amount >= 1.0f && damage_armor ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole block should probably be replaced to calls with item::damage_armor_durability and other related functions, to avoid duplication. (Also because right now it isn't doing things like checking if the armor is unbreakable, etc
guy.add_effect( spell_effect, dur_td, bp, permanent, intensity ); | ||
} | ||
} | ||
if( liquid_remaining == liquid_amount && !guy.is_avatar() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is _avatar() check is redundant (and erroneous), this message can be handled with Character::add_msg_player_or_npc. Assuming that you are working around the vision check, it would still be better to opt it with Character::add_msg_if_player
// If any containers were destroyed, dump the contents on the ground | ||
map &here = get_map(); | ||
for( item &remain : worn_remains ) { | ||
here.add_item_or_charges( guy.pos(), remain ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of this should be handled by Character::drop_invalid_inventory()
// Acid damages clothes directly, but should only harm players via the corroding effect | ||
// However, something like boiling water should just deal damage instantly. guy_damage == true if so. | ||
if( damage_target ) { | ||
guy.deal_damage( nullptr, bp, damage_instance( damage.type, damage.amount ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Source should be the caster, not nullptr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Break up your PRs, this is becoming a problem rather than a reminder.
I'm getting the impression that you are working on some main feature and "fixing other things as you notice them". That kind of thing is tolerable when the main feature and the "while I'm at it"'s are pretty small, but that is not the case here.
There was some of that here, but mostly it was that in this case my starting goal was to move acid and bile over to this system and it unexpectedly required me to do a bunch of work on armor and materials. I'll go ahead and split the bile stuff off from this one and see if that can get merged first. |
Summary
Features "Liquid attacks can do damage, apply flags, damage items, and apply effects"
Purpose of change
edit: This PR is being split up. Part 1 (boomers) is now in #71964
#69555 was a step toward creating liquid attacks that actually respect what a character is wearing, but it still fell short as it was relying only on a simple wet protection check, and could only apply effects. Our game has the player getting splashed with all kinds of stuff pretty frequently, so it would be nice to have a better simulation.
Describe the solution
Creates the splash_attack() function, which simulates splashing a volume of liquid onto a character.
Expands Magic code to support splash attacks
Reworks boomers and huge boomers
Partially reworks acid-spitting zombies
Fixes and updates nonphysical armor
Describe alternatives you've considered
Once this is merged and there are no issues, the plan is as follows:
After that, the sky's the limit. I think slimes could probably do something interesting with this - imagine a boss slime in some evil slime lair that splashes you with a fluid that gives you slime mutations in an attempt to assimilate you. Free mutations until you get one too many and cease to exist. Or how about vombie, the zombie that vomits diseases on you? At the very least we need to make the sewer slimes explode in a shower of lifestyle-sapping grossness.
Testing
These gloves are 95% steel on the outside (acid resistance 7), leaving a 5% chance that the acid will affect the canvas where there is no metal (acid resistance 4)
This brigandine, reversed from the gloves, is 100% canvas on the outside, 90% steel on the inside. Because the outer layer covers 100%, the steel is not counted in the item's acid resistance - the acid splashes the outside of the garment and potentially damages it there. Note that physical non-environmental resistances are unchanged.
Fire, being non-physical environmental damage, doesn't respect thickness and averages the value of all included materials according to their coverage. This is, per notes in the code, the intended behavior, but it wasn't averaging, it was just adding layers together while also not respecting thickness.
Additional context
Acidic zombies, being the most basic form, frequently damage basic clothes, but only infrequently damage tougher materials like leather, and will never damage rubber, metal or plastic.
I'm a player, what do I do about all this?