From 95b32e8537f724d38594b06473a966229c708999 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Fri, 13 Jul 2007 19:51:13 +0000 Subject: [1731587] Kenku get claw-kick and a small speed boost when flying unladen. Swiftness speed boost is now given only if flying, not levitating. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1857 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/enum.h | 7 +++++++ crawl-ref/source/externs.h | 10 ++++++--- crawl-ref/source/fight.cc | 29 ++++++++++++++++++++------ crawl-ref/source/mon-util.cc | 20 ++++++++++-------- crawl-ref/source/mon-util.h | 4 ++-- crawl-ref/source/monstuff.cc | 4 ++-- crawl-ref/source/output.cc | 3 ++- crawl-ref/source/player.cc | 49 ++++++++++++++++++++++++++++++++++++-------- crawl-ref/source/spells1.cc | 15 ++++++++++---- 9 files changed, 105 insertions(+), 36 deletions(-) diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 74041dab06..bb9ef9ad5f 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -1728,6 +1728,13 @@ enum launch_retval LRET_THROWN }; +enum flight_type +{ + FL_NONE = 0, + FL_FLY, + FL_LEVITATE +}; + enum level_area_type // you.level_type { LEVEL_DUNGEON, // 0 diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 330c3fe0a8..311879ace4 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -192,7 +192,7 @@ public: virtual int res_poison() const = 0; virtual int res_negative_energy() const = 0; - virtual int levitates() const = 0; + virtual flight_type flies() const = 0; virtual bool paralysed() const = 0; virtual bool confused() const = 0; @@ -810,6 +810,9 @@ public: bool can_see_invisible() const; bool is_icy() const; + bool light_flight() const; + bool travelling_light() const; + kill_category kill_alignment() const; bool has_spell(int spell) const; @@ -818,6 +821,7 @@ public: std::string shout_verb() const; item_def *slot_item(equipment_type eq); + const item_def *slot_item(equipment_type eq) const; // actor int id() const; @@ -880,7 +884,7 @@ public: int res_poison() const; int res_negative_energy() const; - int levitates() const; + flight_type flies() const; bool paralysed() const; bool confused() const; @@ -1124,7 +1128,7 @@ public: int res_poison() const; int res_negative_energy() const; - int levitates() const; + flight_type flies() const; bool invisible() const; bool can_see_invisible() const; bool is_icy() const; diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 620e314ddf..b647428c04 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -545,6 +545,7 @@ bool melee_attack::player_aux_unarmed() damage_brand = SPWPN_NORMAL; int uattack = UNAT_NO_ATTACK; bool simple_miss_message = false; + std::string miss_verb; if (can_do_unarmed) { @@ -575,9 +576,11 @@ bool melee_attack::player_aux_unarmed() switch (scount) { case 0: + { if (uattack != UNAT_KICK) //jmf: hooves mutation { - if ((you.species != SP_CENTAUR && !you.mutation[MUT_HOOVES]) + if ((you.species != SP_CENTAUR && you.species != SP_KENKU + && !you.mutation[MUT_HOOVES]) || coinflip()) { continue; @@ -592,10 +595,23 @@ bool melee_attack::player_aux_unarmed() continue; } - unarmed_attack = "kick"; + // Kenku have large taloned feet that do good damage. + const bool clawed_kick = + you.species == SP_KENKU && !you.mutation[MUT_HOOVES]; + + if (clawed_kick) + { + unarmed_attack = "claw"; + miss_verb = "kick"; + } + else + unarmed_attack = "kick"; + aux_damage = ((you.mutation[MUT_HOOVES] - || you.species == SP_CENTAUR) ? 10 : 5); + || you.species == SP_CENTAUR + || clawed_kick) ? 10 : 5); break; + } case 1: if (uattack != UNAT_HEADBUTT) @@ -744,7 +760,8 @@ bool melee_attack::player_aux_unarmed() defender->name(DESC_NOCAP_THE).c_str()); else mprf("Your %s misses %s.", - unarmed_attack.c_str(), + miss_verb.empty()? unarmed_attack.c_str() + : miss_verb.c_str(), defender->name(DESC_NOCAP_THE).c_str()); } } @@ -1583,7 +1600,7 @@ bool melee_attack::apply_damage_brand() break; case SPWPN_ELECTROCUTION: - if (defender->levitates()) + if (defender->flies()) break; else if (defender->res_elec() > 0) break; @@ -2881,7 +2898,7 @@ void melee_attack::mons_apply_attack_flavour(const mon_attack_def &attk) defender->res_elec(), atk->hit_dice + random2( atk->hit_dice / 2 )); - if (defender->levitates()) + if (defender->flies()) special_damage = special_damage * 2 / 3; if (needs_message && special_damage) diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 499ab0b8c7..29e35a0134 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -961,29 +961,31 @@ int mons_skeleton(int mc) return (1); } // end mons_skeleton() -int mons_class_flies(int mc) +flight_type mons_class_flies(int mc) { int f = smc->bitfields; if (f & M_FLIES) - return (1); + return (FL_FLY); if (f & M_LEVITATE) - return (2); + return (FL_LEVITATE); - return (0); + return (FL_NONE); } -int mons_flies( const monsters *mon ) +flight_type mons_flies( const monsters *mon ) { if (mon->type == MONS_PANDEMONIUM_DEMON && mon->ghost->values[ GVAL_DEMONLORD_FLY ]) { - return (1); + return (FL_FLY); } - int ret = mons_class_flies( mon->type ); - return (ret ? ret : (scan_mon_inv_randarts(mon, RAP_LEVITATE) > 0) ? 2 : 0); + const flight_type ret = mons_class_flies( mon->type ); + return (ret ? ret + : (scan_mon_inv_randarts(mon, RAP_LEVITATE) > 0) ? FL_LEVITATE + : FL_NONE); } // end mons_flies() @@ -3020,7 +3022,7 @@ int monsters::res_negative_energy() const return (mons_res_negative_energy(this)); } -int monsters::levitates() const +flight_type monsters::flies() const { return (mons_flies(this)); } diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index ad080d8fda..4f5ef174e9 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -86,8 +86,8 @@ std::string mons_type_name(int type, description_level_type desc ); /* *********************************************************************** * called from: beam - direct - fight - monstuff - mstuff2 - spells4 - view * *********************************************************************** */ -int mons_class_flies( int mc ); -int mons_flies( const monsters *mon ); +flight_type mons_class_flies( int mc ); +flight_type mons_flies( const monsters *mon ); // last updated XXmay2000 {dlb} diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index c9d18cd78a..2941a2ba9e 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -4186,8 +4186,8 @@ static void do_move_monster(monsters *monster, int xi, int yi) void mons_check_pool(monsters *mons, killer_type killer, int killnum) { // Levitating/flying monsters don't make contact with the terrain. - const int lev = mons->levitates(); - if (lev == 2 || (lev && !mons->paralysed())) + const flight_type lev = mons->flies(); + if (lev == FL_LEVITATE || (lev == FL_FLY && !mons->paralysed())) return; int grid = grd(mons->pos()); diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index fe66dd794a..d27962dc0e 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -469,7 +469,8 @@ void print_stats(void) if (wearing_amulet( AMU_CONTROLLED_FLIGHT )) { - dur_colour( MAGENTA, (you.duration[DUR_LEVITATION] <= 10 && !perm) ); + dur_colour( you.light_flight()? BLUE : MAGENTA, + (you.duration[DUR_LEVITATION] <= 10 && !perm) ); cprintf( "Fly " ); } else diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 0c373c2690..7edefca883 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -1407,10 +1407,14 @@ int player_movement_speed(void) if (player_equip_ego_type( EQ_BODY_ARMOUR, SPARM_PONDEROUSNESS )) mv += 2; - // Swiftness is an Air spell, it doesn't work in water... - // but levitating players will move faster. -- bwr + // in the air, can fly fast (should be lightly burdened). + if (you.light_flight()) + mv--; + + // Swiftness is an Air spell, it doesn't work in water, but + // flying players will move faster. if (you.duration[DUR_SWIFTNESS] > 0 && !player_in_water()) - mv -= (player_is_levitating() ? 4 : 2); + mv -= (you.flies() == FL_FLY ? 4 : 2); /* Mutations: -2, -3, -4, unless innate and shapechanged */ if (you.mutation[MUT_FAST] > 0 && @@ -1910,7 +1914,7 @@ int player_evasion() case SP_KENKU: // Flying kenku get an evasion bonus. - if (you.levitates() == 1) + if (you.flies() == FL_FLY) { const int ev_bonus = std::min(9, std::max(1, ev / 5)); ev += ev_bonus; @@ -2152,14 +2156,15 @@ int carrying_capacity( burden_state_type bs ) int burden_change(void) { - char old_burdenstate = you.burden_state; + const burden_state_type old_burdenstate = you.burden_state; + const bool was_flying_light = you.light_flight(); you.burden = 0; if (you.duration[DUR_STONEMAIL]) you.burden += 800; - for (unsigned char bu = 0; bu < ENDOFPACK; bu++) + for (int bu = 0; bu < ENDOFPACK; bu++) { if (you.inv[bu].quantity < 1) continue; @@ -2212,6 +2217,14 @@ int burden_change(void) if (you.burden_state > old_burdenstate) interrupt_activity( AI_BURDEN_CHANGE ); + const bool is_flying_light = you.light_flight(); + + if (is_flying_light != was_flying_light) + { + mpr(is_flying_light? "You feel quicker in the air." + : "You feel heavier in the air."); + } + return you.burden; } // end burden_change() @@ -4840,6 +4853,11 @@ item_def *player::slot_item(equipment_type eq) return (item == -1? NULL : &inv[item]); } +const item_def *player::slot_item(equipment_type eq) const +{ + return const_cast(this)->slot_item(eq); +} + // Returns the item in the player's weapon slot. item_def *player::weapon(int /* which_attack */) { @@ -5117,12 +5135,25 @@ int player::res_negative_energy() const return (player_prot_life()); } -int player::levitates() const +flight_type player::flies() const { if ( !is_levitating() ) - return 0; + return (FL_NONE); else - return (you.duration[DUR_CONTROLLED_FLIGHT] ? 1 : 2); + return (you.duration[DUR_CONTROLLED_FLIGHT] ? FL_FLY : FL_LEVITATE); +} + +bool player::light_flight() const +{ + return (flies() == FL_FLY && travelling_light()); +} + +bool player::travelling_light() const +{ + const item_def *armour = you.slot_item(EQ_BODY_ARMOUR); + if (armour && !is_light_armour(*armour)) + return (false); + return (you.burden < carrying_capacity(BS_UNENCUMBERED) * 60 / 100); } int player::mons_species() const diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 8d952972d6..d850fe9692 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -974,10 +974,7 @@ void cast_fly(int power) { int dur_change = 25 + random2(power) + random2(power); - if (!player_is_levitating()) - mpr("You fly up into the air."); - else - mpr("You feel more buoyant."); + const bool was_levitating = player_is_levitating(); if (you.duration[DUR_LEVITATION] + dur_change > 100) you.duration[DUR_LEVITATION] = 100; @@ -990,6 +987,16 @@ void cast_fly(int power) you.duration[DUR_CONTROLLED_FLIGHT] += dur_change; burden_change(); + + if (!was_levitating) + { + if (you.light_flight()) + mpr("You swoop lightly up into the air."); + else + mpr("You fly up into the air."); + } + else + mpr("You feel more buoyant."); } void cast_insulation(int power) -- cgit v1.2.3-54-g00ecf