Repository navigation
Commit bbe9a6b
committed
Add CombatFormulas::CalcWeaponDamage and the explosion damage path
CalcWeaponDamage works out the damage of one attack before armour, for combat
and for the figure an item card shows. ID 2209001.
For a launcher that is only half the story. A Fat Man's WEAP record is worth 18
damage, because the launcher is a tube and nearly all of the damage belongs to
the shell it fires. Reaching the shell takes two more functions, and they are
not interchangeable.
TESObjectWEAP::GetProjectile, which is static, returns what a weapon fires, or
null for one that fires nothing. The instance data's own override is preferred,
then the base form's, and the ammunition's projectile stands in when neither
names one, so a barrel that swaps the projectile and a change of ammunition are
both followed. ID 2198934.
Explosion::GetDamage returns what a blast already in the world is worth. It
multiplies the explosion record's damage by that explosion's own damageMult,
keeps the result in calculatedDamage and hands the same number back every time
afterwards, so everything the engine asks about one blast agrees with itself.
ID 2236658.
Which of the two applies depends on whether anything has been fired. An item
card describes a weapon that has fired nothing, so there is no Explosion to ask
and CombatFormulas::GetWeaponDisplayDamage calls GetProjectile and reads the
explosion record directly. A blast in the world calls Explosion::GetDamage
instead. The two routes reach the same figure through different code.
Explosion::GetActorOwner resolves an explosion's owner handle and returns it
only when it names an actor, which is the aggressor a blast's blows are credited
to. ID 2236659.1 parent 29e7ac3 commit bbe9a6b
4 files changed
Lines changed: 65 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
45 | 59 | | |
46 | 60 | | |
47 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
77 | 105 | | |
78 | 106 | | |
79 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1036 | 1036 | | |
1037 | 1037 | | |
1038 | 1038 | | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
1039 | 1045 | | |
1040 | 1046 | | |
1041 | 1047 | | |
| |||
2322 | 2328 | | |
2323 | 2329 | | |
2324 | 2330 | | |
| 2331 | + | |
2325 | 2332 | | |
2326 | 2333 | | |
2327 | 2334 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
143 | 159 | | |
144 | 160 | | |
145 | 161 | | |
| |||
0 commit comments