From 2e5c80c5f2690bb4ef929c6c1a6d0c309afe55e5 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 30 Aug 2007 14:40:48 +0000 Subject: Several bugfixes. In no particular order: + Beogh shouldn't care about you attacking non-orc friends. + Mummies don't get "Food" listed as ability costs. + corrected order of invis flickering + modified (and tidied) you_can_wear checks and output + added ']' command to list currently worn equipment (inv) + wielded cursed items can no longer be fired + Wanderers no longer get inappropriate armour + Fixed "bad item" message for confirm-inscribed items + copied "Discharge" to "Static Discharge" in spells.txt (Maybe we should remove the first, but I was unsure about that, so I left it for now.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2035 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abl-show.cc | 2 +- crawl-ref/source/acr.cc | 21 ++++++++------ crawl-ref/source/beam.cc | 6 +++- crawl-ref/source/command.cc | 26 +++++++---------- crawl-ref/source/dat/descript/spells.txt | 4 +++ crawl-ref/source/enum.h | 4 ++- crawl-ref/source/invent.cc | 9 +++++- crawl-ref/source/item_use.cc | 1 + crawl-ref/source/newgame.cc | 25 +++++++++++------ crawl-ref/source/output.cc | 48 +++++++++++--------------------- crawl-ref/source/player.cc | 24 ++++++++++++---- crawl-ref/source/player.h | 2 +- crawl-ref/source/spells2.cc | 6 +++- 13 files changed, 101 insertions(+), 77 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index dfcfa80aba..52277fdbad 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -358,7 +358,7 @@ const std::string make_cost_description( ability_type ability ) ret << " HP"; } - if (abil.food_cost) + if (abil.food_cost && you.species != SP_MUMMY) { if (!ret.str().empty()) ret << ", "; diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 47f2ae2afa..4697d36360 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1577,19 +1577,23 @@ void process_command( command_type cmd ) case CMD_LIST_WEAPONS: list_weapons(); break; - - case CMD_INSCRIBE_ITEM: - inscribe_item(); - break; case CMD_LIST_ARMOUR: list_armour(); break; - + case CMD_LIST_JEWELLERY: list_jewellery(); break; + case CMD_LIST_EQUIPMENT: + get_invent( OSEL_EQUIP ); + break; + + case CMD_INSCRIBE_ITEM: + inscribe_item(); + break; + #ifdef WIZARD case CMD_WIZARD: handle_wizard_command(); @@ -1888,9 +1892,8 @@ static void decrement_durations() decrement_a_duration(DUR_RESIST_POISON, "Your poison resistance expires."); decrement_a_duration(DUR_SLAYING, "You feel less lethal."); - decrement_a_duration(DUR_INVIS, "You flicker for a moment.", - 6, coinflip(), - "You flicker back into view."); + decrement_a_duration(DUR_INVIS, "You flicker back into view.", + 6, coinflip(), "You flicker for a moment."); decrement_a_duration(DUR_BARGAIN, "You feel less charismatic."); decrement_a_duration(DUR_CONF, "You feel less confused."); @@ -2529,7 +2532,7 @@ command_type keycode_to_command( keycode_type key ) case '"': return CMD_LIST_JEWELLERY; case '{': return CMD_INSCRIBE_ITEM; case '[': return CMD_LIST_ARMOUR; - case ']': return CMD_LIST_ARMOUR; + case ']': return CMD_LIST_EQUIPMENT; case ')': return CMD_LIST_WEAPONS; case '(': return CMD_LIST_WEAPONS; case '\\': return CMD_DISPLAY_KNOWN_OBJECTS; diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index c1fbdd170c..7ddf8605c4 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3525,8 +3525,12 @@ static int affect_monster(bolt &beam, monsters *mon) { if (YOU_KILL( beam.thrower )) { - if (mons_friendly( mon )) + if (mons_friendly( mon ) + && (you.religion != GOD_BEOGH // Beogh only cares about orcs + || mons_species(mon->type) == MONS_ORC)) + { did_god_conduct( DID_ATTACK_FRIEND, 5 ); + } if (mons_holiness( mon ) == MH_HOLY) did_god_conduct( DID_ATTACK_HOLY, mon->hit_dice ); diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index ac2bdecbdb..61f53d29a5 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -374,21 +374,12 @@ void list_armour() if (armour_id != -1) estr << you.inv[armour_id].name(DESC_INVENTORY); - - if (!you_can_wear(i)) - { - if (i == EQ_BODY_ARMOUR || i == EQ_HELMET) - { - if (!you_tran_can_wear(i)) - estr << " (currently unavailable)"; - else - estr << " (ill-fitting)"; - } - else - estr << " (unavailable)"; - } + else if (!you_can_wear(i,true)) + estr << " (unavailable)"; else if (!you_tran_can_wear(i)) estr << " (currently unavailable)"; + else if (!you_can_wear(i)) + estr << " (ill-fitting)"; else estr << " none"; @@ -463,10 +454,13 @@ void list_weapons(void) else wstring = "Secondary : "; - if (is_valid_item( you.inv[i] )) + if (is_valid_item( you.inv[i]) && + (you.inv[i].base_type == OBJ_WEAPONS + || you.inv[i].base_type == OBJ_STAVES + || you.inv[i].base_type == OBJ_MISCELLANY)) + { wstring += you.inv[i].name(DESC_INVENTORY_EQUIP); - else if (!you_tran_can_wear(EQ_WEAPON)) - wstring += " (currently unavailable)"; + } else wstring += " none"; diff --git a/crawl-ref/source/dat/descript/spells.txt b/crawl-ref/source/dat/descript/spells.txt index 0d44795dd3..8c687d7310 100644 --- a/crawl-ref/source/dat/descript/spells.txt +++ b/crawl-ref/source/dat/descript/spells.txt @@ -567,6 +567,10 @@ Spider Form This spell temporarily transforms the caster into a venomous, spider-like creature. Spellcasting is slightly more difficult in this form. This spell is not powerful enough to allow the caster to slip out of cursed equipment. %%%% +Static Discharge + +This spell releases electric charges against those next to the caster. These may arc to adjacent monsters (or even the caster) before they eventually ground out. +%%%% Statue Form This spell temporarily transforms the caster into a slow-moving (but extremely robust) stone statue. diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 6232299752..99600a548c 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -619,6 +619,7 @@ enum command_type CMD_LIST_WEAPONS, CMD_LIST_ARMOUR, CMD_LIST_JEWELLERY, + CMD_LIST_EQUIPMENT, CMD_ZAP_WAND, CMD_CAST_SPELL, CMD_MEMORISE_SPELL, @@ -2794,7 +2795,8 @@ enum object_selector { OSEL_ANY = -1, OSEL_WIELD = -2, - OSEL_UNIDENT = -3 + OSEL_UNIDENT = -3, + OSEL_EQUIP = -4 }; enum operation_types diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 461d83bda3..057f4c8e7b 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -633,6 +633,13 @@ static bool item_class_selected(const item_def &i, int selector) || itype == OBJ_MISCELLANY); case OBJ_SCROLLS: return (itype == OBJ_SCROLLS || itype == OBJ_BOOKS); + case OSEL_EQUIP: + for (int eq = 0; eq < NUM_EQUIP; eq++) + { + if (you.equip[eq] == i.link) + return (true); + } + // fall through default: return (false); } @@ -913,7 +920,7 @@ bool has_warning_inscription(const item_def& item, bool check_warning_inscriptions( const item_def& item, operation_types oper ) { - if ( has_warning_inscription(item, oper) ) + if (is_valid_item( item ) && has_warning_inscription(item, oper) ) { std::string prompt = "Really choose "; prompt += item.name(DESC_INVENTORY); diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index bd614dbc85..949f174fe4 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1174,6 +1174,7 @@ static bool fire_item_matches(const item_def &item, unsigned fire_type) static bool fire_item_okay(const item_def &item, unsigned flags) { return (fire_item_matches(item, flags) + && !(you.equip[EQ_WEAPON] == item.link && item_cursed(item)) && check_warning_inscriptions(item, OPER_FIRE)); } diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index fc37123db9..6e34bec11f 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -2427,22 +2427,29 @@ static void give_random_secondary_armour( int slot ) switch (random2(4)) { case 0: - you.inv[ slot ].sub_type = ARM_CLOAK; - you.equip[EQ_CLOAK] = slot; - break; - case 1: you.inv[ slot ].sub_type = ARM_BOOTS; you.equip[EQ_BOOTS] = slot; - break; + if (you_can_wear(EQ_BOOTS)) + break; + // else fall through + case 1: + you.inv[ slot ].sub_type = ARM_HELMET; + you.equip[EQ_HELMET] = slot; + if (you_can_wear(EQ_HELMET)) + break; + // else fall through case 2: you.inv[ slot ].sub_type = ARM_GLOVES; you.equip[EQ_GLOVES] = slot; - break; - case 3: - you.inv[ slot ].sub_type = ARM_HELMET; - you.equip[EQ_HELMET] = slot; + if (you_can_wear(EQ_GLOVES)) + break; + // else fall through + case 3: // anyone can wear this + you.inv[ slot ].sub_type = ARM_CLOAK; + you.equip[EQ_CLOAK] = slot; break; } + } // Returns true if a "good" weapon is given diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 011f2b3a18..0b8689898a 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -23,10 +23,12 @@ #include "externs.h" #include "abl-show.h" +#include "describe.h" #include "format.h" #include "fight.h" #include "initfile.h" #include "itemname.h" +#include "items.h" #include "menu.h" #include "ouch.h" #include "player.h" @@ -637,8 +639,13 @@ static const char *s_equip_slot_names[] = const char *equip_slot_to_name(int equip) { - if (equip == EQ_RINGS) + if (equip == EQ_RINGS || equip == EQ_LEFT_RING || equip == EQ_RIGHT_RING) return "Ring"; + + if (equip == EQ_BOOTS && + (you.species == SP_CENTAUR || you.species == SP_NAGA)) + return "Barding"; + if (equip < 0 || equip >= NUM_EQUIP) return ""; return s_equip_slot_names[equip]; @@ -844,11 +851,6 @@ std::vector get_full_detail(bool calc_unid, long sc) { int eqslot = e_order[i]; const char *slot = equip_slot_to_name( eqslot ); - if (eqslot == EQ_LEFT_RING || eqslot == EQ_RIGHT_RING) - slot = "Ring"; - else if (eqslot == EQ_BOOTS && - (you.species == SP_CENTAUR || you.species == SP_NAGA)) - slot = "Barding"; if ( you.equip[ e_order[i] ] != -1) { @@ -1245,11 +1247,6 @@ void print_overview_screen() { int eqslot = e_order[i]; const char *slot = equip_slot_to_name( eqslot ); - if (eqslot == EQ_LEFT_RING || eqslot == EQ_RIGHT_RING) - slot = "Ring"; - else if (eqslot == EQ_BOOTS && - (you.species == SP_CENTAUR || you.species == SP_NAGA)) - slot = "Barding"; if ( you.equip[ e_order[i] ] != -1) { @@ -1276,27 +1273,10 @@ void print_overview_screen() else snprintf(buf, sizeof buf, "%-7s:", slot); } - else if (!you_can_wear(e_order[i])) + else if (!you_can_wear(e_order[i], true)) { - if (e_order[i] == EQ_BODY_ARMOUR || e_order[i] == EQ_HELMET) - { - if (!you_tran_can_wear(e_order[i])) - { - snprintf(buf, sizeof buf, "%-7s: " - "(currently unavailable)", - slot); - } - else - { snprintf(buf, sizeof buf, - "%-7s: (ill-fitting)", - slot); - } - } - else - { - snprintf(buf, sizeof buf, - "%-7s: (unavailable)", slot); - } + snprintf(buf, sizeof buf, + "%-7s: (unavailable)", slot); } else if (!you_tran_can_wear(e_order[i])) { @@ -1304,6 +1284,12 @@ void print_overview_screen() "(currently unavailable)", slot); } + else if (!you_can_wear(e_order[i])) + { + snprintf(buf, sizeof buf, + "%-7s: (ill-fitting)", + slot); + } else { snprintf(buf, sizeof buf, "%-7s:", slot); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 0aa2a822bf..1222f79510 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -433,10 +433,11 @@ bool player_genus(unsigned char which_genus, unsigned char species) // use (usually wear) a given piece of equipment // Note that EQ_BODY_ARMOUR and EQ_HELMET only check // the ill-fitting variant (i.e. not caps and robes) -// Centaurs and Naga are ignored for now, seeing how -// Boots are changed to Barding in the % screen. +// If special_armour is set to true, special cases +// such as bardings, light armour and caps are +// considered. Otherwise these simply return false. // ------------------------------------------------- -bool you_can_wear(int eq) +bool you_can_wear(int eq, bool special_armour) { // these can be used by all if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_AMULET @@ -452,8 +453,12 @@ bool you_can_wear(int eq) if (you.is_undead) return true; -// if (eq == EQ_BOOTS && (you.species == SP_NAGA || you.species == SP_CENTAUR)) -// return false; + // anyone can wear caps/hats and robes + if (special_armour && (eq == EQ_HELMET || eq == EQ_BODY_ARMOUR)) + return true; + + if (eq == EQ_BOOTS && (you.species == SP_NAGA || you.species == SP_CENTAUR)) + return (special_armour); // of the remaining items, these races can't wear anything if (you.species == SP_TROLL || you.species == SP_SPRIGGAN @@ -467,6 +472,9 @@ bool you_can_wear(int eq) return false; } + if (you.species == SP_MINOTAUR && eq == EQ_HELMET) + return false; + // else no problems return true; } @@ -5246,8 +5254,12 @@ void player::attacking(actor *other) if (other && other->atype() == ACT_MONSTER) { const monsters *mons = dynamic_cast(other); - if (mons_friendly(mons)) + if (mons_friendly(mons) + && (you.religion != GOD_BEOGH // Beogh only cares about orcs + || ::mons_species(mons->type) == MONS_ORC)) + { did_god_conduct(DID_ATTACK_FRIEND, 5); + } else pet_target = monster_index(mons); } diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 898ae998cf..4dff5056a6 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -303,7 +303,7 @@ void redraw_skill(const char your_name[kNameLen], const char class_name[80]); bool player_genus( unsigned char which_genus, unsigned char species = SP_UNKNOWN ); -bool you_can_wear( int eq ); +bool you_can_wear( int eq, bool special_armour = false ); bool you_tran_can_wear( int eq ); /* *********************************************************************** diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 3fd9f1598a..fce14a13dd 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -1092,8 +1092,12 @@ char burn_freeze(int pow, char flavour) if (hurted) { - if (mons_friendly( monster )) + if (mons_friendly( monster ) + && (you.religion != GOD_BEOGH // Beogh only cares about orcs + || mons_species(monster->type) == MONS_ORC)) + { did_god_conduct( DID_ATTACK_FRIEND, 5 ); + } if (mons_holiness( monster ) == MH_HOLY) did_god_conduct( DID_ATTACK_HOLY, monster->hit_dice ); -- cgit v1.2.3-54-g00ecf