1 /**
2  * @file
3  * @brief Misc Xom related functions.
4 **/
5 
6 #pragma once
7 
8 #include <string>
9 
10 #include "kill-method-type.h"
11 #include "maybe-bool.h"
12 #include "monster.h"
13 
14 using std::string;
15 
16 #define XOM_CLOUD_TRAIL_TYPE_KEY "xom_cloud_trail_type"
17 
18 struct item_def;
19 
20 enum xom_message_type
21 {
22     XM_NORMAL,
23     XM_INTRIGUED,
24     NUM_XOM_MESSAGE_TYPES
25 };
26 
27 enum xom_event_type
28 {
29     XOM_DID_NOTHING = 0,
30 
31     // good acts
32     XOM_GOOD_POTION,
33     XOM_GOOD_MAGIC_MAPPING,
34     XOM_GOOD_DETECT_CREATURES,
35     XOM_GOOD_DETECT_ITEMS,
36     XOM_GOOD_SPELL,
37     XOM_GOOD_CONFUSION,
38     XOM_GOOD_SINGLE_ALLY,
39     XOM_GOOD_ANIMATE_MON_WPN,
40     XOM_GOOD_RANDOM_ITEM,
41     XOM_GOOD_ACQUIREMENT,
42     XOM_GOOD_ALLIES,
43     XOM_GOOD_POLYMORPH,
44     XOM_GOOD_TELEPORT,
45     XOM_GOOD_MUTATION,
46     XOM_GOOD_LIGHTNING,
47     XOM_GOOD_SCENERY,
48     XOM_GOOD_SNAKES,
49     XOM_GOOD_DESTRUCTION,
50     XOM_GOOD_FAKE_DESTRUCTION,
51     XOM_GOOD_ENCHANT_MONSTER,
52     XOM_GOOD_FOG,
53     XOM_GOOD_CLOUD_TRAIL,
54     XOM_GOOD_CLEAVING,
55     XOM_LAST_GOOD_ACT = XOM_GOOD_CLEAVING,
56 
57     // bad acts
58     XOM_BAD_MISCAST_PSEUDO,
59     XOM_BAD_STATLOSS,
60     XOM_BAD_TELEPORT,
61     XOM_BAD_CHAOS_UPGRADE,
62     XOM_BAD_MUTATION,
63     XOM_BAD_POLYMORPH,
64     XOM_BAD_MOVING_STAIRS,
65     XOM_BAD_CLIMB_STAIRS,
66     XOM_BAD_CONFUSION,
67     XOM_BAD_DRAINING,
68     XOM_BAD_TORMENT,
69     XOM_BAD_SUMMON_HOSTILES,
70     XOM_BAD_PSEUDO_BANISHMENT,
71     XOM_BAD_BANISHMENT,
72     XOM_BAD_NOISE,
73     XOM_BAD_ENCHANT_MONSTER,
74     XOM_BAD_BLINK_MONSTERS,
75     XOM_BAD_CHAOS_CLOUD,
76     XOM_BAD_SWAP_MONSTERS,
77     XOM_LAST_BAD_ACT = XOM_BAD_SWAP_MONSTERS,
78     XOM_LAST_REAL_ACT = XOM_LAST_BAD_ACT,
79 
80     XOM_PLAYER_DEAD = 100, // player already dead (shouldn't happen)
81     NUM_XOM_EVENTS
82 };
83 
84 void xom_tick();
85 void xom_is_stimulated(int maxinterestingness,
86                        xom_message_type message_type = XM_NORMAL,
87                        bool force_message = false);
88 void xom_is_stimulated(int maxinterestingness, const string& message,
89                        bool force_message = false);
90 bool xom_is_nice(int tension = -1);
91 const string describe_xom_favour();
92 int xom_favour_rank();
93 
94 xom_event_type xom_acts(int sever, maybe_bool niceness = MB_MAYBE,
95                         int tension = -1, bool debug = false);
96 xom_event_type xom_choose_action(bool niceness,  int sever, int tension);
97 void xom_take_action(xom_event_type action, int sever);
98 
99 xom_event_type xom_maybe_reverts_banishment(bool xom_banished = true,
100                                             bool debug = false);
101 void xom_check_lost_item(const item_def& item);
102 void xom_check_destroyed_item(const item_def& item);
103 void xom_death_message(const kill_method_type killed_by);
104 bool xom_saves_your_life(const kill_method_type death_type);
105 void xom_new_level_noise_or_stealth();
106 
107 string xom_effect_to_name(xom_event_type effect);
108 
109 #ifdef WIZARD
110 void debug_xom_effects();
111 #endif
112 
113 bool swap_monsters(monster* m1, monster* m2);
114 bool move_stair(coord_def stair_pos, bool away, bool allow_under);
115 
116 void validate_xom_events();
117