summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-15 10:44:10 -0600
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-15 11:01:58 -0600
commita4a5504e50ca6e67477de99eba44c62ab4557ca5 (patch)
tree941edf62a2d76529a6a2598b6622b071426ae4ad /crawl-ref/source
parente5b09096c90a9c99a7dba3d1597560a0a6bee8ed (diff)
downloadcrawl-ref-a4a5504e50ca6e67477de99eba44c62ab4557ca5.tar.gz
crawl-ref-a4a5504e50ca6e67477de99eba44c62ab4557ca5.zip
Move brand_ammo() to spells2.{cc,h}, right after brand_weapon().
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/spells2.cc128
-rw-r--r--crawl-ref/source/spells2.h1
-rw-r--r--crawl-ref/source/spells3.cc128
-rw-r--r--crawl-ref/source/spells3.h1
4 files changed, 129 insertions, 129 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 639c21d6d7..b29ad1bcaa 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -375,6 +375,134 @@ bool brand_weapon(brand_type which_brand, int power)
return (true);
}
+void brand_ammo(special_missile_type which_type)
+{
+ const int ammo = you.equip[EQ_WEAPON];
+
+ if (ammo == -1
+ || you.inv[ammo].base_type != OBJ_MISSILES
+ || get_ammo_brand(you.inv[ammo]) != SPMSL_NORMAL
+ || you.inv[ammo].sub_type == MI_THROWING_NET)
+ {
+ canned_msg(MSG_NOTHING_HAPPENS);
+ return;
+ }
+
+ preserve_quiver_slots q;
+ const char *old_desc = you.inv[ammo].name(DESC_CAP_YOUR).c_str();
+
+ switch (which_type)
+ {
+ case SPMSL_POISONED:
+ if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_POISONED))
+ {
+ mprf("%s %s covered in a thin film of poison.", old_desc,
+ (you.inv[ammo].quantity == 1) ? "is" : "are");
+
+ if (ammo == you.equip[EQ_WEAPON])
+ you.wield_change = true;
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+ break;
+
+ case SPMSL_FLAME:
+ if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_FLAME))
+ {
+ mprf("%s %s warm to the touch.", old_desc,
+ (you.inv[ammo].quantity == 1) ? "feels" : "feel");
+
+ if (ammo == you.equip[EQ_WEAPON])
+ you.wield_change = true;
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+ break;
+
+ case SPMSL_FROST:
+ if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_FROST))
+ {
+ mprf("%s %s cool to the touch.", old_desc,
+ (you.inv[ammo].quantity == 1) ? "feels" : "feel");
+
+ if (ammo == you.equip[EQ_WEAPON])
+ you.wield_change = true;
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+ break;
+
+ case SPMSL_DISPERSAL:
+ if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_DISPERSAL))
+ {
+ mprf("%s %s rather jumpy.", old_desc,
+ (you.inv[ammo].quantity == 1) ? "seems" : "seem");
+
+ if (ammo == you.equip[EQ_WEAPON])
+ you.wield_change = true;
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+ break;
+
+ case SPMSL_ELECTRIC:
+ if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_ELECTRIC))
+ {
+ mprf("%s %s you!", old_desc,
+ (you.inv[ammo].quantity == 1) ? "shocks" : "shock");
+
+ if (ammo == you.equip[EQ_WEAPON])
+ you.wield_change = true;
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+ break;
+
+ case SPMSL_EXPLODING:
+ if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_EXPLODING))
+ {
+ mprf("%s %s unstable!", old_desc,
+ (you.inv[ammo].quantity == 1) ? "seems" : "seem");
+
+ if (ammo == you.equip[EQ_WEAPON])
+ you.wield_change = true;
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+ break;
+
+ case SPMSL_REAPING:
+ if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_REAPING))
+ {
+ mprf("%s %s of rotten flesh!", old_desc,
+ (you.inv[ammo].quantity == 1) ? "smells" : "smell");
+
+ if (ammo == you.equip[EQ_WEAPON])
+ you.wield_change = true;
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+ break;
+
+ case SPMSL_RETURNING:
+ if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_RETURNING))
+ {
+ mprf("%s %s in your hand.", old_desc,
+ (you.inv[ammo].quantity == 1) ? "wiggles" : "wiggle");
+
+ if (ammo == you.equip[EQ_WEAPON])
+ you.wield_change = true;
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+ break;
+
+ default:
+ canned_msg(MSG_NOTHING_HAPPENS);
+ break;
+ }
+}
+
// Restore the stat in which_stat by the amount in stat_gain, displaying
// a message if suppress_msg is false, and doing so in the recovery
// channel if recovery is true. If stat_gain is 0, restore the stat
diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h
index 943b85e98e..fa3965d7b5 100644
--- a/crawl-ref/source/spells2.h
+++ b/crawl-ref/source/spells2.h
@@ -13,6 +13,7 @@
struct dist;
bool brand_weapon(brand_type which_brand, int power);
+void brand_ammo(special_missile_type which_brand);
bool burn_freeze(int pow, beam_type flavour, monsters *monster);
void corpse_rot();
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 50ae3e5f8f..e9f68f217f 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -1979,134 +1979,6 @@ bool cast_sanctuary(const int power)
return (true);
}
-void brand_ammo(special_missile_type which_type)
-{
- const int ammo = you.equip[EQ_WEAPON];
-
- if (ammo == -1
- || you.inv[ammo].base_type != OBJ_MISSILES
- || get_ammo_brand(you.inv[ammo]) != SPMSL_NORMAL
- || you.inv[ammo].sub_type == MI_THROWING_NET)
- {
- canned_msg(MSG_NOTHING_HAPPENS);
- return;
- }
-
- preserve_quiver_slots q;
- const char *old_desc = you.inv[ammo].name(DESC_CAP_YOUR).c_str();
-
- switch (which_type)
- {
- case SPMSL_POISONED:
- if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_POISONED))
- {
- mprf("%s %s covered in a thin film of poison.", old_desc,
- (you.inv[ammo].quantity == 1) ? "is" : "are");
-
- if (ammo == you.equip[EQ_WEAPON])
- you.wield_change = true;
- }
- else
- canned_msg(MSG_NOTHING_HAPPENS);
- break;
-
- case SPMSL_FLAME:
- if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_FLAME))
- {
- mprf("%s %s warm to the touch.", old_desc,
- (you.inv[ammo].quantity == 1) ? "feels" : "feel");
-
- if (ammo == you.equip[EQ_WEAPON])
- you.wield_change = true;
- }
- else
- canned_msg(MSG_NOTHING_HAPPENS);
- break;
-
- case SPMSL_FROST:
- if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_FROST))
- {
- mprf("%s %s cool to the touch.", old_desc,
- (you.inv[ammo].quantity == 1) ? "feels" : "feel");
-
- if (ammo == you.equip[EQ_WEAPON])
- you.wield_change = true;
- }
- else
- canned_msg(MSG_NOTHING_HAPPENS);
- break;
-
- case SPMSL_DISPERSAL:
- if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_DISPERSAL))
- {
- mprf("%s %s rather jumpy.", old_desc,
- (you.inv[ammo].quantity == 1) ? "seems" : "seem");
-
- if (ammo == you.equip[EQ_WEAPON])
- you.wield_change = true;
- }
- else
- canned_msg(MSG_NOTHING_HAPPENS);
- break;
-
- case SPMSL_ELECTRIC:
- if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_ELECTRIC))
- {
- mprf("%s %s you!", old_desc,
- (you.inv[ammo].quantity == 1) ? "shocks" : "shock");
-
- if (ammo == you.equip[EQ_WEAPON])
- you.wield_change = true;
- }
- else
- canned_msg(MSG_NOTHING_HAPPENS);
- break;
-
- case SPMSL_EXPLODING:
- if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_EXPLODING))
- {
- mprf("%s %s unstable!", old_desc,
- (you.inv[ammo].quantity == 1) ? "seems" : "seem");
-
- if (ammo == you.equip[EQ_WEAPON])
- you.wield_change = true;
- }
- else
- canned_msg(MSG_NOTHING_HAPPENS);
- break;
-
- case SPMSL_REAPING:
- if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_REAPING))
- {
- mprf("%s %s of rotten flesh!", old_desc,
- (you.inv[ammo].quantity == 1) ? "smells" : "smell");
-
- if (ammo == you.equip[EQ_WEAPON])
- you.wield_change = true;
- }
- else
- canned_msg(MSG_NOTHING_HAPPENS);
- break;
-
- case SPMSL_RETURNING:
- if (set_item_ego_type(you.inv[ammo], OBJ_MISSILES, SPMSL_RETURNING))
- {
- mprf("%s %s in your hand.", old_desc,
- (you.inv[ammo].quantity == 1) ? "wiggles" : "wiggle");
-
- if (ammo == you.equip[EQ_WEAPON])
- you.wield_change = true;
- }
- else
- canned_msg(MSG_NOTHING_HAPPENS);
- break;
-
- default:
- canned_msg(MSG_NOTHING_HAPPENS);
- break;
- }
-}
-
bool project_noise(void)
{
bool success = false;
diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h
index 770c38090d..a73cdf88d3 100644
--- a/crawl-ref/source/spells3.h
+++ b/crawl-ref/source/spells3.h
@@ -17,7 +17,6 @@ bool allow_control_teleport(bool quiet = false);
int airstrike(int power, dist &beam);
bool cast_bone_shards(int power, bolt &);
-void brand_ammo(special_missile_type which_brand);
bool cast_selective_amnesia(bool force);
bool cast_smiting(int power, const coord_def& where);
bool remove_sanctuary(bool did_attack = false);