Difference between revisions of "Combat damage h.nss"
From Dragon Age Toolset Wiki
(→Combat_Damage_GetBackstabDamage) |
(→Notable Functions) |
||
Line 5: | Line 5: | ||
=== Notable Functions === | === Notable Functions === | ||
+ | |||
+ | ==== GetCriticalDamageModifier ==== | ||
+ | |||
+ | Returns the multiplier for critical hit damage. | ||
+ | |||
+ | <dascript> | ||
+ | const float COMBAT_CRITICAL_DAMAGE_MODIFIER = 1.5f; // critical hits increase damage by up to this factor. | ||
+ | |||
+ | float GetCriticalDamageModifier(object oAttacker) | ||
+ | { | ||
+ | return COMBAT_CRITICAL_DAMAGE_MODIFIER + (GetCreatureProperty(oAttacker, 54 /*PROPERTY_ATTRIBUTE_CRITICAL_RANGE*/) / 100.0); | ||
+ | } | ||
+ | </dascript> | ||
==== Combat_Damage_GetBackstabDamage ==== | ==== Combat_Damage_GetBackstabDamage ==== | ||
− | Determines the backstab damage given attacker | + | Determines the backstab damage given attacker and attack damage. (weapon is passed in for future use) |
Note: This function was slightly modified from the toolset version to remove some non-essential elements for clarity. | Note: This function was slightly modified from the toolset version to remove some non-essential elements for clarity. | ||
Revision as of 19:37, 28 October 2009
Contents
Overview
combat_damage_h.nss handles the core rule resolution logic for non-spell damage.
Notable Functions
GetCriticalDamageModifier
Returns the multiplier for critical hit damage.
Combat_Damage_GetBackstabDamage
Determines the backstab damage given attacker and attack damage. (weapon is passed in for future use) Note: This function was slightly modified from the toolset version to remove some non-essential elements for clarity.
float Combat_Damage_GetBackstabDamage(object oAttacker, object oWeapon, float fDamage) { // ------------------------------------------------------------------------ // Each backstab is an auto crit. // ------------------------------------------------------------------------ fDamage *= GetCriticalDamageModifier(oAttacker); // ------------------------------------------------------------------------- // Exploit Weakness: Backstab Damage + max(CUN-10,0) / 3.0 // ------------------------------------------------------------------------- if (HasAbility(oAttacker,ABILITY_TALENT_EXPLOIT_WEAKNESS)) { float fBase = MaxF(0.0,(GetAttributeModifier(oAttacker,PROPERTY_ATTRIBUTE_CUNNING)/3.0)) ; float fMod = MaxF(0.2,RandomFloat()); fDamage += (fBase * fMod); } return fDamage; }