From e6c1b4bbeba12074f61dbac3d026f391ec841110 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sat, 7 Apr 2007 23:29:36 +0000 Subject: Merged 1257:1259, 1260:1262 from trunk to 0.2 branch: - PR misapplication in monster combat. - Hydra decapitation experience bug. - Detect Creatures and Items fix. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.2@1263 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/externs.h | 6 +++--- crawl-ref/source/fight.cc | 15 +++++++++------ crawl-ref/source/mon-util.cc | 4 ++-- crawl-ref/source/player.cc | 7 ++----- crawl-ref/source/view.cc | 5 +++-- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 0560a0e2be..e6c08b891d 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -143,7 +143,7 @@ public: virtual bool cannot_fight() const = 0; virtual void attacking(actor *other) = 0; virtual void go_berserk(bool intentional) = 0; - virtual void hurt(actor *attacker, int amount) = 0; + virtual void hurt(const actor *attacker, int amount) = 0; virtual void heal(int amount, bool max_too = false) = 0; virtual void banish(const std::string &who = "") = 0; virtual void blink() = 0; @@ -764,7 +764,7 @@ public: void confuse(int strength); void rot(actor *agent, int rotlevel, int immed_rot); void heal(int amount, bool max_too = false); - void hurt(actor *agent, int amount); + void hurt(const actor *agent, int amount); int holy_aura() const; int warding() const; @@ -994,7 +994,7 @@ public: void slow_down(int str); void confuse(int strength); void rot(actor *agent, int rotlevel, int immed_rot); - void hurt(actor *agent, int amount); + void hurt(const actor *agent, int amount); void heal(int amount, bool max_too = false); void blink(); void teleport(bool right_now = false, bool abyss_shift = false); diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 4ccd1cb207..8e095747d7 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -311,7 +311,7 @@ static bool chop_hydra_head( const actor *attacker, attacker->conj_verb(verb).c_str(), defender->name(DESC_NOCAP_THE).c_str() ); - defender->hit_points = -1; + defender->hurt(attacker, defender->hit_points); } else { @@ -2670,10 +2670,13 @@ void melee_attack::wasp_paralyse_defender() if (attacker->id() == MONS_YELLOW_WASP) paralyse_roll += 3; - if (!defender->res_poison() && one_chance_in(paralyse_roll)) - defender->paralyse( roll_dice(1, 3) ); - else - defender->slow_down( roll_dice(1, 3) ); + if (defender->res_poison() <= 0) + { + if (one_chance_in(paralyse_roll)) + defender->paralyse( roll_dice(1, 3) ); + else + defender->slow_down( roll_dice(1, 3) ); + } } void melee_attack::splash_monster_with_acid(int strength) @@ -2841,7 +2844,7 @@ void melee_attack::mons_apply_attack_flavour(const mon_attack_def &attk) case AF_CONFUSE: if (attk.type == AT_SPORE) { - if (defender->res_poison()) + if (defender->res_poison() > 0) break; if (--atk->hit_dice <= 0) diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index e8cc6205fd..f25858a518 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -2786,7 +2786,7 @@ god_type monsters::deity() const return (god); } -void monsters::hurt(actor *agent, int amount) +void monsters::hurt(const actor *agent, int amount) { if (amount <= 0) return; @@ -2798,7 +2798,7 @@ void monsters::hurt(actor *agent, int amount) monster_die(this, KILL_YOU, 0); else monster_die(this, KILL_MON, - monster_index( dynamic_cast(agent) )); + monster_index( dynamic_cast(agent) )); } } diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index abf7f089e0..bdd629580a 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -5055,9 +5055,6 @@ int player::holiness() const if (is_undead) return (MH_UNDEAD); - if (species == SP_DEMONSPAWN) - return (MH_DEMONIC); - return (MH_NATURAL); } @@ -5128,10 +5125,10 @@ void player::teleport(bool now, bool abyss_shift) you_teleport(); } -void player::hurt(actor *agent, int amount) +void player::hurt(const actor *agent, int amount) { if (agent->atype() == ACT_MONSTER) - ouch(amount, monster_index( dynamic_cast(agent) ), + ouch(amount, monster_index( dynamic_cast(agent) ), KILLED_BY_MONSTER); else { diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 9e1c719c5f..537b44f976 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -62,6 +62,7 @@ #define MAP_CHANGED_FLAG 0x0400 #define MAP_DETECTED_MONSTER 0x0800 #define MAP_DETECTED_ITEM 0x1000 +#define MAP_GRID_KNOWN 0xFF00 #define MAP_CHARACTER_MASK 0x00ff @@ -450,11 +451,11 @@ unsigned short dos_brand( unsigned short colour, screen_buffer_t colour_code_map( int x, int y, bool item_colour, bool travel_colour ) { - if (!is_terrain_known(x + 1, y + 1)) + const unsigned short map_flags = env.map[x][y]; + if (!(map_flags & MAP_GRID_KNOWN)) return (BLACK); // XXX: Yes, the map array and the grid array are off by one. -- bwr - const unsigned short map_flags = env.map[x][y]; const int grid_value = grd[x + 1][y + 1]; unsigned tc = travel_colour? -- cgit v1.2.3-54-g00ecf