dungeon/src/Shaman.cpp

44 lines
980 B
C++
Raw Permalink Normal View History

2017-09-17 13:43:13 +02:00
#include "Shaman.h"
#include "BehaviourTree.h"
#include "BehaviourTreeSelector.h"
#include "WanderNode.h"
#include "RestNode.h"
#include "IfSeeFriendNode.h"
#include "HealFriendNode.h"
2017-09-26 15:49:11 +02:00
#include "AttackEnemyNode.h"
2017-09-17 13:43:13 +02:00
#include "FleeNode.h"
2017-09-23 22:06:36 +02:00
BehaviourTree* shamtree = nullptr;
2018-01-09 21:59:05 +01:00
Shaman::Shaman(vec2i pos) : Actor(pos) {
2017-09-24 00:15:28 +02:00
name = "Shaman";
2017-09-17 13:43:13 +02:00
alive = true;
health = 2;
2017-09-26 15:49:11 +02:00
health_max = 2;
2017-09-17 13:43:13 +02:00
strength = 1;
2017-09-26 15:49:11 +02:00
range = 6;
sprite_id = 's';
faction = FACTION_GOBS;
sprite_color = Color(0.2, 0.7, 0.6, 1);
2017-09-17 13:43:13 +02:00
2017-09-23 22:06:36 +02:00
if (shamtree == nullptr) {
auto * root = new BehaviourTreeSelector(nullptr);
shamtree = new BehaviourTree(root);
2017-09-17 13:43:13 +02:00
{
2017-09-23 22:06:36 +02:00
auto * seefriend = new IfSeeFriendNode(root);
auto * fsel = new BehaviourTreeSelector(seefriend);
{
new HealFriendNode(fsel);
2017-09-26 15:49:11 +02:00
new AttackEnemyNode(fsel);
2017-09-23 22:06:36 +02:00
}
2017-09-17 13:43:13 +02:00
2017-09-23 22:06:36 +02:00
new FleeNode(root);
new WanderNode(root);
}
2017-09-17 13:43:13 +02:00
}
2017-09-23 22:06:36 +02:00
bt = shamtree;
2017-09-17 13:43:13 +02:00
}
2017-09-23 22:06:36 +02:00
Shaman::~Shaman() = default;