1 /* 2 * monsters.h - Monsters. 3 * 4 * Copyright (C) 2000-2013 The Exult Team 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 */ 20 21 #ifndef INCL_MONSTERS 22 #define INCL_MONSTERS 1 23 24 #include "actors.h" 25 #include "ignore_unused_variable_warning.h" 26 27 class Monster_actor; 28 29 /* 30 * Monsters get their own class because they have a bigger footprint 31 * than humans. 32 */ 33 class Monster_actor : public Npc_actor { 34 static Game_object_shared in_world; // All monsters in the world. 35 // Links for 'in_world' list. 36 Game_object_shared next_monster; 37 Monster_actor *prev_monster; 38 Animator *animator; // For wounded men. 39 void link_in(); // Add to in_world list. 40 void link_out(); // Remove from list. 41 void equip(const Monster_info *inf, bool temporary); 42 public: 43 Monster_actor(const std::string &nm, int shapenum, int num = -1, 44 int uc = -1); 45 ~Monster_actor() override; 46 // Create an instance. 47 static Game_object_shared create(int shnum); 48 static Game_object_shared create(int shnum, Tile_coord pos, 49 int sched = -1, int align = static_cast<int>(Actor::neutral), 50 bool temporary = true, bool equipment = true); 51 // Methods to retrieve them all: get_first_in_world()52 static Monster_actor *get_first_in_world() { 53 return in_world ? static_cast<Monster_actor *>(in_world.get()) 54 : nullptr; 55 } get_next_in_world()56 Monster_actor *get_next_in_world() { 57 return next_monster ? static_cast<Monster_actor *>(next_monster.get()) 58 : nullptr; 59 } 60 static void delete_all(); // Delete all monsters. give_up()61 static void give_up() { // For file errors only! 62 in_world = nullptr; 63 } move_aside(Actor * for_actor,int dir)64 bool move_aside(Actor *for_actor, int dir) override { 65 ignore_unused_variable_warning(for_actor, dir); 66 return false; // Monsters don't move aside. 67 } 68 // Render. 69 void paint() override; 70 // Step onto an (adjacent) tile. 71 bool step(Tile_coord t, int frame, bool force = false) override; 72 // Remove/delete this object. 73 void remove_this(Game_object_shared *keep = nullptr) override; 74 // Move to new abs. location. 75 void move(int newtx, int newty, int newlift, int newmap = -1) override; 76 // Add an object. 77 bool add(Game_object *obj, bool dont_check = false, 78 bool combine = false, bool noset = false) override; 79 int get_armor_points() const override; // Get total armor value. 80 // Get total weapon value. 81 const Weapon_info *get_weapon(int &points, int &shape, 82 Game_object *&obj) const override; is_monster()83 bool is_monster() const override { 84 return true; 85 } 86 void die(Game_object *attacker) override; // We're dead. 87 void write(ODataSource *nfile);// Write out (to 'monsnpc.dat'). 88 }; 89 90 #endif 91