From 9eca23b2e16f7206cb0ebaa2abfb99e2159391eb Mon Sep 17 00:00:00 2001 From: ErikasKontenis Date: Thu, 5 Dec 2019 17:15:19 +0200 Subject: [PATCH] implement absorbDrown damage properly on items --- data/items/items.srv | 2 +- data/movements/movements.xml | 2 +- data/movements/scripts/misc/helmet_of_the_deep.lua | 4 ---- src/items.cpp | 2 ++ src/movement.cpp | 4 ++++ 5 files changed, 8 insertions(+), 6 deletions(-) delete mode 100644 data/movements/scripts/misc/helmet_of_the_deep.lua diff --git a/data/items/items.srv b/data/items/items.srv index 52301d3..ea14faa 100644 --- a/data/items/items.srv +++ b/data/items/items.srv @@ -24674,7 +24674,7 @@ TypeID = 5460 Name = "a helmet of the deep" Description = "Enables underwater exploration" Flags = {Take,Armor} -Attributes = {Weight=21000,SlotType=HEAD,ArmorValue=2} # TODO: Drown protection! +Attributes = {Weight=21000,SlotType=HEAD,ArmorValue=2,AbsorbDrown=100} TypeID = 5461 Name = "pirate boots" diff --git a/data/movements/movements.xml b/data/movements/movements.xml index 3844810..676ad85 100644 --- a/data/movements/movements.xml +++ b/data/movements/movements.xml @@ -671,7 +671,7 @@ - + diff --git a/data/movements/scripts/misc/helmet_of_the_deep.lua b/data/movements/scripts/misc/helmet_of_the_deep.lua deleted file mode 100644 index 74091fb..0000000 --- a/data/movements/scripts/misc/helmet_of_the_deep.lua +++ /dev/null @@ -1,4 +0,0 @@ -function onEquip(player, item, slot) - player:removeCondition(CONDITION_DROWN) - return true -end \ No newline at end of file diff --git a/src/items.cpp b/src/items.cpp index e87c360..8259ff0 100644 --- a/src/items.cpp +++ b/src/items.cpp @@ -402,6 +402,8 @@ bool Items::loadItems() items[id].getAbilities().absorbPercent[combatTypeToIndex(COMBAT_FIREDAMAGE)] += script.readNumber(); } else if (identifier == "absorbpoison") { items[id].getAbilities().absorbPercent[combatTypeToIndex(COMBAT_EARTHDAMAGE)] += script.readNumber(); + } else if (identifier == "absorbdrown") { + items[id].getAbilities().absorbPercent[combatTypeToIndex(COMBAT_DROWNDAMAGE)] += script.readNumber(); } else if (identifier == "absorblifedrain") { items[id].getAbilities().absorbPercent[combatTypeToIndex(COMBAT_LIFEDRAIN)] += script.readNumber(); } else if (identifier == "absorbmanadrain") { diff --git a/src/movement.cpp b/src/movement.cpp index 184a44a..0dc15bf 100644 --- a/src/movement.cpp +++ b/src/movement.cpp @@ -646,6 +646,10 @@ uint32_t MoveEvent::EquipItem(MoveEvent* moveEvent, Player* player, Item* item, player->sendIcons(); } + if (it.abilities->absorbPercent[combatTypeToIndex(COMBAT_DROWNDAMAGE)] == 100) { + player->removeCondition(CONDITION_DROWN); + } + if (it.abilities->regeneration) { Condition* condition = Condition::createCondition(static_cast(slot), CONDITION_REGENERATION, -1, 0);