diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-02 07:43:45 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-02 07:43:45 +0000 |
commit | e9183b0754c65eccbb6edb43f73f8657763bcda7 (patch) | |
tree | 1087c3ff2719be7d14c5c1da2a155e6445e6b32d /crawl-ref/source/food.cc | |
parent | d4eac8237d665f9126e74516281b97578fe45d3f (diff) | |
download | crawl-ref-e9183b0754c65eccbb6edb43f73f8657763bcda7.tar.gz crawl-ref-e9183b0754c65eccbb6edb43f73f8657763bcda7.zip |
1616158: Easy-butcher sequence if you are wearing gloves and can butcher
barehanded (effectively ghouls + those with MUT_CLAWS.)
The takeoff/puton armour messages will appear out of sequence, but this
is a bug in the delay process; you can see it now by taking off armour
while wearing a cloak. This could be fixed by having the delay start
message only trigger when the delay actually starts (as opposed to when
it's pushed onto the queue) but I'm not doing that because I'm not sure
where the code assumes the current behaviour.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1713 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/food.cc')
-rw-r--r-- | crawl-ref/source/food.cc | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 94fdc8b718..9c0ad6d5d2 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -145,9 +145,10 @@ void weapon_switch( int targ ) wield_effects( targ, false ); } -// look for a butchering implement, prompting user if no obvious -// options exist. Returns whether a weapon was switched. -static bool find_butchering_implement() +// look for a butchering implement. If fallback is true, +// prompt the user if no obvious options exist. +// Returns whether a weapon was switched. +static bool find_butchering_implement( bool fallback ) { // look for a butchering implement in your pack for (int i = 0; i < ENDOFPACK; ++i) @@ -165,7 +166,10 @@ static bool find_butchering_implement() return true; } } - + + if ( !fallback ) + return false; + // if we didn't swap above, then we still can't cut...let's call // wield_weapon() in the "prompt the user" way... @@ -180,7 +184,6 @@ static bool find_butchering_implement() bool butchery(void) { - bool can_butcher = false; bool wpn_switch = false; bool new_cursed = false; int old_weapon = you.equip[EQ_WEAPON]; @@ -193,7 +196,14 @@ bool butchery(void) you.species == SP_GHOUL || you.mutation[MUT_CLAWS]))); - can_butcher = barehand_butcher || + bool gloved_butcher = (you.species == SP_TROLL || + you.species == SP_GHOUL || + you.mutation[MUT_CLAWS]) && + (you.equip[EQ_GLOVES] != -1 && + !item_cursed(you.inv[you.equip[EQ_GLOVES]])); + int old_gloves = you.equip[EQ_GLOVES]; + + bool can_butcher = barehand_butcher || (you.equip[EQ_WEAPON] != -1 && can_cut_meat(you.inv[you.equip[EQ_WEAPON]])); @@ -246,11 +256,23 @@ bool butchery(void) } if ( answer == 0 ) continue; + + bool removed_gloves = false; if ( Options.easy_butcher && !can_butcher ) { - // try to find a butchering implement - wpn_switch = find_butchering_implement(); + // Try to find a butchering implement. + // If you can butcher by taking off your gloves, don't prompt. + wpn_switch = find_butchering_implement(!gloved_butcher); + removed_gloves = gloved_butcher && !wpn_switch; + if ( removed_gloves ) + { + // Actually take off the gloves; this creates a + // delay. We assume later on that gloves have a 1-turn + // takeoff delay! + takeoff_armour(old_gloves); + barehand_butcher = true; + } const int wpn = you.equip[EQ_WEAPON]; if ( wpn_switch ) { @@ -260,11 +282,11 @@ bool butchery(void) item_cursed( you.inv[wpn]); } - // note that barehanded butchery would not reach this - // stage, so if wpn == -1 the user selected '-' when + // note that if wpn == -1 the user selected '-' when // switching weapons - if (!wpn_switch || wpn == -1 || !can_cut_meat(you.inv[wpn])) + if (!barehand_butcher && + (!wpn_switch || wpn == -1 || !can_cut_meat(you.inv[wpn]))) { // still can't butcher. Early out if ( wpn == -1 ) { @@ -304,7 +326,7 @@ bool butchery(void) { // If we didn't switch weapons, we get in one turn of butchery; // otherwise the work has to happen in the delay. - if (!wpn_switch) + if (!wpn_switch && !removed_gloves) ++mitm[objl].plus2; int work_req = 4 - mitm[objl].plus2; @@ -325,6 +347,10 @@ bool butchery(void) if (!new_cursed && wpn_switch) start_delay( DELAY_WEAPON_SWAP, 1, old_weapon ); + // put on the removed gloves + if ( removed_gloves ) + start_delay( DELAY_ARMOUR_ON, 1, old_gloves ); + you.turn_is_over = true; return true; } |