From 6ad2ff13db0746d82faad381d54127e6c8958190 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Tue, 3 Jul 2007 18:45:58 +0000 Subject: Fixed debug fight simulator. Dialed javelin base damage down a notch. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1733 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/debug.cc | 14 +++++++++----- crawl-ref/source/defines.h | 3 +++ crawl-ref/source/item_use.cc | 8 +++++--- crawl-ref/source/itemprop.cc | 13 ++++++++++--- 4 files changed, 27 insertions(+), 11 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index da8a8a77ad..7158778e84 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -1527,7 +1527,9 @@ static bool fsim_ranged_combat(FILE *out, int wskill, int mi, // throw_it() will decrease quantity by 1 inc_inv_item_quantity(thrown, 1); - if (throw_it(beam, thrown, true)) + beam.target_x = mon.x; + beam.target_y = mon.y; + if (throw_it(beam, thrown, true, DEBUG_COOKIE)) hits++; you.hunger = hunger; @@ -1631,9 +1633,12 @@ static const item_def *fsim_weap_item() return &you.inv[weap]; } -static std::string fsim_wskill() +static std::string fsim_wskill(int missile_slot) { const item_def *iweap = fsim_weap_item(); + if (!iweap && missile_slot != -1) + return skill_name(range_skill(you.inv[missile_slot])); + return iweap && iweap->base_type == OBJ_WEAPONS && is_range_weapon(*iweap)? skill_name( range_skill(*iweap) ) : @@ -1715,7 +1720,7 @@ static void fsim_title(FILE *o, int mon, int ms) fsim_mon_stats(o, menv[mon]); fprintf(o, "\n"); fprintf(o, "Weapon : %s\n", fsim_weapon(ms).c_str()); - fprintf(o, "Skill : %s\n", fsim_wskill().c_str()); + fprintf(o, "Skill : %s\n", fsim_wskill(ms).c_str()); fprintf(o, "\n"); fprintf(o, "Skill | Accuracy | Av.Dam | Av.HitDam | Eff.Dam | Max.Dam | Av.Time\n"); } @@ -1907,8 +1912,7 @@ int fsim_kit_equip(const std::string &kit) else if (you.equip[EQ_WEAPON] != -1) { unwield_item(you.equip[EQ_WEAPON], false); - if (you.equip[EQ_WEAPON] != -1) - return (-100); + you.equip[EQ_WEAPON] = -1; } if (!missile.empty()) diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h index 348c275080..81611699fb 100644 --- a/crawl-ref/source/defines.h +++ b/crawl-ref/source/defines.h @@ -135,6 +135,9 @@ // This value is used to make test_hit checks always succeed #define AUTOMATIC_HIT 1500 +// Yes, I know we have 32-bit ints now. +#define DEBUG_COOKIE 32767 + #define MIN_HIT_MISS_PERCENTAGE 5 // grids that monsters can see diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index b2877bda6c..febacf4c5a 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1394,7 +1394,7 @@ static int dex_adjust_thrown_tohit(int hit) // // Return value is only relevant if dummy_target is non-NULL, and returns // true if dummy_target is hit. -bool throw_it(struct bolt &pbolt, int throw_2, bool teleport, int acc_bonus) +bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus) { struct dist thr; char shoot_skill = 0; @@ -2030,7 +2030,8 @@ bool throw_it(struct bolt &pbolt, int throw_2, bool teleport, int acc_bonus) } // Add in bonus (only from Portaled Projectile for now) - pbolt.hit += acc_bonus; + if (acc_bonus != DEBUG_COOKIE) + pbolt.hit += acc_bonus; scale_dice( pbolt.damage ); @@ -2060,7 +2061,8 @@ bool throw_it(struct bolt &pbolt, int throw_2, bool teleport, int acc_bonus) { // Violating encapsulation somewhat...oh well. hit = (affect( pbolt, pbolt.target_x, pbolt.target_y ) != 0); - beam_drop_object( pbolt, &item, pbolt.target_x, pbolt.target_y ); + if (acc_bonus != DEBUG_COOKIE) + beam_drop_object( pbolt, &item, pbolt.target_x, pbolt.target_y ); } else { diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 81a45b94b5..69709474bb 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -350,7 +350,7 @@ static missile_def Missile_prop[NUM_MISSILES] = { MI_BOLT, "bolt", 9, 5, false }, { MI_LARGE_ROCK, "large rock", 20, 1000, true }, { MI_SLING_BULLET, "sling bullet", 6, 4, true }, - { MI_JAVELIN, "javelin", 11, 40, true }, + { MI_JAVELIN, "javelin", 10, 40, true }, }; struct food_def @@ -1470,8 +1470,15 @@ skill_type range_skill( const item_def &item ) { if (item.base_type == OBJ_WEAPONS && is_range_weapon( item )) return (Weapon_prop[ Weapon_index[item.sub_type] ].skill); - else if (item.base_type == OBJ_MISSILES && item.sub_type == MI_DART) - return (SK_DARTS); + else if (item.base_type == OBJ_MISSILES) + { + switch (item.sub_type) + { + case MI_DART: return (SK_DARTS); + case MI_JAVELIN: return (SK_POLEARMS); + default: break; + } + } return (SK_RANGED_COMBAT); } -- cgit v1.2.3-54-g00ecf