diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-08-31 00:44:20 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-08-31 00:44:20 +0200 |
commit | a9eeb4a370e85069c25286e5cedc9682d5d04b2e (patch) | |
tree | 450c0ccd5f5353553d5b96edee2850623dffcc03 /crawl-ref/source/spl-other.cc | |
parent | 57aec7d2a0ae1095fb1babd8f0fcc276927bf8e5 (diff) | |
parent | 35613e094ca5d0be028ee9261afebf3e35faa563 (diff) | |
download | crawl-ref-a9eeb4a370e85069c25286e5cedc9682d5d04b2e.tar.gz crawl-ref-a9eeb4a370e85069c25286e5cedc9682d5d04b2e.zip |
Merge branch 'master' into glasnost
Yay for conflicts galore (wax removal, std:: purge, tileidx changes).
Diffstat (limited to 'crawl-ref/source/spl-other.cc')
-rw-r--r-- | crawl-ref/source/spl-other.cc | 162 |
1 files changed, 3 insertions, 159 deletions
diff --git a/crawl-ref/source/spl-other.cc b/crawl-ref/source/spl-other.cc index 5cebf38a2d..e58c8022f2 100644 --- a/crawl-ref/source/spl-other.cc +++ b/crawl-ref/source/spl-other.cc @@ -280,7 +280,8 @@ spret_type cast_passwall(const coord_def& delta, int pow, bool fail) coord_def dest; for (dest = you.pos() + delta; in_bounds(dest) && _feat_is_passwallable(grd(dest)); - dest += delta) ; + dest += delta) + {} int walls = (dest - you.pos()).rdist() - 1; if (walls == 0) @@ -303,7 +304,7 @@ spret_type cast_passwall(const coord_def& delta, int pow, bool fail) mpr("You fail to penetrate the rock."); else { - std::string msg; + string msg; if (grd(dest) == DNGN_DEEP_WATER) msg = "You sense a large body of water on the other side of the rock."; else if (grd(dest) == DNGN_LAVA) @@ -358,163 +359,6 @@ spret_type cast_intoxicate(int pow, bool fail) return SPRET_SUCCESS; } -// The intent of this spell isn't to produce helpful potions -// for drinking, but rather to provide ammo for the Evaporate -// spell out of corpses, thus potentially making it useful. -// Producing helpful potions would break game balance here... -// and producing more than one potion from a corpse, or not -// using up the corpse might also lead to game balance problems. - bwr -spret_type cast_fulsome_distillation(int pow, bool check_range, bool fail) -{ - int num_corpses = 0; - item_def *corpse = corpse_at(you.pos(), &num_corpses); - if (num_corpses && you.flight_mode() == FL_LEVITATE) - num_corpses = -1; - - // If there is only one corpse, distill it; otherwise, ask the player - // which corpse to use. - switch (num_corpses) - { - case 0: case -1: - // Allow using Z to victory dance fulsome. - if (!check_range) - { - fail_check(); - mpr("The spell fizzles."); - return SPRET_SUCCESS; - } - - if (num_corpses == -1) - mpr("You can't reach the corpse!"); - else - mpr("There aren't any corpses here."); - return SPRET_ABORT; - case 1: - // Use the only corpse available without prompting. - break; - default: - // Search items at the player's location for corpses. - // The last corpse detected earlier is irrelevant. - corpse = NULL; - for (stack_iterator si(you.pos(), true); si; ++si) - { - if (item_is_corpse(*si)) - { - const std::string corpsedesc = - get_menu_colour_prefix_tags(*si, DESC_THE); - const std::string prompt = - make_stringf("Distill a potion from %s?", - corpsedesc.c_str()); - - if (yesno(prompt.c_str(), true, 0, false)) - { - corpse = &*si; - break; - } - } - } - } - - if (!corpse) - { - canned_msg(MSG_OK); - return SPRET_ABORT; - } - - fail_check(); - - potion_type pot_type = POT_WATER; - - switch (mons_corpse_effect(corpse->mon_type)) - { - case CE_CLEAN: - pot_type = POT_WATER; - break; - - case CE_CONTAMINATED: - pot_type = (mons_weight(corpse->mon_type) >= 900) - ? POT_DEGENERATION : POT_CONFUSION; - break; - - case CE_POISONOUS: - case CE_POISON_CONTAM: - pot_type = POT_POISON; - break; - - case CE_MUTAGEN: - pot_type = POT_MUTATION; - break; - - case CE_ROTTEN: // actually this only occurs via mangling - case CE_ROT: // necrophage - pot_type = POT_DECAY; - break; - - case CE_NOCORPSE: // shouldn't occur - default: - break; - } - - switch (corpse->mon_type) - { - case MONS_RED_WASP: // paralysis attack - pot_type = POT_PARALYSIS; - break; - - case MONS_YELLOW_WASP: // slowing attack - pot_type = POT_SLOWING; - break; - - default: - break; - } - - struct monsterentry* smc = get_monster_data(corpse->mon_type); - - for (int nattk = 0; nattk < 4; ++nattk) - { - if (smc->attack[nattk].flavour == AF_POISON_MEDIUM - || smc->attack[nattk].flavour == AF_POISON_STRONG - || smc->attack[nattk].flavour == AF_POISON_STR - || smc->attack[nattk].flavour == AF_POISON_INT - || smc->attack[nattk].flavour == AF_POISON_DEX - || smc->attack[nattk].flavour == AF_POISON_STAT) - { - pot_type = POT_STRONG_POISON; - } - } - - const bool was_orc = (mons_genus(corpse->mon_type) == MONS_ORC); - const bool was_holy = (mons_class_holiness(corpse->mon_type) == MH_HOLY); - - // We borrow the corpse's object to make our potion. - corpse->base_type = OBJ_POTIONS; - corpse->sub_type = pot_type; - corpse->quantity = 1; - corpse->plus = 0; - corpse->plus2 = 0; - corpse->flags = 0; - corpse->inscription.clear(); - item_colour(*corpse); // sets special as well - - // Always identify said potion. - set_ident_type(*corpse, ID_KNOWN_TYPE); - - mprf("You extract %s from the corpse.", - corpse->name(DESC_A).c_str()); - - // Try to move the potion to the player (for convenience). - if (move_item_to_player(corpse->index(), 1) != 1) - mpr("Unfortunately, you can't carry it right now!"); - - if (was_orc) - did_god_conduct(DID_DESECRATE_ORCISH_REMAINS, 2); - if (was_holy) - did_god_conduct(DID_DESECRATE_HOLY_REMAINS, 2); - - return SPRET_SUCCESS; -} - void remove_condensation_shield() { mpr("Your icy shield evaporates.", MSGCH_DURATION); |