finish npcs

This commit is contained in:
ErikasKontenis
2019-12-10 16:16:58 +02:00
parent d32157e4cb
commit c99f5c5e45
35 changed files with 942 additions and 175 deletions

View File

@@ -321,6 +321,9 @@ bool BehaviourDatabase::loadActions(ScriptReader& script, NpcBehaviour* behaviou
} else if (identifier == "burning") {
action->type = BEHAVIOUR_TYPE_BURNING;
searchType = BEHAVIOUR_PARAMETER_TWO;
} else if (identifier == "drunk") {
action->type = BEHAVIOUR_TYPE_BURNING;
searchType = BEHAVIOUR_PARAMETER_TWO;
} else if (identifier == "setquestvalue") {
action->type = BEHAVIOUR_TYPE_QUESTVALUE;
searchType = BEHAVIOUR_PARAMETER_TWO;
@@ -496,6 +499,9 @@ NpcBehaviourNode* BehaviourDatabase::readValue(ScriptReader& script)
} else if (identifier == "burning") {
node = new NpcBehaviourNode();
node->type = BEHAVIOUR_TYPE_BURNING;
} else if (identifier == "drunk") {
node = new NpcBehaviourNode();
node->type = BEHAVIOUR_TYPE_DRUNK;
} else if (identifier == "level") {
node = new NpcBehaviourNode();
node->type = BEHAVIOUR_TYPE_LEVEL;
@@ -1032,6 +1038,14 @@ int32_t BehaviourDatabase::evaluate(NpcBehaviourNode* node, Player* player, cons
return damage->getTotalDamage();
}
case BEHAVIOUR_TYPE_DRUNK: {
Condition* condition = player->getCondition(CONDITION_DRUNK);
if (!condition) {
return false;
}
return true;
}
case BEHAVIOUR_TYPE_POISON: {
Condition* condition = player->getCondition(CONDITION_POISON);
if (!condition) {

View File

@@ -85,6 +85,7 @@ enum NpcBehaviourType_t
BEHAVIOUR_TYPE_BLESS, // add blessing to player
BEHAVIOUR_TYPE_CREATECONTAINER, // create a container of an item in particular
BEHAVIOUR_TYPE_TOWN, // change player town
BEHAVIOUR_TYPE_DRUNK, // get/set drunk (set not done)
};
enum NpcBehaviourOperator_t