1 /** 2 * \file mon-blows.h 3 * \brief Functions for managing monster melee. 4 * 5 * Copyright (c) 1997 Ben Harrison, David Reeve Sward, Keldon Jones. 6 * 2013 Ben Semmler 7 * 8 * This work is free software; you can redistribute it and/or modify it 9 * under the terms of either: 10 * 11 * a) the GNU General Public License as published by the Free Software 12 * Foundation, version 2, or 13 * 14 * b) the "Angband licence": 15 * This software may be copied and distributed for educational, research, 16 * and not for profit purposes provided that this copyright and statement 17 * are included in all such copies. Other copyrights may also apply. 18 */ 19 20 #ifndef MON_BLOWS_H 21 #define MON_BLOWS_H 22 23 #include "player.h" 24 #include "monster.h" 25 26 struct blow_message { 27 char *act_msg; 28 struct blow_message *next; 29 }; 30 31 struct blow_method { 32 char *name; 33 bool cut; 34 bool stun; 35 bool miss; 36 bool phys; 37 int msgt; 38 struct blow_message *messages; 39 int num_messages; 40 char *desc; 41 struct blow_method *next; 42 }; 43 44 extern struct blow_method *blow_methods; 45 46 /** 47 * Storage for context information for effect handlers called in 48 * make_attack_normal(). 49 * 50 * The members of this struct are initialized in an order-dependent way 51 * (to be more cross-platform). If the members change, make sure to change 52 * any initializers. Ideally, this should eventually used named initializers. 53 */ 54 typedef struct melee_effect_handler_context_s { 55 struct player * const p; 56 struct monster * const mon; 57 struct monster * const t_mon; 58 const int rlev; 59 const struct blow_method *method; 60 const int ac; 61 const char *ddesc; 62 bool obvious; 63 bool blinked; 64 int damage; 65 } melee_effect_handler_context_t; 66 67 /** 68 * Melee blow effect handler. 69 */ 70 typedef void (*melee_effect_handler_f)(melee_effect_handler_context_t *); 71 72 struct blow_effect { 73 char *name; 74 int power; 75 int eval; 76 char *desc; 77 byte lore_attr; /* Color of the attack used in lore text */ 78 byte lore_attr_resist; /* Color used in lore text when resisted */ 79 byte lore_attr_immune; /* Color used in lore text when resisted strongly */ 80 char *effect_type; 81 int resist; 82 int lash_type; 83 struct blow_effect *next; 84 }; 85 86 extern struct blow_effect *blow_effects; 87 88 /* Functions */ 89 int blow_index(const char *name); 90 char *monster_blow_method_action(struct blow_method *method, int midx); 91 extern melee_effect_handler_f melee_handler_for_blow_effect(const char *name); 92 93 #endif /* MON_BLOWS_H */ 94