Skip to content

Arcane Shield fix

Samuel Wegner requested to merge Effigy/t-engine4:arcane_shield_fix into master

Allow damage shields to merge

-This change was originally intended to fix a bug with Arcane Shield (http://forums.te4.org/viewtopic.php?f=42&t=44895), but I ended up creating an on_merge function for timed effect DAMAGE_SHIELD so now anything that creates damage shields will intelligently overwrite an existing shield.

-Will replace an existing damage shield entirely if both the shield value and duration would be greater on the new shield.

-Will update the current shield value (but not max value) of an existing shield if the new value would be greater. We keep the old max value because the player may want to buff their shield with Aegis.

-If we updated an existing shield, we will refresh the current duration based on the new shield's duration unless the duration has already been refreshed 20 times. This checks the same property used by Weapon of Light and Bathe in Light, which is why I allowed refreshing 20 times instead of a smaller amount.

-Will never update or replace an existing shield if the current duration is greater than the new shield's duration. We can't know whether the player values shield value or duration more, and updating the shield value of an existing damage shield with greater duration would introduce power creep.

-Will never merge a reflection shield with a normal shield. For merging two reflection shields, the lesser reflect value is used.

-Many shield sources (e.g., Shielding rune) are still disabled while the player has a damage shield. This is fine because the player can always cancel the current effect if they want to replace it. For merging, we're mainly concerned about back-end sources like Arcane Shield.

-EFF_DAMAGE_SHIELD and EFF_PSI_DAMAGE_SHIELD replace each other upon activation (existing behavior). I may address that in a different branch, but I need to investigate the consequences of changing it.

Merge request reports