aboutsummaryrefslogtreecommitdiffstats
path: root/src/inventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 41fe661..0ed5dc7 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -75,14 +75,15 @@ void InventorySystem::loadItems(void) {
auto atk = itm->FirstChildElement("attack");
if (atk != nullptr) {
Attack attack;
- attack.power = 0;
- atk->QueryIntAttribute("power", &attack.power);
attack.offset = atk->StrAttribute("offset");
attack.range = atk->StrAttribute("range");
attack.vel = atk->StrAttribute("velocity");
attack.accel = atk->StrAttribute("accel");
if (atk->Attribute("effect") != nullptr)
- attack.effect.appendGIF(atk->StrAttribute("effect"));
+ attack.effect.appendGIF(atk->StrAttribute("effect"));
+ auto script = atk->GetText();
+ attack.script = LuaScript(script != nullptr ? script : "");
+ AttackSystem::initLua(attack.script);
attackList.emplace(item.name, attack);
}