summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mstuff2.cc
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 /crawl-ref/source/mstuff2.cc
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
Diffstat (limited to 'crawl-ref/source/mstuff2.cc')
-rw-r--r--crawl-ref/source/mstuff2.cc96
1 files changed, 49 insertions, 47 deletions
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);
}