summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-11-13 14:51:31 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-11-13 14:54:40 +1000
commit6c05a8337e26b40f1cfebbf14cbc00ab0e2b6c8b (patch)
treebdeeadb24ca7a72c465ab32560f96ba5a95d4b16
parentbe0551c2205ac189be5558447625642553c80dd3 (diff)
downloadcrawl-ref-6c05a8337e26b40f1cfebbf14cbc00ab0e2b6c8b.tar.gz
crawl-ref-6c05a8337e26b40f1cfebbf14cbc00ab0e2b6c8b.zip
New monster spell: Sleep. Give sleep to Aizul.
Unlike Ensorcelled Hibernation, Sleep checks MR only, rather than MR and cold resistance. It also does not check monsters having SLEEP_WEARY. It will not act on something that is already sleep.
-rw-r--r--crawl-ref/source/acr.cc2
-rw-r--r--crawl-ref/source/beam.cc36
-rw-r--r--crawl-ref/source/enum.h11
-rw-r--r--crawl-ref/source/mon-cast.cc7
-rw-r--r--crawl-ref/source/mon-spll.h2
-rw-r--r--crawl-ref/source/mon-util.cc2
-rw-r--r--crawl-ref/source/player.cc20
-rw-r--r--crawl-ref/source/player.h1
-rw-r--r--crawl-ref/source/spl-cast.cc5
-rw-r--r--crawl-ref/source/spl-data.h13
10 files changed, 91 insertions, 8 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 2f38866f39..fe11c6612f 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -4412,7 +4412,7 @@ static void _compile_time_asserts()
COMPILE_CHECK(SP_VAMPIRE == 30 , c3);
COMPILE_CHECK(SPELL_DEBUGGING_RAY == 103 , c4);
COMPILE_CHECK(SPELL_PETRIFY == 155 , c5);
- COMPILE_CHECK(NUM_SPELLS == 206 , c6);
+ COMPILE_CHECK(NUM_SPELLS == 207 , c6);
//jmf: NEW ASSERTS: we ought to do a *lot* of these
COMPILE_CHECK(NUM_SPECIES < SP_UNKNOWN , c7);
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index b5f7e83590..b5282066f7 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1322,6 +1322,22 @@ const zap_info zap_data[] = {
false,
false,
0
+ },
+
+ {
+ ZAP_SLEEP,
+ "0",
+ 100,
+ NULL,
+ NULL,
+ BLACK,
+ true,
+ BEAM_SLEEP,
+ DCHAR_SPACE,
+ false,
+ false,
+ false,
+ 0
}
};
@@ -3794,6 +3810,10 @@ void bolt::affect_player_enchantment()
you.hibernate(ench_power);
break;
+ case BEAM_SLEEP:
+ you.put_to_sleep(ench_power);
+ break;
+
case BEAM_CORONA:
you.backlight();
obvious_effect = true;
@@ -5317,6 +5337,17 @@ mon_resist_type bolt::apply_enchantment_to_monster(monsters* mon)
}
return (MON_AFFECTED);
+ case BEAM_SLEEP:
+ if (mon->has_ench(ENCH_SLEEPY))
+ return (MON_UNAFFECTED);
+
+ if (mon->add_ench(mon_enchant(ENCH_SLEEPY, 0, whose_kill())))
+ {
+ if (simple_monster_message(mon, " falls asleep!"))
+ obvious_effect = true;
+ }
+ return (MON_AFFECTED);
+
case BEAM_INVISIBILITY:
{
// Store the monster name before it becomes an "it" -- bwr
@@ -6135,9 +6166,10 @@ std::string beam_type_name(beam_type type)
case BEAM_ENSLAVE_DEMON: return ("enslave demon");
case BEAM_BLINK: return ("blink");
case BEAM_PETRIFY: return ("petrify");
- case BEAM_CORONA: return ("backlight");
+ case BEAM_CORONA: return ("backlight");
case BEAM_PORKALATOR: return ("porkalator");
- case BEAM_HIBERNATION: return ("sleep");
+ case BEAM_HIBERNATION: return ("hibernation");
+ case BEAM_SLEEP: return ("sleep");
case BEAM_BERSERK: return ("berserk");
case BEAM_POTION_BLACK_SMOKE: return ("black smoke");
case BEAM_POTION_GREY_SMOKE: return ("grey smoke");
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index e5f8b56b5d..d33a2ec149 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -247,20 +247,21 @@ enum beam_type // beam[].flavour
BEAM_PORKALATOR,
BEAM_HIBERNATION,
BEAM_BERSERK,
- BEAM_LAST_ENCHANTMENT = BEAM_BERSERK,
+ BEAM_SLEEP,
+ BEAM_LAST_ENCHANTMENT = BEAM_SLEEP,
// new beams for evaporate
- BEAM_POTION_STINKING_CLOUD, // 50
+ BEAM_POTION_STINKING_CLOUD,
BEAM_POTION_POISON,
BEAM_POTION_MIASMA,
BEAM_POTION_STEAM,
BEAM_POTION_FIRE,
- BEAM_POTION_COLD, // 55
+ BEAM_POTION_COLD,
BEAM_POTION_BLACK_SMOKE,
BEAM_POTION_GREY_SMOKE,
BEAM_POTION_MUTAGENIC,
BEAM_POTION_BLUE_SMOKE,
- BEAM_POTION_RAIN, // 60
+ BEAM_POTION_RAIN,
BEAM_POTION_RANDOM,
BEAM_LAST_REAL = BEAM_POTION_RANDOM,
@@ -2885,6 +2886,7 @@ enum spell_type
SPELL_FIRE_ELEMENTALS,
SPELL_EARTH_ELEMENTALS,
SPELL_AIR_ELEMENTALS,
+ SPELL_SLEEP,
NUM_SPELLS
};
@@ -3139,6 +3141,7 @@ enum zap_type
ZAP_CHAOS,
ZAP_SLIME,
ZAP_PORKALATOR,
+ ZAP_SLEEP,
NUM_ZAPS
};
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index abf7869571..83f3fff30f 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -286,6 +286,11 @@ bolt mons_spells( monsters *mons, spell_type spell_cast, int power,
beam.is_beam = true;
break;
+ case SPELL_SLEEP:
+ beam.flavour = BEAM_SLEEP;
+ beam.is_beam = true;
+ break;
+
case SPELL_POLYMORPH_OTHER:
beam.flavour = BEAM_POLYMORPH;
beam.is_beam = true;
@@ -730,6 +735,8 @@ bool setup_mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
if (spell_cast == SPELL_TELEPORT_SELF)
pbolt.ench_power = 2000;
+ else if (spell_cast == SPELL_SLEEP)
+ pbolt.ench_power = 6 * monster->hit_dice;
pbolt.beam_source = monster_index(monster);
diff --git a/crawl-ref/source/mon-spll.h b/crawl-ref/source/mon-spll.h
index 118410f0ab..9989ddcd21 100644
--- a/crawl-ref/source/mon-spll.h
+++ b/crawl-ref/source/mon-spll.h
@@ -1268,7 +1268,7 @@
{
SPELL_VENOM_BOLT,
SPELL_BLINK_OTHER,
- SPELL_HIBERNATION,
+ SPELL_SLEEP,
SPELL_VENOM_BOLT,
SPELL_SLOW,
SPELL_MINOR_HEALING
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index d070c47b98..d891ed2b50 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2415,6 +2415,7 @@ bool ms_waste_of_time( const monsters *mon, spell_type monspell )
case SPELL_BANISHMENT:
case SPELL_DISINTEGRATE:
case SPELL_PARALYSE:
+ case SPELL_SLEEP:
case SPELL_HIBERNATION:
{
if (monspell == SPELL_HIBERNATION && (!foe || foe->asleep()))
@@ -2540,6 +2541,7 @@ static bool _ms_ranged_spell(spell_type monspell, bool attack_only = false,
case SPELL_CONFUSE:
case SPELL_SLOW:
case SPELL_PARALYSE:
+ case SPELL_SLEEP:
case SPELL_TELEPORT_OTHER:
return (ench_too);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 4ea7ac6b41..5233305c3a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -7079,6 +7079,26 @@ void player::hibernate(int)
duration[DUR_SLEEP] = 3 + random2avg(5, 2);
}
+void player::put_to_sleep(int power)
+{
+ ASSERT(!crawl_state.arena);
+
+ if (duration[DUR_SLEEP])
+ {
+ mpr("You feel weary for a moment.");
+ return;
+ }
+
+ mpr("You fall asleep!");
+
+ stop_delay();
+ flash_colour = DARKGREY;
+ viewwindow(false);
+
+ // As above, do this after redraw.
+ duration[DUR_SLEEP] = 5 + random2avg(power / 10, 5);
+}
+
void player::awake()
{
ASSERT(!crawl_state.arena);
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index ebc18ba62f..430307a982 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -475,6 +475,7 @@ public:
bool asleep() const;
bool can_hibernate(bool holi_only = false) const;
void hibernate(int power = 0);
+ void put_to_sleep(int power = 0);
void awake();
void check_awaken(int disturbance);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index ae4c085cc4..8d96fb7f82 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1779,6 +1779,11 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
break;
}
+ case SPELL_SLEEP:
+ if (!zapping(ZAP_SLEEP, powc, beam, true))
+ return (SPRET_ABORT);
+ break;
+
case SPELL_PARALYSE:
if (!zapping(ZAP_PARALYSIS, powc, beam, true))
return (SPRET_ABORT);
diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h
index f7a118fb82..e8d212591e 100644
--- a/crawl-ref/source/spl-data.h
+++ b/crawl-ref/source/spl-data.h
@@ -2434,6 +2434,19 @@
},
{
+ SPELL_SLEEP, "Sleep",
+ SPTYP_ENCHANTMENT,
+ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF,
+ 5,
+ 200,
+ LOS_RADIUS, LOS_RADIUS,
+ 0,
+ NULL,
+ true,
+ false
+},
+
+{
SPELL_NO_SPELL, "nonexistent spell",
0,
SPFLAG_TESTING,