Jump to content

Opcode 12 (damage) and EE


Recommended Posts

Much of this is already known: EE expands the use of this opcode so that the special field can be used. In this case, the special field acts as a bitfield as described below.

 

 

Known values for the 'Special' field:
1 - Drain HP to Caster
2 - Transfer HP to Target
4 - Fist Damage Only
0x100 - Save for Half
0x200 - Made save
0x400 - Doesn't wake sleepers

 

 

----------------

Here is a more detailed explanation on life drain functionality (bits 1 and 2). In all cases, the healing amount is identical to the damage inflicted, so resistance against a certain damage type may reduce or even eliminate the amount of hitpoints gained. Damage and healing is not affected by the amount of hitpoints remaining if the creature is killed. For example you can inflict and gain 20 hit points with a Vampiric Touch even if the target has 1 hitpoint remaining.

----------------

If bit0 is set (1 - drain hp to caster) then the effects increases the caster's current and/or maximum hitpoints in the following manner:

  • if the the timing mode is permanent with no duration value specified (at dword 0xe) only the caster's current hp is increased, up to his/her normal maximum.
  • if a duration value is specified (at dword 0xe) then the caster's maximum hitpoints are temporarily increased by the same amount for a number of real time seconds that matches the duration value specified at 0xe. Current and maximum hitpoints are increased by the same amount regardless of injured/uninjured status of the caster.

The temporary maximum hitpoint increase is stored on the caster as an instance of opcode 18 with the special field set to 1.

 

These added maximum hitpoints do not carry any parent resource so you cannot use opcode 321 to dispel/remove previous instances of added max hitpoints. Also note that the added hitpoints are not dispellable (dispel type is set to 0)

----------------

bit1 (2 - transfer hp to target) works the same way as bit1 except the caster suffers damage and the target gains current (and maximum) hitpoints, as described above. In this case, there doesn't seem to be any limit on extra hitpoints beyond the normal maximum so you can repeatedly increase your max hitpoints. PS:T has similar behavior in Sensory Touch and Blood Bridge, although they both use a PS:T-specific opcode for this.

----------------

bit2 (4 - fist damage only) is used in MONKFLAM.eff via a set melee effect in SPCL238.spl. It applies damage onto a target creature if the caster is attacking with his/her fists.

----------------

bit3 (8) is identical to bit0, in all respects except that hitpoints are not added to the caster's current AND maximum hitpoints if any instances of opcode 18 with special field "1" are carried by the caster.

 

This prevents additional hitpoints from being gained by the life drain functionality of opcode 12 even if the caster were to gain more hitpoints. For example draining and gaining 1 hit point would prevent subsequent hitpoints (both current and maximum) from being added to the caster even if (s)he were to drain 20 hitpoints during this duration. Note that damage is always inflicted even if the caster would not gain hitpoints.

----------------

bit4 (16) seems to be unused

----------------

bit5 (32 - Suppress damage feedback) Does not show damage message in the combat log.

----------------

bit6 (64) and bit7 (128) seem to be unused

----------------

bit8 (256 - save for half) behavior that works if a saving throw is allowed. If this bit is set then the total damage applied will be halved on a successful saving throw instead of being eliminated. Most save-for-half effects in the non-EE games use two separate effects to achieve this (one with a save, one without) that results in two instances of damage text being shown in the combat log if the target fails its saving throw. The save-for-half flag is an elegant way to eliminate the excess text in the combat log and to use a single instance of opcode 12 to handle save-for-half behavior.

----------------

bit9 (512 - made save) "was implemented to support bit 8 (save for half). The saving throw is handled by a separate code (as in all engine versions), so it has to tell the damage opcode that the save was successful. You can indeed use it for exact expressions where one has to suffer xdy/2 damage. But it is best used with bit 8 so it can eliminate the lame double opcodes of fireball, lightning bolt, etc." -Avenger

----------------

bit10 (1024 - doesn't wake sleepers) EE changes the behavior of opcode 39 to awaken creatures on taking damage. Setting this bit in opcode 12 does not awaken creatures.

Edited by Galactygon
Link to comment

Bit0/1/3: The Timing Mode still needs to be "Permanent" when using a duration. Other timing modes do not calculate proper duration - it ends up with an extra (gametime(ticks) * 15) seconds added to its duration.

 

Bit0: For me, this one stacks with itself while Bit 3 does not stack with itself, though both stack with each other.

Bit3: It's identical to Bit 0, except it sets param2 of the Opcode 18 effect to (6) - Unknown, while Bit 0 sets it to (0) - Increment.

 

Bit9: Made save - This is actually "Fail for half". If you don't make the saving throw, whether because you failed it or there isn't one to make, you only take half damage. The only practical use I've found is for deal half-odd damage amounts, such as (5d3)/2.

Bit0: This one stacks for me while Bit 3 does not.

Link to comment

Bit 9 (made save) was implemented to support bit 8 (save for half). The saving throw is handled by a separate code (as in all engine versions), so it has to tell the damage opcode that the save was successful. You can indeed use it for exact expressions where one has to suffer xdy/2 damage. But it is best used with bit 8 so it can eliminate the lame double opcodes of fireball, lightning bolt, etc.

Link to comment

I've updated/clarified the differences between bit0 and bit3. I can confirm that bit3 is the noncumulative version of hp transfer in that if the recipient carries any instance of opcode 18 with special set to 1, then no current and maximum hitpoints are added.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...