summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-26 19:14:07 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-26 19:14:07 +0000
commit97fe1affe7f3a999b29a7ca932b99b4349b0ea46 (patch)
treef82e6bb0d854d901784b3fb6980d492e35bf24a9 /crawl-ref/source
parentc96c36a0477909874c98bdbda3d13333ddb453e2 (diff)
downloadcrawl-ref-97fe1affe7f3a999b29a7ca932b99b4349b0ea46.tar.gz
crawl-ref-97fe1affe7f3a999b29a7ca932b99b4349b0ea46.zip
* Properly deactivate shields during transformations.
* Fix a few transformation edge cases: make sure inappropriate equipment is removed when untransforming e.g. if the player was mutated during transformation or wielded a two-handed weapon. * Mention mulching in ammo descriptions. * Fix 2178374: Spell descriptions for items. * FR 2183104: Get rid of training toggle for skills at 27. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7301 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/acr.cc3
-rw-r--r--crawl-ref/source/command.cc22
-rw-r--r--crawl-ref/source/describe.cc8
-rw-r--r--crawl-ref/source/describe.h1
-rw-r--r--crawl-ref/source/mutation.cc8
-rw-r--r--crawl-ref/source/player.cc3
-rw-r--r--crawl-ref/source/skills2.cc11
-rw-r--r--crawl-ref/source/transfor.cc51
8 files changed, 86 insertions, 21 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 05ce0011cf..c4c77e7025 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1475,7 +1475,8 @@ static void _input()
// XXX: Is there some smart way to avoid autoswitching back if we're
// just about to continue butchering?
if (!you.turn_is_over && player_feels_safe
- && you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED])
+ && you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED]
+ && you_tran_can_wear(EQ_WEAPON))
{
// Decrease value by 1. (0 means attribute is false, 1 = a, 2 = b, ...)
int weap = you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] - 1;
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 735a31adeb..2ab0f6e507 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -1340,16 +1340,7 @@ static bool _do_description(std::string key, std::string footer = "")
{
char name[80];
snprintf(name, 80, key.c_str());
- if (_append_books(desc, mitm[thing_created], key))
- {
- // nothing to be done
- }
- else if (get_item_by_name(&mitm[thing_created], name, OBJ_BOOKS)
- || get_item_by_name(&mitm[thing_created], name, OBJ_STAVES))
- {
- _append_spells(desc, mitm[thing_created]);
- }
- else if (get_item_by_name(&mitm[thing_created], name, OBJ_WEAPONS))
+ if (get_item_by_name(&mitm[thing_created], name, OBJ_WEAPONS))
{
append_weapon_stats(desc, mitm[thing_created]);
desc += "$";
@@ -1359,6 +1350,17 @@ static bool _do_description(std::string key, std::string footer = "")
append_armour_stats(desc, mitm[thing_created]);
desc += "$";
}
+ else if (get_item_by_name(&mitm[thing_created], name, OBJ_MISSILES))
+ {
+ append_missile_info(desc);
+ desc += "$";
+ }
+ else if (get_item_by_name(&mitm[thing_created], name, OBJ_BOOKS)
+ || get_item_by_name(&mitm[thing_created], name, OBJ_STAVES))
+ {
+ if (!_append_books(desc, mitm[thing_created], key))
+ _append_spells(desc, mitm[thing_created]);
+ }
// Now we don't need the item anymore.
destroy_item(thing_created);
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 3c04ab10d9..70d0f3a711 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1215,6 +1215,8 @@ static std::string _describe_ammo( const item_def &item )
}
}
+ append_missile_info(description);
+
return (description);
}
@@ -1228,6 +1230,12 @@ void append_armour_stats(std::string &description, const item_def &item)
_append_value(description, property( item, PARM_EVASION ), true);
}
+void append_missile_info(std::string &description)
+{
+ description += "$All pieces of ammunition may get destroyed upon impact. "
+ "Enchantment reduces the chances of such loss.";
+}
+
//---------------------------------------------------------------
//
// describe_armour
diff --git a/crawl-ref/source/describe.h b/crawl-ref/source/describe.h
index eb1d517b5e..969c615472 100644
--- a/crawl-ref/source/describe.h
+++ b/crawl-ref/source/describe.h
@@ -63,6 +63,7 @@ void inscribe_item( item_def &item, bool proper_prompt );
* *********************************************************************** */
void append_weapon_stats(std::string &description, const item_def &item);
void append_armour_stats(std::string &description, const item_def &item);
+void append_missile_info(std::string &description);
// last updated 12 Jun 2008 {jpeg}
/* ***********************************************************************
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 99fb8eee0f..077b16f44b 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -2049,7 +2049,8 @@ bool mutate(mutation_type which_mutation, bool failMsg,
case MUT_HOOVES:
case MUT_TALONS:
mpr(gain_mutation[mutat][you.mutation[mutat]], MSGCH_MUTATION);
- remove_one_equip(EQ_BOOTS);
+ if (you_tran_can_wear(EQ_BOOTS))
+ remove_one_equip(EQ_BOOTS);
break;
case MUT_CLAWS:
@@ -2060,7 +2061,7 @@ bool mutate(mutation_type which_mutation, bool failMsg,
// 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)
+ if (you.mutation[mutat] >= 2 && you_tran_can_wear(EQ_GLOVES))
remove_one_equip(EQ_GLOVES);
break;
@@ -2070,7 +2071,8 @@ bool mutate(mutation_type which_mutation, bool failMsg,
// Horns force hard helmets off.
if (you.equip[EQ_HELMET] != -1
- && is_hard_helmet(you.inv[you.equip[EQ_HELMET]]))
+ && is_hard_helmet(you.inv[you.equip[EQ_HELMET]])
+ && you_tran_can_wear(EQ_HELMET))
{
remove_one_equip(EQ_HELMET);
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index d79d211372..6239001df3 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -5939,6 +5939,9 @@ item_def *player::weapon(int /* which_attack */)
item_def *player::shield()
{
+ if (!you_tran_can_wear(EQ_SHIELD))
+ return (NULL);
+
return slot_item(EQ_SHIELD);
}
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc
index 0ad17cb5df..c8747bdb8d 100644
--- a/crawl-ref/source/skills2.cc
+++ b/crawl-ref/source/skills2.cc
@@ -1747,17 +1747,13 @@ static void _display_skill_table(bool show_aptitudes, bool show_description)
if (you.skills[x] == 27)
textcolor(YELLOW);
-#if DEBUG_DIAGNOSTICS
- if (you.skills[x] == 0)
+ if (you.skills[x] == 0 || you.skills[x] == 27)
putch(' ');
else
putch(lcount++);
-#else
- putch(lcount++);
-#endif
cprintf( " %c %-14s Skill %2d",
- (you.skills[x] == 0) ? ' ' :
+ (you.skills[x] == 0 || you.skills[x] == 27) ? ' ' :
(you.practise_skill[x]) ? '+' : '-',
skill_name(x), you.skills[x] );
@@ -1897,6 +1893,9 @@ void show_skills()
if (keyin == lcount)
{
+ if (you.skills[x] >= 27)
+ break;
+
if (!show_description)
you.practise_skill[x] = !you.practise_skill[x];
else
diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc
index d67baf0ec1..3340c16434 100644
--- a/crawl-ref/source/transfor.cc
+++ b/crawl-ref/source/transfor.cc
@@ -94,8 +94,10 @@ bool remove_equipment(std::set<equipment_type> removed)
if (removed.find(EQ_WEAPON) != removed.end()
&& you.equip[EQ_WEAPON] != -1)
{
+ const int wpn = you.equip[EQ_WEAPON];
unwield_item();
canned_msg(MSG_EMPTY_HANDED);
+ you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = wpn + 1;
}
// Meld items into you in (reverse) order. (std::set is a sorted container)
@@ -140,7 +142,54 @@ static bool _unmeld_equipment(std::set<equipment_type> melded)
}
else // armour
{
- armour_wear_effects( you.equip[e] );
+ int arm = you.equip[e];
+ bool force_remove = false;
+
+ // In case the player was mutated during the transformation,
+ // check whether the equipment is still wearable.
+ switch (e)
+ {
+ case EQ_HELMET:
+ if (you.mutation[MUT_HORNS]
+ && is_hard_helmet(you.inv[arm]))
+ {
+ force_remove = true;
+ }
+ break;
+
+ case EQ_GLOVES:
+ if (you.mutation[MUT_CLAWS] >= 2)
+ force_remove = true;
+ break;
+
+ case EQ_BOOTS:
+ if (you.mutation[MUT_HOOVES] || you.mutation[MUT_TALONS])
+ force_remove = true;
+ break;
+
+ case EQ_SHIELD:
+ // If you switched weapons during the transformation, make
+ // sure you can still wear your shield.
+ // (This is only possible with Statue Form.)
+ if (you.equip[EQ_WEAPON] != -1
+ && is_shield_incompatible(*you.weapon(), &you.inv[arm]))
+ {
+ force_remove = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (force_remove)
+ {
+ mprf("%s is pushed off your body!",
+ you.inv[arm].name(DESC_CAP_YOUR).c_str());
+ you.equip[e] = -1;
+ }
+ else
+ armour_wear_effects( arm );
}
}