diff options
author | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-15 10:44:10 -0600 |
---|---|---|
committer | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-15 11:01:58 -0600 |
commit | a4a5504e50ca6e67477de99eba44c62ab4557ca5 (patch) | |
tree | 941edf62a2d76529a6a2598b6622b071426ae4ad /crawl-ref/source/spells2.cc | |
parent | e5b09096c90a9c99a7dba3d1597560a0a6bee8ed (diff) | |
download | crawl-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/spells2.cc')
-rw-r--r-- | crawl-ref/source/spells2.cc | 128 |
1 files changed, 128 insertions, 0 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 |