From 52b146bac6c9f15d8b90331576738204651d6c8c Mon Sep 17 00:00:00 2001 From: haranp Date: Thu, 13 Dec 2007 10:02:21 +0000 Subject: Permanent levitation no longer confers permanent flight. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3053 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abl-show.cc | 6 +----- crawl-ref/source/acr.cc | 38 +++++++++++++++----------------------- crawl-ref/source/externs.h | 2 ++ crawl-ref/source/misc.cc | 11 ++++------- crawl-ref/source/output.cc | 4 +--- crawl-ref/source/player.cc | 27 +++++++++++++++++++-------- crawl-ref/source/spells1.cc | 10 +++++----- crawl-ref/source/travel.cc | 9 +-------- 8 files changed, 48 insertions(+), 59 deletions(-) diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 1e41abedc1..b153af37a2 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1184,11 +1184,7 @@ static bool do_ability(const ability_def& abil) cast_fly( you.experience_level * 4 ); if (you.experience_level > 14) - { mpr("You feel very comfortable in the air."); - you.duration[DUR_LEVITATION] = 100; - you.duration[DUR_CONTROLLED_FLIGHT] = 100; - } break; // Fly (Draconians, or anything else with wings) @@ -1978,7 +1974,7 @@ std::vector your_talents( bool check_confused ) add_talent(talents, ABIL_TRAN_BAT, check_confused ); } - if (!you.duration[DUR_CONTROLLED_FLIGHT] && !player_is_airborne()) + if (!player_is_airborne()) { // kenku can fly, but only from the ground // (until level 15, when it becomes permanent until revoked) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index fa1ccfa013..7297d681b1 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2613,34 +2613,26 @@ static void decrement_durations() if (you.duration[DUR_BACKLIGHT] > 0 && !--you.duration[DUR_BACKLIGHT] && !you.backlit()) mpr("You are no longer glowing.", MSGCH_DURATION); - if (you.duration[DUR_LEVITATION] > 1) - { - if (you.species != SP_KENKU || you.experience_level < 15) - you.duration[DUR_LEVITATION]--; - - if (player_equip_ego_type( EQ_BOOTS, SPARM_LEVITATION )) - you.duration[DUR_LEVITATION] = 2; - if (you.duration[DUR_LEVITATION] == 10) + if (!you.permanent_levitation()) + { + if ( decrement_a_duration(DUR_LEVITATION, + "You float gracefully downwards.", + 10, random2(6), + "You are starting to lose your buoyancy!") ) { - mpr("You are starting to lose your buoyancy!", MSGCH_DURATION); - you.duration[DUR_LEVITATION] -= random2(6); - - if (you.duration[DUR_CONTROLLED_FLIGHT] > 0) - you.duration[DUR_CONTROLLED_FLIGHT] = you.duration[DUR_LEVITATION]; + burden_change(); + // Landing kills controlled flight. + you.duration[DUR_CONTROLLED_FLIGHT] = 0; + // re-enter the terrain: + move_player_to_grid( you.x_pos, you.y_pos, false, true, true ); } } - else if (you.duration[DUR_LEVITATION] == 1) - { - mpr("You float gracefully downwards.", MSGCH_DURATION); - you.duration[DUR_LEVITATION] = 0; - burden_change(); - you.duration[DUR_CONTROLLED_FLIGHT] = 0; - - // re-enter the terrain: - move_player_to_grid( you.x_pos, you.y_pos, false, true, true ); - } + if (!you.permanent_flight()) + if ( decrement_a_duration(DUR_CONTROLLED_FLIGHT) && you.airborne() ) + mpr("You lose control over your flight.", MSGCH_DURATION); + if (you.rotting > 0) { // XXX: Mummies have an ability (albeit an expensive one) that diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 6d9ab7909c..e97594c863 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -836,6 +836,8 @@ public: bool omnivorous() const; flight_type flight_mode() const; + bool permanent_levitation() const; + bool permanent_flight() const; bool paralysed() const; bool confused() const; diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index bc6b0a1b9e..81c29b3a7c 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -675,13 +675,10 @@ void up_stairs(dungeon_feature_type force_stair, const dungeon_feature_type stair_taken = stair_find; - if (player_is_airborne()) - { - if (you.duration[DUR_CONTROLLED_FLIGHT]) - mpr("You fly upwards."); - else - mpr("You float upwards... And bob straight up to the ceiling!"); - } + if (you.flight_mode() == FL_FLY) + mpr("You fly upwards."); + else if (you.flight_mode() == FL_LEVITATE) + mpr("You float upwards... And bob straight up to the ceiling!"); else climb_message(stair_find, true, old_level_type); diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 7a0e129133..eb1b0860ef 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -473,9 +473,7 @@ void print_stats(void) if (player_is_airborne()) { - bool perm = (you.species == SP_KENKU && you.experience_level >= 15) - || (player_equip_ego_type( EQ_BOOTS, SPARM_LEVITATION )) - || (you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON); + const bool perm = you.permanent_flight(); if (wearing_amulet( AMU_CONTROLLED_FLIGHT )) { diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 2a9dd4cb78..b264ca8ab1 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -3247,14 +3247,7 @@ void level_change(bool skip_ability_increase) MSGCH_INTRINSIC_GAIN); } else if (you.experience_level == 15) - { mpr("You can now fly continuously.", MSGCH_INTRINSIC_GAIN); - if (you.duration[DUR_LEVITATION]) - { - you.duration[DUR_LEVITATION] = 100; - you.duration[DUR_CONTROLLED_FLIGHT] = 100; - } - } break; case SP_MERFOLK: @@ -3669,7 +3662,7 @@ void display_char_status() const bool swim = player_is_swimming(); const bool lev = player_is_airborne(); - const bool fly = (lev && you.duration[DUR_CONTROLLED_FLIGHT]); + const bool fly = (you.flight_mode() == FL_FLY); const bool swift = (you.duration[DUR_SWIFTNESS] > 0); mprf( "Your %s speed is %s%s%s.", @@ -5988,6 +5981,24 @@ flight_type player::flight_mode() const return (FL_NONE); } +bool player::permanent_levitation() const +{ + return airborne() && + (permanent_flight() || + // Boots of levitation keep you with DUR_LEVITATION >= 2 at + // all times. This is so that you can evoke stop-levitation + // in order to actually cancel levitation (by setting + // DUR_LEVITATION to 1.) Note that antimagic() won't do this. + (player_equip_ego_type( EQ_BOOTS, SPARM_LEVITATION ) && + you.duration[DUR_LEVITATION] > 1)); +} + +bool player::permanent_flight() const +{ + return airborne() && + (you.species == SP_KENKU && you.experience_level >= 15); +} + bool player::light_flight() const { // Only Kenku get perks for flying light. diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 2e8b7acb26..c9bae358a2 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -785,13 +785,13 @@ void antimagic() DUR_INSULATION, DUR_RESIST_POISON, DUR_RESIST_FIRE, DUR_RESIST_COLD, DUR_SLAYING, DUR_STEALTH, DUR_MAGIC_SHIELD, DUR_SAGE }; - - if (you.duration[DUR_LEVITATION] > 2 && you.duration[DUR_LEVITATION] < 100) + + if (!you.permanent_levitation() && you.duration[DUR_LEVITATION] > 2) you.duration[DUR_LEVITATION] = 2; - if (you.duration[DUR_CONTROLLED_FLIGHT] < 100 && - you.duration[DUR_CONTROLLED_FLIGHT] > 1) // don't mess with permaflight + if (!you.permanent_flight() && you.duration[DUR_CONTROLLED_FLIGHT] > 1) you.duration[DUR_CONTROLLED_FLIGHT] = 1; + for ( unsigned int i = 0; i < ARRAYSIZE(dur_list); ++i ) if ( you.duration[dur_list[i]] > 1 ) you.duration[dur_list[i]] = 1; @@ -1046,7 +1046,7 @@ void cast_swiftness(int power) void cast_fly(int power) { - int dur_change = 25 + random2(power) + random2(power); + const int dur_change = 25 + random2(power) + random2(power); const bool was_levitating = player_is_airborne(); diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 11b4df5e7c..750201af37 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -461,13 +461,6 @@ static bool is_safe_move(int x, int y) return (!is_damaging_cloud(ctype)); } -static bool player_is_permalevitating() -{ - return you.duration[DUR_LEVITATION] > 1 && - ((you.species == SP_KENKU && you.experience_level >= 15) - || player_equip_ego_type( EQ_BOOTS, SPARM_LEVITATION )); -} - static void set_pass_feature(unsigned char grid, signed char pass) { if (traversable_terrain[(unsigned) grid] != FORBIDDEN) @@ -489,7 +482,7 @@ void init_travel_terrain_check(bool check_race_equip) set_pass_feature(DNGN_DEEP_WATER, water); // Permanently levitating players can cross most hostile terrain. - signed char trav = player_is_permalevitating()? + const signed char trav = you.permanent_levitation() ? TRAVERSABLE : IMPASSABLE; if (water != TRAVERSABLE) -- cgit v1.2.3-54-g00ecf