Files
cc3k/src/enemies/dragon.cc

29 lines
750 B
C++

#include "dragon.h"
#include "../constants.h"
#include "../level.h"
dragon::dragon(RNG *rng, const feature enabled_features, const position &pos,
const int gen_room_num, const position &guards):
enemy_base{rng, enabled_features, DRAGON, pos, gen_room_num, "D"},
guards{guards} {}
const char *dragon::get_race_name() const {
return "Dragon";
}
long_result dragon::act(level *lvl, character *pc, bool hostile) {
if (is_adjacent(pos, pc->get_pos()) && hostile)
return attack(pc);
return {NOTHING, ""};
}
int dragon::dies(level *lvl) {
for (auto &g : lvl->get_glist())
if (g.get_pos() == guards)
g.unlock();
return 0;
}