From af65a4e054eb0cb18f736776f7fa3bcc29e4eb9c Mon Sep 17 00:00:00 2001 From: haranp Date: Sat, 4 Aug 2007 21:43:38 +0000 Subject: Minor code review of the Beogh idol revenge and Trog/Ely destruction stuff. Xom won't protect you from Beogh revenge, too capricious for that. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1969 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abl-show.cc | 80 ++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 47 deletions(-) (limited to 'crawl-ref/source/abl-show.cc') diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index ae53d55904..b49295aa11 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -927,7 +927,6 @@ static bool do_ability(const ability_def& abil) } case ABIL_DELAYED_FIREBALL: - { if ( !spell_direction(spd, beam, DIR_NONE, TARG_ENEMY) ) return (false); @@ -937,7 +936,6 @@ static bool do_ability(const ability_def& abil) // only one allowed since this is instantaneous -- bwr you.attribute[ ATTR_DELAYED_FIREBALL ] = 0; break; - } case ABIL_GLAMOUR: if (you.duration[DUR_GLAMOUR]) @@ -1511,16 +1509,10 @@ static bool do_ability(const ability_def& abil) break; case ABIL_ELYVILON_DESTROY_WEAPONS: - { - int i = igrd[you.x_pos][you.y_pos]; - if (i != NON_ITEM) - { - ely_destroy_weapons(); - break; - } - mpr("There are no items here."); + if ( !ely_destroy_weapons() ) + return false; break; - } + case ABIL_ELYVILON_LESSER_HEALING: if (!cast_healing( 3 + (you.skills[SK_INVOCATIONS] / 6) )) break; @@ -1794,7 +1786,7 @@ int choose_ability_menu(const std::vector& talents) if ( Options.tutorial_left ) { - // XXX This could be buggy if manage to pick up lots and lots + // XXX This could be buggy if you manage to pick up lots and lots // of abilities during the tutorial. abil_menu.set_more(tut_abilities_info()); abil_menu.set_flags(MF_SINGLESELECT | MF_ANYPRINTABLE | @@ -1846,24 +1838,21 @@ std::vector your_talents( bool check_confused ) { std::vector talents; - // first we do the racial abilities: + // Species-based abilities if (you.species == SP_MUMMY && you.experience_level >= 13) add_talent(talents, ABIL_MUMMY_RESTORATION, check_confused); - // checking for species-related abilities and mutagenic counterparts {dlb}: - if (you.attribute[ATTR_TRANSFORMATION] == TRAN_NONE - && ((you.species == SP_GREY_ELF && you.experience_level >= 5) - || (you.species == SP_HIGH_ELF && you.experience_level >= 15))) + if ( ((you.species == SP_GREY_ELF && you.experience_level >= 5) || + (you.species == SP_HIGH_ELF && you.experience_level >= 15)) && + you.attribute[ATTR_TRANSFORMATION] == TRAN_NONE ) { add_talent(talents, ABIL_GLAMOUR, check_confused); } if (you.species == SP_NAGA) { - if (you.mutation[MUT_BREATHE_POISON]) - add_talent(talents, ABIL_BREATHE_POISON, check_confused ); - else - add_talent(talents, ABIL_SPIT_POISON, check_confused ); + add_talent(talents, you.mutation[MUT_BREATHE_POISON] ? + ABIL_BREATHE_POISON : ABIL_SPIT_POISON, check_confused); } else if (you.mutation[MUT_SPIT_POISON]) { @@ -1895,22 +1884,6 @@ std::vector your_talents( bool check_confused ) add_talent(talents, ABIL_TRAN_BAT, check_confused ); } - if (you.religion == GOD_ELYVILON) - { - add_talent(talents, ABIL_ELYVILON_DESTROY_WEAPONS, check_confused ); - } - else if (you.religion == GOD_TROG) - { - add_talent(talents, ABIL_TROG_BURN_BOOKS, check_confused ); - } - - //jmf: alternately put check elsewhere - if ((you.level_type == LEVEL_DUNGEON && you.mutation[MUT_MAPPING]) || - (you.level_type == LEVEL_PANDEMONIUM && you.mutation[MUT_MAPPING]==3)) - { - add_talent(talents, ABIL_MAPPING, check_confused ); - } - if (!you.duration[DUR_CONTROLLED_FLIGHT] && !player_is_levitating()) { // kenku can fly, but only from the ground @@ -1922,7 +1895,13 @@ std::vector your_talents( bool check_confused ) add_talent(talents, ABIL_FLY_II, check_confused ); } - // demonic powers {dlb}: + // Mutations + if ((you.level_type == LEVEL_DUNGEON && you.mutation[MUT_MAPPING]) || + (you.level_type == LEVEL_PANDEMONIUM && you.mutation[MUT_MAPPING]==3)) + { + add_talent(talents, ABIL_MAPPING, check_confused ); + } + if (you.mutation[MUT_SUMMON_MINOR_DEMONS]) add_talent(talents, ABIL_SUMMON_MINOR_DEMON, check_confused ); @@ -1965,6 +1944,16 @@ std::vector your_talents( bool check_confused ) if (you.mutation[MUT_TELEPORT_AT_WILL]) add_talent(talents, ABIL_TELEPORTATION, check_confused ); + // Religious abilities + if (you.religion == GOD_ELYVILON) + { + add_talent(talents, ABIL_ELYVILON_DESTROY_WEAPONS, check_confused ); + } + else if (you.religion == GOD_TROG) + { + add_talent(talents, ABIL_TROG_BURN_BOOKS, check_confused ); + } + // gods take abilities away until penance completed -- bwr if (!player_under_penance() && !silenced( you.x_pos, you.y_pos )) { @@ -1990,16 +1979,14 @@ std::vector your_talents( bool check_confused ) add_talent(talents, ABIL_BREATHE_HELLFIRE, check_confused ); } else if (you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON - || you.mutation[MUT_BREATHE_FLAMES]) + || you.mutation[MUT_BREATHE_FLAMES]) { add_talent(talents, ABIL_BREATHE_FIRE, check_confused ); } // checking for unreleased delayed fireball if (you.attribute[ ATTR_DELAYED_FIREBALL ]) - { add_talent(talents, ABIL_DELAYED_FIREBALL, check_confused ); - } // evocations from items: if (scan_randarts(RAP_BLINK)) @@ -2016,8 +2003,8 @@ std::vector your_talents( bool check_confused ) || scan_randarts( RAP_INVISIBLE )) { // Now you can only turn invisibility off if you have an - // activatable item. Wands and potions allow will have - // to time out. -- bwr + // activatable item. Wands and potions will have to time + // out. -- bwr if (you.duration[DUR_INVIS]) add_talent(talents, ABIL_EVOKE_TURN_VISIBLE, check_confused ); else @@ -2034,10 +2021,9 @@ std::vector your_talents( bool check_confused ) // activatable item. Potions and miscast effects will // have to time out (this makes the miscast effect actually // a bit annoying). -- bwr - if (you.duration[DUR_LEVITATION]) - add_talent(talents, ABIL_EVOKE_STOP_LEVITATING, check_confused ); - else - add_talent(talents, ABIL_EVOKE_LEVITATE, check_confused ); + add_talent(talents, you.duration[DUR_LEVITATION] ? + ABIL_EVOKE_STOP_LEVITATING : ABIL_EVOKE_LEVITATE, + check_confused); } if (player_equip( EQ_RINGS, RING_TELEPORTATION ) -- cgit v1.2.3-54-g00ecf