diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/beam.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/beam.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/externs.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/fight.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 50 | ||||
-rw-r--r-- | crawl-ref/source/itemprop.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/items.cc | 27 |
7 files changed, 58 insertions, 46 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 11885cb32c..08779d1c69 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -790,7 +790,7 @@ static void zappy( zap_type z_type, int power, bolt &pbolt ) break; case ZAP_NEGATIVE_ENERGY: // cap 150 - pbolt.name = "bolt of negative energy"; + pbolt.name = pbolt.effect_known ? "bolt of negative energy" : "bolt"; pbolt.colour = DARKGREY; pbolt.range = 7 + random2(10); pbolt.damage = calc_dice( 4, 15 + (power * 3) / 5 ); @@ -1670,12 +1670,8 @@ int mons_adjust_flavoured( monsters *monster, bolt &pbolt, simple_monster_message(monster, " is drained."); pbolt.obvious_effect = true; - if (YOU_KILL(pbolt.thrower)) - { - // currently no gods who enjoy use of necromancy - if (pbolt.effect_known) - did_god_conduct(DID_NECROMANCY, 2 + random2(3)); - } + if (YOU_KILL(pbolt.thrower) && pbolt.effect_known) + did_god_conduct(DID_NECROMANCY, 2 + random2(3)); if (one_chance_in(5)) monster->hit_dice--; diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h index 1e24915025..4c61cb5b88 100644 --- a/crawl-ref/source/beam.h +++ b/crawl-ref/source/beam.h @@ -47,6 +47,7 @@ enum zap_symbol_type SYM_EXPLOSION = '#' }; +// must match wand subtypes! (see item_def::zap()) enum zap_type { ZAP_FLAME, // 0 diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 6d505674f4..bf9151a9f3 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -375,6 +375,9 @@ public: bool has_spells() const; bool cursed() const; int book_number() const; + int zap() const; // what kind of beam it shoots (if wand). + // XXX should really return zap_type! + // Returns index in mitm array. Results are undefined if this item is // not in the array! diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 5bf1d1b43f..0972bcf624 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -3631,7 +3631,7 @@ int weapon_str_weight( object_class_type wpn_class, int wpn_type ) // - Short Blades are the best for the dexterous... although they // are very limited in damage potential // - Long Swords are better for the dexterous, the two-handed - // swords are a 50/50 spit; bastard swords are in between. + // swords are a 50/50 split; bastard swords are in between. // - Staves: didn't want to punish the mages who want to use // these... made it a 50/50 split after the 2-hnd bonus // - Polearms: Spears and tridents are the only ones that can @@ -3739,12 +3739,10 @@ static inline int calc_stat_to_dam_base( void ) static void stab_message( struct monsters *defender, int stab_bonus ) { - int r = random2(6); // for randomness - switch(stab_bonus) { case 3: // big melee, monster surrounded/not paying attention - if (r<3) + if (coinflip()) { mprf( "You strike %s from a blind spot!", defender->name(DESC_NOCAP_THE).c_str() ); @@ -3756,7 +3754,7 @@ static void stab_message( struct monsters *defender, int stab_bonus ) } break; case 2: // confused/fleeing - if (r<4) + if ( !one_chance_in(3) ) { mprf( "You catch %s completely off-guard!", defender->name(DESC_NOCAP_THE).c_str() ); @@ -3772,5 +3770,5 @@ static void stab_message( struct monsters *defender, int stab_bonus ) defender->name(DESC_CAP_THE).c_str(), defender->pronoun(PRONOUN_REFLEXIVE).c_str() ); break; - } // end switch + } } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 753cc8549c..a1c1b5f7ba 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -2907,19 +2907,21 @@ void zap_wand(void) const bool dangerous = player_in_a_dangerous_place(); if (alreadyknown) { - if (wand.sub_type == WAND_TELEPORTATION) + switch ( wand.sub_type ) { + case WAND_TELEPORTATION: targ_mode = TARG_ANY; - } - else if (wand.sub_type == WAND_HASTING - || wand.sub_type == WAND_HEALING - || wand.sub_type == WAND_INVISIBILITY) - { + break; + + case WAND_HASTING: + case WAND_HEALING: + case WAND_INVISIBILITY: targ_mode = TARG_FRIEND; - } - else - { + break; + + default: targ_mode = TARG_ENEMY; + break; } } @@ -2939,28 +2941,10 @@ void zap_wand(void) zap_wand.ty = you.y_pos + random2(13) - 6; } - // blargh! blech! this is just begging to be a problem ... - // not to mention work-around after work-around as wands are - // added, removed, or altered {dlb}: - char type_zapped = wand.sub_type; - - if (type_zapped == WAND_ENSLAVEMENT) - type_zapped = ZAP_ENSLAVEMENT; - - if (type_zapped == WAND_DRAINING) - type_zapped = ZAP_NEGATIVE_ENERGY; - - if (type_zapped == WAND_DISINTEGRATION) - type_zapped = ZAP_DISINTEGRATION; - - if (type_zapped == WAND_RANDOM_EFFECTS) + const zap_type type_zapped = static_cast<zap_type>(wand.zap()); + if (wand.sub_type == WAND_RANDOM_EFFECTS) { - type_zapped = random2(16); beam.effect_known = false; - if (one_chance_in(20)) - type_zapped = ZAP_NEGATIVE_ENERGY; - if (one_chance_in(17)) - type_zapped = ZAP_ENSLAVEMENT; if (dangerous) { // Xom loves it when you use a Wand of Random Effects and @@ -2973,10 +2957,11 @@ void zap_wand(void) beam.source_y = you.y_pos; beam.set_target(zap_wand); + // zapping() updates beam zapping( static_cast<zap_type>(type_zapped), 30 + roll_dice(2, you.skills[SK_EVOCATIONS]), beam ); - if ((beam.obvious_effect || type_zapped == WAND_FIREBALL) && + if ((beam.obvious_effect || type_zapped == ZAP_FIREBALL) && !alreadyknown) { set_ident_type( wand.base_type, wand.sub_type, ID_KNOWN_TYPE ); @@ -3000,7 +2985,8 @@ void zap_wand(void) { if (!item_ident( wand, ISFLAG_KNOW_PLUSES )) { - mpr("Your skill with magical items lets you calculate the power of this device..."); + mpr("Your skill with magical items lets you calculate " + "the power of this device..."); } mprf("This wand has %d charge%s left.", @@ -3078,7 +3064,7 @@ void drink(void) return; } - if (inv_count() < 1) + if (inv_count() == 0) { canned_msg(MSG_NOTHING_CARRIED); return; diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index 61c4cbe41d..c9e037dc14 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -529,7 +529,8 @@ enum vorpal_damage_type }; // NOTE: This order is very special! Its basically the same as ZAP_*, -// and there are bits of the code that still use that fact.. see zap_wand(). +// and there are bits of the code that still use that fact. +// See item_def::zap(). enum wand_type // mitm[].subtype { WAND_FLAME, // 0 diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 7e873542d2..1e5d7cb6cc 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -3206,6 +3206,33 @@ bool item_def::launched_by(const item_def &launcher) const return (sub_type == mt || (mt == MI_STONE && sub_type == MI_SLING_BULLET)); } +int item_def::zap() const +{ + if (base_type != OBJ_WANDS) + return ZAP_DEBUGGING_RAY; + + zap_type result; + switch (sub_type) + { + case WAND_ENSLAVEMENT: result = ZAP_ENSLAVEMENT; break; + case WAND_DRAINING: result = ZAP_NEGATIVE_ENERGY; break; + case WAND_DISINTEGRATION: result = ZAP_DISINTEGRATION; break; + + case WAND_RANDOM_EFFECTS: + result = static_cast<zap_type>(random2(16)); + if ( one_chance_in(20) ) + result = ZAP_NEGATIVE_ENERGY; + if ( one_chance_in(17) ) + result = ZAP_ENSLAVEMENT; + break; + + default: + result = static_cast<zap_type>(sub_type); + break; + } + return result; +} + int item_def::index() const { return (this - mitm.buffer()); |