From 7b4927dc530fe713ac4c784af53e1958d78a4eeb Mon Sep 17 00:00:00 2001 From: dshaligram Date: Thu, 25 Oct 2007 09:11:50 +0000 Subject: Spell changes: strengthened stone arrow and the storms, weakened bolts of fire and cold, and crystal spear. (Re)allow partial spell names when using &Z in wizmode. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2543 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 16 ++++++++-------- crawl-ref/source/debug.cc | 2 +- crawl-ref/source/spells1.cc | 2 +- crawl-ref/source/spl-util.cc | 14 ++++++++++---- crawl-ref/source/spl-util.h | 2 +- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index aad4afc6af..4907d156ba 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -686,10 +686,10 @@ static void zappy( zap_type z_type, int power, bolt &pbolt ) pbolt.name = "stone arrow"; pbolt.colour = LIGHTGREY; pbolt.range = 8 + random2(5); - pbolt.damage = dice_def( 2, 4 + power / 8 ); // 25: 2d7 50: 2d10 - pbolt.hit = 5 + power / 10; // 25: 6 50: 7 + pbolt.damage = dice_def( 2, 5 + power / 7 ); // 25: 2d8 50: 2d12 + pbolt.hit = 8 + power / 10; // 25: 10 50: 13 pbolt.type = SYM_MISSILE; - pbolt.flavour = BEAM_MMISSILE; // unresistable + pbolt.flavour = BEAM_MMISSILE; // irresistible pbolt.obvious_effect = true; break; @@ -754,7 +754,7 @@ static void zappy( zap_type z_type, int power, bolt &pbolt ) pbolt.name = "bolt of fire"; pbolt.colour = RED; pbolt.range = 7 + random2(10); - pbolt.damage = calc_dice( 6, 20 + (power * 3) / 4 ); + pbolt.damage = calc_dice( 6, 18 + power * 2 / 3 ); pbolt.hit = 10 + power / 25; // 50: 12 100: 14 pbolt.type = SYM_ZAP; pbolt.flavour = BEAM_FIRE; @@ -767,7 +767,7 @@ static void zappy( zap_type z_type, int power, bolt &pbolt ) pbolt.name = "bolt of cold"; pbolt.colour = WHITE; pbolt.range = 7 + random2(10); - pbolt.damage = calc_dice( 6, 20 + (power * 3) / 4 ); + pbolt.damage = calc_dice( 6, 18 + power * 2 / 3 ); pbolt.hit = 10 + power / 25; // 50: 12 100: 14 pbolt.type = SYM_ZAP; pbolt.flavour = BEAM_COLD; @@ -898,8 +898,8 @@ static void zappy( zap_type z_type, int power, bolt &pbolt ) case ZAP_CRYSTAL_SPEAR: // cap 200 pbolt.name = "crystal spear"; pbolt.colour = WHITE; - pbolt.range = 7 + random2(10); - pbolt.damage = calc_dice( 12, 30 + (power * 4) / 3 ); + pbolt.range = 6 + random2(4); + pbolt.damage = calc_dice( 10, 23 + power ); pbolt.hit = 10 + power / 15; // 50: 13 100: 16 pbolt.type = SYM_MISSILE; pbolt.flavour = BEAM_MMISSILE; // unresistable @@ -924,7 +924,7 @@ static void zappy( zap_type z_type, int power, bolt &pbolt ) pbolt.name = "great blast of cold"; pbolt.colour = BLUE; pbolt.range = 9 + random2(5); - pbolt.damage = calc_dice( 6, 15 + power ); + pbolt.damage = calc_dice( 10, 18 + power ); pbolt.damage.num = 0; // only does explosion damage pbolt.hit = 20 + power / 10; // 50: 25 100: 30 pbolt.ench_power = power; // used for radius diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 4c9299e011..b41a91c53f 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -360,7 +360,7 @@ void cast_spec_spell_name(void) return; } - spell_type type = spell_by_name(specs); + spell_type type = spell_by_name(specs, true); if (type == SPELL_NO_SPELL) { mpr((one_chance_in(20)) ? "Maybe you should go back to WIZARD school." diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 35a8e8179b..d297fbf181 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -266,7 +266,7 @@ int cast_fire_storm(int powc, bolt &beam) beam.ench_power = powc; // used for radius beam.name = "great blast of fire"; beam.hit = 20 + powc / 10; - beam.damage = calc_dice( 6, 15 + powc ); + beam.damage = calc_dice( 9, 20 + powc ); explosion( beam ); mpr("A raging storm of fire appears!"); diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index 2f06175670..9cbaace2df 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -76,13 +76,14 @@ void init_spell_descs(void) spell_list[spelldata[i].id] = i; } // end init_spell_descs() -spell_type spell_by_name(std::string name) +spell_type spell_by_name(std::string name, bool partial_match) { if (name.empty()) return (SPELL_NO_SPELL); lowercase(name); - + + int spellmatch = -1; for (int i = 0; i < NUM_SPELLS; i++) { spell_type type = static_cast(i); @@ -90,11 +91,16 @@ spell_type spell_by_name(std::string name) if (!sptitle) continue; - if (name == lowercase_string(sptitle)) + const std::string spell_name = lowercase_string(sptitle); + if (name == spell_name) return (type); + + if (partial_match && spell_name.find(name) != std::string::npos) + spellmatch = i; } - return (SPELL_NO_SPELL); + return (spellmatch != -1? static_cast(spellmatch) + : SPELL_NO_SPELL); } int get_spell_slot_by_letter( char letter ) diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h index 56986ab064..1f3ce8219e 100644 --- a/crawl-ref/source/spl-util.h +++ b/crawl-ref/source/spl-util.h @@ -64,7 +64,7 @@ struct spell_desc //* * called from: acr void init_spell_descs(void); -spell_type spell_by_name(std::string name); +spell_type spell_by_name(std::string name, bool partial_match = false); int get_spell_slot_by_letter( char letter ); spell_type get_spell_by_letter( char letter ); -- cgit v1.2.3-54-g00ecf