From 1cb88e12f39a3bc94e9182f9069b5ff8e52cffcb Mon Sep 17 00:00:00 2001 From: haranp Date: Tue, 23 Oct 2007 16:58:30 +0000 Subject: Blade card now gives feedback when failing to brand. Blade card can now give different brands, not just SPWPN_VORPAL. Type safety on brand_weapon(). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2522 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/decks.cc | 19 ++++++++++++++++++- crawl-ref/source/spells2.cc | 4 +++- crawl-ref/source/spells2.h | 3 ++- 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 8c3803b552..95ef24630b 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1588,7 +1588,24 @@ static void blade_card(int power, deck_rarity_type rarity) } else { - brand_weapon(SPWPN_VORPAL, random2(power/4)); // maybe other brands? + const brand_type brands[] = { + SPWPN_FLAMING, SPWPN_FREEZING, SPWPN_VENOM, SPWPN_DRAINING, + SPWPN_VORPAL, SPWPN_DISTORTION, SPWPN_PAIN, SPWPN_DUMMY_CRUSHING + }; + + if ( !brand_weapon(RANDOM_ELEMENT(brands), random2(power/4)) ) + { + if ( you.equip[EQ_WEAPON] == -1 ) + { + msg::stream << "Your " << your_hand(true) << " twitch." + << std::endl; + } + else + { + msg::stream << "Your weapon vibrates for a moment." + << std::endl; + } + } } } diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 80c849b89f..a03676bdc2 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -534,7 +534,7 @@ void cast_twisted(int power, beh_type corps_beh, int corps_hit) } } // end cast_twisted() -bool brand_weapon(int which_brand, int power) +bool brand_weapon(brand_type which_brand, int power) { int temp_rand; // probability determination {dlb} int duration_affected = 0; //jmf: NB: now HOW LONG, not WHICH BRAND. @@ -639,6 +639,8 @@ bool brand_weapon(int which_brand, int power) msg += " glows silver and feels heavier."; duration_affected = 7; break; + default: + break; } set_item_ego_type( you.inv[wpn], OBJ_WEAPONS, which_brand ); diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h index a19c83a76f..9fc45ef1b0 100644 --- a/crawl-ref/source/spells2.h +++ b/crawl-ref/source/spells2.h @@ -14,6 +14,7 @@ #define SPELLS2_H #include "enum.h" +#include "itemprop.h" // from brand_type struct dist; @@ -21,7 +22,7 @@ struct dist; /* *********************************************************************** * called from: spell * *********************************************************************** */ -bool brand_weapon(int which_brand, int power); +bool brand_weapon(brand_type which_brand, int power); // last updated 24may2000 {dlb} -- cgit v1.2.3-54-g00ecf