summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2010-01-02 23:53:15 -0800
committerStefan O'Rear <stefanor@cox.net>2010-01-02 23:53:15 -0800
commit45257acf3e73631c66d66ebc9ed3e4ac88951a37 (patch)
treef8c465d36a5f019349d18b817bce746ece6efff3 /crawl-ref
parentecb85a04028949511fb528ca262eab74093c645f (diff)
downloadcrawl-ref-45257acf3e73631c66d66ebc9ed3e4ac88951a37.tar.gz
crawl-ref-45257acf3e73631c66d66ebc9ed3e4ac88951a37.zip
Rods function in melee as a +x/+x club (#300)
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/describe.cc4
-rw-r--r--crawl-ref/source/fight.cc19
-rw-r--r--crawl-ref/source/itemprop.cc14
3 files changed, 29 insertions, 8 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 95473fc4a1..8f06b1f582 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1923,6 +1923,10 @@ std::string get_item_description( const item_def &item, bool verbose,
else
description << desc;
}
+ std::string stats = "";
+ append_weapon_stats(stats, item);
+ description << stats;
+ description << "$$It falls into the 'Maces & Flails' category.";
}
else
{
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index d6ae6ad37e..1df53b95d2 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -1551,7 +1551,7 @@ int melee_attack::player_apply_water_attack_bonus(int damage)
int melee_attack::player_apply_weapon_skill(int damage)
{
if (weapon && (weapon->base_type == OBJ_WEAPONS
- || item_is_staff( *weapon )))
+ || weapon->base_type == OBJ_STAVES))
{
damage *= 25 + (random2( you.skills[ wpn_skill ] + 1 ));
damage /= 25;
@@ -1583,10 +1583,14 @@ int melee_attack::player_apply_misc_modifiers(int damage)
int melee_attack::player_apply_weapon_bonuses(int damage)
{
- if (weapon && weapon->base_type == OBJ_WEAPONS)
+ if (weapon && (weapon->base_type == OBJ_WEAPONS
+ || item_is_rod( *weapon )))
{
int wpn_damage_plus = weapon->plus2;
+ if (item_is_rod( *weapon ))
+ wpn_damage_plus = (short)weapon->props["rod_enchantment"];
+
damage += (wpn_damage_plus > -1) ? (random2(1 + wpn_damage_plus))
: -(1 + random2(-wpn_damage_plus));
@@ -1767,6 +1771,8 @@ int melee_attack::player_weapon_type_modify(int damage)
weap_type = WPN_UNARMED;
else if (item_is_staff(*weapon))
weap_type = WPN_QUARTERSTAFF;
+ else if (item_is_rod(*weapon))
+ weap_type = WPN_CLUB;
else if (weapon->base_type == OBJ_WEAPONS)
weap_type = weapon->sub_type;
@@ -3905,10 +3911,13 @@ int melee_attack::player_to_hit(bool random_factor)
}
}
- else if (item_is_staff( *weapon ))
+ else if (weapon->base_type == OBJ_STAVES)
{
// magical staff
your_to_hit += property( *weapon, PWPN_HIT );
+
+ if (item_is_rod( *weapon ))
+ your_to_hit += (short)weapon->props["rod_enchantment"];
}
}
@@ -4068,7 +4077,7 @@ int melee_attack::player_weapon_speed()
int attack_delay = 0;
if (weapon && (weapon->base_type == OBJ_WEAPONS
- || item_is_staff( *weapon )))
+ || weapon->base_type == OBJ_STAVES))
{
attack_delay = property( *weapon, PWPN_SPEED );
attack_delay -= you.skills[ wpn_skill ] / 2;
@@ -4212,7 +4221,7 @@ int melee_attack::player_calc_base_weapon_damage()
{
int damage = 0;
- if (weapon->base_type == OBJ_WEAPONS || item_is_staff( *weapon ))
+ if (weapon->base_type == OBJ_WEAPONS || weapon->base_type == OBJ_STAVES)
damage = property( *weapon, PWPN_DAMAGE );
// Staves can be wielded with a worn shield, but are much less
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index f19bea28f1..9b9a938b16 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -1307,6 +1307,8 @@ int get_damage_type(const item_def &item)
{
int ret = DAM_BASH;
+ if (item_is_rod(item))
+ ret = DAM_BLUDGEON;
if (item.base_type == OBJ_WEAPONS)
ret = (Weapon_prop[Weapon_index[item.sub_type]].dam_type & DAM_MASK);
@@ -1635,6 +1637,8 @@ skill_type weapon_skill( const item_def &item )
{
if (item.base_type == OBJ_WEAPONS && !is_range_weapon( item ))
return (Weapon_prop[ Weapon_index[item.sub_type] ].skill);
+ else if (item_is_rod( item ))
+ return (SK_MACES_FLAILS); // Rods are short and stubby
else if (item.base_type == OBJ_STAVES)
return (SK_STAVES);
@@ -2063,6 +2067,8 @@ int corpse_freshness(const item_def &item)
//
int property(const item_def &item, int prop_type)
{
+ weapon_type weapon_sub;
+
switch (item.base_type)
{
case OBJ_ARMOUR:
@@ -2089,12 +2095,14 @@ int property(const item_def &item, int prop_type)
break;
case OBJ_STAVES:
+ weapon_sub = item_is_rod(item) ? WPN_CLUB : WPN_QUARTERSTAFF;
+
if (prop_type == PWPN_DAMAGE)
- return (Weapon_prop[ Weapon_index[WPN_QUARTERSTAFF] ].dam);
+ return (Weapon_prop[ Weapon_index[weapon_sub] ].dam);
else if (prop_type == PWPN_HIT)
- return (Weapon_prop[ Weapon_index[WPN_QUARTERSTAFF] ].hit);
+ return (Weapon_prop[ Weapon_index[weapon_sub] ].hit);
else if (prop_type == PWPN_SPEED)
- return (Weapon_prop[ Weapon_index[WPN_QUARTERSTAFF] ].speed);
+ return (Weapon_prop[ Weapon_index[weapon_sub] ].speed);
break;
default: