From 19cd3f60eb72fef46210d73fffeec8dd10769400 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 21 Apr 2008 12:15:40 +0000 Subject: Change mummy curses to only turn part of a stack of potions into decay. Instead, the amount is 2 + random2(quantity - 1), so ranging anywhere from 2 to the entire stack. Yes, I know this is probably highly controversial, but I've thought about it some, and I think that this will actually change little for most characters: You still won't take large stacks of valuable potions into the Tomb since even if only part of the stack is destroyed it's a huge loss. On the other hand, this is easier on newbies who had no idea this could happen, and makes it a bit more harder for Transmuters to turn their twenty-something potions of water into decay. I also added a message ("Your potions of xyz decay.") if you know the decay type. Otherwise the message is suppressed, so as to replicate the current situation of "Hey, what's this? When did I pick up those? (q)uaff..." For consistency, I also added a message when stuff is cursed, or rather I merged all those "Your foo glows black" messages into do_curse_stuff() that now takes a parameter "quiet" to control whether it's printed ot not. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4438 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 4 +- crawl-ref/source/decks.cc | 2 +- crawl-ref/source/item_use.cc | 24 ++------ crawl-ref/source/itemprop.cc | 18 ++++-- crawl-ref/source/itemprop.h | 2 +- crawl-ref/source/libgui.cc | 2 - crawl-ref/source/misc.cc | 128 +++++++++++++++++++++++++++---------------- crawl-ref/source/misc.h | 2 +- crawl-ref/source/monstuff.cc | 43 ++++++--------- crawl-ref/source/monstuff.h | 2 +- crawl-ref/source/output.cc | 8 ++- crawl-ref/source/spells3.cc | 3 +- 12 files changed, 130 insertions(+), 108 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index ab4d8a0a2d..22100827a0 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2469,12 +2469,12 @@ static void _prep_input() { you.time_taken = player_speed(); you.shield_blocks = 0; // no blocks this round - update_screen(); textcolor(LIGHTGREY); set_redraw_status( REDRAW_LINE_2_MASK | REDRAW_LINE_3_MASK ); print_stats(); + update_screen(); } // Decrement a single duration. Print the message if the duration runs out. @@ -2905,8 +2905,10 @@ static void _decrement_durations() } if (!you.permanent_flight()) + { if ( _decrement_a_duration(DUR_CONTROLLED_FLIGHT) && you.airborne() ) mpr("You lose control over your flight.", MSGCH_DURATION); + } if (you.rotting > 0) { diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 7e6daee812..de4c78a610 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -2431,7 +2431,7 @@ static void _curse_card(int power, deck_rarity_type rarity) if ( power_level >= 2 ) { // curse (almost) everything + decay - while ( curse_an_item(true) && !one_chance_in(1000) ) + while ( curse_an_item(true, true) && !one_chance_in(1000) ) ; } else if ( power_level == 1 ) diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 30e78b8467..72d21f072b 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -706,12 +706,7 @@ void wield_effects(int item_wield_2, bool showMsgs) case SPWPN_SCYTHE_OF_CURSES: you.special_wield = SPWLD_CURSE; if (!item_cursed(item) && one_chance_in(5)) - { - mprf("%s glows black for a moment.", - item.name(DESC_CAP_YOUR).c_str()); - - do_curse_item( item ); - } + do_curse_item( item, false ); break; case SPWPN_MACE_OF_VARIABILITY: @@ -1770,6 +1765,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, item.quantity = 1; item.slot = index_to_letter(item.link); origin_set_unknown(item); + if (item.base_type == OBJ_POTIONS && (item.sub_type == POT_BLOOD || item.sub_type == POT_BLOOD_COAGULATED) @@ -4271,10 +4267,7 @@ void read_scroll( int slot ) } else { - mprf("%s glows black for a moment.", - you.inv[nthing].name(DESC_CAP_YOUR).c_str()); - - do_curse_item( you.inv[nthing] ); + do_curse_item( you.inv[nthing], false ); you.wield_change = true; } break; @@ -4392,11 +4385,7 @@ void read_scroll( int slot ) else { // make the name before we curse it - item_def& item = you.inv[you.equip[affected]]; - mprf("%s glows black for a moment.", - item.name(DESC_CAP_YOUR).c_str()); - - do_curse_item( item ); + do_curse_item( you.inv[you.equip[affected]], false ); } break; @@ -4566,10 +4555,7 @@ void use_randart(item_def &item) if ( !item_cursed(item) && proprt[RAP_CURSED] > 0 && one_chance_in(proprt[RAP_CURSED]) ) { - mprf("%s glows black for a moment.", - item.name(DESC_CAP_YOUR).c_str()); - - do_curse_item( item ); + do_curse_item( item, false ); randart_wpn_learn_prop(item, RAP_CURSED); } diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 0412d78b7b..8ef02ed116 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -474,11 +474,15 @@ bool item_known_uncursed( const item_def &item ) return ((item.flags & ISFLAG_KNOW_CURSE) && !(item.flags & ISFLAG_CURSED)); } -void do_curse_item( item_def &item ) +void do_curse_item( item_def &item, bool quiet ) { + // already cursed? + if (item.flags & ISFLAG_CURSED) + return; + // Xom is amused by the player's items being cursed, especially // if they're worn/equipped. - if (!(item.flags & ISFLAG_CURSED) && item.x == -1 && item.y == -1) + if (item.x == -1 && item.y == -1) { int amusement = 64; @@ -496,6 +500,12 @@ void do_curse_item( item_def &item ) xom_is_stimulated(amusement); } + if (!quiet) + { + mprf("Your %s glows black for a moment.", + item.name(DESC_PLAIN).c_str()); + } + item.flags |= ISFLAG_CURSED; } @@ -558,8 +568,8 @@ void set_ident_flags( item_def &item, unsigned long flags ) request_autoinscribe(); } - if (notes_are_active() && !(item.flags & ISFLAG_NOTED_ID) && - fully_identified(item) && is_interesting_item(item)) + if (notes_are_active() && !(item.flags & ISFLAG_NOTED_ID) + && fully_identified(item) && is_interesting_item(item)) { // make a note of it take_note(Note(NOTE_ID_ITEM, 0, 0, item.name(DESC_NOCAP_A).c_str(), diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index 23cc7eeaa3..0301819c12 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -582,7 +582,7 @@ bool item_is_critical(const item_def &item); bool item_cursed( const item_def &item ); bool item_known_cursed( const item_def &item ); bool item_known_uncursed( const item_def &item ); -void do_curse_item( item_def &item ); +void do_curse_item( item_def &item, bool quiet = true ); void do_uncurse_item( item_def &item ); // stationary: diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc index 6ccf2ae5a7..41ddebde0f 100644 --- a/crawl-ref/source/libgui.cc +++ b/crawl-ref/source/libgui.cc @@ -1302,9 +1302,7 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init) || mode == REGION_MSG || mode == REGION_STAT); if (valid_tip_region && mode != oldmode) - { update_tip_text(""); - } if (toggle_telescope && mode == REGION_MAP) { diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index b5e2093fab..6b5207dedb 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -378,25 +378,37 @@ void maybe_coagulate_blood_potions_floor(int obj) ASSERT(timer.size() == blood.quantity); } -static void _coagulating_blood_message(item_def &blood, int num_coagulated) +// Prints messages for blood potions coagulating in inventory (coagulate = true) +// or whenever potions are cursed into potions of decay (coagulate = false). +static void _potion_stack_changed_message(item_def &potion, int num_changed, + bool coagulate = true) { - ASSERT(num_coagulated > 0); + ASSERT(num_changed > 0); + if (coagulate) + ASSERT(potion.sub_type == POT_BLOOD); std::string msg; - if (blood.quantity == num_coagulated) - msg = blood.name(DESC_CAP_YOUR, false); + if (potion.quantity == num_changed) + msg = "Your "; else { - if (num_coagulated == 1) - msg = "One of "; + if (num_changed == 1) + msg = "One of your "; + else if (num_changed == 2) + msg = "Two of your "; + else if (num_changed >= (potion.quantity * 3) / 4) + msg = "Most of your "; else - msg = "Some of "; - - msg += blood.name(DESC_NOCAP_YOUR, false); + msg = "Some of your "; } + msg += potion.name(DESC_PLAIN, false); + + if (coagulate) + msg += " coagulate"; + else + msg += " decay"; - msg += " coagulate"; - if (num_coagulated == 1) + if (num_changed == 1) msg += "s"; msg += "."; @@ -465,11 +477,20 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) more(); #endif + // just in case + you.wield_change = true; + you.redraw_quiver = true; + if (!coag_count) // some potions rotted away { blood.quantity -= rot_count; if (blood.quantity < 1) + { + if (you.equip[EQ_WEAPON] == blood.link) + you.equip[EQ_WEAPON] = -1; + destroy_item(blood); + } else ASSERT(blood.quantity == timer.size()); @@ -483,7 +504,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) bool knew_coag = (get_ident_type(OBJ_POTIONS, POT_BLOOD_COAGULATED) == ID_KNOWN_TYPE); - _coagulating_blood_message(blood, coag_count); + _potion_stack_changed_message(blood, coag_count); // identify both blood and coagulated blood, if necessary if (!knew_blood) @@ -510,7 +531,12 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) blood.quantity -= coag_count + rot_count; if (blood.quantity < 1) + { + if (you.equip[EQ_WEAPON] == blood.link) + you.equip[EQ_WEAPON] = -1; + destroy_item(blood); + } else { ASSERT(timer.size() == blood.quantity); @@ -683,7 +709,12 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) blood.quantity -= rot_count + coag_count; if (blood.quantity < 1) + { + if (you.equip[EQ_WEAPON] == blood.link) + you.equip[EQ_WEAPON] = -1; + destroy_item(blood); + } else { ASSERT(timer.size() == blood.quantity); @@ -914,43 +945,61 @@ void turn_corpse_into_blood_potions( item_def &item ) create_monster_hide(mons_class); } -// A variation of the mummy curse: for potions of blood (vital for Vampires!) -// split the stack and only turn part of it into POT_DECAY. -void split_blood_potions_into_decay( int obj, int amount ) +// A variation of the mummy curse: +// instead of trashing the entire stack, split the stack and only turn part +// of it into POT_DECAY. +void split_potions_into_decay( int obj, int amount, bool need_msg ) { ASSERT(obj != -1); - item_def potion = you.inv[obj]; + item_def &potion = you.inv[obj]; ASSERT(is_valid_item(potion)); ASSERT(potion.base_type == OBJ_POTIONS); - ASSERT(potion.sub_type == POT_BLOOD - || potion.sub_type == POT_BLOOD_COAGULATED); + ASSERT(amount > 0); ASSERT(amount <= potion.quantity); - if (amount <= 0) - amount = random2(potion.quantity) + 1; + // output decay message + if (need_msg && get_ident_type(OBJ_POTIONS, POT_DECAY) == ID_KNOWN_TYPE) + _potion_stack_changed_message(potion, amount, false); + + // just in case + you.wield_change = true; + you.redraw_quiver = true; - // We're being nice here, and only decay the *oldest* potions. - for (int i = 0; i < amount; i++) - remove_oldest_blood_potion(potion); + if (potion.sub_type == POT_BLOOD || potion.sub_type == POT_BLOOD_COAGULATED) + { + // We're being nice here, and only decay the *oldest* potions. + for (int i = 0; i < amount; i++) + remove_oldest_blood_potion(potion); + } // try to merge into existing stacks of decayed potions for (int m = 0; m < ENDOFPACK; m++) { if (you.inv[m].base_type == OBJ_POTIONS - && you.inv[m].sub_type == POT_DECAY - && you.inv[m].colour == potion.colour) + && you.inv[m].sub_type == POT_DECAY) { - you.inv[obj].quantity -= amount; + if (potion.quantity == amount) + { + if (you.equip[EQ_WEAPON] == obj) + you.equip[EQ_WEAPON] = -1; + + destroy_item(potion); + } + else + you.inv[obj].quantity -= amount; + you.inv[m].quantity += amount; + return; } } - // if entire stack affected just change subtype + // else, if entire stack affected just change subtype if (amount == potion.quantity) { you.inv[obj].sub_type = POT_DECAY; + unset_ident_flags( you.inv[obj], ISFLAG_IDENT_MASK ); // all different return; } @@ -971,6 +1020,7 @@ void split_blood_potions_into_decay( int obj, int amount ) item.plus2 = 0; item.special = 0; item.flags = 0; + item.colour = potion.colour; you.inv[obj].quantity -= amount; return; @@ -982,8 +1032,7 @@ void split_blood_potions_into_decay( int obj, int amount ) while (o != NON_ITEM) { if (mitm[o].base_type == OBJ_POTIONS - && mitm[o].sub_type == POT_DECAY - && mitm[o].colour == you.inv[obj].colour) + && mitm[o].sub_type == POT_DECAY) { dec_inv_item_quantity(obj, amount); inc_mitm_item_quantity(o, amount); @@ -1004,22 +1053,7 @@ void split_blood_potions_into_decay( int obj, int amount ) potion2.flags = potion.flags; potion2.quantity = amount; potion2.special = 0; - - switch (random2(4)) - { - case 0: - potion2.colour = RED; - break; - case 1: - potion2.colour = BROWN; - break; - case 2: - potion2.colour = GREEN; - break; - case 3: - potion2.colour = LIGHTRED; - break; - } + potion2.colour = potion.colour; copy_item_to_grid( potion2, you.x_pos, you.y_pos ); } @@ -2525,12 +2559,12 @@ bool mons_is_safe(const struct monsters *mon, bool want_move) // Return all monsters in range (default: LOS) that the player is able to see // and recognize as being a monster. -// +// // want_move (??) Somehow affects what monsters are considered dangerous // just_check Return zero or one monsters only // dangerous_only Return only "dangerous" monsters // range search radius (defaults: LOS) -// +// void get_playervisible_monsters(std::vector &mons, bool want_move, bool just_check, diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h index 096c3f67e4..120bec657b 100644 --- a/crawl-ref/source/misc.h +++ b/crawl-ref/source/misc.h @@ -77,7 +77,7 @@ void pick_up_blood_potions_stack( item_def &stack, int quant ); bool can_bottle_blood_from_corpse( int mons_type ); void turn_corpse_into_blood_potions ( item_def &item ); -void split_blood_potions_into_decay( int obj, int amount = -1 ); +void split_potions_into_decay( int obj, int amount, bool need_msg = true ); bool victim_can_bleed(int montype); void bleed_onto_floor(int x, int y, int mon, int damage, bool spatter = false); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 87edb41f96..f36788784a 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -205,7 +205,7 @@ int get_mimic_colour( const monsters *mimic ) } // monster curses a random player inventory item: -bool curse_an_item( bool decay_potions ) +bool curse_an_item( bool decay_potions, bool quiet ) { int count = 0; int item = ENDOFPACK; @@ -241,36 +241,28 @@ bool curse_an_item( bool decay_potions ) return (false); // curse item: + if (decay_potions && !quiet) // just for mummies + mpr("You feel nervous for a moment...", MSGCH_MONSTER_SPELL); - /* problem: changes large piles of potions */ /* don't change you.inv_special (just for fun) */ if (you.inv[item].base_type == OBJ_POTIONS) { - // Potions of blood are vital to vampires, so make an exception for - // for them. (Come to think of it, this would work nicely for all - // other potion types as well.) - if (you.inv[item].sub_type == POT_BLOOD - || you.inv[item].sub_type == POT_BLOOD_COAGULATED) - { - int amount = random2(you.inv[item].quantity) + 1; - split_blood_potions_into_decay(item, amount); - - // Xom is amused if this happens to thirsty vampires - if (you.species == SP_VAMPIRE && you.hunger_state <= HS_HUNGRY) - xom_is_stimulated(32 * amount); - } + int amount; + // decay at least two of the stack + if (you.inv[item].quantity <= 2) + amount = you.inv[item].quantity; else - { - // Xom is amused by useful potions being ruined. - if (item_value(you.inv[item], true) / you.inv[item].quantity > 2) - xom_is_stimulated(32 * you.inv[item].quantity); + amount = 2 + random2(you.inv[item].quantity - 1); - you.inv[item].sub_type = POT_DECAY; - unset_ident_flags( you.inv[item], ISFLAG_IDENT_MASK ); // all different - } + split_potions_into_decay(item, amount); + + if (item_value(you.inv[item], true) / amount > 2) + xom_is_stimulated(32 * amount); } else - do_curse_item( you.inv[item] ); + { + do_curse_item( you.inv[item], false ); + } return (true); } @@ -1159,10 +1151,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) if (monster->type == MONS_MUMMY) { if (YOU_KILL(killer) && killer != KILL_YOU_CONF) - { - if (curse_an_item(true)) - mpr("You feel nervous for a moment...", MSGCH_MONSTER_SPELL); - } + curse_an_item(true); } else if (monster->type == MONS_GUARDIAN_MUMMY || monster->type == MONS_GREATER_MUMMY diff --git a/crawl-ref/source/monstuff.h b/crawl-ref/source/monstuff.h index ee8e077005..44e78cfdea 100644 --- a/crawl-ref/source/monstuff.h +++ b/crawl-ref/source/monstuff.h @@ -95,7 +95,7 @@ void behaviour_event( monsters *mon, int event_type, /* *********************************************************************** * called from: fight - it_use3 - spells * *********************************************************************** */ -bool curse_an_item(bool decay_potions); +bool curse_an_item(bool decay_potions, bool quiet = false); /* *********************************************************************** diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index e49001f017..ac901039c8 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -791,7 +791,8 @@ static void _print_status_lights(int y) clear_to_end_of_line(); ++ line_cur; // Careful not to trip the )#(*$ cgotoxy ASSERT - if (line_cur == line_end) break; + if (line_cur == line_end) + break; cgotoxy(1, line_cur, GOTO_STAT); } } @@ -865,15 +866,16 @@ void print_stats(void) if (you.redraw_quiver || you.wield_change) { _print_stats_qv(10+yhack); + you.redraw_quiver = false; } - you.wield_change = false; - you.redraw_quiver = false; + you.wield_change = false; if (you.redraw_status_flags) { you.redraw_status_flags = 0; _print_status_lights(11+yhack); } + textcolor(LIGHTGREY); update_screen(); } diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 32ceaa126a..1a75a1ccc2 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -350,7 +350,8 @@ void sublimation(int power) mprf("The blood within %s frothes and boils.", you.inv[wielded].quantity == 1 ? "the flask you are holding" : "one of your flasks"); - split_blood_potions_into_decay( wielded, 1 ); + + split_potions_into_decay( wielded, 1, false ); mpr("A flood of magical energy pours into your mind!"); inc_mp( 7 + random2(7), false ); -- cgit v1.2.3-54-g00ecf