summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-03 14:41:49 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-03 14:41:49 +0000
commit1ae786a89983b2c5511028e1ef894f5b7504eb04 (patch)
treeba5ca815c90e6a173bc9f4c3570d93b27a43442d
parentcbb4198487aa2b7a3e59d5ad42d29bed2058ebbd (diff)
downloadcrawl-ref-1ae786a89983b2c5511028e1ef894f5b7504eb04.tar.gz
crawl-ref-1ae786a89983b2c5511028e1ef894f5b7504eb04.zip
Fix 2005590: Branded darts unbranded when thrown.
Thrown darts of ice or flame will correctly be displayed as puffs of frost/flame, will do the appropriate damage both to player and monsters and will be identified when thrown by a monster. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6367 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/food.cc2
-rw-r--r--crawl-ref/source/item_use.cc117
-rw-r--r--crawl-ref/source/itemprop.cc6
-rw-r--r--crawl-ref/source/itemprop.h4
-rw-r--r--crawl-ref/source/makeitem.cc19
-rw-r--r--crawl-ref/source/mstuff2.cc96
6 files changed, 122 insertions, 122 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 3683453987..d222383925 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -571,7 +571,7 @@ bool butchery(int which_corpse)
// Shall we butcher this corpse?
do
{
- mprf(MSGCH_PROMPT, "%s %s? [yc/n/a/q/?]",
+ mprf(MSGCH_PROMPT, "%s %s? (yc/n/a/q/?)",
(sacrifice || !can_bottle_blood_from_corpse(si->plus)) ?
"Butcher" : "Bottle",
corpse_name.c_str());
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 2eb1259aa8..9ac66044ca 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1989,24 +1989,26 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
if (wepClass == OBJ_WEAPONS)
baseDam = std::max(0, property(item, PWPN_DAMAGE) - 4);
- // Extract launcher bonuses due to magic.
- if (projected == LRET_LAUNCHED)
- {
- lnchHitBonus = you.inv[you.equip[EQ_WEAPON]].plus;
- lnchDamBonus = you.inv[you.equip[EQ_WEAPON]].plus2;
- }
-
// Extract weapon/ammo bonuses due to magic.
ammoHitBonus = item.plus;
ammoDamBonus = item.plus2;
+ int bow_brand = SPWPN_NORMAL;
+
+ if (projected == LRET_LAUNCHED)
+ bow_brand = get_weapon_brand(you.inv[you.equip[EQ_WEAPON]]);
+
+ const int ammo_brand = get_ammo_brand( item );
+ bool poisoned = (ammo_brand == SPMSL_POISONED);
+
// CALCULATIONS FOR LAUNCHED WEAPONS
if (projected == LRET_LAUNCHED)
{
const item_def &launcher = you.inv[you.equip[EQ_WEAPON]];
- const int bow_brand = get_weapon_brand( launcher );
- const int ammo_brand = get_ammo_brand( item );
- bool poisoned = (ammo_brand == SPMSL_POISONED);
+
+ // Extract launcher bonuses due to magic.
+ lnchHitBonus = launcher.plus;
+ lnchDamBonus = launcher.plus2;
const int item_base_dam = property( item, PWPN_DAMAGE );
const int lnch_base_dam = property( launcher, PWPN_DAMAGE );
@@ -2229,52 +2231,6 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
pbolt.name = item.name(DESC_PLAIN);
}
- // Note that bow_brand is known since the bow is equipped.
- if ((bow_brand == SPWPN_FLAME || ammo_brand == SPMSL_FLAME)
- && ammo_brand != SPMSL_ICE && bow_brand != SPWPN_FROST)
- {
- // [dshaligram] Branded arrows are much stronger.
- dice_mult = (dice_mult * 150) / 100;
-
- pbolt.flavour = BEAM_FIRE;
- pbolt.name = "bolt of ";
-
- if (poisoned)
- pbolt.name += "poison ";
-
- pbolt.name += "flame";
- pbolt.colour = RED;
- pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT);
- pbolt.thrower = KILL_YOU_MISSILE;
- pbolt.aux_source.clear();
- }
-
- if ((bow_brand == SPWPN_FROST || ammo_brand == SPMSL_ICE)
- && ammo_brand != SPMSL_FLAME && bow_brand != SPWPN_FLAME)
- {
- // [dshaligram] Branded arrows are much stronger.
- dice_mult = (dice_mult * 150) / 100;
-
- pbolt.flavour = BEAM_COLD;
- pbolt.name = "bolt of ";
-
- if (poisoned)
- pbolt.name += "poison ";
-
- pbolt.name += "frost";
- pbolt.colour = WHITE;
- pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT);
- pbolt.thrower = KILL_YOU_MISSILE;
- pbolt.aux_source.clear();
- }
-
- // The chief advantage here is the extra damage this does
- // against susceptible creatures.
-
- // Note: weapons & ammo of eg fire are not cumulative
- // ammo of fire and weapons of frost don't work together,
- // and vice versa.
-
// ID check. Can't ID off teleported projectiles, uh, because
// it's too weird. Also it messes up the messages.
if (item_ident(you.inv[you.equip[EQ_WEAPON]], ISFLAG_KNOW_PLUSES))
@@ -2463,6 +2419,55 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
}
}
+ mprf(MSGCH_DIAGNOSTICS, "bow_brand: %d, ammo_brand: %d",
+ bow_brand, ammo_brand);
+
+ // The chief advantage here is the extra damage this does
+ // against susceptible creatures.
+
+ // Note: weapons & ammo of eg fire are not cumulative
+ // ammo of fire and weapons of frost don't work together,
+ // and vice versa.
+
+ // Note that bow_brand is known since the bow is equipped.
+ if ((bow_brand == SPWPN_FLAME || ammo_brand == SPMSL_FLAME)
+ && ammo_brand != SPMSL_ICE && bow_brand != SPWPN_FROST)
+ {
+ // [dshaligram] Branded arrows are much stronger.
+ dice_mult = (dice_mult * 150) / 100;
+
+ pbolt.flavour = BEAM_FIRE;
+ pbolt.name = "bolt of ";
+
+ if (poisoned)
+ pbolt.name += "poison ";
+
+ pbolt.name += "flame";
+ pbolt.colour = RED;
+ pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT);
+ pbolt.thrower = KILL_YOU_MISSILE;
+ pbolt.aux_source.clear();
+ }
+
+ if ((bow_brand == SPWPN_FROST || ammo_brand == SPMSL_ICE)
+ && ammo_brand != SPMSL_FLAME && bow_brand != SPWPN_FLAME)
+ {
+ // [dshaligram] Branded arrows are much stronger.
+ dice_mult = (dice_mult * 150) / 100;
+
+ pbolt.flavour = BEAM_COLD;
+ pbolt.name = "bolt of ";
+
+ if (poisoned)
+ pbolt.name += "poison ";
+
+ pbolt.name += "frost";
+ pbolt.colour = WHITE;
+ pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT);
+ pbolt.thrower = KILL_YOU_MISSILE;
+ pbolt.aux_source.clear();
+ }
+
// Dexterity bonus, and possible skill increase for silly throwing.
if (projected)
{
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 88d89636ce..359ba8f0aa 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -930,7 +930,7 @@ int get_weapon_brand( const item_def &item )
int get_ammo_brand( const item_def &item )
{
- // no artefact arrows yet -- bwr
+ // No artefact arrows yet. -- bwr
if (item.base_type != OBJ_MISSILES || is_random_artefact( item ))
return (SPMSL_NORMAL);
@@ -2042,8 +2042,8 @@ launch_retval is_launched(actor *actor, const item_def *launcher,
return (LRET_LAUNCHED);
}
- return (is_throwable(missile, actor->body_size())?
- LRET_THROWN : LRET_FUMBLED);
+ return (is_throwable(missile, actor->body_size()) ? LRET_THROWN
+ : LRET_FUMBLED);
}
bool is_range_weapon_type( weapon_type wtype )
diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h
index 2dfc3e8f0c..23e3fd56af 100644
--- a/crawl-ref/source/itemprop.h
+++ b/crawl-ref/source/itemprop.h
@@ -91,8 +91,8 @@ enum brand_type // equivalent to (you.inv[].special or mitm[].special) % 30
SPWPN_DRAINING,
SPWPN_SPEED, // 10
SPWPN_VORPAL,
- SPWPN_FLAME,
- SPWPN_FROST,
+ SPWPN_FLAME, // ranged, only
+ SPWPN_FROST, // ranged, only
SPWPN_VAMPIRICISM,
SPWPN_PAIN, // 15
SPWPN_DISTORTION,
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 6ae00c98fe..adb2db53e4 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -1693,12 +1693,6 @@ static special_missile_type _determine_missile_brand(const item_def& item,
const bool force_good = (item_level == MAKE_GOOD_ITEM);
special_missile_type rc = SPMSL_NORMAL;
- // note that needles can only be poisoned
- //
- // Actually, it'd be really nice if there where
- // some paralysis or slowing poison needles, just
- // so that blowguns have some added utility over
- // the other launchers/throwing weapons. -- bwr
// All needles are either poison or curare.
if (item.sub_type == MI_NEEDLE)
@@ -1722,17 +1716,16 @@ static special_missile_type _determine_missile_brand(const item_def& item,
if (item.sub_type == MI_JAVELIN && one_chance_in(25))
rc = SPMSL_RETURNING;
- // orcish ammo gets poisoned a lot more often -- in the original
- // code it was poisoned every time!?
+ // Orcish ammo gets poisoned a lot more often.
if (get_equip_race(item) == ISFLAG_ORCISH && one_chance_in(3))
rc = SPMSL_POISONED;
// Un-poison sling bullets; un-flame and un-ice javelins; unbrand
// throwing nets.
- if ((item.sub_type == MI_SLING_BULLET && rc == SPMSL_POISONED)
- || item.sub_type == MI_JAVELIN
- && (rc == SPMSL_FLAME || rc == SPMSL_ICE)
- || item.sub_type == MI_THROWING_NET)
+ if (item.sub_type == MI_SLING_BULLET && rc == SPMSL_POISONED
+ || item.sub_type == MI_JAVELIN
+ && (rc == SPMSL_FLAME || rc == SPMSL_ICE)
+ || item.sub_type == MI_THROWING_NET)
{
rc = SPMSL_NORMAL;
}
@@ -2170,7 +2163,7 @@ static void _generate_armour_item(item_def& item, bool allow_uniques,
{
if ( item.plus > 2 )
item.plus = 2;
- }
+ }
}
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index 909e09d6ff..9bf6cde740 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -1279,8 +1279,17 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
exDamBonus = (damMult * monster->hit_dice) / 10 + 1;
}
+ // Monsters no longer gain unfair advantages with weapons of fire/ice
+ // and incorrect ammo. They now have same restriction as players.
+
+ int bow_brand = SPWPN_NORMAL;
+ const int ammo_brand = get_ammo_brand( item );
+ const bool poison = (ammo_brand == SPMSL_POISONED);
+
if (projected == LRET_LAUNCHED)
{
+ bow_brand = get_weapon_brand(mitm[monster->inv[MSLOT_WEAPON]]);
+
switch (lnchType)
{
case WPN_BLOWGUN:
@@ -1329,13 +1338,6 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
exHitBonus = (hitMult * monster->hit_dice) / 10 + 1;
exDamBonus = (damMult * monster->hit_dice) / 10 + 1;
- // monsters no longer gain unfair advantages with weapons of fire/ice
- // and incorrect ammo. They now have same restriction as players.
-
- const int bow_brand =
- get_weapon_brand(mitm[monster->inv[MSLOT_WEAPON]]);
- const int ammo_brand = get_ammo_brand( item );
-
if (!baseDam && elemental_missile_beam(bow_brand, ammo_brand))
baseDam = 4;
@@ -1355,8 +1357,6 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
pbolt.hit++;
}
- const bool poison = (ammo_brand == SPMSL_POISONED);
-
// POISON brand launchers poison ammo
if (bow_brand == SPWPN_VENOM && ammo_brand == SPMSL_NORMAL)
set_item_ego_type( item, OBJ_MISSILES, SPMSL_POISONED );
@@ -1365,41 +1365,6 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
if (bow_brand == SPWPN_VORPAL)
diceMult = diceMult * 130 / 100;
- // WEAPON or AMMO of FIRE
- if (bow_brand == SPWPN_FLAME && ammo_brand != SPMSL_ICE
- || ammo_brand == SPMSL_FLAME && bow_brand != SPWPN_FROST)
- {
- baseHit += 2;
- exDamBonus += 6;
-
- pbolt.flavour = BEAM_FIRE;
- pbolt.name = "bolt of ";
-
- if (poison)
- pbolt.name += "poison ";
-
- pbolt.name += "flame";
- pbolt.colour = RED;
- pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP);
- }
- // WEAPON or AMMO of FROST
- else if (bow_brand == SPWPN_FROST && ammo_brand != SPMSL_FLAME
- || ammo_brand == SPMSL_ICE && bow_brand != SPWPN_FLAME)
- {
- baseHit += 2;
- exDamBonus += 6;
-
- pbolt.flavour = BEAM_COLD;
- pbolt.name = "bolt of ";
-
- if (poison)
- pbolt.name += "poison ";
-
- pbolt.name += "frost";
- pbolt.colour = WHITE;
- pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP);
- }
-
// Note: we already have throw_energy taken off. -- bwr
int speed_delta = 0;
if (lnchType == WPN_CROSSBOW)
@@ -1427,16 +1392,51 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
monster->speed_increment += speed_delta;
}
+ // WEAPON or AMMO of FIRE
+ if (bow_brand == SPWPN_FLAME && ammo_brand != SPMSL_ICE
+ || ammo_brand == SPMSL_FLAME && bow_brand != SPWPN_FROST)
+ {
+ baseHit += 2;
+ exDamBonus += 6;
+
+ pbolt.flavour = BEAM_FIRE;
+ pbolt.name = "bolt of ";
+
+ if (poison)
+ pbolt.name += "poison ";
+
+ pbolt.name += "flame";
+ pbolt.colour = RED;
+ pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP);
+ }
+ // WEAPON or AMMO of FROST
+ else if (bow_brand == SPWPN_FROST && ammo_brand != SPMSL_FLAME
+ || ammo_brand == SPMSL_ICE && bow_brand != SPWPN_FLAME)
+ {
+ baseHit += 2;
+ exDamBonus += 6;
+
+ pbolt.flavour = BEAM_COLD;
+ pbolt.name = "bolt of ";
+
+ if (poison)
+ pbolt.name += "poison ";
+
+ pbolt.name += "frost";
+ pbolt.colour = WHITE;
+ pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP);
+ }
+
// monster intelligence bonus
if (mons_intel(monster->type) == I_HIGH)
exHitBonus += 10;
- // now, if a monster is, for some reason, throwing something really
+ // Now, if a monster is, for some reason, throwing something really
// stupid, it will have baseHit of 0 and damage of 0. Ah well.
std::string msg = monster->name(DESC_CAP_THE);
msg += ((projected == LRET_LAUNCHED) ? " shoots " : " throws ");
- if (!pbolt.name.empty())
+ if (!pbolt.name.empty() && projected == LRET_LAUNCHED)
{
msg += "a ";
msg += pbolt.name;
@@ -1456,7 +1456,9 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
mpr(msg.c_str());
if (projected == LRET_LAUNCHED
- && item_type_known(mitm[monster->inv[MSLOT_WEAPON]]))
+ && item_type_known(mitm[monster->inv[MSLOT_WEAPON]])
+ || projected == LRET_THROWN
+ && mitm[hand_used].base_type == OBJ_MISSILES)
{
set_ident_flags(mitm[hand_used], ISFLAG_KNOW_TYPE);
}