summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-summoning.h
diff options
context:
space:
mode:
authorPete Hurst <pete@streamuniverse.tv>2013-06-25 08:09:01 +0100
committerPete Hurst <pete@streamuniverse.tv>2013-06-25 23:39:51 +0100
commit178395be99e9c9c94f371d1117e904962d94ee04 (patch)
tree2521891345f06042b22ea9265cb3e516e5cd7254 /crawl-ref/source/spl-summoning.h
parent3273a34d9857ded372bb5dd24d49dd0d8c6da27e (diff)
downloadcrawl-ref-178395be99e9c9c94f371d1117e904962d94ee04.tar.gz
crawl-ref-178395be99e9c9c94f371d1117e904962d94ee04.zip
Limit number of summons per spell type
For each summoning spell there is a limit of how many summons can be created. Going over this limit means that the older ones will time out in a turn or two. Currently this is applied only to non-necromantic non-permanent player summons. This summonsdata[] array can be modified to change the cap and timeout (i.e. how long old summons last when they are replaced by new ones) per spell type. To support a new spell, a called to summoned_monster is required after the monster has been created, and the spell needs to be listed in summonsdata[].
Diffstat (limited to 'crawl-ref/source/spl-summoning.h')
-rw-r--r--crawl-ref/source/spl-summoning.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/crawl-ref/source/spl-summoning.h b/crawl-ref/source/spl-summoning.h
index 92f988f3ab..33170e397b 100644
--- a/crawl-ref/source/spl-summoning.h
+++ b/crawl-ref/source/spl-summoning.h
@@ -3,6 +3,7 @@
#include "beam.h"
#include "enum.h"
+#include "data-index.h"
#include "itemprop-enum.h"
#include "spl-cast.h"
@@ -97,4 +98,29 @@ void end_spectral_weapon(monster* mons, bool killed, bool quiet = false);
bool trigger_spectral_weapon(actor* agent, const actor* target);
bool check_target_spectral_weapon(const actor* mons, const actor *defender);
bool confirm_attack_spectral_weapon(monster* mons, const actor *defender);
+
+bool summoned_monster(monster* mons, actor* caster, spell_type spell);
+bool summons_are_capped(spell_type spell);
+
+struct summons_desc // : public data_index_entry<spell_type>
+{
+ // XXX: Assumes that all summons types from each spell are equal,
+ // this is probably fine for now, but will need thought if a spell
+ // needs to have two separate caps
+ spell_type which;
+ int type_cap; // Maximum number for this type
+ int timeout; // Timeout length for replaced summons
+};
+
+class summons_index : public data_index<spell_type, summons_desc, NUM_SPELLS>
+{
+public:
+ summons_index(const summons_desc* _pop)
+ : data_index<spell_type, summons_desc, NUM_SPELLS>(_pop)
+ {};
+
+protected:
+ spell_type map(const summons_desc* val);
+};
+
#endif