diff options
-rw-r--r-- | crawl-ref/source/beam.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/cloud.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/delay.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/food.cc | 46 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/ouch.cc | 18 | ||||
-rw-r--r-- | crawl-ref/source/ouch.h | 2 |
7 files changed, 50 insertions, 32 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index dcc697eba0..e5a40bd57d 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3144,7 +3144,10 @@ int affect(bolt &beam, int x, int y, item_def *item) // If not a tracer, affect items and place clouds. if (!beam.is_tracer) { - expose_items_to_element(beam.flavour, x, y); + const int burn_power = (beam.is_explosion) ? 5 : + (beam.is_beam) ? 3 : 2; + + expose_items_to_element(beam.flavour, x, y, burn_power); rangeUsed += _affect_place_clouds(beam, x, y); } diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index 9b01fa84d6..0aef61b1f0 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -157,7 +157,7 @@ void manage_clouds(void) } expose_items_to_element(cloud2beam(env.cloud[cc].type), - env.cloud[cc].x, env.cloud[cc].y); + env.cloud[cc].x, env.cloud[cc].y, 2); _dissipate_cloud(cc, env.cloud[cc], dissipate); } diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 3979b187d6..7b9133594b 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -698,13 +698,6 @@ void handle_delay( void ) if (apply_area_visible(_recite_to_monsters, delay.parm1)) viewwindow(true, false); break; - case DELAY_FEED_VAMPIRE: - { - item_def &corpse = (delay.parm1 ? you.inv[delay.parm2] - : mitm[delay.parm2]); - vampire_nutrition_per_turn(corpse, -1); - break; - } default: break; } diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 44f39bdb5a..8e876e67f7 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -314,7 +314,8 @@ static bool _prepare_butchery(bool can_butcher, bool removed_gloves, return (true); } -static bool _butcher_corpse(int corpse_id, bool force_butcher = false) +static bool _butcher_corpse(int corpse_id, bool first_corpse = true, + bool force_butcher = false) { ASSERT(corpse_id != -1); @@ -324,7 +325,7 @@ static bool _butcher_corpse(int corpse_id, bool force_butcher = false) if (can_sac && !rotten) { - start_delay(DELAY_OFFER_CORPSE, 1, corpse_id); + start_delay(DELAY_OFFER_CORPSE, 0, corpse_id); } else { @@ -336,7 +337,7 @@ static bool _butcher_corpse(int corpse_id, bool force_butcher = false) you.religion); } - int work_req = 4 - mitm[corpse_id].plus2; + int work_req = 4 - mitm[corpse_id].plus2 - (first_corpse ? 1 : 0); if (work_req < 0) work_req = 0; @@ -546,7 +547,7 @@ bool butchery(int which_corpse) { return (false); } - success = _butcher_corpse(corpse_id); + success = _butcher_corpse(corpse_id, true); _terminate_butchery(wpn_switch, removed_gloves, old_weapon, old_gloves); // Remind player of corpses in pack that could be butchered or @@ -561,6 +562,8 @@ bool butchery(int which_corpse) bool bottle_all = false; // for Vampires bool force_butcher = false; bool repeat_prompt = false; + bool did_weap_swap = false; + bool first_corpse = true; int keyin; for (stack_iterator si(you.pos()); si; ++si) { @@ -611,10 +614,15 @@ bool butchery(int which_corpse) case 'c': case 'd': case 'a': - if (!_prepare_butchery(can_butcher, removed_gloves, - wpn_switch, butcher_tool)) + if (!did_weap_swap) { - return (false); + if (_prepare_butchery(can_butcher, removed_gloves, + wpn_switch, butcher_tool)) + { + did_weap_swap = true; + } + else + return (false); } corpse_id = si->index(); @@ -654,11 +662,15 @@ bool butchery(int which_corpse) if (corpse_id != -1) { - if (_butcher_corpse(corpse_id, force_butcher || butcher_all)) + if (_butcher_corpse(corpse_id, first_corpse, + force_butcher || butcher_all)) + { success = true; + first_corpse = false; + } - if (!butcher_all && !bottle_all) - break; +// if (!butcher_all && !bottle_all) +// break; } } @@ -2093,7 +2105,7 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, bool reqid, if (ur_herbivorous) { if (!suppress_msg) - mpr("You can't eat raw meat!"); + mpr("Blech - you need greens!"); return (false); } else if (kindof_thing == FOOD_CHUNK) @@ -2328,8 +2340,16 @@ static bool _vampire_consume_corpse(const int slot, bool invent) int chunk_amount = 1 + max_chunks/2; chunk_amount = stepdown_value( chunk_amount, 4, 4, 12, 12 ); - start_delay( DELAY_FEED_VAMPIRE, 1 + chunk_amount/2, - (int) invent, slot ); + // Get some nutrition right away, in case we're interrupted. + // (-1 for the starting message.) + vampire_nutrition_per_turn(corpse, -1); + if (chunk_amount/2 > 0) + { + // The draining delay doesn't have a start action, and we only need + // the continue/finish messages if it takes longer than 1 turn. + start_delay( DELAY_FEED_VAMPIRE, chunk_amount/2, + (int) invent, slot ); + } return (true); } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 9fc7428131..643c115589 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -2580,7 +2580,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, if (teleport) { // Violating encapsulation somewhat...oh well. - hit = (affect(pbolt, pbolt.target_x, pbolt.target_y) != 0); + hit = (affect(pbolt, pbolt.target_x, pbolt.target_y, &item) != 0); if (acc_bonus != DEBUG_COOKIE) beam_drop_object(pbolt, &item, pbolt.target_x, pbolt.target_y); } diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index e87b2499ab..97e51b76a6 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -538,7 +538,7 @@ static void _expose_invent_to_element(beam_type flavour, int strength) } } -void expose_items_to_element(beam_type flavour, int x, int y) +void expose_items_to_element(beam_type flavour, int x, int y, int strength) { int num_dest = 0; @@ -551,16 +551,18 @@ void expose_items_to_element(beam_type flavour, int x, int y) if (!is_valid_item(*si)) continue; - if ( si->base_type == target_class - || (target_class == OBJ_FOOD && si->base_type == OBJ_CORPSES)) + if (si->base_type == target_class + || target_class == OBJ_FOOD && si->base_type == OBJ_CORPSES) { - num_dest += si->quantity; - item_was_destroyed(*si); - destroy_item(si->index()); + if (x_chance_in_y(strength, 100)) + { + num_dest++; + dec_mitm_item_quantity(si->index(), 1); + } } } - if (num_dest > 0) + if (num_dest) { if (see_grid(x, y)) { @@ -602,7 +604,7 @@ void expose_items_to_element(beam_type flavour, int x, int y) // // This function now calls _expose_invent_to_element() if strength > 0. // -// XXX: this function is far from perfect and a work in progress. +// XXX: This function is far from perfect and a work in progress. void expose_player_to_element(beam_type flavour, int strength) { // Note that BEAM_TELEPORT is sent here when the player diff --git a/crawl-ref/source/ouch.h b/crawl-ref/source/ouch.h index 7f66535d75..18ca77f210 100644 --- a/crawl-ref/source/ouch.h +++ b/crawl-ref/source/ouch.h @@ -107,7 +107,7 @@ void lose_level(void); * *********************************************************************** */ void drain_exp(bool announce_full = true); -void expose_items_to_element(beam_type flavour, int x, int y); +void expose_items_to_element(beam_type flavour, int x, int y, int strength = 0); void expose_player_to_element(beam_type flavour, int strength = 0); #endif |