-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Allow limbs to define MA techniques and unarmed damage, expand MA tech functionality #53939
Conversation
All damage types, mult before flat, encumbrance-based chances
Ondamage, duration, chance etc work
Tentacle kung fu here we come! |
Yeah, working on something similar to this right now. I called it "attack vectors" where you define which body parts can be used by a technique. A Jab uses EDIT: My draft for attack vectors #53954 |
Well I have ever so slightly accidentally broke it once, but this should be ready for review now. In case passing all damage types back from |
@@ -2135,7 +2209,7 @@ std::string Character::melee_special_effects( Creature &t, damage_instance &d, i | |||
std::string target = t.disp_name(); | |||
|
|||
if( has_active_bionic( bio_shock ) && get_power_level() >= bio_shock->power_trigger && | |||
( !is_armed() || weapon.conductive() ) ) { | |||
( weap.is_null() || weapon.conductive() ) ) { |
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.
Aren't weap
and weapon
the same in the end?
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.
Unless I misread weapon
refers back to the character's wielded weapon, whereas weap
is the argument passed to this function. attack_overwrite
techs instead pass null as their weap
.
I tried setting cur_weapon
to null before which would have been much cleaner but it made the player's weapon disappear on a trigger.
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.
When melee_special_effects
is called from melee_attack_abstract
, weap
parameter is cur_weapon
.
Then item *cur_weapon = allow_unarmed ? &used_weapon() : &weapon;
and used_weapon
is defined as martial_arts_data->selected_force_unarmed() ? null_item_reference() : weapon;
Basically if unarmed attack is allowed, currently wielded weapon (weapon
) will bed used unless martial art forces an unarmed attack.
What bothers me is melee_special_effects
using both weap
and weapon
in some checks. Say, you attack w/o weapon (because martial art forces you) and weap
is null_item_reference
, but you will still get zapped in case your weapon
is conductive and you will add fire damage if wielded weapon
has FLAMING
flag.
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.
Yes, the current sequence of the attack is weird like that. Ideally I'd imagine changing the sequence so that the attempted technique gets decided first setting the used weapon (forced unarmed/attack override or your wielded weapon), it uses that weapons' to-hit for the hit roll, then checking if the technique you were attempting succeeded (and applying the message/special effects/monster defense depending on what weapon you used). However, while that would make more sense it would also pretty much completely invalidate the current martial arts' sequencing of techniques and general balance - that isn't something I feel comfortable doing, especially not without having more of a plan for MAs than "it'll be neater under the hood".
Summary
Infrastructure "Enhance martial art techniques, allow limbs to define technique lists and unarmed damage boni"
Purpose of change
Infrastructure changes in preparation for reworking mutation special attacks as part of the limb project. Lays the groundwork to move them over from freebie procs to MA techniques and adds some functionality to techs to allow for moving as much mutation functionality over as possible.
Describe the solution
techniques
andtechnique_encumbrance_limit
(list and bool) to bodypart definitions. On querying the applicable melee techniques the part will return them as long as acurrent encumbrance in encumbrance tech limit
roll failstech_effects
to allow for a freely defined list of effects to apply on a successful trigger - by default only if the technique does damage, but that's overrideable withon_damage: false
req_character_flags
or being disabled on any of theforbidden_char_flags
attack_override
to simulate the melee tech replacing as much of the original attack as it's possible without rewriting the whole melee attack function (see alternatives) - it zeroes both its damage and movement cost and turns the attack unarmed for the purposes of melee special effects and skill training, instead using the tech'sflat_bonuses
unarmed_damage
to limb definitions, allowing the bodypart to define damage and armor penetration bonuses for every damage type. Currently the bonuses of all limbs stack, that should be easy enough to limit to the chosen attack vector when that system is in place.TODO:
Barring any objections move the stunning/downing MA techs over to theThe tech picking function incudes some checks to prevent you choosing a stunning tech on an already stunned enemy, so this would result in tech picking becoming a bit dumber. I'll just include the effect array in the demo techtech_effects
array and deprecating that codeweighting
already achieves this, more or less. Yay for undocumented features, I guess.Try adding unarmed damage boosts to limbs, but my track record isn't great with damage.cppShamelessly repurposing dseguin's armor code was easier than I expected. Bodyparts can now contribute to unarmed damage and armor penetration (per damage type), using any damage type provided they are either uncovered or are wearing armor withALLOW_NATURAL_ATTACKS
- it could stand to be a bit more gradual, but it works for now. I might look into arbitrary flag definitions (yoinked from mutations'allowed_items
, of course), but it works for a first passDescribe alternatives you've considered
attack_override
is clumsily special-cased here and there in the melee attack abstract code. The reason for that is that techniques only get chosen after a hit is rolled based on the weapon and crit, so the attack will still use the base weapons' to-hit and stamina cost in effect. The alternative would be to reorganize the whole function and decide on the attempted technique before the hit rolls(overriding the attack setting force_unarmed), which could then fail if e.g. an attempt at a crit tech failed to roll a crit in reality. I think that system would make more sense than waiting to hit and deciding "hey I was actually doing my super crit attack, no backsies!", but I also don't want to be the one doing that rewrite.If
attack_override
is seen as an insufficient solution I would need to turn mutant limb attacks into unarmed-only techs, which is workable but not ideal (you should take a bite out of your enemies occasionally if you have raptor fangs and are in melee, in my head).I hope turning on the other damage types for all melee attacks is acceptable, the alternative would be either checking if the tech downstream has any acid etc. components and only passing the type then or adding the damage type back in
perform_technique
, both of which are considerably more involved than removing a =.Gating any one from the effect list behind set character flags, but adding two/three separate techs to unhardcode venomous attacks seems like an acceptable amount of duplication.
Testing
Limbs add their melee techs to the tech list.
The techs use the requirements (including flags) as defined.
Effects are applied in the desired duration, chance and damage relation.
Added nonstandard damage types are applied on successful tech hits.
Attack_override replaces the base characteristics of the attack.
Unarmed damage and armor penetration is applied from limbs.
Additional context
@Hymore246 this might be of interest.
The tech effect code is the same system monster special attacks use with the serial numbers filed off and some fields removed. I tried using the newer JSON readers but I could not get it to work, and it does the job well enough.