nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
129 stars 93 forks source link

[Feature request] Get/SetCriticalMultiplier(object oPlayer, int nBaseItem) #820

Closed silent-rock closed 4 years ago

silent-rock commented 4 years ago

I'm not sure if it's possible, but it would be an awesome feature to have to be able to modify weapon's critical hit multiplier via nwnx_weapon plugin like the Weapon Master's Increased multiplier feat does.

Baaleos commented 4 years ago

While not technically the same as a crit multiplier - the nwnx_damage plugin could adjust the damage to your hearts content, based on the same criteria.

/// @struct NWNX_Damage_AttackEventData /// @brief Attack Event Data struct NWNX_Damage_AttackEventData { object oTarget; ///< The target who took the damage int iBludgeoning; ///< Bludgeoning damage int iPierce; ///< Piercing damage int iSlash; ///< Slashing damage int iMagical; ///< Magical damage int iAcid; ///< Acid damage int iCold; ///< Cold damage int iDivine; ///< Divine damage int iElectrical; ///< Electrical damage int iFire; ///< Fire damage int iNegative; ///< Negative damage int iPositive; ///< Positive damage int iSonic; ///< Sonic damage int iBase; ///< Base damage int iAttackNumber; ///< 1-based index of the attack in current combat round int iAttackResult; ///< 1=hit, 3=critical hit, 4=miss, 8=concealed int iAttackType; ///< 1=main hand, 2=offhand, 3-5=creature, 6=haste int iSneakAttack; ///< 0=neither, 1=sneak attack, 2=death attack, 3=both };

You could catch the attack data, see if it is a critical hit, see if you have the required feat and then adjust the damage to match whatever you want.

Eg: If the players has the FIRE_WEAPON_FEAT (I just made that up) The weapon has fire damage + it is a critical hit, then you double the fire damage etc.

mtijanic commented 4 years ago

Should be easy. Just an exclusive hook on CNWSCreatureStats::GetCriticalHitMultiplier, call original, then read additional modifier from POS. There's also CNWSCreatureStats::GetCriticalHitRoll for the threat range.

jd28 commented 4 years ago

Anyone interested in implementing something like this might well look at how Acaos did it https://github.com/NWNX/nwnx2-linux/tree/master/plugins/weapons approx. 12 years ago.

jd28 commented 4 years ago

Maybe a Lua implementation could help as well: https://github.com/jd28/Solstice/blob/develop/src/solstice/rules/weapons.lua#L522-L633

WilliamDraco commented 4 years ago

897 provides scope to resolve this using OnEquip scripts in conjunction with feats, or similar.

I believe this issue may be closed.