Download Lua/CharacterEffectCompositeDef/CageFighting.generated.lua from sirnii/myspace: direct link, hf CLI and curl.
- Browser
- Download file 899 Bytes
-
https://huggingface.co/spaces/sirnii/myspace/resolve/main/Lua/CharacterEffectCompositeDef/CageFighting.generated.lua
- Command line
-
hf download hf://spaces/sirnii/myspace/Lua/CharacterEffectCompositeDef/CageFighting.generated.lua
-
curl -L -o CageFighting.generated.lua https://huggingface.co/spaces/sirnii/myspace/resolve/main/Lua/CharacterEffectCompositeDef/CageFighting.generated.lua
899 Bytes
| -- ========== GENERATED BY CharacterEffectCompositeDef Editor DO NOT EDIT MANUALLY! ========== | |
| UndefineClass('CageFighting') | |
| DefineClass.CageFighting = { | |
| __parents = { "CharacterEffect" }, | |
| __generated_by_class = "CharacterEffectCompositeDef", | |
| object_class = "CharacterEffect", | |
| unit_reactions = { | |
| PlaceObj('UnitReaction', { | |
| Event = "PreUnitTakeDamage", | |
| Handler = function (self, target, damage, attacker, attack_target, hit) | |
| if target:HasStatusEffect("CageFightingToTheDeath") then return end | |
| if target == attack_target then | |
| local hpTotal = Max(0, target.HitPoints - damage) | |
| local maxHp = target:GetInitialMaxHitPoints() -- without wounds | |
| local hpLoseAt = MulDivRound(maxHp, CageFightingLostAtPercent, 100) | |
| if hpTotal < hpLoseAt then | |
| Msg("CageFightingLose", target) | |
| return target.HitPoints - hpLoseAt | |
| end | |
| end | |
| end, | |
| }), | |
| }, | |
| } | |