From 9876ce66bfd29003796a8182b20696e57fe7add5 Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 30 Jun 2008 14:24:50 +0000 Subject: Simplify. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6243 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/fight.cc | 7 +------ crawl-ref/source/itemprop.cc | 18 ++++++++---------- crawl-ref/source/itemprop.h | 16 ++++++++-------- crawl-ref/source/makeitem.cc | 6 +++--- 4 files changed, 20 insertions(+), 27 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 11102b8cd7..52be3c7d62 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -1444,13 +1444,8 @@ int melee_attack::player_apply_weapon_bonuses(int damage) } // Demonspawn get a damage bonus for demonic weapons. - if (you.species == SP_DEMONSPAWN - && (weapon->sub_type == WPN_DEMON_BLADE - || weapon->sub_type == WPN_DEMON_WHIP - || weapon->sub_type == WPN_DEMON_TRIDENT)) - { + if (you.species == SP_DEMONSPAWN && is_demonic(*weapon)) damage += random2(3); - } } return (damage); diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 6049435031..4bf5b79575 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -689,9 +689,7 @@ void set_equip_race( item_def &item, unsigned long flags ) || item.sub_type == WPN_KNIFE || item.sub_type == WPN_QUARTERSTAFF || item.sub_type == WPN_SCYTHE - || item.sub_type == WPN_DEMON_BLADE - || item.sub_type == WPN_DEMON_WHIP - || item.sub_type == WPN_DEMON_TRIDENT + || is_demonic(item) || is_blessed_blade(item)) { return; @@ -1452,9 +1450,9 @@ int weapon_rarity( int w_type ) case WPN_KNIFE: case WPN_QUICK_BLADE: case WPN_TRIPLE_SWORD: - case WPN_DEMON_TRIDENT: case WPN_DEMON_WHIP: case WPN_DEMON_BLADE: + case WPN_DEMON_TRIDENT: case WPN_BLESSED_FALCHION: case WPN_BLESSED_LONG_SWORD: case WPN_BLESSED_SCIMITAR: @@ -1614,7 +1612,7 @@ int double_wpn_awkward_speed( const item_def &item ) return ((base * 30 + 10) / 20 + 2); } -bool is_demonic( const item_def &item ) +bool is_demonic(const item_def &item) { if (item.base_type == OBJ_WEAPONS) { @@ -1631,9 +1629,9 @@ bool is_demonic( const item_def &item ) } return (false); -} // end is_demonic() +} -bool is_blessed_blade( const item_def &item ) +bool is_blessed_blade(const item_def &item) { if (item.base_type == OBJ_WEAPONS) { @@ -1657,7 +1655,7 @@ bool is_blessed_blade( const item_def &item ) return (false); } // end is_blessed_blade() -bool is_convertible( const item_def &item ) +bool is_convertible(const item_def &item) { return (!is_artefact(item) && (item.base_type == OBJ_WEAPONS @@ -1665,7 +1663,7 @@ bool is_convertible( const item_def &item ) || weapon_skill(item) == SK_LONG_BLADES))); } // end is_convertible() -bool convert2good( item_def &item, bool allow_blessed ) +bool convert2good(item_def &item, bool allow_blessed) { if (item.base_type != OBJ_WEAPONS) return (false); @@ -1737,7 +1735,7 @@ bool convert2good( item_def &item, bool allow_blessed ) item.flags &= ~ISFLAG_RACIAL_MASK; return (true); -} // end convert2good() +} int weapon_str_weight( const item_def &wpn ) { diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index 59e89f67ef..2dfc3e8f0c 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -667,14 +667,14 @@ bool is_double_ended( const item_def &item ); int double_wpn_awkward_speed( const item_def &item ); -bool is_demonic( const item_def &item ); -bool is_blessed_blade( const item_def &item ); -bool is_convertible( const item_def &item ); -bool convert2good( item_def &item, bool allow_blessed = true ); - -int get_vorpal_type( const item_def &item ); -int get_damage_type( const item_def &item ); -bool does_damage_type( const item_def &item, int dam_type ); +bool is_demonic(const item_def &item); +bool is_blessed_blade(const item_def &item); +bool is_convertible(const item_def &item); +bool convert2good(item_def &item, bool allow_blessed = true); + +int get_vorpal_type( const item_def &item ); +int get_damage_type( const item_def &item ); +bool does_damage_type( const item_def &item, int dam_type ); int weapon_str_weight( const item_def &wpn ); int weapon_dex_weight( const item_def &wpn ); diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 4a92ea8a1a..07b854f7be 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -1463,9 +1463,9 @@ static brand_type _determine_weapon_brand(const item_def& item, int item_level) rc = SPWPN_VENOM; break; - case WPN_DEMON_TRIDENT: case WPN_DEMON_WHIP: case WPN_DEMON_BLADE: + case WPN_DEMON_TRIDENT: if (one_chance_in(10)) rc = SPWPN_PAIN; @@ -3497,11 +3497,11 @@ static item_make_species_type _give_weapon(monsters *mon, int level, if (one_chance_in(7)) item.sub_type = WPN_BROAD_AXE; if (one_chance_in(7)) - item.sub_type = WPN_DEMON_TRIDENT; + item.sub_type = WPN_DEMON_WHIP; if (one_chance_in(7)) item.sub_type = WPN_DEMON_BLADE; if (one_chance_in(7)) - item.sub_type = WPN_DEMON_WHIP; + item.sub_type = WPN_DEMON_TRIDENT; if (one_chance_in(3)) set_item_ego_type( item, OBJ_WEAPONS, SPWPN_FLAMING ); -- cgit v1.2.3-54-g00ecf