Where should I be patching to change melee damage?

Started by ifly6, August 12, 2021, 06:33:57 PM

Previous topic - Next topic

ifly6

I'm trying to add something where if someone is wearing, say, a button down shirt, and wielding a ranged weapon, the ranged weapon will do more damage in Melee. I'm looking at something like patching RimWorld.Verb_MeleeAttackDamage#ApplyMeleeDamageToTarget but I have no idea whether this is the right entrance place in the absolutely enormous number of classes and methods to patch that change.

I also saw the MeleeDamage methods which create chances for hit, dodge, etc. And also how they apply damage. I just have no idea where the damage to be applied is actually calculated.

naryl

Don't know if it's the right place but patching VerbProperties.GetDamageFactorFor(Tool, Pawn, HediffComp_VerbGiver) worked for me. VerbProperties instance has IsMeleeAttack and you can check apparel through the Pawn argument.