dragons will now attack if player goes near its hoard
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
#include "constants.h"
|
||||
#include "player.h"
|
||||
#include "level.h"
|
||||
#include "enemies/dragon.h"
|
||||
|
||||
enemy_base::enemy_base(RNG *rng, const feature enabled_features,
|
||||
const enum race &nrace, const position &pos,
|
||||
@ -17,6 +18,10 @@ int enemy_base::get_room_num() const {
|
||||
long_result enemy_base::act(level *lvl, character *pc, bool hostile) {
|
||||
if (is_adjacent(pos, pc->get_pos()) && hostile)
|
||||
return attack(pc);
|
||||
else if (race == DRAGON &&
|
||||
is_adjacent(static_cast<dragon * >(this)->get_guards(),
|
||||
pc->get_pos()))
|
||||
return attack(pc);
|
||||
|
||||
if (enabled_features & FEATURE_ENEMIES_CHASE && hostile &&
|
||||
distance_sqr(pos, pc->get_pos()) <= DIST_THRESHOLD_SQR) {
|
||||
|
Reference in New Issue
Block a user