summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-25 17:13:42 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-25 17:13:42 +0000
commit447aafdcc3aff11d1c3a30965077cddb8001b4e8 (patch)
tree4d4cd671091c03bc909d194f557d7bc0edc42d40
parent1bb43d66dd5614be3b29c8f827363ef30ec56e44 (diff)
downloadcrawl-ref-447aafdcc3aff11d1c3a30965077cddb8001b4e8.tar.gz
crawl-ref-447aafdcc3aff11d1c3a30965077cddb8001b4e8.zip
Consolidate the two immolation routines (the scroll and the effect when
affixing a fire brand) into one function. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7615 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/effects.cc40
-rw-r--r--crawl-ref/source/effects.h2
-rw-r--r--crawl-ref/source/enum.h7
-rw-r--r--crawl-ref/source/item_use.cc44
4 files changed, 52 insertions, 41 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 43a035a98e..8b6688ec85 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -264,9 +264,47 @@ int torment(int caster, const coord_def& where)
return apply_area_within_radius(torment_monsters, where, 0, 8, caster);
}
+void immolation(int caster, bool known)
+{
+ const char *aux = "immolation";
+
+ if (caster < 0)
+ {
+ switch (caster)
+ {
+ case IMMOLATION_SCROLL:
+ aux = "scroll of immolation";
+ break;
+
+ case IMMOLATION_SPELL:
+ aux = "a fiery explosion";
+ break;
+ }
+
+ caster = IMMOLATION_GENERIC;
+ }
+
+ bolt beam;
+ beam.flavour = BEAM_FIRE;
+ beam.type = dchar_glyph(DCHAR_FIRED_BURST);
+ beam.damage = dice_def(3, 10);
+ beam.target = you.pos();
+ beam.name = "fiery explosion";
+ beam.colour = RED;
+ beam.thrower = (caster == IMMOLATION_GENERIC) ? KILL_MISC : KILL_YOU;
+ beam.aux_source = aux;
+ beam.ex_size = 2;
+ beam.is_tracer = false;
+ beam.is_explosion = true;
+ beam.effect_known = known;
+
+ explosion(beam, false, false, true, true, true,
+ caster != IMMOLATION_SCROLL);
+}
+
static std::string _who_banished(const std::string &who)
{
- return (who.empty()? who : " (" + who + ")");
+ return (who.empty() ? who : " (" + who + ")");
}
void banished(dungeon_feature_type gate_type, const std::string &who)
diff --git a/crawl-ref/source/effects.h b/crawl-ref/source/effects.h
index 9f784ebf47..0e2db7d125 100644
--- a/crawl-ref/source/effects.h
+++ b/crawl-ref/source/effects.h
@@ -112,6 +112,8 @@ int torment(int caster, const coord_def& where);
int torment_player(int pow, int caster);
int torment_monsters(coord_def where, int pow, int caster);
+void immolation(int caster, bool known = false);
+
// called from: debug
void change_labyrinth(bool msg = false);
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 2d1d42a688..c6a9b6b2b6 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1296,6 +1296,13 @@ enum hunger_state // you.hunger_state
HS_ENGORGED // 8
};
+enum immolation_source_type
+{
+ IMMOLATION_GENERIC = -1,
+ IMMOLATION_SCROLL = -2,
+ IMMOLATION_SPELL = -3
+};
+
enum item_status_flag_type // per item flags: ie. ident status, cursed status
{
ISFLAG_KNOW_CURSE = 0x00000001, // curse status
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index d9e5803ef7..b566cbcac0 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3874,23 +3874,7 @@ static bool _vorpalise_weapon()
case SPWPN_FLAMING:
mprf("%s is engulfed in an explosion of flames!", itname.c_str());
- {
- bolt beam;
-
- beam.name = "fiery explosion";
- beam.aux_source = "a fiery explosion";
- beam.type = dchar_glyph(DCHAR_FIRED_BURST);
- beam.damage = dice_def(3, 10);
- beam.flavour = BEAM_FIRE;
- beam.target = you.pos();
- beam.colour = RED;
- beam.thrower = KILL_YOU;
- beam.ex_size = 2;
- beam.is_tracer = false;
- beam.is_explosion = true;
-
- explosion(beam);
- }
+ immolation(IMMOLATION_SPELL);
break;
case SPWPN_FREEZING:
@@ -4480,30 +4464,10 @@ void read_scroll(int slot)
{
mpr("The scroll explodes in your hands!");
// We do this here to prevent it from blowing itself up.
- set_ident_type( scroll, ID_KNOWN_TYPE );
- dec_inv_item_quantity( item_slot, 1 );
-
- bolt beam;
+ set_ident_type(scroll, ID_KNOWN_TYPE);
+ dec_inv_item_quantity(item_slot, 1);
- beam.is_tracer = false;
-
- // unsure about this: BEAM_EXPLOSION instead? {dlb}
- beam.flavour = BEAM_FIRE;
- beam.type = dchar_glyph(DCHAR_FIRED_BURST);
- beam.damage = dice_def(3, 10);
- beam.target = you.pos();
- beam.name = "fiery explosion";
- beam.colour = RED;
- // your explosion, (not someone else's explosion)
- beam.thrower = KILL_YOU;
- beam.aux_source = "reading a scroll of immolation";
- beam.ex_size = 2;
- beam.is_explosion = true;
-
- if (!alreadyknown)
- beam.effect_known = false;
-
- explosion(beam, false, false, true, true, true, false);
+ immolation(IMMOLATION_SCROLL, alreadyknown);
break;
}