diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/decks.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/effects.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/makeitem.cc | 38 | ||||
-rw-r--r-- | crawl-ref/source/misc.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 20 | ||||
-rw-r--r-- | crawl-ref/source/ouch.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 20 |
7 files changed, 63 insertions, 29 deletions
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 1328c4e0d3..ed25476877 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1681,7 +1681,7 @@ static bool _damaging_card(card_type card, int power, deck_rarity_type rarity) card_name(card)); if (spell_direction(target, beam, DIR_NONE, TARG_ENEMY, true, true, info) - && player_tracer(ztype, power/4, beam)) + && player_tracer(ZAP_DEBUGGING_RAY, power/4, beam)) { zapping(ztype, random2(power/4), beam); } diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 4ad8841591..05850e6ef0 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -876,8 +876,7 @@ static int _find_acquirement_subtype(object_class_type class_wanted, int count = 0; int skill = SK_FIGHTING; - // Can't do much with launchers, so we'll avoid them for now -- bwr - for (int i = SK_SHORT_BLADES; i < SK_DARTS; i++) + for (int i = SK_SHORT_BLADES; i <= SK_DARTS; i++) { if (i == SK_UNUSED_1) continue; diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index f15fa47a27..f52373fb6c 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -1417,21 +1417,21 @@ static brand_type _determine_weapon_brand(const item_def& item, int item_level) case WPN_CROSSBOW: { const int tmp = random2(1000); - if ( tmp < 375 ) + if (tmp < 375) rc = SPWPN_FLAME; - else if ( tmp < 750 ) + else if (tmp < 750) rc = SPWPN_FROST; - else if ( tmp < 920 ) + else if (tmp < 920) rc = SPWPN_PROTECTION; - else if ( tmp < 980 ) + else if (tmp < 980) rc = SPWPN_VORPAL; else rc = SPWPN_SPEED; break; } - // quarterstaff - not powerful, as this would make - // the 'staves' skill just too good + // Quarterstaff - not powerful, as this would make + // the 'staves' skill just too good. case WPN_QUARTERSTAFF: if (one_chance_in(30)) rc = SPWPN_PAIN; @@ -1758,7 +1758,7 @@ static void _generate_missile_item(item_def& item, int force_type, 0); } - // no fancy rocks -- break out before we get to racial/special stuff + // No fancy rocks -- break out before we get to racial/special stuff. if (item.sub_type == MI_LARGE_ROCK) { item.quantity = 2 + random2avg(5,2); @@ -1783,7 +1783,7 @@ static void _generate_missile_item(item_def& item, int force_type, _determine_missile_brand(item, item_level) ); } - // reduced quantity if special + // Reduced quantity if special. if (item.sub_type == MI_JAVELIN || get_ammo_brand( item ) == SPMSL_CURARE || get_ammo_brand( item ) == SPMSL_RETURNING) @@ -1798,7 +1798,7 @@ static void _generate_missile_item(item_def& item, int force_type, if (x_chance_in_y(11 + item_level, 100)) item.plus += random2(5); - // elven arrows and dwarven bolts are quality items + // Elven arrows and dwarven bolts are quality items. if (get_equip_race(item) == ISFLAG_ELVEN && item.sub_type == MI_ARROW || get_equip_race(item) == ISFLAG_DWARVEN && item.sub_type == MI_BOLT) { @@ -1835,7 +1835,10 @@ static bool _try_make_armour_artefact(item_def& item, int force_type, // 10% of boots become barding. if (item.sub_type == ARM_BOOTS && one_chance_in(10)) - item.sub_type = coinflip() ? ARM_NAGA_BARDING : ARM_CENTAUR_BARDING; + { + item.sub_type = coinflip() ? ARM_NAGA_BARDING + : ARM_CENTAUR_BARDING; + } // Determine enchantment and cursedness. if (one_chance_in(5)) @@ -2759,7 +2762,7 @@ int items( int allow_uniques, // not just true-false, item.quantity = 1; // generally the case - // determine sub_type accordingly {dlb}: + // Determine sub_type accordingly. {dlb} switch (item.base_type) { case OBJ_WEAPONS: @@ -3637,7 +3640,7 @@ static item_make_species_type _give_weapon(monsters *mon, int level, if (mons_genus(mon->type) == MONS_NAGA) item_race = MAKE_ITEM_NO_RACE; - // only happens if something in above switch doesn't set it {dlb} + // Only happens if something in above switch doesn't set it. {dlb} if (item.base_type == OBJ_UNASSIGNED) return (item_race); @@ -3708,6 +3711,17 @@ static void _give_ammo(monsters *mon, int level, _got_curare_roll(level) ? SPMSL_CURARE : SPMSL_POISONED); } + else + { + // Sanity check to avoid useless brands. + const int bow_brand = get_bow_brand(*launcher); + const int ammo_brand = get_ammo_brand(mitm[thing_created]); + if (bow_brand == SPWPN_FLAME && ammo_brand != SPMSL_NORMAL + || bow_brand == SPWPN_FROST && ammo_brand != SPMSL_NORMAL) + { + mitm[thing_created].special = SPMSL_NORMAL; + } + } // Master archers get double ammo - archery is their only attack. if (mon->type == MONS_DEEP_ELF_MASTER_ARCHER) diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index f5be8ee92e..719e2fea0d 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -741,6 +741,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) return (true); } +// Removes the oldest timer of a stack of blood potions. // Mostly used for (q)uaff, (f)ire, and Evaporate. long remove_oldest_blood_potion(item_def &stack) { @@ -759,7 +760,7 @@ long remove_oldest_blood_potion(item_def &stack) timer.pop_back(); // The quantity will be decreased elsewhere. - return val; + return (val); } // Used whenever copies of blood potions have to be cleaned up. diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index e0916f6e92..453bd1a00f 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -3668,6 +3668,14 @@ bool monsters::pickup_melee_weapon(item_def &item, int near) int eslot = -1; item_def *weap; + // FIXME: A monster already wielding a melee weapon can put a second-rate + // weapon into its alternate slot but never use it. + // To fix this, this strange loop will have to be improved: + // - get weapons of first and second slot + // - compare weapons (or their non-existence) to the new one + // - ignore ranged weapons (we're picking up a melee weapon) + // - replace an existing melee weapon by a better one + // - else don't do anything for (int i = MSLOT_WEAPON; i <= MSLOT_ALT_WEAPON; ++i) { weap = mslot_item(static_cast<mon_inv_type>(i)); @@ -3945,7 +3953,8 @@ bool monsters::pickup_missile(item_def &item, int near, bool force) // Monsters in a fight will only pick up missiles if doing so // is worthwhile. - if (!mons_is_wandering(this) && (!mons_friendly(this) || foe != MHITYOU) + if (!mons_is_wandering(this) + && (!mons_friendly(this) || foe != MHITYOU) && (item.quantity < 5 || miss && miss->quantity >= 7)) { return (false); @@ -3967,13 +3976,20 @@ bool monsters::pickup_missile(item_def &item, int near, bool force) launch = mslot_item(static_cast<mon_inv_type>(i)); if (launch) { + const int bow_brand = get_bow_brand(*launch); + const int item_brand = get_ammo_brand(item); // If this ammunition is better, drop the old ones. + // Don't upgrade to ammunition whose brand cancels the + // launcher brand or doesn't improve it further. if (fires_ammo_type(*launch) == item.sub_type && (fires_ammo_type(*launch) != miss->sub_type || item.plus > miss->plus || item.plus == miss->plus && get_ammo_brand(*miss) == SPMSL_NORMAL - && get_ammo_brand(item) != SPMSL_NORMAL)) + && item_brand != SPMSL_NORMAL + && (bow_brand != SPWPN_FLAME + || item_brand == SPMSL_POISONED) + && bow_brand != SPWPN_FROST)) { if (!drop_item(MSLOT_MISSILE, near)) return (false); diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index a0415148a0..4e0df5df79 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -559,7 +559,11 @@ void expose_items_to_element(beam_type flavour, int x, int y, int strength) if (x_chance_in_y(strength, 100)) { num_dest++; - dec_mitm_item_quantity(si->index(), 1); + if (!dec_mitm_item_quantity(si->index(), 1) + && is_blood_potion(*si)) + { + remove_oldest_blood_potion(*si); + } } } } diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 7317e0c5f5..7fb387ea2f 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -3049,7 +3049,7 @@ bool is_evil_item(const item_def& item) break; } - return retval; + return (retval); } bool good_god_dislikes_item_handling(const item_def &item) @@ -3069,10 +3069,9 @@ bool god_dislikes_item_handling(const item_def &item) if (you.religion == GOD_ZIN) { - if (((item.base_type == OBJ_POTIONS - && item.sub_type == POT_MUTATION) - || (item.base_type == OBJ_WANDS - && item.sub_type == WAND_POLYMORPH_OTHER)) + if ((item.base_type == OBJ_POTIONS && item.sub_type == POT_MUTATION + || item.base_type == OBJ_WANDS + && item.sub_type == WAND_POLYMORPH_OTHER) && item_type_known(item)) { return (true); @@ -3087,21 +3086,22 @@ bool god_dislikes_item_handling(const item_def &item) if (you.religion == GOD_SHINING_ONE) { + if (!item_type_known(item)) + return (false); + if (item.base_type == OBJ_WEAPONS) { const int item_brand = get_weapon_brand(item); - if (item_brand == SPWPN_VENOM && item_type_known(item)) + if (item_brand == SPWPN_VENOM) return (true); } else if (item.base_type == OBJ_MISSILES) { const int item_brand = get_ammo_brand(item); - if (item_type_known(item) && - (item_brand == SPMSL_POISONED - || item_brand == SPMSL_POISONED_II - || item_brand == SPMSL_CURARE)) + if (item_brand == SPMSL_POISONED + || item_brand == SPMSL_CURARE) { return (true); } |