From 8d408bcec276c6900302ddb079f17da88456acd3 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 16 Sep 2007 21:51:20 +0000 Subject: Applying patches by dolorous: 1794789: Move "Xom is BORED" message into god channel 1795785: remove redundant check for potions of blood 1795673: claw-related clean-ups and enforcing consistency in transformations and claws (Lich and Statue retain claws, Ice Beast doesn't). I also added a check for hooves and claws mutation for the % and [ you_can_wear output. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2114 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/command.cc | 2 +- crawl-ref/source/delay.cc | 5 ++--- crawl-ref/source/externs.h | 1 + crawl-ref/source/fight.cc | 15 ++++++++++++-- crawl-ref/source/food.cc | 28 +++++++++---------------- crawl-ref/source/it_use2.cc | 3 +-- crawl-ref/source/item_use.cc | 12 +++++++++++ crawl-ref/source/mutation.cc | 12 ++++++----- crawl-ref/source/output.cc | 2 +- crawl-ref/source/player.cc | 49 ++++++++++++++++++++++++++++++++++---------- crawl-ref/source/player.h | 2 +- crawl-ref/source/religion.cc | 2 +- crawl-ref/source/spells4.cc | 4 ++-- crawl-ref/source/transfor.cc | 3 ++- 14 files changed, 92 insertions(+), 48 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 81ef504d05..604d77cad3 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -379,7 +379,7 @@ void list_armour() estr << you.inv[armour_id].name(DESC_INVENTORY); else if (!you_can_wear(i,true)) estr << " (unavailable)"; - else if (!you_tran_can_wear(i)) + else if (!you_tran_can_wear(i, true)) estr << " (currently unavailable)"; else if (!you_can_wear(i)) estr << " (restricted)"; diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 05474129c5..23ec28cb52 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -564,9 +564,8 @@ static void finish_delay(const delay_queue_item &delay) if (is_valid_item(item) && item.base_type == OBJ_CORPSES) { mprf("You finish %s the corpse into pieces.", - (you.species == SP_TROLL || you.species == SP_GHOUL - || you.mutation[MUT_FANGS] == 3) ? "ripping" - : "chopping"); + (you.has_usable_claws() || you.mutation[MUT_FANGS] == 3) ? + "ripping" : "chopping"); if (you.species == SP_VAMPIRE && (!god_likes_butchery(you.religion) || diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 3c59a1ece6..326dee57b5 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -724,6 +724,7 @@ public: size_type body_size(int psize = PSIZE_TORSO, bool base = false) const; int damage_type(int attk = -1); int damage_brand(int attk = -1); + bool has_claws() const; bool has_usable_claws() const; item_def *weapon(int which_attack = -1); item_def *shield(); diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index c9c0fb6d79..3afd4536d5 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -1299,9 +1299,20 @@ int melee_attack::player_weapon_type_modify(int damage) else attack_verb = "shred"; break; - case TRAN_ICE_BEAST: case TRAN_STATUE: case TRAN_LICH: + if (you.has_usable_claws()) + { + if (damage < HIT_MED) + attack_verb = "claw"; + else if (damage < HIT_STRONG) + attack_verb = "mangle"; + else + attack_verb = "eviscerate"; + break; + } + // or fall-through + case TRAN_ICE_BEAST: if (damage < HIT_MED) attack_verb = "punch"; else @@ -2268,7 +2279,7 @@ int melee_attack::player_to_hit(bool random_factor) your_to_hit -= 5; const bool see_invis = player_see_invis(); - // if you can't see yourself, you're a little less acurate. + // if you can't see yourself, you're a little less accurate. if (you.invisible() && !see_invis) your_to_hit -= 5; diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 0bd634dc44..f72ef2cf80 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -195,31 +195,23 @@ bool butchery(void) bool wpn_switch = false; bool new_cursed = false; int old_weapon = you.equip[EQ_WEAPON]; + int old_gloves = you.equip[EQ_GLOVES]; const transformation_type transform = static_cast(you.attribute[ATTR_TRANSFORMATION]); // Xom probably likes this, occasionally bool teeth_butcher = (you.mutation[MUT_FANGS] == 3); - - bool barehand_butcher = - (you.equip[ EQ_GLOVES ] == -1 - && (transform_can_butcher_barehanded(transform) - || (transform == TRAN_NONE - && (you.species == SP_TROLL - || you.species == SP_GHOUL - || you.mutation[MUT_CLAWS])))); - - 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 = teeth_butcher || barehand_butcher || - (you.equip[EQ_WEAPON] != -1 && - can_cut_meat(you.inv[you.equip[EQ_WEAPON]])); + bool barehand_butcher = (transform_can_butcher_barehanded(transform) + || you.has_claws()) && you.equip[EQ_GLOVES] == -1; + + bool gloved_butcher = you.has_claws() && (you.equip[EQ_GLOVES] != -1 + && !item_cursed(you.inv[you.equip[EQ_GLOVES]])); + + bool can_butcher = teeth_butcher || barehand_butcher + || you.equip[EQ_WEAPON] != -1 + && can_cut_meat(you.inv[you.equip[EQ_WEAPON]]); if (igrd[you.x_pos][you.y_pos] == NON_ITEM) { diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index 381a9f2364..cd805455fc 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -323,8 +323,7 @@ bool potion_effect( potion_type pot_eff, int pow ) } else { - bool likes_blood = (you.species == SP_KOBOLD - || you.species == SP_OGRE + bool likes_blood = (you.species == SP_OGRE || you.species == SP_TROLL || you.mutation[MUT_CARNIVOROUS]); diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index ffaefc2522..c7d90978d9 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -754,6 +754,18 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) return (false); } + if (sub_type == ARM_GLOVES) + { + if (you.species == SP_TROLL || you.species == SP_GHOUL + || you.mutation[MUT_CLAWS] >= 3) + { + if (verbose) + mpr( "You can't wear gloves with your huge claws!" ); + + return (false); + } + } + if (sub_type == ARM_BOOTS) { if (you.species == SP_NAGA || you.species == SP_CENTAUR) diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 3deee3e691..c4b39e8dab 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -68,7 +68,7 @@ const char* troll_claw_descrip[4] = { "You have claws for hands.", "You have sharp claws for hands.", "You have very sharp claws for hands.", - "Your claws are sharper than steel." + "You have claws sharper than steel for hands." }; const char *mutation_descrip[][3] = { @@ -260,7 +260,7 @@ const char *mutation_descrip[][3] = { {"Your wings are large and strong.", "", ""}, //jmf: dracos only //jmf: these next two are for evil gods to mark their followers; good gods - // will never accept a 'marked' worhsipper + // will never accept a 'marked' worshipper {"There is a blue sigil on each of your hands.", "There are several blue sigils on your hands and arms.", @@ -1608,14 +1608,16 @@ bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, break; case MUT_CLAWS: - mpr((you.species == SP_TROLL ? troll_claw_messages : gain_mutation[mutat])[you.mutation[mutat]], MSGCH_MUTATION); - // gloves aren't prevented until level three - if (you.mutation[ mutat ] >= 3) + // gloves aren't prevented until level 3; we don't have the + // mutation yet, so we have to check for level 2 or higher claws + // here + if (you.mutation[mutat] >= 2) remove_one_equip(EQ_GLOVES); + break; case MUT_HORNS: // horns force your helmet off diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index eb3d7de1a0..5f080bf755 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1282,7 +1282,7 @@ void print_overview_screen() snprintf(buf, sizeof buf, "%-7s: (unavailable)", slot); } - else if (!you_tran_can_wear(e_order[i])) + else if (!you_tran_can_wear(e_order[i], true)) { snprintf(buf, sizeof buf, "%-7s: " "(currently unavailable)", diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 49c0b2abc4..d432fa0e86 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -475,9 +475,6 @@ bool you_can_wear(int eq, bool special_armour) if (player_genus(GENPC_ELVEN)) return true; - if (you.is_undead) - return true; - // anyone can wear caps/hats and robes and at least one of buckler/shield if (special_armour && (eq == EQ_HELMET || eq == EQ_BODY_ARMOUR || eq == EQ_SHIELD)) @@ -496,19 +493,34 @@ bool you_can_wear(int eq, bool special_armour) } if (you.species == SP_KENKU && (eq == EQ_HELMET || eq == EQ_BOOTS)) - { return false; - } if (you.species == SP_MINOTAUR && eq == EQ_HELMET) return false; + if (you.species == SP_GHOUL && eq == EQ_GLOVES) + return false; + // else no problems return true; } -bool you_tran_can_wear(int eq) +bool you_tran_can_wear(int eq, bool check_mutation) { + // not a transformation, but also temporary -> check first + if (check_mutation) + { + if (you.mutation[MUT_CLAWS] >= 3 && eq == EQ_GLOVES) + return false; + + if (eq == EQ_BOOTS + && (player_is_swimming() && you.species == SP_MERFOLK + || you.mutation[MUT_HOOVES] >= 2)) + { + return false; + } + } + int transform = you.attribute[ATTR_TRANSFORMATION]; // no further restrictions @@ -5729,13 +5741,28 @@ void player::slow_down(int str) ::slow_player( str ); } +bool player::has_claws() const +{ + // these transformations bring claws with them + if (attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON + || attribute[ATTR_TRANSFORMATION] == TRAN_SERPENT_OF_HELL) + { + return true; + } + + // these are the only other sources for claws + if (species != SP_TROLL && species != SP_GHOUL && !mutation[MUT_CLAWS]) + return false; + + // transformations other than these will override claws + return ( attribute[ATTR_TRANSFORMATION] == TRAN_NONE + || attribute[ATTR_TRANSFORMATION] == TRAN_STATUE + || attribute[ATTR_TRANSFORMATION] == TRAN_LICH ); +} + bool player::has_usable_claws() const { - return (equip[EQ_GLOVES] == -1 && - (attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON - || mutation[MUT_CLAWS] - || species == SP_TROLL - || species == SP_GHOUL)); + return (equip[EQ_GLOVES] == -1 && has_claws()); } god_type player::deity() const diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 8f4f0e897f..d70fd80048 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -314,7 +314,7 @@ bool player_genus( unsigned char which_genus, unsigned char species = SP_UNKNOWN ); bool you_can_wear( int eq, bool special_armour = false ); -bool you_tran_can_wear( int eq ); +bool you_tran_can_wear( int eq, bool check_mutation = false ); /* *********************************************************************** * called from: ability - effects - fight - it_use3 - ouch - spell - diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index ee7893204a..ec8e2519aa 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3068,7 +3068,7 @@ void handle_god_time(void) // something interesting happening. if (you.gift_timeout == 1) { - mpr("Xom is getting BORED."); + god_speaks(you.religion, "Xom is getting BORED."); you.gift_timeout = 0; } else if (you.gift_timeout > 1) diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index c8d51b2eec..8a7b7511d7 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -86,14 +86,14 @@ std::string your_hand( bool plural ) mpr("ERROR: unknown transformation in your_hand() (spells4.cc)"); case TRAN_NONE: case TRAN_STATUE: - if (you.species == SP_TROLL || you.species == SP_GHOUL) + case TRAN_LICH: + if (you.has_usable_claws()) { result = "claw"; break; } // or fall-through case TRAN_ICE_BEAST: - case TRAN_LICH: result = "hand"; break; case TRAN_SPIDER: diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc index 538c3012f1..26a17daca1 100644 --- a/crawl-ref/source/transfor.cc +++ b/crawl-ref/source/transfor.cc @@ -434,7 +434,8 @@ bool transform(int pow, transformation_type which_trans) bool transform_can_butcher_barehanded(transformation_type tt) { - return (tt == TRAN_BLADE_HANDS || tt == TRAN_DRAGON); + return (tt == TRAN_BLADE_HANDS || tt == TRAN_DRAGON + || tt == TRAN_SERPENT_OF_HELL); } void untransform(void) -- cgit v1.2.3-54-g00ecf