summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells2.cc
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-12-25 13:22:48 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-12-25 13:22:48 +1000
commite711d4b1bb15d82886af6fbf557d63e74f2b5fd0 (patch)
tree2d52b0ebf028be58db570f87e7282d0ff1fbb6f4 /crawl-ref/source/spells2.cc
parent750012d6a9fc992d5651acd58a4eaff69dac106c (diff)
downloadcrawl-ref-e711d4b1bb15d82886af6fbf557d63e74f2b5fd0.tar.gz
crawl-ref-e711d4b1bb15d82886af6fbf557d63e74f2b5fd0.zip
A start at a dLua spells library.
Provides wrappers for non-player Toxic Radiance and Ozocubu's Refrigeration. These are basically just an adjustment of kill categories and messages to allow them to be used as background effects in WizLabs (Ozocubu's and Olgreb's). Hopefully a wrapper for monster (and possibly player)-cast bolt structures can also be included, which could then be accessed with the (planned) Lua traps functionality.
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r--crawl-ref/source/spells2.cc31
1 files changed, 23 insertions, 8 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index b4e15848b8..4902786aa6 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -625,9 +625,12 @@ static std::string _describe_monsters(const counted_monster_list &list)
// Poisonous light passes right through invisible players
// and monsters, and so, they are unaffected by this spell --
// assumes only you can cast this spell (or would want to).
-void cast_toxic_radiance()
+void cast_toxic_radiance(bool non_player)
{
- mpr("You radiate a sickly green light!");
+ if (non_player)
+ mpr("The air is filled with a sickly green light!");
+ else
+ mpr("You radiate a sickly green light!");
flash_view(GREEN);
more();
@@ -655,10 +658,13 @@ void cast_toxic_radiance()
// this check should not be !monster->invisible().
if (!mi->has_ench(ENCH_INVIS))
{
+ kill_category kc = KC_YOU;
+ if (non_player)
+ kc = KC_OTHER;
bool affected =
- poison_monster(*mi, KC_YOU, 1, false, false);
+ poison_monster(*mi, kc, 1, false, false);
- if (coinflip() && poison_monster(*mi, KC_YOU, false, false))
+ if (coinflip() && poison_monster(*mi, kc, false, false))
affected = true;
if (affected)
@@ -685,14 +691,20 @@ void cast_toxic_radiance()
{
// Exclamation mark to suggest that a lot of creatures were
// affected.
- mpr("The monsters around you are poisoned!");
+ if (non_player)
+ mpr("Nearby monsters are poisoned!");
+ else
+ mpr("The monsters around you are poisoned!");
}
}
}
-void cast_refrigeration(int pow)
+void cast_refrigeration(int pow, bool non_player)
{
- mpr("The heat is drained from your surroundings.");
+ if (non_player)
+ mpr("Something drains the heat from around you.");
+ else
+ mpr("The heat is drained from your surroundings.");
flash_view(LIGHTCYAN);
more();
@@ -752,7 +764,10 @@ void cast_refrigeration(int pow)
// Calculate damage and apply.
int hurt = mons_adjust_flavoured(*mi, beam, dam_dice.roll());
- mi->hurt(&you, hurt, BEAM_COLD);
+ if (non_player)
+ mi->hurt(NULL, hurt, BEAM_COLD);
+ else
+ mi->hurt(&you, hurt, BEAM_COLD);
// Cold-blooded creatures can be slowed.
if (mi->alive()