Updated gl_compute_damage example script to work as 1:1 reflection of vanilla damage formula

- In hope that this will make it easier for someone to write his own damage formula
This commit is contained in:
phobos2077
2023-05-14 22:50:33 +02:00
parent 493003af54
commit e6e941e14c
3 changed files with 91 additions and 35 deletions
+10 -1
View File
@@ -35,7 +35,7 @@
#define WEAPON_TYPE_UNARMED (1)
#define WEAPON_TYPE_MELEE (2)
#define WEAPON_TYPE_THROWN (3)
#define WEAPON_TYPE_GUNS (4)
#define WEAPON_TYPE_RANGED (4)
/* Item Flags (FlagsExt in proto) */
#define HEALING_ITEM 0x04000000 // Healing Item (item will be used by NPCs for healing in combat) [sfall 4.3.1/3.8.31]
@@ -502,6 +502,15 @@
#define C_ATTACK_KNOCKBACK_VALUE5 (0xB0)
#define C_ATTACK_KNOCKBACK_VALUE6 (0xB4)
#define CRITICAL_VALUE_MULT (0) // This is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage.
#define CRITICAL_VALUE_EFFECTS (1) // This is a flag bit field (DAM_*) controlling what effects the critical causes.
#define CRITICAL_VALUE_STAT_CHECK (2) // This makes a check against a (SPECIAL) stat. Values of 2 (endurance), 5 (agility), and 6 (luck) are used, but other stats will probably work as well. A value of -1 indicates that no check is to be made.
#define CRITICAL_VALUE_STAT_MOD (3) // Affects the outcome of the stat check, if one is made. Positive values make it easier to pass the check, and negative ones make it harder.
#define CRITICAL_VALUE_FAIL_EFFECT (4) // Another bit field, using the same values as EFFECTS. If the stat check is failed, these are applied in addition to the earlier ones.
#define CRITICAL_VALUE_MSG (5) // The message to show when this critical occurs, taken from combat.msg .
#define CRITICAL_VALUE_FAIL_MSG (6) // Shown instead of Message if the stat check is failed.
/* Playback mode defines for the soundplay function */
#define soundraw (0x80000000) // sfall flag
#define Stereo8bit (soundstereo)
+1
View File
@@ -273,6 +273,7 @@
#define weapon_attack_mode1(pid) (get_proto_data(pid, PROTO_FLAG_EXT) bwand 0x0000000F)
#define weapon_attack_mode2(pid) ((get_proto_data(pid, PROTO_FLAG_EXT) bwand 0x000000F0) / 0x10)
#define weapon_attack_mode(pid, attackType) (weapon_attack_mode1(pid) if attackType == ATKTYPE_LWEP1 or attackType == ATKTYPE_RWEP1 else weapon_attack_mode2(pid))
/* SFALL_FUNCX MACROS */