From 621bd9ce58cc45ce9cfcc3cf1f576882b40a426d Mon Sep 17 00:00:00 2001 From: dshaligram Date: Thu, 15 Mar 2007 20:10:20 +0000 Subject: Cleaned up ghost and Pandemonium demon handling. Can now have multiple ghosts or Pandemonium demons on a level. Ghosts and Pan demons can coexist. (D:9 and later are eligible for >1 ghost.) Enabled loading ghosts in Pandemonium. Pandemonium demons can now be created outside Pan. Not that you'd want to do it, but you can. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1043 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/monstuff.cc | 48 +++++++++----------------------------------- 1 file changed, 10 insertions(+), 38 deletions(-) (limited to 'crawl-ref/source/monstuff.cc') diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 0b3f48b85c..0b1fc60250 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -772,39 +772,15 @@ void monster_die(monsters *monster, char killer, int i, bool silent) monster_cleanup(monster); if ( xom_will_act ) - Xom_acts(true, xom_will_act, false); - + Xom_acts(true, xom_will_act, false); } // end monster_die void monster_cleanup(monsters *monster) { unsigned int monster_killed = monster_index(monster); - int dmi = 0; - - for (unsigned char j = 0; j < NUM_MON_ENCHANTS; j++) - monster->enchantment[j] = ENCH_NONE; - - monster->flags = 0; - monster->type = -1; - monster->hit_points = 0; - monster->max_hit_points = 0; - monster->hit_dice = 0; - monster->ac = 0; - monster->ev = 0; - monster->speed_increment = 0; - monster->attitude = ATT_HOSTILE; - monster->behaviour = BEH_SLEEP; - monster->foe = MHITNOT; - - if (in_bounds(monster->x, monster->y)) - mgrd[monster->x][monster->y] = NON_MONSTER; - - for (dmi = MSLOT_GOLD; dmi >= MSLOT_WEAPON; dmi--) - { - monster->inv[dmi] = NON_ITEM; - } + monster->reset(); - for (dmi = 0; dmi < MAX_MONSTERS; dmi++) + for (int dmi = 0; dmi < MAX_MONSTERS; dmi++) { if (menv[dmi].foe == monster_killed) menv[dmi].foe = MHITNOT; @@ -812,7 +788,6 @@ void monster_cleanup(monsters *monster) if (you.pet_target == monster_killed) you.pet_target = MHITNOT; - } // end monster_cleanup() static bool jelly_divide(struct monsters * parent) @@ -1037,7 +1012,7 @@ bool monster_polymorph( struct monsters *monster, int targetc, int power ) strcat( str_polymon, "something you cannot see!" ); else { - strcat( str_polymon, monam( 250, targetc, true, DESC_NOCAP_A ) ); + strcat( str_polymon, monam( NULL, 250, targetc, true, DESC_NOCAP_A ) ); if (targetc == MONS_PULSATING_LUMP) strcat( str_polymon, " of flesh" ); @@ -2371,7 +2346,7 @@ static void handle_nearby_ability(struct monsters *monster) break; case MONS_PANDEMONIUM_DEMON: - if (ghost.values[ GVAL_DEMONLORD_CYCLE_COLOUR ]) + if (monster->ghost->values[ GVAL_DEMONLORD_CYCLE_COLOUR ]) monster->colour = random_colour(); break; } @@ -3164,7 +3139,7 @@ static bool handle_spell( monsters *monster, bolt & beem ) return (false); } else if (monster->type == MONS_PANDEMONIUM_DEMON - && !ghost.values[ GVAL_DEMONLORD_SPELLCASTER ]) + && !monster->ghost->values[ GVAL_DEMONLORD_SPELLCASTER ]) { return (false); } @@ -4313,13 +4288,10 @@ static bool handle_pickup(struct monsters *monster) case OBJ_GOLD: //mv - monsters now pick up gold (19 May 2001) if (monsterNearby) { - - strcpy(info, monam( monster->number, monster->type, - player_monster_visible( monster ), - DESC_CAP_THE )); - - strcat(info, " picks up some gold."); - mpr(info); + mprf("%s picks up some gold.", + monam( monster, monster->number, monster->type, + player_monster_visible( monster ), + DESC_CAP_THE )); } if (monster->inv[MSLOT_GOLD] != NON_ITEM) -- cgit v1.2.3-54-g00ecf