summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-04 17:24:52 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-04 17:24:52 +0000
commitcdab703a671fabd21a015d23a5dc8a3ed5e10b36 (patch)
tree8fb64601c35b90df902bddf7f3bb63db807a393e /crawl-ref/source
parentba7c629689d1042cf8cb4d94de535025154bc0ea (diff)
downloadcrawl-ref-cdab703a671fabd21a015d23a5dc8a3ed5e10b36.tar.gz
crawl-ref-cdab703a671fabd21a015d23a5dc8a3ed5e10b36.zip
Allow racial javelins. Javelins can now be elven and orcish, since
dwarves don't make polearms, and are made so 25% of the time, the same as for spears. Since they have no associated launcher, the usual bonuses for throwing racial gear apply to them, in spite of their being missiles thrown by hand. Also, disable branded javelins for now, as branding for thrown missiles in general isn't implemented. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2997 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/describe.cc23
-rw-r--r--crawl-ref/source/item_use.cc16
-rw-r--r--crawl-ref/source/itemprop.cc15
-rw-r--r--crawl-ref/source/itemprop.h3
-rw-r--r--crawl-ref/source/makeitem.cc13
5 files changed, 58 insertions, 12 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index ea37a0c283..ce0448e2cb 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1442,8 +1442,10 @@ static std::string describe_ammo( const item_def &item )
break;
}
- switch ( get_equip_race(item) )
+ if ( has_launcher(item) )
{
+ switch ( get_equip_race(item) )
+ {
case ISFLAG_DWARVEN:
description +=
"$It is more effective in conjunction with dwarven launchers.";
@@ -1456,6 +1458,25 @@ static std::string describe_ammo( const item_def &item )
description +=
"$It is more effective in conjunction with orcish launchers.";
break;
+ }
+ }
+ else
+ {
+ switch ( get_equip_race(item) )
+ {
+ case ISFLAG_DWARVEN:
+ description +=
+ "$It is most deadly when thrown by dwarves.";
+ break;
+ case ISFLAG_ELVEN:
+ description +=
+ "$It is most deadly when thrown by elves.";
+ break;
+ case ISFLAG_ORCISH:
+ description +=
+ "$It is most deadly when thrown by orcs.";
+ break;
+ }
}
if (item.special != 0 && item_type_known(item))
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 5fbaf7423c..98f9377224 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2079,7 +2079,8 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
// all weapons that use 'throwing' go here..
if (wepClass == OBJ_WEAPONS
|| (wepClass == OBJ_MISSILES
- && (wepType == MI_STONE || wepType == MI_LARGE_ROCK)))
+ && (wepType == MI_STONE || wepType == MI_LARGE_ROCK
+ || wepType == MI_JAVELIN)))
{
// elves with elven weapons
if (get_equip_race(item) == ISFLAG_ELVEN
@@ -2106,6 +2107,17 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
break;
}
}
+ else if (wepClass == OBJ_MISSILES)
+ {
+ switch (wepType)
+ {
+ case MI_JAVELIN:
+ baseHit += 1;
+ break;
+ default:
+ break;
+ }
+ }
exHitBonus = you.skills[SK_THROWING] * 2;
@@ -2152,8 +2164,6 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
break;
case MI_JAVELIN:
// Javelins use throwing skill.
- baseHit = 1;
- baseDam = property( item, PWPN_DAMAGE );
exHitBonus += skill_bump(SK_THROWING);
exDamBonus += you.skills[SK_THROWING] * 3 / 5;
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 2bb580de93..69da6bcc42 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -709,8 +709,11 @@ void set_equip_race( item_def &item, unsigned long flags )
}
break;
case OBJ_MISSILES:
- if (item.sub_type == MI_ARROW)
+ if (item.sub_type == MI_ARROW
+ || item.sub_type == MI_JAVELIN)
+ {
return;
+ }
break;
default:
break;
@@ -1855,7 +1858,15 @@ const char * ammo_name( const item_def &bow )
{
ASSERT( is_range_weapon( bow ) );
return ammo_name(fires_ammo_type( bow ));
-}
+}
+
+// returns true if item has an associated launcher
+bool has_launcher( const item_def &wpn )
+{
+ return (wpn.sub_type != MI_LARGE_ROCK &&
+ wpn.sub_type != MI_JAVELIN &&
+ wpn.sub_type != MI_THROWING_NET);
+}
// returns true if item can be reasonably thrown without a launcher
bool is_throwable( const item_def &wpn, size_type bodysize )
diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h
index 07848add5e..39292bcbd5 100644
--- a/crawl-ref/source/itemprop.h
+++ b/crawl-ref/source/itemprop.h
@@ -672,8 +672,9 @@ missile_type fires_ammo_type( const item_def &item );
missile_type fires_ammo_type( weapon_type wtype );
const char * ammo_name( const item_def &bow );
const char * ammo_name( missile_type mtyp );
+bool has_launcher( const item_def &wpn );
bool is_throwable( const item_def &wpn,
- size_type bodysize = SIZE_MEDIUM );
+ size_type bodysize = SIZE_MEDIUM );
launch_retval is_launched(actor *actor, const item_def *launcher,
const item_def &missile);
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index aa21dfa01c..7df3bd4615 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -1625,7 +1625,8 @@ static item_status_flag_type determine_missile_race(const item_def& item,
case MAKE_ITEM_RANDOM_RACE:
// Elves don't make bolts, sling bullets, or throwing nets
if ((item.sub_type == MI_ARROW
- || item.sub_type == MI_DART)
+ || item.sub_type == MI_DART
+ || item.sub_type == MI_JAVELIN)
&& one_chance_in(4))
{
rc = ISFLAG_ELVEN;
@@ -1634,13 +1635,15 @@ static item_status_flag_type determine_missile_race(const item_def& item,
// Orcs don't make sling bullets or throwing nets
if ((item.sub_type == MI_ARROW
|| item.sub_type == MI_BOLT
- || item.sub_type == MI_DART)
+ || item.sub_type == MI_DART
+ || item.sub_type == MI_JAVELIN)
&& one_chance_in(4))
{
rc = ISFLAG_ORCISH;
}
- // Dwarves don't make arrows, sling bullets, or throwing nets
+ // Dwarves don't make arrows, sling bullets, javelins, or
+ // throwing nets
if ((item.sub_type == MI_DART
|| item.sub_type == MI_BOLT)
&& one_chance_in(6))
@@ -1696,9 +1699,9 @@ static special_missile_type determine_missile_brand(const item_def& item,
if (get_equip_race(item) == ISFLAG_ORCISH && one_chance_in(3))
rc = SPMSL_POISONED;
- // Un-poison sling bullets, unbrand nets.
+ // Un-poison sling bullets; unbrand javelins and throwing nets.
if ((item.sub_type == MI_SLING_BULLET && rc == SPMSL_POISONED)
- || item.sub_type == MI_THROWING_NET)
+ || item.sub_type == MI_JAVELIN || item.sub_type == MI_THROWING_NET)
{
rc = SPMSL_NORMAL;
}