summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-09-24 20:14:14 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2006-09-24 20:14:14 +0000
commit8ff8b514bd6f983e092b1ddddda6f29b5dd5197b (patch)
treeb9da152e8916d5eaa7e5935496a90a3616d3b8c8
parent4896fc165af059b72aecc5b7f592d98bb38eadcd (diff)
downloadcrawl-ref-8ff8b514bd6f983e092b1ddddda6f29b5dd5197b.tar.gz
crawl-ref-8ff8b514bd6f983e092b1ddddda6f29b5dd5197b.zip
Made some more steps on the way to integrating itemprop.cc and
eliminating wpn-misc.cc. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup@107 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/describe.cc12
-rw-r--r--crawl-ref/source/dungeon.cc26
-rw-r--r--crawl-ref/source/fight.cc10
-rw-r--r--crawl-ref/source/food.cc13
-rw-r--r--crawl-ref/source/item_use.cc6
-rw-r--r--crawl-ref/source/itemprop.cc4
-rw-r--r--crawl-ref/source/mon-pick.cc2
-rw-r--r--crawl-ref/source/mstuff2.cc5
-rw-r--r--crawl-ref/source/player.cc2
-rw-r--r--crawl-ref/source/randart.cc4
-rw-r--r--crawl-ref/source/skills2.cc3
-rw-r--r--crawl-ref/source/spells2.cc4
-rw-r--r--crawl-ref/source/spells3.cc4
-rw-r--r--crawl-ref/source/wpn-misc.cc83
-rw-r--r--crawl-ref/source/wpn-misc.h29
15 files changed, 43 insertions, 164 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 65deaa249f..0bcafcf040 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1040,7 +1040,7 @@ static std::string describe_weapon( const item_def &item, char verbose)
}
}
- if (verbose == 1 && !launches_things( item.sub_type ))
+ if (verbose == 1 && !is_range_weapon( item ))
{
description += "$Damage rating: ";
append_value(description, property( item, PWPN_DAMAGE ), false);
@@ -1096,7 +1096,7 @@ static std::string describe_weapon( const item_def &item, char verbose)
"all of orcish descent. ";
break;
case SPWPN_VENOM:
- if (launches_things( item.sub_type ))
+ if (is_range_weapon(item))
description += "It poisons the unbranded ammo it fires. ";
else
description += "It poisons the flesh of those it strikes. ";
@@ -1110,7 +1110,7 @@ static std::string describe_weapon( const item_def &item, char verbose)
"it drains the life of those it strikes. ";
break;
case SPWPN_SPEED:
- if (launches_things( item.sub_type ))
+ if (is_range_weapon(item))
{
description += "It allows its wielder to fire twice when "
"they would otherwise have fired only once. ";
@@ -1122,7 +1122,7 @@ static std::string describe_weapon( const item_def &item, char verbose)
}
break;
case SPWPN_VORPAL:
- if (launches_things(item.sub_type))
+ if (is_range_weapon(item))
{
description += "Any ";
description += ammo_name( item );
@@ -1191,7 +1191,7 @@ static std::string describe_weapon( const item_def &item, char verbose)
description += "$It has a curse placed upon it.";
}
- if (verbose == 1 && !launches_things( item.sub_type ))
+ if (verbose == 1 && !is_range_weapon(item))
{
#ifdef USE_NEW_COMBAT_STATS
const int str_weight = weapon_str_weight( item.base_type, item.sub_type );
@@ -1230,7 +1230,7 @@ static std::string describe_weapon( const item_def &item, char verbose)
break;
}
- if (launches_things( item.sub_type ))
+ if (is_range_weapon(item))
{
switch (get_equip_race( item ))
{
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index f6c260ff11..f30e09ecab 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -127,7 +127,6 @@ static unsigned char item_in_shop(unsigned char shop_type);
static bool treasure_area(int level_number, unsigned char ta1_x,
unsigned char ta2_x, unsigned char ta1_y,
unsigned char ta2_y);
-static int rare_weapon(int w_type);
static bool is_weapon_special(int the_weapon);
static void set_weapon_special(int the_weapon, int spwpn);
static void big_room(int level_number);
@@ -578,7 +577,7 @@ int items( int allow_uniques, // not just true-false,
{
temp_value = (unsigned char) random2(NUM_WEAPONS);
- if (rare_weapon(temp_value) >= random2(10) + 1)
+ if (weapon_rarity(temp_value) >= random2(10) + 1)
{
mitm[p].sub_type = temp_value;
break;
@@ -862,7 +861,7 @@ int items( int allow_uniques, // not just true-false,
if ((random2(200) <= 50 + item_level
|| item_level == MAKE_GOOD_ITEM
- || is_demonic(mitm[p].sub_type))
+ || is_demonic(mitm[p]))
// nobody would bother enchanting a club
&& mitm[p].sub_type != WPN_CLUB
&& mitm[p].sub_type != WPN_GIANT_CLUB
@@ -874,7 +873,7 @@ int items( int allow_uniques, // not just true-false,
{
if (random2(300) <= 100 + item_level
|| item_level == MAKE_GOOD_ITEM
- || is_demonic( mitm[p].sub_type ))
+ || is_demonic( mitm[p] ))
{
// note: this doesn't guarantee special enchantment
switch (mitm[p].sub_type)
@@ -3201,10 +3200,10 @@ void give_item(int mid, int level_number) //mv: cleanup+minor changes
// mv: gives ammunition
// note that item_race is not reset for this section
if (menv[mid].inv[MSLOT_WEAPON] != NON_ITEM
- && launches_things( mitm[menv[mid].inv[MSLOT_WEAPON]].sub_type ))
+ && is_range_weapon( mitm[menv[mid].inv[MSLOT_WEAPON]] ))
{
xitc = OBJ_MISSILES;
- xitt = launched_by(mitm[menv[mid].inv[MSLOT_WEAPON]].sub_type);
+ xitt = fires_ammo_type(mitm[menv[mid].inv[MSLOT_WEAPON]]);
thing_created = items( 0, xitc, xitt, true, give_level, item_race );
if (thing_created == NON_ITEM)
@@ -5982,9 +5981,9 @@ void item_colour( item_def &item )
break;
}
- if (is_demonic( item.sub_type ))
+ if (is_demonic( item ))
item.colour = random_colour();
- else if (launches_things( item.sub_type ))
+ else if (is_range_weapon( item ))
item.colour = BROWN;
else
{
@@ -6493,17 +6492,6 @@ void item_colour( item_def &item )
}
} // end item_colour()
-// Checks how rare a weapon is. Many of these have special routines for
-// placement, especially those with a rarity of zero. Chance is out of 10.
-static int rare_weapon(int w_type)
-{
- // zero value weapons must be placed specially -- see items() {dlb}
- if (is_demonic(w_type))
- return 0;
-
- return (weapon_rarity(w_type));
-} // end rare_weapon()
-
//jmf: generate altar based on where you are, or possibly randomly
static int pick_an_altar(void)
{
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index b694f09412..e398e9cc67 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -758,7 +758,7 @@ bool you_attack(int monster_attacked, bool unarmed_attacks)
bonus_damage = damage_done;
#endif
- if (!launches_things( you.inv[ weapon ].sub_type )
+ if (!is_range_weapon( you.inv[weapon] )
&& !item_ident( you.inv[ weapon ], ISFLAG_KNOW_PLUSES )
&& random2(100) < you.skills[ wpn_skill ])
{
@@ -1033,7 +1033,7 @@ bool you_attack(int monster_attacked, bool unarmed_attacks)
if (ur_armed
&& you.inv[ weapon ].base_type == OBJ_WEAPONS
- && is_demonic( you.inv[ weapon ].sub_type ))
+ && is_demonic( you.inv[ weapon ] ))
{
did_god_conduct(DID_UNHOLY, 1);
}
@@ -2167,7 +2167,7 @@ void monster_attack(int monster_attacking)
if (attacker->type != MONS_DANCING_WEAPON && mmov_x != NON_ITEM
&& mitm[mmov_x].base_type == OBJ_WEAPONS
- && !launches_things( mitm[mmov_x].sub_type ))
+ && !is_range_weapon( mitm[mmov_x] ))
{
strcat(info, " with ");
it_name(mmov_x, DESC_NOCAP_A, str_pass); // was 7
@@ -3037,7 +3037,7 @@ bool monsters_fight(int monster_attacking, int monster_attacked)
if (attacker->inv[hand_used] != NON_ITEM
&& mitm[attacker->inv[hand_used]].base_type == OBJ_WEAPONS
- && !launches_things( mitm[attacker->inv[hand_used]].sub_type ))
+ && !is_range_weapon( mitm[attacker->inv[hand_used]] ))
{
damage_taken = random2(property( mitm[attacker->inv[hand_used]],
PWPN_DAMAGE ));
@@ -3122,7 +3122,7 @@ bool monsters_fight(int monster_attacking, int monster_attacked)
if (attacker->type != MONS_DANCING_WEAPON
&& attacker->inv[hand_used] != NON_ITEM
&& mitm[attacker->inv[hand_used]].base_type == OBJ_WEAPONS
- && !launches_things( mitm[attacker->inv[hand_used]].sub_type ))
+ && !is_range_weapon( mitm[attacker->inv[hand_used]] ))
{
strcat(info, " with ");
it_name(mmov_x, DESC_NOCAP_A, str_pass); // was 7
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 1acf2f3d4f..3d4b1d20a6 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -187,10 +187,7 @@ bool butchery(void)
else
{
if (you.equip[EQ_WEAPON] != -1)
- {
- can_butcher = can_cut_meat( you.inv[you.equip[EQ_WEAPON]].base_type,
- you.inv[you.equip[EQ_WEAPON]].sub_type );
- }
+ can_butcher = can_cut_meat(you.inv[you.equip[EQ_WEAPON]]);
// Should probably check for cursed-weapons, bare hands and
// non-weapons in hand here, but wield_weapon will be used for
@@ -211,8 +208,7 @@ bool butchery(void)
for (int i = 0; i < ENDOFPACK; ++i)
{
if (is_valid_item( you.inv[i] )
- && can_cut_meat( you.inv[i].base_type,
- you.inv[i].sub_type )
+ && can_cut_meat( you.inv[i] )
&& you.inv[i].base_type == OBJ_WEAPONS
&& item_known_uncursed(you.inv[i])
&& item_ident( you.inv[i], ISFLAG_KNOW_TYPE )
@@ -245,10 +241,7 @@ bool butchery(void)
// update the can_butcher status accordingly (note: if we could
// butcher with our bare hands we wouldn't be here) -- bwr
if (wpn_switch && you.equip[EQ_WEAPON] != -1)
- {
- can_butcher = can_cut_meat( you.inv[you.equip[EQ_WEAPON]].base_type,
- you.inv[you.equip[EQ_WEAPON]].sub_type );
- }
+ can_butcher = can_cut_meat( you.inv[you.equip[EQ_WEAPON]] );
}
// Account for the weapon switch above if it happened... we're
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index a55bff6810..c20914e251 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -363,7 +363,7 @@ void wield_effects(int item_wield_2, bool showMsgs)
if (you.inv[item_wield_2].base_type == OBJ_WEAPONS)
{
- if (is_demonic(you.inv[item_wield_2].sub_type)
+ if (is_demonic(you.inv[item_wield_2])
&& (you.religion == GOD_ZIN || you.religion == GOD_SHINING_ONE
|| you.religion == GOD_ELYVILON))
{
@@ -1090,9 +1090,9 @@ int get_fire_item_index( void )
// check if we have ammo for a wielded launcher:
if (weapon != -1
&& you.inv[ weapon ].base_type == OBJ_WEAPONS
- && launches_things( you.inv[ weapon ].sub_type ))
+ && is_range_weapon( you.inv[ weapon ] ))
{
- int type_wanted = launched_by( you.inv[ weapon ].sub_type );
+ int type_wanted = fires_ammo_type( you.inv[ weapon ] );
item = try_finding_missile( type_wanted );
}
break;
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 7990f97be6..1ae24a6fe8 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -1227,7 +1227,7 @@ hands_reqd_type hands_reqd( const item_def &item, size_type size )
{
case OBJ_STAVES:
case OBJ_WEAPONS:
- // Merging staff with magical staves for consistancy... doing
+ // Merging staff with magical staves for consistency... doing
// as a special case because we want to be very flexible with
// these useful objects (we want spriggans and ogre magi to
// be able to use them).
@@ -1794,7 +1794,7 @@ bool can_cut_meat( const item_def &item )
return (does_damage_type( item, DAM_SLICE ));
}
-// returns true if item counts as a tool for tool size comaparisons and msgs
+// returns true if item counts as a tool for tool size comparisons and msgs
bool is_tool( const item_def &item )
{
// Currently using OBJ_WEAPONS instead of can_cut_meat() as almost
diff --git a/crawl-ref/source/mon-pick.cc b/crawl-ref/source/mon-pick.cc
index 79fc29f1fc..be1a0cbc2b 100644
--- a/crawl-ref/source/mon-pick.cc
+++ b/crawl-ref/source/mon-pick.cc
@@ -2146,6 +2146,7 @@ static int mons_hallzot_level(int mcls)
case MONS_SHADOW_DRAGON:
case MONS_SKELETAL_DRAGON:
case MONS_STORM_DRAGON:
+ case MONS_CURSE_TOE:
mlev += 5;
break;
case MONS_DEATH_COB:
@@ -2194,6 +2195,7 @@ static int mons_hallzot_rare(int mcls)
return 40;
case MONS_SHADOW_DRAGON:
case MONS_DEATH_DRAKE:
+ case MONS_CURSE_TOE:
return 30;
case MONS_DEEP_ELF_ANNIHILATOR:
case MONS_DEEP_ELF_DEATH_MAGE:
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index e5abcd061a..c0646ceb55 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -853,14 +853,15 @@ void setup_generic_throw(struct monsters *monster, struct bolt &pbolt)
}
// decide if something is launched or thrown
-// pass -1 for launcher class & 0 for type if no weapon is weilded
+// pass -1 for launcher class & 0 for type if no weapon is wielded
void throw_type( int lnchClass, int lnchType, int wepClass, int wepType,
bool &launched, bool &thrown )
{
if (wepClass == OBJ_MISSILES
&& lnchClass == OBJ_WEAPONS
- && launches_things(lnchType) && wepType == launched_by(lnchType))
+ && launches_things(lnchType)
+ && wepType == launched_by(lnchType))
{
launched = true;
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 833528aed9..f6eccafa54 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -376,7 +376,7 @@ int player_damage_type( void )
if (wpn != -1)
{
- return (damage_type(you.inv[wpn]));
+ return (get_vorpal_type(you.inv[wpn]));
}
else if (you.equip[EQ_GLOVES] == -1 &&
(you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS
diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc
index 0c43b16c7a..da9f937448 100644
--- a/crawl-ref/source/randart.cc
+++ b/crawl-ref/source/randart.cc
@@ -815,7 +815,7 @@ void randart_wpn_properties( const item_def &item,
if (proprt[RAP_BRAND] == SPWPN_SPEED && atype == WPN_QUICK_BLADE)
proprt[RAP_BRAND] = SPWPN_NORMAL;
- if (launches_things(atype))
+ if (is_range_weapon(item))
{
proprt[RAP_BRAND] = SPWPN_NORMAL;
@@ -833,7 +833,7 @@ void randart_wpn_properties( const item_def &item,
}
- if (is_demonic(atype))
+ if (is_demonic(item))
{
switch (random5(9))
{
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc
index b4a0cbca9f..b17ed9f5ec 100644
--- a/crawl-ref/source/skills2.cc
+++ b/crawl-ref/source/skills2.cc
@@ -30,6 +30,7 @@
#include "externs.h"
#include "fight.h"
+#include "itemprop.h"
#include "player.h"
#include "randart.h"
#include "religion.h"
@@ -2294,7 +2295,7 @@ void wield_warning(bool newWeapon)
strcat(wepstr, wepstr2);
// only warn about str/dex for non-launcher weapons
- if (!launches_things(wepType))
+ if (!is_range_weapon( you.inv[you.equip[EQ_WEAPON]] ))
{
#ifdef USE_NEW_COMBAT_STATS
const int stat_bonus = effective_stat_bonus();
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 3f243dcaf0..0f249bb58e 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -557,7 +557,7 @@ bool brand_weapon(int which_brand, int power)
return false;
if (you.inv[wpn].base_type != OBJ_WEAPONS
- || launches_things(you.inv[wpn].sub_type))
+ || is_range_weapon(you.inv[wpn]))
{
return false;
}
@@ -573,7 +573,7 @@ bool brand_weapon(int which_brand, int power)
in_name( wpn, DESC_CAP_YOUR, str_pass );
strcpy( info, str_pass );
- const int wpn_type = damage_type(you.inv[wpn]);
+ const int wpn_type = get_vorpal_type(you.inv[wpn]);
switch (which_brand) // use SPECIAL_WEAPONS here?
{
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 157547eb5f..a38fa615e8 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -431,10 +431,10 @@ void dancing_weapon(int pow, bool force_hostile)
const int wpn = you.equip[EQ_WEAPON];
- // See if weilded item is appropriate:
+ // See if wielded item is appropriate:
if (wpn == -1
|| you.inv[wpn].base_type != OBJ_WEAPONS
- || launches_things( you.inv[wpn].sub_type )
+ || is_range_weapon( you.inv[wpn] )
|| is_fixed_artefact( you.inv[wpn] ))
{
goto failed_spell;
diff --git a/crawl-ref/source/wpn-misc.cc b/crawl-ref/source/wpn-misc.cc
index 90b9cb0d37..2cbd7d8181 100644
--- a/crawl-ref/source/wpn-misc.cc
+++ b/crawl-ref/source/wpn-misc.cc
@@ -25,76 +25,6 @@
**************************************************
*/
-// FIXME: Remove these eventually
-
-int damage_type(const item_def &item)
-{
- return (damage_type(item.base_type, item.sub_type));
-}
-
-int damage_type(int wclass, int wtype)
-{
- int type_damage = DVORP_CRUSHING; // this is the default, btw {dlb}
-
- if (wclass == OBJ_WEAPONS)
- {
- switch (wtype)
- {
- case WPN_DAGGER:
- case WPN_DEMON_BLADE:
- case WPN_DOUBLE_SWORD:
- case WPN_GREAT_SWORD:
- case WPN_KATANA:
- case WPN_KNIFE:
- case WPN_LONG_SWORD:
- case WPN_QUICK_BLADE:
- case WPN_SABRE:
- case WPN_FALCHION:
- case WPN_SCIMITAR:
- case WPN_SCYTHE:
- case WPN_SHORT_SWORD:
- case WPN_TRIPLE_SWORD:
- case WPN_BLESSED_BLADE:
- case WPN_LAJATANG:
- type_damage = DVORP_SLICING;
- break;
-
- case WPN_DEMON_TRIDENT:
- case WPN_EVENINGSTAR:
- case WPN_GIANT_SPIKED_CLUB:
- case WPN_MORNINGSTAR:
- case WPN_SPEAR:
- case WPN_SPIKED_FLAIL:
- case WPN_TRIDENT:
- type_damage = DVORP_PIERCING;
- break;
-
- case WPN_WAR_AXE:
- case WPN_BATTLEAXE:
- case WPN_BROAD_AXE:
- case WPN_EXECUTIONERS_AXE:
- case WPN_GLAIVE:
- case WPN_HALBERD:
- case WPN_HAND_AXE:
- case WPN_LOCHABER_AXE:
- type_damage = DVORP_CHOPPING;
- break;
- }
- }
-
- return (type_damage);
-} // end damage_type()
-
-bool can_cut_meat(int wclass, int wtype)
-{
- int type = damage_type( wclass, wtype );
-
- if (type == DVORP_CHOPPING || type == DVORP_SLICING)
- return (true);
-
- return (false);
-}
-
int hands_reqd_for_weapon(int wclass, int wtype)
{
int reqd_hands = HANDS_ONE;
@@ -147,19 +77,6 @@ int hands_reqd_for_weapon(int wclass, int wtype)
return (reqd_hands);
} // end hands_reqd_for_weapon()
-bool is_demonic(unsigned char weapon_subtype)
-{
- switch (weapon_subtype)
- {
- case WPN_DEMON_BLADE:
- case WPN_DEMON_WHIP:
- case WPN_DEMON_TRIDENT:
- return true;
-
- default:
- return false;
- }
-} // end is_demonic()
bool launches_things( unsigned char weapon_subtype )
{
diff --git a/crawl-ref/source/wpn-misc.h b/crawl-ref/source/wpn-misc.h
index 55b9e35c86..e16ae910c2 100644
--- a/crawl-ref/source/wpn-misc.h
+++ b/crawl-ref/source/wpn-misc.h
@@ -16,32 +16,18 @@
#include "externs.h"
-
-/* ***********************************************************************
- * called from: food.h
- * *********************************************************************** */
-bool can_cut_meat(int wclass, int wtype);
-
-/* ***********************************************************************
- * called from: acr - fight - food - item_use - itemname - spells2
- * *********************************************************************** */
-int damage_type(int wclass, int wtype);
-int damage_type(const item_def &item);
-
-
// last updated: 10jun2000 {dlb}
/* ***********************************************************************
* called from: describe - fight - item_use
* *********************************************************************** */
int hands_reqd_for_weapon(int wclass, int wtype);
-
// last updated: 10jun2000 {dlb}
/* ***********************************************************************
- * called from: dungeon - fight - item_use - randart
+ * called from: describe - dungeon - fight - item_use - mstuff2 - randart -
+ * spells2 - spells3
* *********************************************************************** */
-bool is_demonic(unsigned char weapon_subtype);
-
+bool launches_things( unsigned char weapon_subtype );
// last updated: 10jun2000 {dlb}
/* ***********************************************************************
@@ -49,13 +35,4 @@ bool is_demonic(unsigned char weapon_subtype);
* *********************************************************************** */
unsigned char launched_by(unsigned char weapon_subtype);
-
-// last updated: 10jun2000 {dlb}
-/* ***********************************************************************
- * called from: describe - dungeon - fight - item_use - mstuff2 - randart -
- * spells2 - spells3
- * *********************************************************************** */
-bool launches_things( unsigned char weapon_subtype );
-
-
#endif