From bc721ca0cd58a2ffed55245d300266962cf3c123 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 12 Apr 2009 09:49:39 +0000 Subject: * Fix compilation. * Fix wording of stair slide chaos effect. * Add new stimulation triggers for Xom (monsters being polymorphed, accidentally hasted/healed, or going berserk) which has the side effect of keeping Xom's interest up if you actually use the chaos branded weapon he gifted you. * Greatly reduce stimulation possible from deliberately quaffing bad potions. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9596 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 15 ++++++++++-- crawl-ref/source/directn.cc | 4 +-- crawl-ref/source/fight.cc | 27 +++++++++++++++++---- crawl-ref/source/it_use2.cc | 8 +++++- crawl-ref/source/item_use.cc | 2 +- crawl-ref/source/menu.cc | 2 +- crawl-ref/source/misc.cc | 3 ++- crawl-ref/source/mon-util.cc | 5 ++++ crawl-ref/source/monstuff.cc | 5 ++++ crawl-ref/source/player.cc | 5 +++- crawl-ref/source/terrain.cc | 58 +++++++++++++++++++++++++++----------------- crawl-ref/source/view.cc | 4 +-- 12 files changed, 100 insertions(+), 38 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index dae307097d..22f2ca83b4 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3975,7 +3975,18 @@ void bolt::update_hurt_or_helped(monsters *mon) if (nasty_to(mon)) foe_info.hurt++; else if (nice_to(mon)) + { foe_info.helped++; + // Accidentally helped a foe. + if (!is_tracer && !effect_known) + { + int interest = 128; + if (flavour == BEAM_INVISIBILITY && can_see_invis) + interest = 32; + + xom_is_stimulated(interest); + } + } } else { @@ -4586,8 +4597,8 @@ bool bolt::has_saving_throw() const case BEAM_HEALING: case BEAM_INVISIBILITY: case BEAM_DISPEL_UNDEAD: - case BEAM_ENSLAVE_SOUL: // it has a different saving throw - case BEAM_ENSLAVE_DEMON: // it has a different saving throw + case BEAM_ENSLAVE_SOUL: // has a different saving throw + case BEAM_ENSLAVE_DEMON: // ditto rc = false; break; default: diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 92a7fc3845..91bddc720d 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -3462,7 +3462,7 @@ int targeting_behaviour::get_key() if (!crawl_state.is_replaying_keys()) flush_input_buffer(FLUSH_BEFORE_COMMAND); - return unmangle_direction_keys( getchm(KC_TARGETING), KC_TARGETING, + return unmangle_direction_keys( getchm(KMC_TARGETING), KMC_TARGETING, false, false); } @@ -3471,7 +3471,7 @@ command_type targeting_behaviour::get_command(int key) if (key == -1) key = get_key(); - command_type cmd = key_to_command(key, KC_TARGETING); + command_type cmd = key_to_command(key, KMC_TARGETING); if (cmd >= CMD_MIN_TARGET && cmd < CMD_TARGET_CYCLE_TARGET_MODE) return (cmd); diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index ab50ad6471..f81078d91f 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -2286,8 +2286,8 @@ void melee_attack::chaos_affects_defender() int rage_chance = can_rage ? 10 : 0; int miscast_chance = 10; + // Already a shifter? if (is_shifter) - // Already a shifter. shifter_chance = 0; // A chaos self-attack increased the chance of certain effects, @@ -2306,9 +2306,11 @@ void melee_attack::chaos_affects_defender() if (defender->atype() == ACT_PLAYER) mpr("You give off a flash of multicoloured light!"); else if (you.can_see(defender)) + { simple_monster_message(defender_as_monster(), " gives off a flash of " "multicoloured light!"); + } else mpr("There is a flash of multicoloured light!"); } @@ -2349,14 +2351,19 @@ void melee_attack::chaos_affects_defender() if (clone_idx != NON_MONSTER) { if (obvious_effect) + { special_damage_message = make_stringf("%s is duplicated!", def_name(DESC_NOCAP_THE).c_str()); + } monsters &clone(menv[clone_idx]); // The player shouldn't get new permanent followers from cloning. if (clone.attitude == ATT_FRIENDLY && !clone.is_summoned()) clone.mark_summoned(6, true, MON_SUMM_CLONE); + + // Monsters being cloned is interesting. + xom_is_stimulated(mons_friendly(&clone) ? 16 : 32); } break; } @@ -2375,6 +2382,7 @@ void melee_attack::chaos_affects_defender() break; case CHAOS_MAKE_SHIFTER: + { ASSERT(can_poly && shifter_chance > 0); ASSERT(!is_shifter); ASSERT(defender->atype() == ACT_MONSTER); @@ -2384,8 +2392,14 @@ void melee_attack::chaos_affects_defender() ENCH_GLOWING_SHAPESHIFTER : ENCH_SHAPESHIFTER); // Immediately polymorph monster, just to make the effect obvious. monster_polymorph(defender_as_monster(), RANDOM_MONSTER); - break; + // Xom loves it if this happens! + const int friend_factor = mons_friendly(defender_as_monster()) ? 1 : 2; + const int glow_factor = + (defender_as_monster()->has_ench(ENCH_SHAPESHIFTER) ? 1 : 2); + xom_is_stimulated( 64 * friend_factor * glow_factor ); + break; + } case CHAOS_MISCAST: { int level = defender->get_experience_level(); @@ -2405,7 +2419,7 @@ void melee_attack::chaos_affects_defender() miscast_level = level; miscast_type = SPTYP_RANDOM; - miscast_target = coinflip() ? attacker : defender; + miscast_target = one_chance_in(3) ? attacker : defender; break; } @@ -2464,6 +2478,9 @@ void melee_attack::chaos_affects_defender() : attacker_as_monster()->confused_by_you() ? KILL_YOU_CONF : KILL_MON; + if (beam.thrower == KILL_YOU || mons_friendly(attacker_as_monster())) + beam.attitude = ATT_FRIENDLY; + beam.beam_source = attacker->mindex(); beam.source = defender->pos(); @@ -2493,7 +2510,7 @@ static bool _move_stairs(const actor* attacker, const actor* defender) // The player can't use shops to escape, so don't bother. if (stair_feat == DNGN_ENTER_SHOP) - return false; + return (false); // Don't move around notable terrain the player is aware of if it's // out of sight. @@ -2542,7 +2559,7 @@ void melee_attack::chaos_affects_attacker() { mprf("Smoke pours forth from %s!", wep_name(DESC_NOCAP_YOUR).c_str()); big_cloud(random_smoke_type(), KC_OTHER, attacker->pos(), 20, - 8 + random2(4)); + 4 + random2(8)); DID_AFFECT(); } diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index 5d63c851e1..43c7f51ae9 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -49,7 +49,13 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known) && drank_it ? 2 : 1); // Knowingly drinking bad potions is much less amusing. - const int xom_factor = factor * (drank_it && was_known ? 2 : 1); + int xom_factor = factor; + if (drank_it && was_known) + { + xom_factor *= 2; + if (!player_in_a_dangerous_place()) + xom_factor *= 3; + } switch (pot_eff) { diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 52e6a64cf9..619598edc3 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -4910,7 +4910,7 @@ void read_scroll(int slot) case SCR_FOG: mpr("The scroll dissolves into smoke."); - big_cloud(random_smoke_type(), KC_OTHER, you.pos(), 50, 8 + random2(8)); + big_cloud(random_smoke_type(), KC_YOU, you.pos(), 50, 8 + random2(8)); break; case SCR_MAGIC_MAPPING: diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc index 25b02bcb10..62146b0038 100644 --- a/crawl-ref/source/menu.cc +++ b/crawl-ref/source/menu.cc @@ -310,7 +310,7 @@ void Menu::do_menu() while (alive) { #ifndef USE_TILE - int keyin = getchm(KC_MENU, c_getch); + int keyin = getchm(KMC_MENU, c_getch); #else mouse_control mc(MOUSE_MODE_MORE); int keyin = getch(); diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index f97da8e21f..5f19ee1974 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -2016,7 +2016,8 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, return; } - if (!force_stair && you.flight_mode() == FL_LEVITATE) + if (!force_stair && you.flight_mode() == FL_LEVITATE + && !is_gate(stair_find)) { mpr("You're floating high up above the floor!"); return; diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index f5aab7b4db..e900a36cda 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -55,6 +55,7 @@ REVISION("$Rev$"); #include "traps.h" #include "tutorial.h" #include "view.h" +#include "xom.h" //jmf: moved from inside function static FixedVector < int, NUM_MONSTERS > mon_entry; @@ -5713,6 +5714,10 @@ void monsters::go_berserk(bool /* intentional */) add_ench(mon_enchant(ENCH_BERSERK, 0, KC_OTHER, duration * 10)); add_ench(mon_enchant(ENCH_HASTE, 0, KC_OTHER, duration * 10)); simple_monster_message( this, " goes berserk!" ); + + // Xom likes monsters going berserk. + if (mons_near(this)) + xom_is_stimulated(mons_friendly(this) ? 32 : 128); } void monsters::expose_to_element(beam_type flavour, int strength) diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index e74c754b3e..5ebb2b2ee9 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -2124,6 +2124,11 @@ bool monster_polymorph(monsters *monster, monster_type targetc, if (!force_beh) player_angers_monster(monster); + // Xom likes watching monsters being polymorphed. + xom_is_stimulated(mons_is_shapeshifter(monster) ? 16 : + power == PPT_LESS || mons_friendly(monster) ? 32 : + power == PPT_SAME ? 64 : 128); + return (player_messaged); } diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index c8bceea2f8..ba506a7fa7 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -4872,6 +4872,9 @@ void rot_hp( int hp_loss ) you.base_hp -= hp_loss; calc_hp(); + if (you.species != SP_GHOUL) + xom_is_stimulated(hp_loss * 32); + you.redraw_hit_points = true; } @@ -5059,7 +5062,7 @@ int get_real_mp(bool include_items) enp += std::max(spell_extra, invoc_extra); enp = stepdown_value(enp, 9, 18, 45, 100); - // this is our "rotted" base (applied after scaling): + // This is our "rotted" base (applied after scaling): enp += (you.base_magic_points - 5000); // Yes, we really do want this duplication... this is so the stepdown diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index 305979db1e..6c83d1f162 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -605,7 +605,7 @@ static void _announce_swap_real(coord_def orig_pos, coord_def dest_pos) see_grid(orig_pos) ? DESC_CAP_THE : DESC_CAP_A, false); - std::string prep = grid_preposition(orig_feat, true); + std::string prep = grid_preposition(orig_feat, false); std::string orig_actor, dest_actor; if (orig_pos == you.pos()) @@ -882,10 +882,8 @@ bool slide_feature_over(const coord_def &src, coord_def prefered_dest, } else { - radius_iterator ri(src, 1, true, false, true); - int squares = 0; - for (; ri; ++ri) + for (radius_iterator ri(src, 1, true, false, true); ri; ++ri) { if (_ok_dest_grid(orig_actor, orig_feat, *ri)) { @@ -1033,6 +1031,10 @@ dungeon_feature_type feat_by_desc(std::string desc) return (DNGN_UNSEEN); } +// If active is true, the player is just stepping onto the grid, with the +// message: " slides away as you move it!" +// Else, the actor is already on the grid: +// " moves from to !" std::string grid_preposition(dungeon_feature_type grid, bool active, const actor* who) { @@ -1043,41 +1045,53 @@ std::string grid_preposition(dungeon_feature_type grid, bool active, { if (grid == DNGN_STONE_ARCH) return "beside"; - else if (grid_is_solid(grid)) + else if (grid_is_solid(grid)) // Passwall? { if (active) - return "around"; - else return "inside"; - } - else if (!airborne && (grid == DNGN_LAVA || grid == DNGN_DEEP_WATER)) - { - if (active) - return "around"; else - return "in"; + return "around"; } - else + else if (!airborne) { - if (active) - return "over"; + if (grid == DNGN_LAVA || grid_is_water(grid)) + { + if (active) + return "into"; + else + return "around"; + } else - return "above"; + { + if (active) + return "onto"; + else + return "under"; + } } } - if (dir == CMD_GO_DOWNSTAIRS - && (grid_is_staircase(grid) || grid_is_escape_hatch(grid))) + if (dir == CMD_GO_UPSTAIRS && grid_is_escape_hatch(grid)) { if (active) - return "over"; + return "under"; else return "above"; } - else if (grid_is_escape_hatch(grid)) + + if (airborne) { if (active) - return "under"; + return "over"; + else + return "beneath"; + } + + if (dir == CMD_GO_DOWNSTAIRS + && (grid_is_staircase(grid) || grid_is_escape_hatch(grid))) + { + if (active) + return "onto"; else return "beneath"; } diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index e1e70b0768..6473c1c761 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -3470,9 +3470,9 @@ void show_map( coord_def &spec_place, bool travel_mode ) redraw_map = true; c_input_reset(true); - int key = unmangle_direction_keys(getchm(KC_LEVELMAP), KC_LEVELMAP, + int key = unmangle_direction_keys(getchm(KMC_LEVELMAP), KMC_LEVELMAP, false, false); - command_type cmd = key_to_command(key, KC_LEVELMAP); + command_type cmd = key_to_command(key, KMC_LEVELMAP); if (cmd < CMD_MIN_OVERMAP || cmd > CMD_MAX_OVERMAP) cmd = CMD_NO_CMD; -- cgit v1.2.3-54-g00ecf