diff options
Diffstat (limited to 'src/game-server/monstermanager.cpp')
-rw-r--r-- | src/game-server/monstermanager.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/game-server/monstermanager.cpp b/src/game-server/monstermanager.cpp index efdb4420..2d59d690 100644 --- a/src/game-server/monstermanager.cpp +++ b/src/game-server/monstermanager.cpp @@ -104,6 +104,7 @@ void MonsterManager::reload() } MonsterDrops drops; + bool attributesSet = false; for (xmlNodePtr subnode = node->xmlChildrenNode; subnode != NULL; subnode = subnode->next) @@ -118,9 +119,36 @@ void MonsterManager::reload() drops.push_back(drop); } } + else if (xmlStrEqual(subnode->name, BAD_CAST "attributes")) + { + attributesSet = true; + monster->setAttribute(BASE_ATTR_HP, XML::getProperty(subnode, "hp", -1)); + monster->setAttribute(BASE_ATTR_PHY_ATK_MIN, XML::getProperty(subnode, "attack-min", -1)); + monster->setAttribute(BASE_ATTR_PHY_ATK_DELTA, XML::getProperty(subnode, "attack-delta", -1)); + monster->setAttribute(BASE_ATTR_MAG_ATK, XML::getProperty(subnode, "attack-magic", -1)); + monster->setAttribute(BASE_ATTR_EVADE, XML::getProperty(subnode, "evade", -1)); + monster->setAttribute(BASE_ATTR_HIT, XML::getProperty(subnode, "hit", -1)); + monster->setAttribute(BASE_ATTR_PHY_RES, XML::getProperty(subnode, "physical-defence", -1)); + monster->setAttribute(BASE_ATTR_MAG_RES, XML::getProperty(subnode, "magical-defence", -1)); + // TODO: speed + // TODO: size + + //check for completeness + bool attributesComplete = true; + for (int i = BASE_ATTR_BEGIN; i < BASE_ATTR_END; i++) + { + if (monster->getAttribute(i) == -1) + { + attributesComplete = false; + monster->setAttribute(i, 0); + } + } + if (!attributesComplete) LOG_WARN(monsterReferenceFile<<": Attributes incomplete for monster #"<<id); + } } monster->setDrops(drops); + if (!attributesSet) LOG_WARN(monsterReferenceFile<<": No attributes defined for monster #"<<id); ++nbMonsters; } |