From cde03d988c8d0a7816738f2b08ce2ce7c86cbc5d Mon Sep 17 00:00:00 2001 From: Krutoy242 Date: Thu, 15 Aug 2024 13:44:02 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=92=99fix=20`challenger`=20armor?= =?UTF-8?q?=20trait=20error=20on=20getting=20damage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/cot/trait/mods/scalinghealth.zs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/cot/trait/mods/scalinghealth.zs b/scripts/cot/trait/mods/scalinghealth.zs index 91102a441..fa07676a9 100644 --- a/scripts/cot/trait/mods/scalinghealth.zs +++ b/scripts/cot/trait/mods/scalinghealth.zs @@ -47,14 +47,14 @@ b.localizedDescription = game.localize('e2ee.tconstruct.material.challenger.desc b.maxLevel = 4; b.getModifications = function(trait, player, mods, armor, damageSource, damage, index) { if (damage <= 0.0) return mods; - val bonus = getArmorBonus(trait, armor, player); + val bonus = getAnyBonus(1, player); mods.armorMod *= bonus; mods.toughnessMod *= bonus; return mods; }; b.onDamaged = function (trait, armor, player, source, damage, newDamage, evt) { if (player.world.remote || newDamage <= 0) return newDamage; - val bonus = getArmorBonus(trait, armor, player); + val bonus = getAnyBonus(1, player); showFX(player, player.x, player.y, player.z, bonus); return newDamage; }; @@ -76,13 +76,6 @@ function getToolBonus(trait as Trait, tool as IItemStack, entity as IEntity) as return getAnyBonus(data.level, entity); } -function getArmorBonus(trait as ArmorTrait, tool as IItemStack, entity as IEntity) as double { - if (isNull(trait)) return 1.0; - val data = trait.getData(tool); - if (isNull(data)) return 1.0; - return getAnyBonus(data.level, entity); -} - function getAnyBonus(level as double, entity as IEntity) as double { val areaDiff = entity.world.getAreaDifficultyAt(entity.position); return getBonus(areaDiff, level);