X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fmonster2.c;h=dc3a4147d69550fce39e4f8c6da8adce91357b3d;hb=1e10c9cd3b5eb8f276f71e523872c13caf6ac10f;hp=9da86ac07a46447eecb6fcb83587c79e717447d0;hpb=0a92fe05a64757755950090dbe5991ac749df516;p=hengband%2Fhengband.git diff --git a/src/monster2.c b/src/monster2.c index 9da86ac07..dc3a4147d 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -1,23 +1,20 @@ /* File: monster2.c */ -/* Purpose: misc code for monsters */ - /* - * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke + * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke * - * This software may be copied and distributed for educational, research, and - * not for profit purposes provided that this copyright and statement are - * included in all such copies. + * This software may be copied and distributed for educational, research, + * and not for profit purposes provided that this copyright and statement + * are included in all such copies. Other copyrights may also apply. */ +/* Purpose: misc code for monsters */ + #include "angband.h" #define HORDE_NOGOOD 0x01 #define HORDE_NOEVIL 0x02 -bool is_kage = FALSE; -u16b horde_align = 0; - cptr horror_desc[MAX_SAN_HORROR] = { #ifdef JP @@ -161,6 +158,7 @@ void set_target(monster_type *m_ptr, int y, int x) m_ptr->target_x = x; } + /* * Reset the target of counter attack */ @@ -169,6 +167,29 @@ void reset_target(monster_type *m_ptr) set_target(m_ptr, 0, 0); } + +/* + * Extract monster race pointer of a monster's true form + */ +monster_race *real_r_ptr(monster_type *m_ptr) +{ + monster_race *r_ptr = &r_info[m_ptr->r_idx]; + + /* Extract real race */ + if (m_ptr->mflag2 & MFLAG2_CHAMELEON) + { + if (r_ptr->flags1 & RF1_UNIQUE) + return &r_info[MON_CHAMELEON_K]; + else + return &r_info[MON_CHAMELEON]; + } + else + { + return r_ptr; + } +} + + /* * Delete a monster by index. * @@ -191,21 +212,19 @@ void delete_monster_idx(int i) /* Hack -- Reduce the racial counter */ - if (m_ptr->mflag2 & MFLAG_CHAMELEON) - { - if (r_ptr->flags1 & RF1_UNIQUE) - r_info[MON_CHAMELEON_K].cur_num--; - else - r_info[MON_CHAMELEON].cur_num--; - } - else - { - r_ptr->cur_num--; - } + real_r_ptr(m_ptr)->cur_num--; /* Hack -- count the number of "reproducers" */ if (r_ptr->flags2 & (RF2_MULTIPLY)) num_repro--; + if (MON_CSLEEP(m_ptr)) (void)set_monster_csleep(i, 0); + if (MON_FAST(m_ptr)) (void)set_monster_fast(i, 0); + if (MON_SLOW(m_ptr)) (void)set_monster_slow(i, 0); + if (MON_STUNNED(m_ptr)) (void)set_monster_stunned(i, 0); + if (MON_CONFUSED(m_ptr)) (void)set_monster_confused(i, 0); + if (MON_MONFEAR(m_ptr)) (void)set_monster_monfear(i, 0); + if (MON_INVULNER(m_ptr)) (void)set_monster_invulner(i, 0, FALSE); + /* Hack -- remove target monster */ if (i == target_who) target_who = 0; @@ -232,14 +251,19 @@ void delete_monster_idx(int i) /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; - /* Hack -- efficiency */ - o_ptr->held_m_idx = 0; + /* + * o_ptr->held_m_idx is needed in delete_object_idx() + * to prevent calling lite_spot() + */ /* Delete the object */ delete_object_idx(this_o_idx); } + if (is_pet(m_ptr)) check_pets_num_and_align(m_ptr, FALSE); + + /* Wipe the Monster */ (void)WIPE(m_ptr, monster_type); @@ -248,6 +272,10 @@ void delete_monster_idx(int i) /* Visual update */ lite_spot(y, x); + + /* Update some things */ + if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) + p_ptr->update |= (PU_MON_LITE); } @@ -274,7 +302,7 @@ void delete_monster(int y, int x) */ static void compact_monsters_aux(int i1, int i2) { - int y, x; + int y, x, i; cave_type *c_ptr; @@ -328,12 +356,29 @@ static void compact_monsters_aux(int i1, int i2) /* Hack -- Update the health bar */ if (p_ptr->health_who == i1) health_track(i2); + /* Hack -- Update parent index */ + if (is_pet(m_ptr)) + { + for (i = 1; i < m_max; i++) + { + monster_type *m2_ptr = &m_list[i]; + + if (m2_ptr->parent_m_idx == i1) + m2_ptr->parent_m_idx = i2; + } + } + /* Structure copy */ - COPY(&m_list[i2], &m_list[i1], monster_type); + (void)COPY(&m_list[i2], &m_list[i1], monster_type); /* Wipe the hole */ (void)WIPE(&m_list[i1], monster_type); + for (i = 0; i < MAX_MTIMED; i++) + { + int mproc_idx = get_mproc_idx(i1, i); + if (mproc_idx >= 0) mproc_list[i][mproc_idx] = i2; + } } @@ -401,6 +446,14 @@ void compact_monsters(int size) /* All monsters get a saving throw */ if (randint0(100) < chance) continue; + if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) + { + char m_name[80]; + + monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE); + do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_COMPACT, m_name); + } + /* Delete the monster */ delete_monster_idx(i); @@ -445,12 +498,14 @@ void wipe_m_list(void) { r_info[MON_BANOR].max_num = 0; r_info[MON_BANOR].r_pkills++; + r_info[MON_BANOR].r_akills++; if (r_info[MON_BANOR].r_tkills < MAX_SHORT) r_info[MON_BANOR].r_tkills++; } if (r_info[MON_LUPART].max_num) { r_info[MON_LUPART].max_num = 0; r_info[MON_LUPART].r_pkills++; + r_info[MON_LUPART].r_akills++; if (r_info[MON_LUPART].r_tkills < MAX_SHORT) r_info[MON_LUPART].r_tkills++; } } @@ -460,24 +515,9 @@ void wipe_m_list(void) { monster_type *m_ptr = &m_list[i]; - monster_race *r_ptr = &r_info[m_ptr->r_idx]; - /* Skip dead monsters */ if (!m_ptr->r_idx) continue; - /* Mega-Hack -- preserve Unique's XXX XXX XXX */ - - /* Hack -- Reduce the racial counter */ - if (m_ptr->mflag2 & MFLAG_CHAMELEON) - { - if (r_ptr->flags1 & RF1_UNIQUE) - r_info[MON_CHAMELEON_K].cur_num = 0; - else - r_info[MON_CHAMELEON].cur_num = 0; - } - else - r_ptr->cur_num = 0; - /* Monster is gone */ cave[m_ptr->fy][m_ptr->fx].m_idx = 0; @@ -486,12 +526,24 @@ void wipe_m_list(void) } + /* + * Wiping racial counters of all monsters and incrementing of racial + * counters of monsters in party_mon[] are required to prevent multiple + * generation of unique monster who is the minion of player. + */ + + /* Hack -- Wipe the racial counter of all monster races */ + for (i = 1; i < max_r_idx; i++) r_info[i].cur_num = 0; + /* Reset "m_max" */ m_max = 1; /* Reset "m_cnt" */ m_cnt = 0; + /* Reset "mproc_max[]" */ + for (i = 0; i < MAX_MTIMED; i++) mproc_max[i] = 0; + /* Hack -- reset "reproducer" count */ num_repro = 0; @@ -578,11 +630,6 @@ static int summon_specific_type = 0; static int summon_specific_who = -1; -/* - * Hack -- the hostility of the summoned monster - */ -static bool summon_specific_hostile = TRUE; - static bool summon_unique_okay = FALSE; @@ -645,8 +692,8 @@ static bool summon_specific_aux(int r_idx) case SUMMON_HI_UNDEAD: { okay = ((r_ptr->d_char == 'L') || - (r_ptr->d_char == 'V') || - (r_ptr->d_char == 'W')); + (r_ptr->d_char == 'V') || + (r_ptr->d_char == 'W')); break; } @@ -708,10 +755,10 @@ static bool summon_specific_aux(int r_idx) case SUMMON_BIZARRE6: { okay = ((r_ptr->d_char == '!') || - (r_ptr->d_char == '?') || - (r_ptr->d_char == '=') || - (r_ptr->d_char == '$') || - (r_ptr->d_char == '|')); + (r_ptr->d_char == '?') || + (r_ptr->d_char == '=') || + (r_ptr->d_char == '$') || + (r_ptr->d_char == '|')); break; } @@ -724,7 +771,7 @@ static bool summon_specific_aux(int r_idx) case SUMMON_CYBER: { okay = ((r_ptr->d_char == 'U') && - (r_ptr->flags4 & RF4_ROCKET)); + (r_ptr->flags4 & RF4_ROCKET)); break; } @@ -750,7 +797,7 @@ static bool summon_specific_aux(int r_idx) case SUMMON_ANIMAL_RANGER: { okay = ((r_ptr->flags3 & (RF3_ANIMAL)) && - (strchr("abcflqrwBCHIJKMRS", r_ptr->d_char)) && + (my_strchr("abcflqrwBCHIJKMRS", r_ptr->d_char)) && !(r_ptr->flags3 & (RF3_DRAGON)) && !(r_ptr->flags3 & (RF3_EVIL)) && !(r_ptr->flags3 & (RF3_UNDEAD)) && @@ -762,14 +809,13 @@ static bool summon_specific_aux(int r_idx) case SUMMON_HI_DRAGON_LIVING: { - okay = ((r_ptr->d_char == 'D') && - !(r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING))); + okay = ((r_ptr->d_char == 'D') && monster_living(r_ptr)); break; } case SUMMON_LIVING: { - okay = (!(r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING))); + okay = monster_living(r_ptr); break; } @@ -823,7 +869,7 @@ static bool summon_specific_aux(int r_idx) for (i = 0; i < 4; i++) if (r_ptr->blow[i].method == RBM_EXPLODE) okay = TRUE; - okay = (okay && (!(r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))); + okay = (okay && monster_living(r_ptr)); break; } @@ -855,11 +901,31 @@ static bool summon_specific_aux(int r_idx) (r_idx == MON_KNI_TEMPLAR)); break; } + case SUMMON_EAGLES: { okay = (r_ptr->d_char == 'B' && - (r_ptr->flags8 & RF8_WILD_MOUNTAIN) && - (r_ptr->flags8 & RF8_WILD_ONLY)); + (r_ptr->flags8 & RF8_WILD_MOUNTAIN) && + (r_ptr->flags8 & RF8_WILD_ONLY)); + break; + } + + case SUMMON_PIRANHAS: + { + okay = (r_idx == MON_PIRANHA); + break; + } + + case SUMMON_ARMAGE_GOOD: + { + okay = (r_ptr->d_char == 'A' && (r_ptr->flags3 & RF3_GOOD)); + break; + } + + case SUMMON_ARMAGE_EVIL: + { + okay = ((r_ptr->flags3 & RF3_DEMON) || + (r_ptr->d_char == 'A' && (r_ptr->flags3 & RF3_EVIL))); break; } } @@ -881,7 +947,7 @@ static bool restrict_monster_to_dungeon(int r_idx) { dungeon_info_type *d_ptr = &d_info[dungeon_type]; monster_race *r_ptr = &r_info[r_idx]; - byte a; + byte a; if (d_ptr->flags1 & DF1_CHAMELEON) { @@ -889,10 +955,12 @@ static bool restrict_monster_to_dungeon(int r_idx) } if (d_ptr->flags1 & DF1_NO_MAGIC) { - if (r_idx == MON_CHAMELEON) return TRUE; - if (r_ptr->freq_spell && !(r_ptr->flags4 & RF4_NOMAGIC_MASK) && !(r_ptr->flags5 & RF5_NOMAGIC_MASK) && !(r_ptr->flags6 & RF6_NOMAGIC_MASK)) + if (r_idx != MON_CHAMELEON && + r_ptr->freq_spell && + !(r_ptr->flags4 & RF4_NOMAGIC_MASK) && + !(r_ptr->flags5 & RF5_NOMAGIC_MASK) && + !(r_ptr->flags6 & RF6_NOMAGIC_MASK)) return FALSE; - else return TRUE; } if (d_ptr->flags1 & DF1_NO_MELEE) { @@ -901,219 +969,164 @@ static bool restrict_monster_to_dungeon(int r_idx) !(r_ptr->flags5 & (RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_CAUSE_1 | RF5_CAUSE_2 | RF5_CAUSE_3 | RF5_CAUSE_4 | RF5_MIND_BLAST | RF5_BRAIN_SMASH)) && !(r_ptr->flags6 & (RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK))) return FALSE; - else return TRUE; } if (d_ptr->flags1 & DF1_BEGINNER) { if (r_ptr->level > dun_level) return FALSE; - else return TRUE; } - if (d_ptr->special_div == 64) return TRUE; + if (d_ptr->special_div >= 64) return TRUE; if (summon_specific_type && !(d_ptr->flags1 & DF1_CHAMELEON)) return TRUE; - if(d_ptr->mode == DUNGEON_MODE_AND) - { - if (d_ptr->mflags1) + switch (d_ptr->mode) + { + case DUNGEON_MODE_AND: + if (d_ptr->mflags1) { - if((d_ptr->mflags1 & r_ptr->flags1) != d_ptr->mflags1) - return FALSE; + if ((d_ptr->mflags1 & r_ptr->flags1) != d_ptr->mflags1) + return FALSE; } - if (d_ptr->mflags2) + if (d_ptr->mflags2) { - if((d_ptr->mflags2 & r_ptr->flags2) != d_ptr->mflags2) - return FALSE; + if ((d_ptr->mflags2 & r_ptr->flags2) != d_ptr->mflags2) + return FALSE; } - if (d_ptr->mflags3) + if (d_ptr->mflags3) { - if((d_ptr->mflags3 & r_ptr->flags3) != d_ptr->mflags3) - return FALSE; + if ((d_ptr->mflags3 & r_ptr->flags3) != d_ptr->mflags3) + return FALSE; } - if (d_ptr->mflags4) + if (d_ptr->mflags4) { - if((d_ptr->mflags4 & r_ptr->flags4) != d_ptr->mflags4) - return FALSE; + if ((d_ptr->mflags4 & r_ptr->flags4) != d_ptr->mflags4) + return FALSE; } - if (d_ptr->mflags5) + if (d_ptr->mflags5) { - if((d_ptr->mflags5 & r_ptr->flags5) != d_ptr->mflags5) - return FALSE; + if ((d_ptr->mflags5 & r_ptr->flags5) != d_ptr->mflags5) + return FALSE; } - if (d_ptr->mflags6) + if (d_ptr->mflags6) { - if((d_ptr->mflags6 & r_ptr->flags6) != d_ptr->mflags6) - return FALSE; + if ((d_ptr->mflags6 & r_ptr->flags6) != d_ptr->mflags6) + return FALSE; } - if (d_ptr->mflags7) + if (d_ptr->mflags7) { - if((d_ptr->mflags7 & r_ptr->flags7) != d_ptr->mflags7) - return FALSE; + if ((d_ptr->mflags7 & r_ptr->flags7) != d_ptr->mflags7) + return FALSE; } - if (d_ptr->mflags8) + if (d_ptr->mflags8) { - if((d_ptr->mflags8 & r_ptr->flags8) != d_ptr->mflags8) - return FALSE; + if ((d_ptr->mflags8 & r_ptr->flags8) != d_ptr->mflags8) + return FALSE; } - if (d_ptr->mflags9) + if (d_ptr->mflags9) { - if((d_ptr->mflags9 & r_ptr->flags9) != d_ptr->mflags9) - return FALSE; + if ((d_ptr->mflags9 & r_ptr->flags9) != d_ptr->mflags9) + return FALSE; } - for(a = 0; a < 5; a++) - if(d_ptr->r_char[a] && (d_ptr->r_char[a] != r_ptr->d_char)) return FALSE; - } - else if(d_ptr->mode == DUNGEON_MODE_NAND) - { - byte ok[9 + 5], i = 0, j = 0; + if (d_ptr->mflagsr) + { + if ((d_ptr->mflagsr & r_ptr->flagsr) != d_ptr->mflagsr) + return FALSE; + } + for (a = 0; a < 5; a++) + if (d_ptr->r_char[a] && (d_ptr->r_char[a] != r_ptr->d_char)) return FALSE; - if (d_ptr->mflags1) + return TRUE; + + case DUNGEON_MODE_NAND: + if (d_ptr->mflags1) { - i++; - if(d_ptr->mflags1 & r_ptr->flags1) - ok[0] = 1; + if ((d_ptr->mflags1 & r_ptr->flags1) != d_ptr->mflags1) + return TRUE; } - if (d_ptr->mflags2) + if (d_ptr->mflags2) { - i++; - if(d_ptr->mflags2 & r_ptr->flags2) - ok[1] = 1; + if ((d_ptr->mflags2 & r_ptr->flags2) != d_ptr->mflags2) + return TRUE; } - if (d_ptr->mflags3) + if (d_ptr->mflags3) { - i++; - if(d_ptr->mflags3 & r_ptr->flags3) - ok[2] = 1; + if ((d_ptr->mflags3 & r_ptr->flags3) != d_ptr->mflags3) + return TRUE; } - if (d_ptr->mflags4) + if (d_ptr->mflags4) { - i++; - if(d_ptr->mflags4 & r_ptr->flags4) - ok[3] = 1; + if ((d_ptr->mflags4 & r_ptr->flags4) != d_ptr->mflags4) + return TRUE; } - if (d_ptr->mflags5) + if (d_ptr->mflags5) { - i++; - if(d_ptr->mflags5 & r_ptr->flags5) - ok[4] = 1; + if ((d_ptr->mflags5 & r_ptr->flags5) != d_ptr->mflags5) + return TRUE; } - if (d_ptr->mflags6) + if (d_ptr->mflags6) { - i++; - if(d_ptr->mflags6 & r_ptr->flags6) - ok[5] = 1; + if ((d_ptr->mflags6 & r_ptr->flags6) != d_ptr->mflags6) + return TRUE; } - if (d_ptr->mflags7) + if (d_ptr->mflags7) { - i++; - if(d_ptr->mflags7 & r_ptr->flags7) - ok[6] = 1; + if ((d_ptr->mflags7 & r_ptr->flags7) != d_ptr->mflags7) + return TRUE; } - if (d_ptr->mflags8) + if (d_ptr->mflags8) { - i++; - if(d_ptr->mflags8 & r_ptr->flags8) - ok[7] = 1; + if ((d_ptr->mflags8 & r_ptr->flags8) != d_ptr->mflags8) + return TRUE; } - if (d_ptr->mflags9) + if (d_ptr->mflags9) { - i++; - if(d_ptr->mflags9 & r_ptr->flags9) - ok[8] = 1; + if ((d_ptr->mflags9 & r_ptr->flags9) != d_ptr->mflags9) + return TRUE; } + if (d_ptr->mflagsr) + { + if ((d_ptr->mflagsr & r_ptr->flagsr) != d_ptr->mflagsr) + return TRUE; + } + for (a = 0; a < 5; a++) + if (d_ptr->r_char[a] && (d_ptr->r_char[a] != r_ptr->d_char)) return TRUE; - for(a = 0; a < 5; a++) - { - if(d_ptr->r_char[a]) - { - i++; - if (d_ptr->r_char[a] != r_ptr->d_char) ok[9 + a] = 1; - } - } - - j = ok[0] + ok[1] + ok[2] + ok[3] + ok[4] + ok[5] + ok[6] + ok[7] + ok[8] + ok[9] + ok[10] + ok[11] + ok[12] + ok[13]; - - if(i == j) return FALSE; - } - else if(d_ptr->mode == DUNGEON_MODE_OR) - { - byte ok = FALSE, i; - s32b flag; - - for(i = 0; i < 32; i++) - { - flag = d_ptr->mflags1 & (1 << i); - if(r_ptr->flags1 & flag) ok = TRUE; - - flag = d_ptr->mflags2 & (1 << i); - if(r_ptr->flags2 & flag) ok = TRUE; - - flag = d_ptr->mflags3 & (1 << i); - if(r_ptr->flags3 & flag) ok = TRUE; - - flag = d_ptr->mflags4 & (1 << i); - if(r_ptr->flags4 & flag) ok = TRUE; - - flag = d_ptr->mflags5 & (1 << i); - if(r_ptr->flags5 & flag) ok = TRUE; - - flag = d_ptr->mflags6 & (1 << i); - if(r_ptr->flags6 & flag) ok = TRUE; - - flag = d_ptr->mflags7 & (1 << i); - if(r_ptr->flags7 & flag) ok = TRUE; - - flag = d_ptr->mflags8 & (1 << i); - if(r_ptr->flags8 & flag) ok = TRUE; - - flag = d_ptr->mflags9 & (1 << i); - if(r_ptr->flags9 & flag) ok = TRUE; - } - for(a = 0; a < 5; a++) - if(d_ptr->r_char[a] == r_ptr->d_char) ok = TRUE; - - return ok; - } - else if(d_ptr->mode == DUNGEON_MODE_NOR) - { - byte ok = TRUE, i; - s32b flag; - - for(i = 0; i < 32; i++) - { - flag = d_ptr->mflags1 & (1 << i); - if(r_ptr->flags1 & flag) ok = FALSE; - - flag = d_ptr->mflags2 & (1 << i); - if(r_ptr->flags2 & flag) ok = FALSE; - - flag = d_ptr->mflags3 & (1 << i); - if(r_ptr->flags3 & flag) ok = FALSE; - - flag = d_ptr->mflags4 & (1 << i); - if(r_ptr->flags4 & flag) ok = FALSE; - - flag = d_ptr->mflags5 & (1 << i); - if(r_ptr->flags5 & flag) ok = FALSE; - - flag = d_ptr->mflags6 & (1 << i); - if(r_ptr->flags6 & flag) ok = FALSE; + return FALSE; - flag = d_ptr->mflags7 & (1 << i); - if(r_ptr->flags7 & flag) ok = FALSE; + case DUNGEON_MODE_OR: + if (r_ptr->flags1 & d_ptr->mflags1) return TRUE; + if (r_ptr->flags2 & d_ptr->mflags2) return TRUE; + if (r_ptr->flags3 & d_ptr->mflags3) return TRUE; + if (r_ptr->flags4 & d_ptr->mflags4) return TRUE; + if (r_ptr->flags5 & d_ptr->mflags5) return TRUE; + if (r_ptr->flags6 & d_ptr->mflags6) return TRUE; + if (r_ptr->flags7 & d_ptr->mflags7) return TRUE; + if (r_ptr->flags8 & d_ptr->mflags8) return TRUE; + if (r_ptr->flags9 & d_ptr->mflags9) return TRUE; + if (r_ptr->flagsr & d_ptr->mflagsr) return TRUE; + for (a = 0; a < 5; a++) + if (d_ptr->r_char[a] == r_ptr->d_char) return TRUE; - flag = d_ptr->mflags8 & (1 << i); - if(r_ptr->flags8 & flag) ok = FALSE; + return FALSE; - flag = d_ptr->mflags9 & (1 << i); - if(r_ptr->flags9 & flag) ok = FALSE; - } - for(a = 0; a < 5; a++) - if(d_ptr->r_char[a] == r_ptr->d_char) ok = FALSE; - return ok; - } + case DUNGEON_MODE_NOR: + if (r_ptr->flags1 & d_ptr->mflags1) return FALSE; + if (r_ptr->flags2 & d_ptr->mflags2) return FALSE; + if (r_ptr->flags3 & d_ptr->mflags3) return FALSE; + if (r_ptr->flags4 & d_ptr->mflags4) return FALSE; + if (r_ptr->flags5 & d_ptr->mflags5) return FALSE; + if (r_ptr->flags6 & d_ptr->mflags6) return FALSE; + if (r_ptr->flags7 & d_ptr->mflags7) return FALSE; + if (r_ptr->flags8 & d_ptr->mflags8) return FALSE; + if (r_ptr->flags9 & d_ptr->mflags9) return FALSE; + if (r_ptr->flagsr & d_ptr->mflagsr) return FALSE; + for (a = 0; a < 5; a++) + if (d_ptr->r_char[a] == r_ptr->d_char) return FALSE; + + return TRUE; + } - return TRUE; + return TRUE; } /* @@ -1155,7 +1168,7 @@ errr get_mon_num_prep(monster_hook_type monster_hook, if (r_ptr->flags7 & RF7_GUARDIAN) continue; - + /* Depth Monsters never appear out of depth */ if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (r_ptr->level > dun_level)) @@ -1165,7 +1178,7 @@ errr get_mon_num_prep(monster_hook_type monster_hook, /* Accept this monster */ entry->prob2 = entry->prob1; - if (dun_level && (!p_ptr->inside_quest || p_ptr->inside_quest < MIN_RANDOM_QUEST) && !restrict_monster_to_dungeon(entry->index) && !p_ptr->inside_battle) + if (dun_level && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest)) && !restrict_monster_to_dungeon(entry->index) && !p_ptr->inside_battle) { int hoge = entry->prob2 * d_info[dungeon_type].special_div; entry->prob2 = hoge / 64; @@ -1240,41 +1253,29 @@ static int mysqrt(int n) s16b get_mon_num(int level) { int i, j, p; - int r_idx; - long value, total; - monster_race *r_ptr; - alloc_entry *table = alloc_race_table; int pls_kakuritu, pls_level; - int hoge=mysqrt(level*10000L); + int hoge = mysqrt(level*10000L); if (level > MAX_DEPTH - 1) level = MAX_DEPTH - 1; - if ((dungeon_turn > hoge*(TURNS_PER_TICK*500L)) && !level) - { - pls_kakuritu = MAX(2, NASTY_MON-((dungeon_turn/(TURNS_PER_TICK*2500L)-hoge/10))); - pls_level = MIN(8,3 + dungeon_turn/(TURNS_PER_TICK*20000L)-hoge/40); - } - else - { - pls_kakuritu = NASTY_MON; - pls_level = 2; - } + pls_kakuritu = MAX(NASTY_MON_MAX, NASTY_MON_BASE - ((dungeon_turn / (TURNS_PER_TICK * 2500L) - hoge / 10))); + pls_level = MIN(NASTY_MON_PLUS_MAX, 3 + dungeon_turn / (TURNS_PER_TICK * 20000L) - hoge / 40 + MIN(5, level / 10)) ; if (d_info[dungeon_type].flags1 & DF1_MAZE) { - pls_kakuritu = MIN(pls_kakuritu/2, pls_kakuritu-10); + pls_kakuritu = MIN(pls_kakuritu / 2, pls_kakuritu - 10); if (pls_kakuritu < 2) pls_kakuritu = 2; pls_level += 2; level += 3; } /* Boost the level */ - if ((level > 0) && !p_ptr->inside_battle && !(d_info[dungeon_type].flags1 & DF1_BEGINNER)) + if (!p_ptr->inside_battle && !(d_info[dungeon_type].flags1 & DF1_BEGINNER)) { /* Nightmare mode allows more out-of depth monsters */ if (ironman_nightmare && !randint0(pls_kakuritu)) @@ -1288,25 +1289,11 @@ s16b get_mon_num(int level) if (!randint0(pls_kakuritu)) { /* Pick a level bonus */ - int d = MIN(5, level/10) + pls_level; - - /* Boost the level */ - level += d; - } - - /* Occasional "nasty" monster */ - if (!randint0(pls_kakuritu)) - { - /* Pick a level bonus */ - int d = MIN(5, level/10) + pls_level; - - /* Boost the level */ - level += d; + level += pls_level; } } } - /* Reset total */ total = 0L; @@ -1329,7 +1316,7 @@ s16b get_mon_num(int level) { /* Hack -- "unique" monsters must be "unique" */ if (((r_ptr->flags1 & (RF1_UNIQUE)) || - (r_ptr->flags7 & (RF7_UNIQUE_7))) && + (r_ptr->flags7 & (RF7_NAZGUL))) && (r_ptr->cur_num >= r_ptr->max_num)) { continue; @@ -1358,7 +1345,6 @@ s16b get_mon_num(int level) /* No legal monsters */ if (total <= 0) return (0); - /* Pick a monster */ value = randint0(total); @@ -1372,7 +1358,6 @@ s16b get_mon_num(int level) value = value - table[i].prob3; } - /* Power boost */ p = randint0(100); @@ -1458,24 +1443,26 @@ s16b get_mon_num(int level) * so that "char desc[80];" is sufficiently large for any result. * * Mode Flags: - * 0x01 --> Objective (or Reflexive) - * 0x02 --> Possessive (or Reflexive) - * 0x04 --> Use indefinites for hidden monsters ("something") - * 0x08 --> Use indefinites for visible monsters ("a kobold") - * 0x10 --> Pronominalize hidden monsters - * 0x20 --> Pronominalize visible monsters - * 0x40 --> Assume the monster is hidden - * 0x80 --> Assume the monster is visible - * 0x100 --> Chameleon's true name - * 0x200 --> Ignore hallucination, and penetrate shape change + * MD_OBJECTIVE --> Objective (or Reflexive) + * MD_POSSESSIVE --> Possessive (or Reflexive) + * MD_INDEF_HIDDEN --> Use indefinites for hidden monsters ("something") + * MD_INDEF_VISIBLE --> Use indefinites for visible monsters ("a kobold") + * MD_PRON_HIDDEN --> Pronominalize hidden monsters + * MD_PRON_VISIBLE --> Pronominalize visible monsters + * MD_ASSUME_HIDDEN --> Assume the monster is hidden + * MD_ASSUME_VISIBLE --> Assume the monster is visible + * MD_TRUE_NAME --> Chameleon's true name + * MD_IGNORE_HALLU --> Ignore hallucination, and penetrate shape change * * Useful Modes: - * 0x00 --> Full nominative name ("the kobold") or "it" - * 0x04 --> Full nominative name ("the kobold") or "something" - * 0x80 --> Genocide resistance name ("the kobold") - * 0x88 --> Killing name ("a kobold") - * 0x22 --> Possessive, genderized if visable ("his") or "its" - * 0x23 --> Reflexive, genderized if visable ("himself") or "itself" + * 0x00 --> Full nominative name ("the kobold") or "it" + * MD_INDEF_HIDDEN --> Full nominative name ("the kobold") or "something" + * MD_ASSUME_VISIBLE --> Genocide resistance name ("the kobold") + * MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE --> Killing name ("a kobold") + * MD_PRON_VISIBLE | MD_POSSESSIVE + * --> Possessive, genderized if visable ("his") or "its" + * MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE + * --> Reflexive, genderized if visable ("himself") or "itself" */ void monster_desc(char *desc, monster_type *m_ptr, int mode) { @@ -1490,20 +1477,17 @@ void monster_desc(char *desc, monster_type *m_ptr, int mode) r_ptr = &r_info[m_ptr->ap_r_idx]; - if ((mode & 0x100) && (m_ptr->mflag2 & MFLAG_CHAMELEON)) - { - if (r_ptr->flags1 & RF1_UNIQUE) name = (r_name + r_info[MON_CHAMELEON_K].name); - else name = (r_name + r_info[MON_CHAMELEON].name); - } + /* Mode of MD_TRUE_NAME will reveal Chameleon's true name */ + if (mode & MD_TRUE_NAME) name = (r_name + real_r_ptr(m_ptr)->name); else name = (r_name + r_ptr->name); /* Are we hallucinating? (Idea from Nethack...) */ - if (p_ptr->image && !(mode & 0x200)) + if (p_ptr->image && !(mode & MD_IGNORE_HALLU)) { if (one_in_(2)) { #ifdef JP -if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) + if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) #else if (!get_rnd_line("silly.txt", m_ptr->r_idx, silly_name)) #endif @@ -1519,7 +1503,7 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) { hallu_race = &r_info[randint1(max_r_idx - 1)]; } - while (hallu_race->flags1 & RF1_UNIQUE); + while (!hallu_race->name || (hallu_race->flags1 & RF1_UNIQUE)); strcpy(silly_name, (r_name + hallu_race->name)); } @@ -1529,10 +1513,10 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) } /* Can we "see" it (exists + forced, or visible + not unforced) */ - seen = (m_ptr && ((mode & 0x80) || (!(mode & 0x40) && m_ptr->ml))); + seen = (m_ptr && ((mode & MD_ASSUME_VISIBLE) || (!(mode & MD_ASSUME_HIDDEN) && m_ptr->ml))); /* Sexed Pronouns (seen and allowed, or unseen and allowed) */ - pron = (m_ptr && ((seen && (mode & 0x20)) || (!seen && (mode & 0x10)))); + pron = (m_ptr && ((seen && (mode & MD_PRON_VISIBLE)) || (!seen && (mode & MD_PRON_HIDDEN)))); /* First, try using pronouns, or describing hidden monsters */ @@ -1558,73 +1542,72 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) /* Brute force: split on the possibilities */ - switch (kind + (mode & 0x07)) + switch (kind + (mode & (MD_INDEF_HIDDEN | MD_POSSESSIVE | MD_OBJECTIVE))) { /* Neuter, or unknown */ #ifdef JP - case 0x00: res = "²¿¤«"; break; - case 0x01: res = "²¿¤«"; break; - case 0x02: res = "²¿¤«¤Î"; break; - case 0x03: res = "²¿¤«¼«¿È"; break; - case 0x04: res = "²¿¤«"; break; - case 0x05: res = "²¿¤«"; break; - case 0x06: res = "²¿¤«"; break; - case 0x07: res = "¤½¤ì¼«¿È"; break; + case 0x00: res = "²¿¤«"; break; + case 0x00 + (MD_OBJECTIVE): res = "²¿¤«"; break; + case 0x00 + (MD_POSSESSIVE): res = "²¿¤«¤Î"; break; + case 0x00 + (MD_POSSESSIVE | MD_OBJECTIVE): res = "²¿¤«¼«¿È"; break; + case 0x00 + (MD_INDEF_HIDDEN): res = "²¿¤«"; break; + case 0x00 + (MD_INDEF_HIDDEN | MD_OBJECTIVE): res = "²¿¤«"; break; + case 0x00 + (MD_INDEF_HIDDEN | MD_POSSESSIVE): res = "²¿¤«"; break; + case 0x00 + (MD_INDEF_HIDDEN | MD_POSSESSIVE | MD_OBJECTIVE): res = "¤½¤ì¼«¿È"; break; #else - case 0x00: res = "it"; break; - case 0x01: res = "it"; break; - case 0x02: res = "its"; break; - case 0x03: res = "itself"; break; - case 0x04: res = "something"; break; - case 0x05: res = "something"; break; - case 0x06: res = "something's"; break; - case 0x07: res = "itself"; break; + case 0x00: res = "it"; break; + case 0x00 + (MD_OBJECTIVE): res = "it"; break; + case 0x00 + (MD_POSSESSIVE): res = "its"; break; + case 0x00 + (MD_POSSESSIVE | MD_OBJECTIVE): res = "itself"; break; + case 0x00 + (MD_INDEF_HIDDEN): res = "something"; break; + case 0x00 + (MD_INDEF_HIDDEN | MD_OBJECTIVE): res = "something"; break; + case 0x00 + (MD_INDEF_HIDDEN | MD_POSSESSIVE): res = "something's"; break; + case 0x00 + (MD_INDEF_HIDDEN | MD_POSSESSIVE | MD_OBJECTIVE): res = "itself"; break; #endif /* Male (assume human if vague) */ #ifdef JP - case 0x10: res = "Èà"; break; - case 0x11: res = "Èà"; break; - case 0x12: res = "Èà¤Î"; break; - case 0x13: res = "È༫¿È"; break; - case 0x14: res = "狼"; break; - case 0x15: res = "狼"; break; - case 0x16: res = "狼¤Î"; break; - case 0x17: res = "È༫¿È"; break; + case 0x10: res = "Èà"; break; + case 0x10 + (MD_OBJECTIVE): res = "Èà"; break; + case 0x10 + (MD_POSSESSIVE): res = "Èà¤Î"; break; + case 0x10 + (MD_POSSESSIVE | MD_OBJECTIVE): res = "È༫¿È"; break; + case 0x10 + (MD_INDEF_HIDDEN): res = "狼"; break; + case 0x10 + (MD_INDEF_HIDDEN | MD_OBJECTIVE): res = "狼"; break; + case 0x10 + (MD_INDEF_HIDDEN | MD_POSSESSIVE): res = "狼¤Î"; break; + case 0x10 + (MD_INDEF_HIDDEN | MD_POSSESSIVE | MD_OBJECTIVE): res = "È༫¿È"; break; #else - case 0x10: res = "he"; break; - case 0x11: res = "him"; break; - case 0x12: res = "his"; break; - case 0x13: res = "himself"; break; - case 0x14: res = "someone"; break; - case 0x15: res = "someone"; break; - case 0x16: res = "someone's"; break; - case 0x17: res = "himself"; break; + case 0x10: res = "he"; break; + case 0x10 + (MD_OBJECTIVE): res = "him"; break; + case 0x10 + (MD_POSSESSIVE): res = "his"; break; + case 0x10 + (MD_POSSESSIVE | MD_OBJECTIVE): res = "himself"; break; + case 0x10 + (MD_INDEF_HIDDEN): res = "someone"; break; + case 0x10 + (MD_INDEF_HIDDEN | MD_OBJECTIVE): res = "someone"; break; + case 0x10 + (MD_INDEF_HIDDEN | MD_POSSESSIVE): res = "someone's"; break; + case 0x10 + (MD_INDEF_HIDDEN | MD_POSSESSIVE | MD_OBJECTIVE): res = "himself"; break; #endif /* Female (assume human if vague) */ #ifdef JP - case 0x20: res = "Èà½÷"; break; - case 0x21: res = "Èà½÷"; break; - case 0x22: res = "Èà½÷¤Î"; break; - case 0x23: res = "Èà½÷¼«¿È"; break; - case 0x24: res = "狼"; break; - case 0x25: res = "狼"; break; - case 0x26: res = "狼¤Î"; break; - case 0x27: res = "Èà½÷¼«¿È"; break; + case 0x20: res = "Èà½÷"; break; + case 0x20 + (MD_OBJECTIVE): res = "Èà½÷"; break; + case 0x20 + (MD_POSSESSIVE): res = "Èà½÷¤Î"; break; + case 0x20 + (MD_POSSESSIVE | MD_OBJECTIVE): res = "Èà½÷¼«¿È"; break; + case 0x20 + (MD_INDEF_HIDDEN): res = "狼"; break; + case 0x20 + (MD_INDEF_HIDDEN | MD_OBJECTIVE): res = "狼"; break; + case 0x20 + (MD_INDEF_HIDDEN | MD_POSSESSIVE): res = "狼¤Î"; break; + case 0x20 + (MD_INDEF_HIDDEN | MD_POSSESSIVE | MD_OBJECTIVE): res = "Èà½÷¼«¿È"; break; #else - case 0x20: res = "she"; break; - case 0x21: res = "her"; break; - case 0x22: res = "her"; break; - case 0x23: res = "herself"; break; - case 0x24: res = "someone"; break; - case 0x25: res = "someone"; break; - case 0x26: res = "someone's"; break; - case 0x27: res = "herself"; break; + case 0x20: res = "she"; break; + case 0x20 + (MD_OBJECTIVE): res = "her"; break; + case 0x20 + (MD_POSSESSIVE): res = "her"; break; + case 0x20 + (MD_POSSESSIVE | MD_OBJECTIVE): res = "herself"; break; + case 0x20 + (MD_INDEF_HIDDEN): res = "someone"; break; + case 0x20 + (MD_INDEF_HIDDEN | MD_OBJECTIVE): res = "someone"; break; + case 0x20 + (MD_INDEF_HIDDEN | MD_POSSESSIVE): res = "someone's"; break; + case 0x20 + (MD_INDEF_HIDDEN | MD_POSSESSIVE | MD_OBJECTIVE): res = "herself"; break; #endif - } /* Copy the result */ @@ -1633,19 +1616,18 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) /* Handle visible monsters, "reflexive" request */ - else if ((mode & 0x02) && (mode & 0x01)) + else if ((mode & (MD_POSSESSIVE | MD_OBJECTIVE)) == (MD_POSSESSIVE | MD_OBJECTIVE)) { /* The monster is visible, so use its gender */ #ifdef JP - if (r_ptr->flags1 & (RF1_FEMALE)) strcpy(desc, "Èà½÷¼«¿È"); - else if (r_ptr->flags1 & (RF1_MALE)) strcpy(desc, "È༫¿È"); - else strcpy(desc, "¤½¤ì¼«¿È"); + if (r_ptr->flags1 & (RF1_FEMALE)) strcpy(desc, "Èà½÷¼«¿È"); + else if (r_ptr->flags1 & (RF1_MALE)) strcpy(desc, "È༫¿È"); + else strcpy(desc, "¤½¤ì¼«¿È"); #else if (r_ptr->flags1 & RF1_FEMALE) strcpy(desc, "herself"); else if (r_ptr->flags1 & RF1_MALE) strcpy(desc, "himself"); else strcpy(desc, "itself"); #endif - } @@ -1653,37 +1635,37 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) else { /* Tanuki? */ - if (is_pet(m_ptr) && m_ptr->ap_r_idx != m_ptr->r_idx) + if (is_pet(m_ptr) && !is_original_ap(m_ptr)) { #ifdef JP - char *t; - strcpy(buf, name); - t = buf; - while(strncmp(t, "¡Ù", 2) && *t) t++; - if (*t) - { - *t = '\0'; - (void)sprintf(desc, "%s¡©¡Ù", buf); - } - else - (void)sprintf(desc, "%s¡©", name); + char *t; + strcpy(buf, name); + t = buf; + while(strncmp(t, "¡Ù", 2) && *t) t++; + if (*t) + { + *t = '\0'; + (void)sprintf(desc, "%s¡©¡Ù", buf); + } + else + (void)sprintf(desc, "%s¡©", name); #else - (void)sprintf(desc, "%s?", name); + (void)sprintf(desc, "%s?", name); #endif } else /* It could be a Unique */ - if ((r_ptr->flags1 & RF1_UNIQUE) && !(p_ptr->image && !(mode & 0x200))) + if ((r_ptr->flags1 & RF1_UNIQUE) && !(p_ptr->image && !(mode & MD_IGNORE_HALLU))) { /* Start with the name (thus nominative and objective) */ - if ((m_ptr->mflag2 & MFLAG_CHAMELEON) && !(mode & 0x100)) + if ((m_ptr->mflag2 & MFLAG2_CHAMELEON) && !(mode & MD_TRUE_NAME)) { #ifdef JP char *t; strcpy(buf, name); t = buf; - while(strncmp(t, "¡Ù", 2) && *t) t++; + while (strncmp(t, "¡Ù", 2) && *t) t++; if (*t) { *t = '\0'; @@ -1695,18 +1677,27 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) (void)sprintf(desc, "%s?", name); #endif } - else if ((cave[m_ptr->fy][m_ptr->fx].m_idx == p_ptr->riding) || !p_ptr->inside_battle) - (void)strcpy(desc, name); - else + + /* Inside monster arena, and it is not your mount */ + else if (p_ptr->inside_battle && + !(p_ptr->riding && (&m_list[p_ptr->riding] == m_ptr))) + { + /* It is a fake unique monster */ #ifdef JP (void)sprintf(desc, "%s¤â¤É¤­", name); #else (void)sprintf(desc, "fake %s", name); #endif + } + + else + { + (void)strcpy(desc, name); + } } /* It could be an indefinite monster */ - else if (mode & 0x08) + else if (mode & MD_INDEF_VISIBLE) { /* XXX Check plurality for "some" */ @@ -1751,7 +1742,7 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) strcat(desc,buf); } - if ((m_ptr->fy == py) && (m_ptr->fx == px)) + if (p_ptr->riding && (&m_list[p_ptr->riding] == m_ptr)) { #ifdef JP strcat(desc,"(¾èÇÏÃæ)"); @@ -1760,7 +1751,7 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) #endif } - if ((mode & 0x200) && (m_ptr->mflag2 & MFLAG_CHAMELEON)) + if ((mode & MD_IGNORE_HALLU) && (m_ptr->mflag2 & MFLAG2_CHAMELEON)) { if (r_ptr->flags1 & RF1_UNIQUE) { @@ -1780,13 +1771,13 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) } } - if ((mode & 0x200) && m_ptr->ap_r_idx != m_ptr->r_idx) + if ((mode & MD_IGNORE_HALLU) && !is_original_ap(m_ptr)) { strcat(desc, format("(%s)", r_name + r_info[m_ptr->r_idx].name)); } /* Handle the Possessive as a special afterthought */ - if (mode & 0x02) + if (mode & MD_POSSESSIVE) { /* XXX Check for trailing "s" */ @@ -1796,7 +1787,6 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) #else (void)strcat(desc, "'s"); #endif - } } } @@ -1806,24 +1796,107 @@ if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name)) /* * Learn about a monster (by "probing" it) + * + * Return the number of new flags learnt. -Mogami- */ -void lore_do_probe(int m_idx) +int lore_do_probe(int r_idx) { - monster_type *m_ptr = &m_list[m_idx]; + monster_race *r_ptr = &r_info[r_idx]; + int i, n = 0; + byte tmp_byte; - monster_race *r_ptr = &r_info[m_ptr->r_idx]; + /* Maximal info about awareness */ + if (r_ptr->r_wake != MAX_UCHAR) n++; + if (r_ptr->r_ignore != MAX_UCHAR) n++; + r_ptr->r_wake = r_ptr->r_ignore = MAX_UCHAR; + + /* Observe "maximal" attacks */ + for (i = 0; i < 4; i++) + { + /* Examine "actual" blows */ + if (r_ptr->blow[i].effect || r_ptr->blow[i].method) + { + /* Maximal observations */ + if (r_ptr->r_blows[i] != MAX_UCHAR) n++; + r_ptr->r_blows[i] = MAX_UCHAR; + } + } + + /* Maximal drops */ + tmp_byte = + (((r_ptr->flags1 & RF1_DROP_4D2) ? 8 : 0) + + ((r_ptr->flags1 & RF1_DROP_3D2) ? 6 : 0) + + ((r_ptr->flags1 & RF1_DROP_2D2) ? 4 : 0) + + ((r_ptr->flags1 & RF1_DROP_1D2) ? 2 : 0) + + ((r_ptr->flags1 & RF1_DROP_90) ? 1 : 0) + + ((r_ptr->flags1 & RF1_DROP_60) ? 1 : 0)); + + /* Only "valid" drops */ + if (!(r_ptr->flags1 & RF1_ONLY_GOLD)) + { + if (r_ptr->r_drop_item != tmp_byte) n++; + r_ptr->r_drop_item = tmp_byte; + } + if (!(r_ptr->flags1 & RF1_ONLY_ITEM)) + { + if (r_ptr->r_drop_gold != tmp_byte) n++; + r_ptr->r_drop_gold = tmp_byte; + } - /* Hack -- Memorize some flags */ + /* Observe many spells */ + if (r_ptr->r_cast_spell != MAX_UCHAR) n++; + r_ptr->r_cast_spell = MAX_UCHAR; + + /* Count unknown flags */ + for (i = 0; i < 32; i++) + { + if (!(r_ptr->r_flags1 & (1L << i)) && + (r_ptr->flags1 & (1L << i))) n++; + if (!(r_ptr->r_flags2 & (1L << i)) && + (r_ptr->flags2 & (1L << i))) n++; + if (!(r_ptr->r_flags3 & (1L << i)) && + (r_ptr->flags3 & (1L << i))) n++; + if (!(r_ptr->r_flags4 & (1L << i)) && + (r_ptr->flags4 & (1L << i))) n++; + if (!(r_ptr->r_flags5 & (1L << i)) && + (r_ptr->flags5 & (1L << i))) n++; + if (!(r_ptr->r_flags6 & (1L << i)) && + (r_ptr->flags6 & (1L << i))) n++; + if (!(r_ptr->r_flagsr & (1L << i)) && + (r_ptr->flagsr & (1L << i))) n++; + + /* r_flags7 is actually unused */ +#if 0 + if (!(r_ptr->r_flags7 & (1L << i)) && + (r_ptr->flags7 & (1L << i))) n++; +#endif + } + + /* Know all the flags */ r_ptr->r_flags1 = r_ptr->flags1; r_ptr->r_flags2 = r_ptr->flags2; r_ptr->r_flags3 = r_ptr->flags3; + r_ptr->r_flags4 = r_ptr->flags4; + r_ptr->r_flags5 = r_ptr->flags5; + r_ptr->r_flags6 = r_ptr->flags6; + r_ptr->r_flagsr = r_ptr->flagsr; + + /* r_flags7 is actually unused */ + /* r_ptr->r_flags7 = r_ptr->flags7; */ + + /* Know about evolution */ + if (!(r_ptr->r_xtra1 & MR1_SINKA)) n++; + r_ptr->r_xtra1 |= MR1_SINKA; /* Update monster recall window */ - if (p_ptr->monster_race_idx == m_ptr->r_idx) + if (p_ptr->monster_race_idx == r_idx) { /* Window stuff */ p_ptr->window |= (PW_MONSTER); } + + /* Return the number of new flags learnt */ + return n; } @@ -1846,6 +1919,9 @@ void lore_treasure(int m_idx, int num_item, int num_gold) monster_race *r_ptr = &r_info[m_ptr->r_idx]; + /* If the monster doesn't have original appearance, don't note */ + if (!is_original_ap(m_ptr)) return; + /* Note the number of things dropped */ if (num_item > r_ptr->r_drop_item) r_ptr->r_drop_item = num_item; if (num_gold > r_ptr->r_drop_gold) r_ptr->r_drop_gold = num_gold; @@ -1874,7 +1950,7 @@ void sanity_blast(monster_type *m_ptr, bool necro) if (!necro) { char m_name[80]; - monster_race *r_ptr = &r_info[m_ptr->r_idx]; + monster_race *r_ptr = &r_info[m_ptr->ap_r_idx]; power = r_ptr->level / 2; @@ -1912,12 +1988,13 @@ void sanity_blast(monster_type *m_ptr, bool necro) { /* Something silly happens... */ #ifdef JP -msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª", + msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª", + funny_desc[randint0(MAX_SAN_FUNNY)], m_name); #else msg_format("You behold the %s visage of %s!", + funny_desc[randint0(MAX_SAN_FUNNY)], m_name); #endif - funny_desc[randint0(MAX_SAN_FUNNY)], m_name); if (one_in_(3)) { @@ -1930,22 +2007,22 @@ msg_format("%s%s /* Something frightening happens... */ #ifdef JP -msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª", + msg_format("%s%s¤Î´é¤ò¸«¤Æ¤·¤Þ¤Ã¤¿¡ª", + horror_desc[randint0(MAX_SAN_HORROR)], m_name); #else msg_format("You behold the %s visage of %s!", -#endif - horror_desc[randint0(MAX_SAN_HORROR)], m_name); +#endif r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR; /* Demon characters are unaffected */ - if ((p_ptr->prace == RACE_IMP) || (p_ptr->prace == RACE_DEMON) || (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) return; + if (prace_is_(RACE_IMP) || prace_is_(RACE_DEMON) || (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) return; if (p_ptr->wizard) return; /* Undead characters are 50% likely to be unaffected */ - if ((p_ptr->prace == RACE_SKELETON) || (p_ptr->prace == RACE_ZOMBIE) - || (p_ptr->prace == RACE_VAMPIRE) || (p_ptr->prace == RACE_SPECTRE) || + if (prace_is_(RACE_SKELETON) || prace_is_(RACE_ZOMBIE) + || prace_is_(RACE_VAMPIRE) || prace_is_(RACE_SPECTRE) || (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_UNDEAD)) { if (saving_throw(25 + p_ptr->lev)) return; @@ -2210,6 +2287,8 @@ void update_mon(int m_idx, bool full) monster_race *r_ptr = &r_info[m_ptr->r_idx]; + bool do_disturb = disturb_move; + int d; /* Current location */ @@ -2222,6 +2301,17 @@ void update_mon(int m_idx, bool full) /* Seen by vision */ bool easy = FALSE; + /* Non-Ninja player in the darkness */ + bool in_darkness = (d_info[dungeon_type].flags1 & DF1_DARKNESS) && !p_ptr->see_nocto; + + /* Do disturb? */ + if (disturb_high) + { + monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; + + if (ap_r_ptr->r_tkills && ap_r_ptr->level >= p_ptr->lev) + do_disturb = TRUE; + } /* Compute distance */ if (full) @@ -2251,32 +2341,36 @@ void update_mon(int m_idx, bool full) /* Detected */ - if (m_ptr->mflag & (MFLAG_MARK)) flag = TRUE; + if (m_ptr->mflag2 & (MFLAG2_MARK)) flag = TRUE; /* Nearby */ - if (d <= ((d_info[dungeon_type].flags1 & DF1_DARKNESS) ? MAX_SIGHT / 2 : MAX_SIGHT)) + if (d <= (in_darkness ? MAX_SIGHT / 2 : MAX_SIGHT)) { - if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS) || (d <= MAX_SIGHT / 4)) + if (!in_darkness || (d <= MAX_SIGHT / 4)) { if (p_ptr->special_defense & KATA_MUSOU) { /* Detectable */ flag = TRUE; - /* Hack -- Memorize mental flags */ - if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART); - if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID); + if (is_original_ap(m_ptr) && !p_ptr->image) + { + /* Hack -- Memorize mental flags */ + if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART); + if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID); + } } /* Basic telepathy */ + /* Snipers get telepathy when they concentrate deeper */ else if (p_ptr->telepathy) { /* Empty mind, no telepathy */ if (r_ptr->flags2 & (RF2_EMPTY_MIND)) { /* Memorize flags */ - r_ptr->r_flags2 |= (RF2_EMPTY_MIND); + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags2 |= (RF2_EMPTY_MIND); } /* Weird mind, occasional telepathy */ @@ -2288,12 +2382,15 @@ void update_mon(int m_idx, bool full) /* Detectable */ flag = TRUE; - /* Memorize flags */ - r_ptr->r_flags2 |= (RF2_WEIRD_MIND); + if (is_original_ap(m_ptr) && !p_ptr->image) + { + /* Memorize flags */ + r_ptr->r_flags2 |= (RF2_WEIRD_MIND); - /* Hack -- Memorize mental flags */ - if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART); - if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID); + /* Hack -- Memorize mental flags */ + if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART); + if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID); + } } } @@ -2303,9 +2400,12 @@ void update_mon(int m_idx, bool full) /* Detectable */ flag = TRUE; - /* Hack -- Memorize mental flags */ - if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART); - if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID); + if (is_original_ap(m_ptr) && !p_ptr->image) + { + /* Hack -- Memorize mental flags */ + if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART); + if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID); + } } } @@ -2313,99 +2413,85 @@ void update_mon(int m_idx, bool full) if ((p_ptr->esp_animal) && (r_ptr->flags3 & (RF3_ANIMAL))) { flag = TRUE; - r_ptr->r_flags3 |= (RF3_ANIMAL); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_ANIMAL); } /* Magical sensing */ if ((p_ptr->esp_undead) && (r_ptr->flags3 & (RF3_UNDEAD))) { flag = TRUE; - r_ptr->r_flags3 |= (RF3_UNDEAD); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_UNDEAD); } /* Magical sensing */ if ((p_ptr->esp_demon) && (r_ptr->flags3 & (RF3_DEMON))) { flag = TRUE; - r_ptr->r_flags3 |= (RF3_DEMON); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_DEMON); } /* Magical sensing */ if ((p_ptr->esp_orc) && (r_ptr->flags3 & (RF3_ORC))) { flag = TRUE; - r_ptr->r_flags3 |= (RF3_ORC); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_ORC); } /* Magical sensing */ if ((p_ptr->esp_troll) && (r_ptr->flags3 & (RF3_TROLL))) { flag = TRUE; - r_ptr->r_flags3 |= (RF3_TROLL); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_TROLL); } /* Magical sensing */ if ((p_ptr->esp_giant) && (r_ptr->flags3 & (RF3_GIANT))) { flag = TRUE; - r_ptr->r_flags3 |= (RF3_GIANT); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_GIANT); } /* Magical sensing */ if ((p_ptr->esp_dragon) && (r_ptr->flags3 & (RF3_DRAGON))) { flag = TRUE; - r_ptr->r_flags3 |= (RF3_DRAGON); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_DRAGON); } /* Magical sensing */ if ((p_ptr->esp_human) && (r_ptr->flags2 & (RF2_HUMAN))) { flag = TRUE; - r_ptr->r_flags2 |= (RF2_HUMAN); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags2 |= (RF2_HUMAN); } /* Magical sensing */ if ((p_ptr->esp_evil) && (r_ptr->flags3 & (RF3_EVIL))) { flag = TRUE; - r_ptr->r_flags3 |= (RF3_EVIL); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_EVIL); } /* Magical sensing */ if ((p_ptr->esp_good) && (r_ptr->flags3 & (RF3_GOOD))) { flag = TRUE; - r_ptr->r_flags3 |= (RF3_GOOD); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_GOOD); } /* Magical sensing */ - if ((p_ptr->esp_nonliving) && - (r_ptr->flags3 & (RF3_NONLIVING)) && - !(r_ptr->flags3 & (RF3_DEMON)) && - !(r_ptr->flags3 & (RF3_UNDEAD))) + if ((p_ptr->esp_nonliving) && + ((r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) == RF3_NONLIVING)) { flag = TRUE; - r_ptr->r_flags3 |= (RF3_NONLIVING); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_NONLIVING); } /* Magical sensing */ if ((p_ptr->esp_unique) && (r_ptr->flags1 & (RF1_UNIQUE))) { flag = TRUE; - r_ptr->r_flags1 |= (RF1_UNIQUE); - + if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags1 |= (RF1_UNIQUE); } } @@ -2415,11 +2501,18 @@ void update_mon(int m_idx, bool full) bool do_invisible = FALSE; bool do_cold_blood = FALSE; + /* Snipers can see targets in darkness when they concentrate deeper */ + if (p_ptr->concent >= CONCENT_RADAR_THRESHOLD) + { + /* Easy to see */ + easy = flag = TRUE; + } + /* Use "infravision" */ if (d <= p_ptr->see_infra) { /* Handle "cold blooded" monsters */ - if (r_ptr->flags2 & (RF2_COLD_BLOOD)) + if ((r_ptr->flags2 & (RF2_COLD_BLOOD | RF2_AURA_FIRE)) == RF2_COLD_BLOOD) { /* Take note */ do_cold_blood = TRUE; @@ -2461,9 +2554,12 @@ void update_mon(int m_idx, bool full) /* Visible */ if (flag) { - /* Memorize flags */ - if (do_invisible) r_ptr->r_flags2 |= (RF2_INVISIBLE); - if (do_cold_blood) r_ptr->r_flags2 |= (RF2_COLD_BLOOD); + if (is_original_ap(m_ptr) && !p_ptr->image) + { + /* Memorize flags */ + if (do_invisible) r_ptr->r_flags2 |= (RF2_INVISIBLE); + if (do_cold_blood) r_ptr->r_flags2 |= (RF2_COLD_BLOOD); + } } } } @@ -2486,13 +2582,16 @@ void update_mon(int m_idx, bool full) if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH); /* Hack -- Count "fresh" sightings */ - if ((m_ptr->ap_r_idx == MON_KAGE) && (r_info[MON_KAGE].r_sights < MAX_SHORT)) - r_info[MON_KAGE].r_sights++; - else if (m_ptr->ap_r_idx == m_ptr->r_idx && - r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++; + if (!p_ptr->image) + { + if ((m_ptr->ap_r_idx == MON_KAGE) && (r_info[MON_KAGE].r_sights < MAX_SHORT)) + r_info[MON_KAGE].r_sights++; + else if (is_original_ap(m_ptr) && (r_ptr->r_sights < MAX_SHORT)) + r_ptr->r_sights++; + } /* Eldritch Horror */ - if (r_ptr->flags2 & RF2_ELDRITCH_HORROR) + if (r_info[m_ptr->ap_r_idx].flags2 & RF2_ELDRITCH_HORROR) { sanity_blast(m_ptr, FALSE); } @@ -2501,7 +2600,7 @@ void update_mon(int m_idx, bool full) if (disturb_near && (projectable(m_ptr->fy, m_ptr->fx, py, px) && projectable(py, px, m_ptr->fy, m_ptr->fx))) { if (disturb_pets || is_hostile(m_ptr)) - disturb(1, 0); + disturb(1, 1); } } } @@ -2523,10 +2622,10 @@ void update_mon(int m_idx, bool full) if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH); /* Disturb on disappearance */ - if (disturb_move) + if (do_disturb) { if (disturb_pets || is_hostile(m_ptr)) - disturb(1, 0); + disturb(1, 1); } } } @@ -2542,10 +2641,10 @@ void update_mon(int m_idx, bool full) m_ptr->mflag |= (MFLAG_VIEW); /* Disturb on appearance */ - if (disturb_move) + if (do_disturb) { if (disturb_pets || is_hostile(m_ptr)) - disturb(1, 0); + disturb(1, 1); } } } @@ -2560,10 +2659,10 @@ void update_mon(int m_idx, bool full) m_ptr->mflag &= ~(MFLAG_VIEW); /* Disturb on disappearance */ - if (disturb_move) + if (do_disturb) { if (disturb_pets || is_hostile(m_ptr)) - disturb(1, 0); + disturb(1, 1); } } } @@ -2608,22 +2707,18 @@ static bool monster_hook_chameleon_lord(int r_idx) if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE)) return FALSE; - if (!monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, r_ptr)) return FALSE; + if (!monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE; /* Not born */ if (!(old_r_ptr->flags7 & RF7_CHAMELEON)) { - if ((m_ptr->sub_align & SUB_ALIGN_EVIL) && (r_ptr->flags3 & RF3_GOOD)) return FALSE; - if ((m_ptr->sub_align & SUB_ALIGN_GOOD) && (r_ptr->flags3 & RF3_EVIL)) return FALSE; + if (monster_has_hostile_align(m_ptr, 0, 0, r_ptr)) return FALSE; } /* Born now */ else if (summon_specific_who > 0) { - monster_type *sm_ptr = &m_list[summon_specific_who]; - - if ((sm_ptr->sub_align & SUB_ALIGN_EVIL) && (r_ptr->flags3 & RF3_GOOD)) return FALSE; - if ((sm_ptr->sub_align & SUB_ALIGN_GOOD) && (r_ptr->flags3 & RF3_EVIL)) return FALSE; + if (monster_has_hostile_align(&m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE; } return TRUE; @@ -2642,7 +2737,7 @@ static bool monster_hook_chameleon(int r_idx) if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE)) return FALSE; - if (!monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, r_ptr)) return FALSE; + if (!monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE; /* Not born */ if (!(old_r_ptr->flags7 & RF7_CHAMELEON)) @@ -2655,10 +2750,7 @@ static bool monster_hook_chameleon(int r_idx) /* Born now */ else if (summon_specific_who > 0) { - monster_type *sm_ptr = &m_list[summon_specific_who]; - - if ((sm_ptr->sub_align & SUB_ALIGN_EVIL) && (r_ptr->flags3 & RF3_GOOD)) return FALSE; - if ((sm_ptr->sub_align & SUB_ALIGN_GOOD) && (r_ptr->flags3 & RF3_EVIL)) return FALSE; + if (monster_has_hostile_align(&m_list[summon_specific_who], 0, 0, r_ptr)) return FALSE; } return (*(get_monster_hook()))(r_idx); @@ -2667,12 +2759,12 @@ static bool monster_hook_chameleon(int r_idx) void choose_new_monster(int m_idx, bool born, int r_idx) { - int oldmaxhp, i; + int oldmaxhp; monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr; char old_m_name[80]; - int old_r_idx = m_ptr->r_idx; bool old_unique = FALSE; + int old_r_idx = m_ptr->r_idx; if (r_info[m_ptr->r_idx].flags1 & RF1_UNIQUE) old_unique = TRUE; @@ -2709,10 +2801,19 @@ void choose_new_monster(int m_idx, bool born, int r_idx) if (!r_idx) return; } + if (is_pet(m_ptr)) check_pets_num_and_align(m_ptr, FALSE); + m_ptr->r_idx = r_idx; m_ptr->ap_r_idx = r_idx; update_mon(m_idx, FALSE); lite_spot(m_ptr->fy, m_ptr->fx); + + if ((r_info[old_r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) || + (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))) + p_ptr->update |= (PU_MON_LITE); + + if (is_pet(m_ptr)) check_pets_num_and_align(m_ptr, TRUE); + if (born) { /* Sub-alignment of a chameleon */ @@ -2743,17 +2844,7 @@ void choose_new_monster(int m_idx, bool born, int r_idx) } /* Extract the monster base speed */ - m_ptr->mspeed = r_ptr->speed; - /* Hack -- small racial variety */ - /* Allow some small variation per monster */ - if(one_in_(4)){ - i = extract_energy[r_ptr->speed] / 3; - if (i) m_ptr->mspeed += rand_spread(0, i); - } - else{ - i = extract_energy[r_ptr->speed] / 10; - if (i) m_ptr->mspeed += rand_spread(0, i); - } + m_ptr->mspeed = get_mspeed(r_ptr); oldmaxhp = m_ptr->max_maxhp; /* Assign maximal hitpoints */ @@ -2765,8 +2856,20 @@ void choose_new_monster(int m_idx, bool born, int r_idx) { m_ptr->max_maxhp = damroll(r_ptr->hdice, r_ptr->hside); } + + /* Monsters have double hitpoints in Nightmare mode */ + if (ironman_nightmare) + { + u32b hp = m_ptr->max_maxhp * 2L; + m_ptr->max_maxhp = (s16b)MIN(30000, hp); + } + m_ptr->maxhp = (long)(m_ptr->maxhp * m_ptr->max_maxhp) / oldmaxhp; + if (m_ptr->maxhp < 1) m_ptr->maxhp = 1; m_ptr->hp = (long)(m_ptr->hp * m_ptr->max_maxhp) / oldmaxhp; + + /* reset dealt_damage */ + m_ptr->dealt_damage = 0; } @@ -2794,7 +2897,7 @@ static bool monster_hook_tanuki(int r_idx) */ static int initial_r_appearance(int r_idx) { - int attempts = 1000; + int attempts = 1000; int ap_r_idx; int min = MIN(base_level-5, 50); @@ -2815,14 +2918,36 @@ static int initial_r_appearance(int r_idx) /* - * Attempt to place a monster of the given race at the given location. - * - * To give the player a sporting chance, any monster that appears in - * line-of-sight and is extremely dangerous can be marked as - * "FORCE_SLEEP", which will cause them to be placed with low energy, - * which often (but not always) lets the player move before they do. - * - * This routine refuses to place out-of-depth "FORCE_DEPTH" monsters. + * Get initial monster speed + */ +byte get_mspeed(monster_race *r_ptr) +{ + /* Extract the monster base speed */ + int mspeed = r_ptr->speed; + + /* Hack -- small racial variety */ + if (!(r_ptr->flags1 & RF1_UNIQUE) && !p_ptr->inside_arena) + { + /* Allow some small variation per monster */ + int i = SPEED_TO_ENERGY(r_ptr->speed) / (one_in_(4) ? 3 : 10); + if (i) mspeed += rand_spread(0, i); + } + + if (mspeed > 199) mspeed = 199; + + return (byte)mspeed; +} + + +/* + * Attempt to place a monster of the given race at the given location. + * + * To give the player a sporting chance, any monster that appears in + * line-of-sight and is extremely dangerous can be marked as + * "FORCE_SLEEP", which will cause them to be placed with low energy, + * which often (but not always) lets the player move before they do. + * + * This routine refuses to place out-of-depth "FORCE_DEPTH" monsters. * * XXX XXX XXX Use special "here" and "dead" flags for unique monsters, * remove old "cur_num" and "max_num" fields. @@ -2833,12 +2958,10 @@ static int initial_r_appearance(int r_idx) * This is the only function which may place a monster in the dungeon, * except for the savefile loading code. */ -bool place_monster_one(int who, int y, int x, int r_idx, u32b mode) +static bool place_monster_one(int who, int y, int x, int r_idx, u32b mode) { - int i; - int rune_dam = 0; - - cave_type *c_ptr; + /* Access the location */ + cave_type *c_ptr = &cave[y][x]; monster_type *m_ptr; @@ -2846,53 +2969,40 @@ bool place_monster_one(int who, int y, int x, int r_idx, u32b mode) cptr name = (r_name + r_ptr->name); - /* DO NOT PLACE A MONSTER IN THE SMALL SCALE WILDERNESS !!! */ - if(p_ptr->wild_mode) return FALSE; + int cmi; + + /* DO NOT PLACE A MONSTER IN THE SMALL SCALE WILDERNESS !!! */ + if (p_ptr->wild_mode) return FALSE; /* Verify location */ if (!in_bounds(y, x)) return (FALSE); - /* Require empty space (if not ghostly) */ - if (!(!dun_level && (cave[y][x].feat == FEAT_MOUNTAIN) && ((r_ptr->flags8 & RF8_WILD_MOUNTAIN) || (r_ptr->flags7 & RF7_CAN_FLY))) && - !(cave_empty_bold2(y, x) || (mode & PM_IGNORE_TERRAIN)) && - !((r_ptr->flags2 & RF2_PASS_WALL) && - !(cave_perma_bold(y, x) || cave[y][x].m_idx || - ((y == py) && (x == px))))) return (FALSE); - /* Paranoia */ if (!r_idx) return (FALSE); /* Paranoia */ if (!r_ptr->name) return (FALSE); -#if 0 - /* Hack -- no creation on glyph of warding */ - if (cave[y][x].feat == FEAT_GLYPH) return (FALSE); - if (cave[y][x].feat == FEAT_MINOR_GLYPH) return (FALSE); -#endif - - /* Nor on the Pattern */ - if ((cave[y][x].feat >= FEAT_PATTERN_START) - && (cave[y][x].feat <= FEAT_PATTERN_XTRA2)) - return (FALSE); - - if (!(mode & PM_IGNORE_TERRAIN) && - !monster_can_cross_terrain(cave[y][x].feat, r_ptr)) + if (!(mode & PM_IGNORE_TERRAIN)) { - return FALSE; + /* Not on the Pattern */ + if (pattern_tile(y, x)) return FALSE; + + /* Require empty space (if not ghostly) */ + if (!monster_can_enter(y, x, r_ptr, 0)) return FALSE; } if (!p_ptr->inside_battle) { /* Hack -- "unique" monsters must be "unique" */ if (((r_ptr->flags1 & (RF1_UNIQUE)) || - (r_ptr->flags7 & (RF7_UNIQUE_7))) && + (r_ptr->flags7 & (RF7_NAZGUL))) && (r_ptr->cur_num >= r_ptr->max_num)) { /* Cannot create */ return (FALSE); } - + if ((r_ptr->flags7 & (RF7_UNIQUE2)) && (r_ptr->cur_num >= 1)) { @@ -2904,7 +3014,7 @@ bool place_monster_one(int who, int y, int x, int r_idx, u32b mode) if (r_info[MON_BANOR].cur_num > 0) return FALSE; if (r_info[MON_LUPART].cur_num > 0) return FALSE; } - + /* Depth monsters may NOT be created out of depth, unless in Nightmare mode */ if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (dun_level < r_ptr->level) && (!ironman_nightmare || (r_ptr->flags1 & (RF1_QUESTOR)))) @@ -2914,10 +3024,10 @@ bool place_monster_one(int who, int y, int x, int r_idx, u32b mode) } } - if(quest_number(dun_level)) + if (quest_number(dun_level)) { int hoge = quest_number(dun_level); - if((quest[hoge].type == QUEST_TYPE_KILL_LEVEL) || (quest[hoge].type == QUEST_TYPE_RANDOM)) + if ((quest[hoge].type == QUEST_TYPE_KILL_LEVEL) || (quest[hoge].type == QUEST_TYPE_RANDOM)) { if(r_idx == quest[hoge].r_idx) { @@ -2936,10 +3046,7 @@ bool place_monster_one(int who, int y, int x, int r_idx, u32b mode) } } - /* Access the location */ - c_ptr = &cave[y][x]; - - if (c_ptr->feat == FEAT_GLYPH) + if (is_glyph_grid(c_ptr)) { if (randint1(BREAK_GLYPH) < (r_ptr->level+20)) { @@ -2958,11 +3065,11 @@ msg_print(" c_ptr->info &= ~(CAVE_MARK); /* Break the rune */ - c_ptr->feat = floor_type[randint0(100)]; + c_ptr->info &= ~(CAVE_OBJECT); + c_ptr->mimic = 0; /* Notice */ note_spot(y, x); - rune_dam = 1000; } else return FALSE; } @@ -2979,10 +3086,6 @@ msg_print(" #else if (cheat_hear) msg_format("Deep Unique (%s).", name); #endif - - - /* Boost rating by twice delta-depth */ - rating += (r_ptr->level - dun_level) * 2; } /* Normal monsters */ @@ -2994,10 +3097,6 @@ msg_print(" #else if (cheat_hear) msg_format("Deep Monster (%s).", name); #endif - - - /* Boost rating by delta-depth */ - rating += (r_ptr->level - dun_level); } } @@ -3013,7 +3112,7 @@ msg_print(" } - if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7) || (r_ptr->level < 10)) is_kage = FALSE; + if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL) || (r_ptr->level < 10)) mode &= ~PM_KAGE; /* Make a new monster */ c_ptr->m_idx = m_pop(); @@ -3030,6 +3129,19 @@ msg_print(" m_ptr->r_idx = r_idx; m_ptr->ap_r_idx = initial_r_appearance(r_idx); + /* No flags */ + m_ptr->mflag = 0; + m_ptr->mflag2 = 0; + + /* Hack -- Appearance transfer */ + if ((mode & PM_MULTIPLY) && (who > 0) && !is_original_ap(&m_list[who])) + { + m_ptr->ap_r_idx = m_list[who].ap_r_idx; + + /* Hack -- Shadower spawns Shadower */ + if (m_list[who].mflag2 & MFLAG2_KAGE) m_ptr->mflag2 |= MFLAG2_KAGE; + } + /* Sub-alignment of a monster */ if ((who > 0) && !(r_ptr->flags3 & (RF3_EVIL | RF3_GOOD))) m_ptr->sub_align = m_list[who].sub_align; @@ -3045,10 +3157,8 @@ msg_print(" m_ptr->fx = x; - /* No "damage" yet */ - m_ptr->stunned = 0; - m_ptr->confused = 0; - m_ptr->monfear = 0; + /* No "timed status" yet */ + for (cmi = 0; cmi < MAX_MTIMED; cmi++) m_ptr->mtimed[cmi] = 0; /* Unknown distance */ m_ptr->cdis = 0; @@ -3059,28 +3169,35 @@ msg_print(" m_ptr->exp = 0; - /* No flags */ - m_ptr->mflag = 0; - m_ptr->mflag2 = 0; + + /* Your pet summons its pet. */ + if (who > 0 && is_pet(&m_list[who])) + { + mode |= PM_FORCE_PET; + m_ptr->parent_m_idx = who; + } + else + { + m_ptr->parent_m_idx = 0; + } if (r_ptr->flags7 & RF7_CHAMELEON) { choose_new_monster(c_ptr->m_idx, TRUE, 0); r_ptr = &r_info[m_ptr->r_idx]; - m_ptr->mflag2 |= MFLAG_CHAMELEON; - rating++; + m_ptr->mflag2 |= MFLAG2_CHAMELEON; /* Hack - Set sub_align to neutral when the Chameleon Lord is generated as "GUARDIAN" */ if ((r_ptr->flags1 & RF1_UNIQUE) && (who <= 0)) m_ptr->sub_align = SUB_ALIGN_NEUTRAL; } - else if (is_kage) + else if ((mode & PM_KAGE) && !(mode & PM_FORCE_PET)) { m_ptr->ap_r_idx = MON_KAGE; - m_ptr->mflag2 |= MFLAG_KAGE; + m_ptr->mflag2 |= MFLAG2_KAGE; } - if (mode & PM_NO_PET) m_ptr->mflag2 |= MFLAG_NOPET; + if (mode & PM_NO_PET) m_ptr->mflag2 |= MFLAG2_NOPET; /* Not visible */ m_ptr->ml = FALSE; @@ -3094,21 +3211,17 @@ msg_print(" else if ((r_ptr->flags7 & RF7_FRIENDLY) || (mode & PM_FORCE_FRIENDLY) || is_friendly_idx(who)) { - if (!(p_ptr->align >= 0 && (r_ptr->flags3 & RF3_EVIL)) && - !(p_ptr->align < 0 && (r_ptr->flags3 & RF3_GOOD))) - { - set_friendly(m_ptr); - } + if (!monster_has_hostile_align(NULL, 0, -1, r_ptr)) set_friendly(m_ptr); } /* Assume no sleeping */ - m_ptr->csleep = 0; + m_ptr->mtimed[MTIMED_CSLEEP] = 0; /* Enforce sleeping if needed */ if ((mode & PM_ALLOW_SLEEP) && r_ptr->sleep && !ironman_nightmare) { int val = r_ptr->sleep; - m_ptr->csleep = ((val * 2) + randint1(val * 10)); + (void)set_monster_csleep(c_ptr->m_idx, (val * 2) + randint1(val * 10)); } /* Assign maximal hitpoints */ @@ -3135,28 +3248,16 @@ msg_print(" if (m_ptr->r_idx == MON_WOUNDED_BEAR) m_ptr->hp = m_ptr->maxhp / 2; else m_ptr->hp = m_ptr->maxhp; + + + /* dealt damage is 0 at initial*/ + m_ptr->dealt_damage = 0; /* Extract the monster base speed */ - m_ptr->mspeed = r_ptr->speed; + m_ptr->mspeed = get_mspeed(r_ptr); - /* Hack -- small racial variety */ - if (!(r_ptr->flags1 & RF1_UNIQUE) && !p_ptr->inside_arena) - { - /* Allow some small variation per monster */ - if(one_in_(4)){ - i = extract_energy[r_ptr->speed] / 3; - if (i) m_ptr->mspeed += rand_spread(0, i); - } - else{ - i = extract_energy[r_ptr->speed] / 10; - if (i) m_ptr->mspeed += rand_spread(0, i); - } - } - - if (mode & PM_HASTE) m_ptr->fast = 100; - - if (m_ptr->mspeed > 199) m_ptr->mspeed = 199; + if (mode & PM_HASTE) (void)set_monster_fast(c_ptr->m_idx, 100); /* Give a random starting energy */ if (!ironman_nightmare) @@ -3187,23 +3288,35 @@ msg_print(" } + if (r_ptr->flags7 & RF7_SELF_LD_MASK) + p_ptr->update |= (PU_MON_LITE); + else if ((r_ptr->flags7 & RF7_HAS_LD_MASK) && !MON_CSLEEP(m_ptr)) + p_ptr->update |= (PU_MON_LITE); + /* Update the monster */ update_mon(c_ptr->m_idx, TRUE); - /* Hack -- Count the monsters on the level */ - if (m_ptr->mflag2 & MFLAG_CHAMELEON) - r_info[r_idx].cur_num++; - else - r_ptr->cur_num++; + /* Count the monsters on the level */ + real_r_ptr(m_ptr)->cur_num++; + /* + * Memorize location of the unique monster in saved floors. + * A unique monster move from old saved floor. + */ + if (character_dungeon && + ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))) + real_r_ptr(m_ptr)->floor_id = p_ptr->floor_id; /* Hack -- Count the number of "reproducers" */ if (r_ptr->flags2 & RF2_MULTIPLY) num_repro++; - /* Hack -- Notice new multi-hued monsters */ - if (r_ptr->flags1 & RF1_ATTR_MULTI) shimmer_monsters = TRUE; + { + monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx]; + if (ap_r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)) + shimmer_monsters = TRUE; + } if (p_ptr->warning && character_dungeon) { @@ -3251,16 +3364,27 @@ msg_print(" #endif o_ptr = choose_warning_item(); - object_desc(o_name, o_ptr, FALSE, 0); + if (o_ptr) + { + object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); +#ifdef JP + msg_format("%s¤Ï%s¸÷¤Ã¤¿¡£", o_name, color); +#else + msg_format("%s glows %s.", o_name, color); +#endif + } + else + { #ifdef JP - msg_format("%s¤Ï%s¸÷¤Ã¤¿¡£",o_name, color); + msg_format("%s¸÷¤ëʪ¤¬Æ¬¤ËÉ⤫¤ó¤À¡£", color); #else - msg_format("%s glows %s.",o_name, color); + msg_format("An %s image forms in your mind."); #endif + } } } - if (c_ptr->feat == FEAT_MINOR_GLYPH) + if (is_explosive_rune_grid(c_ptr)) { /* Break the ward */ if (randint1(BREAK_MINOR_GLYPH) > r_ptr->level) @@ -3290,7 +3414,9 @@ msg_print(" c_ptr->info &= ~(CAVE_MARK); /* Break the rune */ - c_ptr->feat = floor_type[randint0(100)]; + c_ptr->info &= ~(CAVE_OBJECT); + c_ptr->mimic = 0; + note_spot(y, x); lite_spot(y, x); } @@ -3306,7 +3432,7 @@ msg_print(" #define MON_SCAT_MAXD 10 -static bool mon_scatter(int *yp, int *xp, int y, int x, int max_dist) +static bool mon_scatter(int r_idx, int *yp, int *xp, int y, int x, int max_dist) { int place_x[MON_SCAT_MAXD]; int place_y[MON_SCAT_MAXD]; @@ -3321,45 +3447,47 @@ static bool mon_scatter(int *yp, int *xp, int y, int x, int max_dist) num[i] = 0; for (nx = x - max_dist; nx <= x + max_dist; nx++) + { for (ny = y - max_dist; ny <= y + max_dist; ny++) { /* Ignore annoying locations */ if (!in_bounds(ny, nx)) continue; - - /* Require "line of sight" */ - if (!los(y, x, ny, nx)) continue; - - /* Walls and Monsters block flow */ - if (!cave_empty_bold2(ny, nx)) continue; - if (cave[ny][nx].m_idx) continue; - if ((ny == py) && (nx == px)) continue; - -#if 0 - /* Hack -- no summon on glyph of warding */ - if (cave[ny][nx].feat == FEAT_GLYPH) continue; - if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue; -#endif - - /* ... nor on the Pattern */ - if ((cave[ny][nx].feat >= FEAT_PATTERN_START) && - (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2)) - continue; - + + /* Require "line of projection" */ + if (!projectable(y, x, ny, nx)) continue; + + if (r_idx > 0) + { + monster_race *r_ptr = &r_info[r_idx]; + + /* Require empty space (if not ghostly) */ + if (!monster_can_enter(ny, nx, r_ptr, 0)) + continue; + } + else + { + /* Walls and Monsters block flow */ + if (!cave_empty_bold2(ny, nx)) continue; + + /* ... nor on the Pattern */ + if (pattern_tile(ny, nx)) continue; + } + i = distance(y, x, ny, nx); if (i > max_dist) continue; - + num[i]++; /* random swap */ - if(one_in_(num[i])) + if (one_in_(num[i])) { place_x[i] = nx; place_y[i] = ny; } - } + } i = 0; while (i < MON_SCAT_MAXD && 0 == num[i]) @@ -3387,7 +3515,7 @@ static bool place_monster_group(int who, int y, int x, int r_idx, u32b mode) { monster_race *r_ptr = &r_info[r_idx]; - int old, n, i; + int n, i; int total = 0, extra = 0; int hack_n = 0; @@ -3426,9 +3554,6 @@ static bool place_monster_group(int who, int y, int x, int r_idx, u32b mode) if (total > GROUP_MAX) total = GROUP_MAX; - /* Save the rating */ - old = rating; - /* Start on the monster */ hack_n = 1; hack_x[0] = x; @@ -3462,9 +3587,6 @@ static bool place_monster_group(int who, int y, int x, int r_idx, u32b mode) } } - /* Hack -- restore the rating */ - rating = old; - /* Success */ return (TRUE); @@ -3488,7 +3610,7 @@ static bool place_monster_okay(int r_idx) monster_race *z_ptr = &r_info[r_idx]; /* Hack - Escorts have to have the same dungeon flag */ - if (monster_dungeon(place_monster_idx) != monster_dungeon(r_idx)) return (FALSE); + if (mon_hook_dungeon(place_monster_idx) != mon_hook_dungeon(r_idx)) return (FALSE); /* Require similar "race" */ if (z_ptr->d_char != r_ptr->d_char) return (FALSE); @@ -3503,15 +3625,11 @@ static bool place_monster_okay(int r_idx) if (place_monster_idx == r_idx) return (FALSE); /* Skip different alignment */ - if (((m_ptr->sub_align & SUB_ALIGN_EVIL) && (z_ptr->flags3 & RF3_GOOD)) || - ((m_ptr->sub_align & SUB_ALIGN_GOOD) && (z_ptr->flags3 & RF3_EVIL))) - return FALSE; + if (monster_has_hostile_align(m_ptr, 0, 0, z_ptr)) return FALSE; if (r_ptr->flags7 & RF7_FRIENDLY) { - if (((p_ptr->align < 0) && (z_ptr->flags3 & RF3_GOOD)) || - ((p_ptr->align > 0) && (z_ptr->flags3 & RF3_EVIL))) - return FALSE; + if (monster_has_hostile_align(NULL, 1, -1, z_ptr)) return FALSE; } if ((r_ptr->flags7 & RF7_CHAMELEON) && !(z_ptr->flags7 & RF7_CHAMELEON)) @@ -3542,23 +3660,33 @@ static bool place_monster_okay(int r_idx) */ bool place_monster_aux(int who, int y, int x, int r_idx, u32b mode) { - int i; + int i, j, n; monster_race *r_ptr = &r_info[r_idx]; - if (one_in_(333) && !(mode & PM_NO_KAGE) && !(mode & PM_FORCE_PET)) - is_kage = TRUE; - else - is_kage = FALSE; + if (!(mode & PM_NO_KAGE) && one_in_(333)) + mode |= PM_KAGE; /* Place one monster, or fail */ if (!place_monster_one(who, y, x, r_idx, mode)) return (FALSE); - /* Require the "group" flag */ if (!(mode & PM_ALLOW_GROUP)) return (TRUE); place_monster_m_idx = hack_m_idx_ii; + /* Reinforcement */ + for(i = 0; i < 6; i++) + { + if(!r_ptr->reinforce_id[i]) break; + n = damroll(r_ptr->reinforce_dd[i], r_ptr->reinforce_ds[i]); + for(j = 0; j < n; j++) + { + int nx, ny, z, d = 7; + scatter(&ny, &nx, y, x, d, 0); + (void)place_monster_one(place_monster_m_idx, ny, nx, r_ptr->reinforce_id[i], mode); + } + } + /* Friends for certain monsters */ if (r_ptr->flags1 & (RF1_FRIENDS)) { @@ -3566,7 +3694,6 @@ bool place_monster_aux(int who, int y, int x, int r_idx, u32b mode) (void)place_monster_group(who, y, x, r_idx, mode); } - /* Escorts for certain monsters */ if (r_ptr->flags1 & (RF1_ESCORT)) { @@ -3668,9 +3795,6 @@ bool alloc_horde(int y, int x) } if (attempts < 1) return FALSE; - if (r_ptr->flags3 & RF3_GOOD) horde_align |= HORDE_NOEVIL; - if (r_ptr->flags3 & RF3_EVIL) horde_align |= HORDE_NOGOOD; - attempts = 1000; while (--attempts) @@ -3679,11 +3803,11 @@ bool alloc_horde(int y, int x) if (place_monster_aux(0, y, x, r_idx, 0L)) break; } - if (attempts < 1) {horde_align = 0;return FALSE;} + if (attempts < 1) return FALSE; m_idx = cave[y][x].m_idx; - if (m_list[m_idx].mflag2 & MFLAG_CHAMELEON) r_ptr = &r_info[m_list[m_idx].r_idx]; + if (m_list[m_idx].mflag2 & MFLAG2_CHAMELEON) r_ptr = &r_info[m_list[m_idx].r_idx]; summon_kin_type = r_ptr->d_char; for (attempts = randint1(10) + 5; attempts; attempts--) @@ -3696,13 +3820,49 @@ bool alloc_horde(int y, int x) x = cx; } - horde_align = 0; return TRUE; } #endif /* MONSTER_HORDES */ +/* + * Put the Guardian + */ +bool alloc_guardian(bool def_val) +{ + int guardian = d_info[dungeon_type].final_guardian; + + if (guardian && (d_info[dungeon_type].maxdepth == dun_level) && (r_info[guardian].cur_num < r_info[guardian].max_num)) + { + int oy; + int ox; + int try_count = 4000; + + /* Find a good position */ + while (try_count) + { + /* Get a random spot */ + oy = randint1(cur_hgt - 4) + 2; + ox = randint1(cur_wid - 4) + 2; + + /* Is it a good spot ? */ + if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[guardian], 0)) + { + /* Place the guardian */ + if (place_monster_aux(0, oy, ox, guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) return TRUE; + } + + /* One less try count */ + try_count--; + } + + return FALSE; + } + + return def_val; +} + /* * Attempt to allocate a random monster in the dungeon. @@ -3717,33 +3877,9 @@ bool alloc_monster(int dis, u32b mode) { int y = 0, x = 0; int attempts_left = 10000; - int guardian = d_info[dungeon_type].final_guardian; - - /* Put an Guardian */ - if(guardian && d_info[dungeon_type].maxdepth == dun_level && r_info[guardian].cur_num < r_info[guardian].max_num ) - { - int oy; - int ox; - int try = 4000; - - /* Find a good position */ - while(try) - { - /* Get a random spot */ - oy = randint1(cur_hgt - 4) + 2; - ox = randint1(cur_wid - 4) + 2; - - /* Is it a good spot ? */ - if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[guardian])) - { - /* Place the guardian */ - if (place_monster_aux(0, oy, ox, guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) break; - } - /* One less try */ - try--; - } - } + /* Put the Guardian */ + if (alloc_guardian(FALSE)) return TRUE; /* Find a legal, distant, unoccupied, space */ while (attempts_left--) @@ -3753,13 +3889,13 @@ bool alloc_monster(int dis, u32b mode) x = randint0(cur_wid); /* Require empty floor grid (was "naked") */ - if (dun_level || (wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].terrain != TERRAIN_MOUNTAIN)) + if (dun_level) { if (!cave_empty_bold2(y, x)) continue; } else { - if (!cave_empty_bold2(y, x) && (cave[y][x].feat != FEAT_MOUNTAIN)) continue; + if (!cave_empty_bold(y, x)) continue; } /* Accept far away grids */ @@ -3788,9 +3924,9 @@ msg_print(" if (alloc_horde(y, x)) { #ifdef JP -if (cheat_hear) msg_print("¥â¥ó¥¹¥¿¡¼¤ÎÂç·²"); + if (cheat_hear) msg_format("¥â¥ó¥¹¥¿¡¼¤ÎÂç·²(%c)", summon_kin_type); #else - if (cheat_hear) msg_print("Monster horde."); + if (cheat_hear) msg_format("Monster horde (%c).", summon_kin_type); #endif return (TRUE); @@ -3822,7 +3958,7 @@ static bool summon_specific_okay(int r_idx) monster_race *r_ptr = &r_info[r_idx]; /* Hack - Only summon dungeon monsters */ - if (!monster_dungeon(r_idx)) return (FALSE); + if (!mon_hook_dungeon(r_idx)) return (FALSE); /* Hack -- identify the summoning monster */ if (summon_specific_who > 0) @@ -3832,48 +3968,28 @@ static bool summon_specific_okay(int r_idx) /* Do not summon enemies */ /* Friendly vs. opposite aligned normal or pet */ - if (((r_ptr->flags3 & RF3_EVIL) && - (m_ptr->sub_align & SUB_ALIGN_GOOD)) || - ((r_ptr->flags3 & RF3_GOOD) && - (m_ptr->sub_align & SUB_ALIGN_EVIL))) - { - return FALSE; - } - - /* Hostile vs. non-hostile */ - if (is_hostile(m_ptr) != summon_specific_hostile) - { - return FALSE; - } + if (monster_has_hostile_align(m_ptr, 0, 0, r_ptr)) return FALSE; } /* Use the player's alignment */ else if (summon_specific_who < 0) { /* Do not summon enemies of the pets */ - if ((p_ptr->align < -9) && (r_ptr->flags3 & RF3_GOOD)) - { - if (!one_in_((0-p_ptr->align)/2+1)) return FALSE; - } - else if ((p_ptr->align > 9) && (r_ptr->flags3 & RF3_EVIL)) + if (monster_has_hostile_align(NULL, 10, -10, r_ptr)) { - if (!one_in_(p_ptr->align/2+1)) return FALSE; + if (!one_in_(ABS(p_ptr->align) / 2 + 1)) return FALSE; } } /* Hack -- no specific type specified */ if (!summon_specific_type) return (TRUE); - if (!summon_unique_okay && ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))) return FALSE; + if (!summon_unique_okay && ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))) return FALSE; if ((summon_specific_who < 0) && - ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7)) && - (((p_ptr->align > 9) && (r_ptr->flags3 & RF3_EVIL)) || - ((p_ptr->align < -9) && (r_ptr->flags3 & RF3_GOOD)))) + ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) && + monster_has_hostile_align(NULL, 10, -10, r_ptr)) return FALSE; - if ((horde_align & HORDE_NOGOOD) && (r_ptr->flags3 & RF3_GOOD)) return FALSE; - if ((horde_align & HORDE_NOEVIL) && (r_ptr->flags3 & RF3_EVIL)) return FALSE; - if ((r_ptr->flags7 & RF7_CHAMELEON) && (d_info[dungeon_type].flags1 & DF1_CHAMELEON)) return TRUE; return (summon_specific_aux(r_idx)); @@ -3910,7 +4026,7 @@ bool summon_specific(int who, int y1, int x1, int lev, int type, u32b mode) if (p_ptr->inside_arena) return (FALSE); - if (!mon_scatter(&y, &x, y1, x1, 2)) return FALSE; + if (!mon_scatter(0, &y, &x, y1, x1, 2)) return FALSE; /* Save the summoner */ summon_specific_who = who; @@ -3920,9 +4036,6 @@ bool summon_specific(int who, int y1, int x1, int lev, int type, u32b mode) summon_unique_okay = (mode & PM_ALLOW_UNIQUE) ? TRUE : FALSE; - /* Save the hostility */ - summon_specific_hostile = (!(mode & PM_FORCE_FRIENDLY) && !(is_friendly_idx(who)) && !(mode & PM_FORCE_PET)); - /* Prepare allocation table */ get_mon_num_prep(summon_specific_okay, get_monster_hook2(y, x)); @@ -3963,7 +4076,7 @@ bool summon_named_creature (int who, int oy, int ox, int r_idx, u32b mode) if (p_ptr->inside_arena) return FALSE; - if (!mon_scatter(&y, &x, oy, ox, 2)) return FALSE; + if (!mon_scatter(r_idx, &y, &x, oy, ox, 2)) return FALSE; /* Place it (allow groups) */ return place_monster_aux(who, y, x, r_idx, (mode | PM_NO_KAGE)); @@ -3981,19 +4094,20 @@ bool multiply_monster(int m_idx, bool clone, u32b mode) int y, x; - if (!mon_scatter(&y, &x, m_ptr->fy, m_ptr->fx, 1)) + if (!mon_scatter(m_ptr->r_idx, &y, &x, m_ptr->fy, m_ptr->fx, 1)) return FALSE; - if (m_ptr->mflag2 & MFLAG_NOPET) mode |= PM_NO_PET; + if (m_ptr->mflag2 & MFLAG2_NOPET) mode |= PM_NO_PET; /* Create a new monster (awake, no groups) */ - if (!place_monster_aux(m_idx, y, x, m_ptr->r_idx, (mode | PM_NO_KAGE))) + if (!place_monster_aux(m_idx, y, x, m_ptr->r_idx, (mode | PM_NO_KAGE | PM_MULTIPLY))) return FALSE; - if (clone) + /* Hack -- Transfer "clone" flag */ + if (clone || (m_ptr->smart & SM_CLONED)) { m_list[hack_m_idx_ii].smart |= SM_CLONED; - m_list[hack_m_idx_ii].mflag2 |= MFLAG_NOPET; + m_list[hack_m_idx_ii].mflag2 |= MFLAG2_NOPET; } return TRUE; @@ -4018,19 +4132,16 @@ void message_pain(int m_idx, int dam) char m_name[80]; - /* Get the monster name */ monster_desc(m_name, m_ptr, 0); - /* Notice non-damage */ - if (dam == 0) + if(dam == 0) // Notice non-damage { #ifdef JP msg_format("%^s¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤¡£", m_name); #else msg_format("%^s is unharmed.", m_name); #endif - return; } @@ -4040,687 +4151,309 @@ void message_pain(int m_idx, int dam) tmp = (newhp * 100L) / oldhp; percentage = (int)(tmp); - - /* Mushrooms, Eyes, Jellies, Molds, Vortices, Worms, Quylthulgs */ - if (strchr(",ejmvwQ", r_ptr->d_char)) + if(my_strchr(",ejmvwQ", r_ptr->d_char)) // Mushrooms, Eyes, Jellies, Molds, Vortices, Worms, Quylthulgs { #ifdef JP - if (percentage > 95) - msg_format("%^s¤Ï¤Û¤È¤ó¤Éµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); - else if (percentage > 75) - msg_format("%^s¤Ï¤·¤ê¹þ¤ß¤·¤¿¡£", m_name); - else if (percentage > 50) - msg_format("%^s¤Ï½Ì¤³¤Þ¤Ã¤¿¡£", m_name); - else if (percentage > 35) - msg_format("%^s¤ÏÄˤߤ˿̤¨¤¿¡£", m_name); - else if (percentage > 20) - msg_format("%^s¤Ï¿È¤â¤À¤¨¤·¤¿¡£", m_name); - else if (percentage > 10) - msg_format("%^s¤Ï¶ìÄˤǿȤâ¤À¤¨¤·¤¿¡£", m_name); - else - msg_format("%^s¤Ï¤°¤Ë¤ã¤°¤Ë¤ã¤ÈáÛÚ»¤·¤¿¡£", m_name); + if(percentage > 95) msg_format("%^s¤Ï¤Û¤È¤ó¤Éµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + else if(percentage > 75) msg_format("%^s¤Ï¤·¤ê¹þ¤ß¤·¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤Ï½Ì¤³¤Þ¤Ã¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤ÏÄˤߤ˿̤¨¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤Ï¿È¤â¤À¤¨¤·¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¶ìÄˤǿȤâ¤À¤¨¤·¤¿¡£", m_name); + else msg_format("%^s¤Ï¤°¤Ë¤ã¤°¤Ë¤ã¤ÈáÛÚ»¤·¤¿¡£", m_name); #else - if (percentage > 95) - msg_format("%^s barely notices.", m_name); - else if (percentage > 75) - msg_format("%^s flinches.", m_name); - else if (percentage > 50) - msg_format("%^s squelches.", m_name); - else if (percentage > 35) - msg_format("%^s quivers in pain.", m_name); - else if (percentage > 20) - msg_format("%^s writhes about.", m_name); - else if (percentage > 10) - msg_format("%^s writhes in agony.", m_name); - else - msg_format("%^s jerks limply.", m_name); + if(percentage > 95) msg_format("%^s barely notices.", m_name); + else if(percentage > 75) msg_format("%^s flinches.", m_name); + else if(percentage > 50) msg_format("%^s squelches.", m_name); + else if(percentage > 35) msg_format("%^s quivers in pain.", m_name); + else if(percentage > 20) msg_format("%^s writhes about.", m_name); + else if(percentage > 10) msg_format("%^s writhes in agony.", m_name); + else msg_format("%^s jerks limply.", m_name); #endif - } - - /* Fish */ - else if (strchr("l", r_ptr->d_char)) + else if(my_strchr("l", r_ptr->d_char)) // Fish { - if (percentage > 95) #ifdef JP -msg_format("%^s¤Ï¤Û¤È¤ó¤Éµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + if(percentage > 95) msg_format("%^s¤Ï¤Û¤È¤ó¤Éµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + else if(percentage > 75) msg_format("%^s¤Ï¤·¤ê¹þ¤ß¤·¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤Ïí´í°¤·¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤ÏÄˤߤ˿̤¨¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤Ï¿È¤â¤À¤¨¤·¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¶ìÄˤǿȤâ¤À¤¨¤·¤¿¡£", m_name); + else msg_format("%^s¤Ï¤°¤Ë¤ã¤°¤Ë¤ã¤ÈáÛÚ»¤·¤¿¡£", m_name); #else - msg_format("%^s barely notices.", m_name); -#endif - else if (percentage > 75) -#ifdef JP -msg_format("%^s¤Ï¤·¤ê¹þ¤ß¤·¤¿¡£", m_name); -#else - msg_format("%^s flinches.", m_name); -#endif - else if (percentage > 50) -#ifdef JP -msg_format("%^s¤Ïí´í°¤·¤¿¡£", m_name); -#else - msg_format("%^s hesitates.", m_name); -#endif - else if (percentage > 35) -#ifdef JP -msg_format("%^s¤ÏÄˤߤ˿̤¨¤¿¡£", m_name); -#else - msg_format("%^s quivers in pain.", m_name); -#endif - else if (percentage > 20) -#ifdef JP -msg_format("%^s¤Ï¿È¤â¤À¤¨¤·¤¿¡£", m_name); -#else - msg_format("%^s writhes about.", m_name); -#endif - else if (percentage > 10) -#ifdef JP -msg_format("%^s¤Ï¶ìÄˤǿȤâ¤À¤¨¤·¤¿¡£", m_name); -#else - msg_format("%^s writhes in agony.", m_name); -#endif - else -#ifdef JP -msg_format("%^s¤Ï¤°¤Ë¤ã¤°¤Ë¤ã¤ÈáÛÚ»¤·¤¿¡£", m_name); -#else - msg_format("%^s jerks limply.", m_name); -#endif + if(percentage > 95) msg_format("%^s barely notices.", m_name); + else if(percentage > 75) msg_format("%^s flinches.", m_name); + else if(percentage > 50) msg_format("%^s hesitates.", m_name); + else if(percentage > 35) msg_format("%^s quivers in pain.", m_name); + else if(percentage > 20) msg_format("%^s writhes about.", m_name); + else if(percentage > 10) msg_format("%^s writhes in agony.", m_name); + else msg_format("%^s jerks limply.", m_name); +#endif } - - /* Golems, Walls, Doors, Stairs */ - else if (strchr("g#+<>", r_ptr->d_char)) - { - if (percentage > 95) -#ifdef JP -msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); -#else - msg_format("%^s ignores the attack.", m_name); -#endif - else if (percentage > 75) -#ifdef JP -msg_format("%s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); -#else - msg_format("%^s shrugs off the attack.", m_name); -#endif - else if (percentage > 50) -#ifdef JP -msg_format("%^s¤ÏÍëÌĤΤ褦¤ËËʤ¨¤¿¡£", m_name); -#else - msg_format("%^s roars thunderously.", m_name); -#endif - else if (percentage > 35) -#ifdef JP -msg_format("%^s¤Ï¶ì¤·¤²¤ËËʤ¨¤¿¡£", m_name); -#else - msg_format("%^s rumbles.", m_name); -#endif - else if (percentage > 20) + else if(my_strchr("g#+<>", r_ptr->d_char)) // Golems, Walls, Doors, Stairs + { #ifdef JP -msg_format("%^s¤Ï¤¦¤á¤¤¤¿¡£", m_name); + if(percentage > 95) msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + else if(percentage > 75) msg_format("%s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤ÏÍëÌĤΤ褦¤ËËʤ¨¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤Ï¶ì¤·¤²¤ËËʤ¨¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤Ï¤¦¤á¤¤¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ïí´í°¤·¤¿¡£", m_name); + else msg_format("%^s¤Ï¤¯¤·¤ã¤¯¤·¤ã¤Ë¤Ê¤Ã¤¿¡£", m_name); #else - msg_format("%^s grunts.", m_name); -#endif - else if (percentage > 10) -#ifdef JP -msg_format("%^s¤Ïí´í°¤·¤¿¡£", m_name); -#else - msg_format("%^s hesitates.", m_name); -#endif - else -#ifdef JP -msg_format("%^s¤Ï¤¯¤·¤ã¤¯¤·¤ã¤Ë¤Ê¤Ã¤¿¡£", m_name); -#else - msg_format("%^s crumples.", m_name); + if(percentage > 95) msg_format("%^s ignores the attack.", m_name); + else if(percentage > 75) msg_format("%^s shrugs off the attack.", m_name); + else if(percentage > 50) msg_format("%^s roars thunderously.", m_name); + else if(percentage > 35) msg_format("%^s rumbles.", m_name); + else if(percentage > 20) msg_format("%^s grunts.", m_name); + else if(percentage > 10) msg_format("%^s hesitates.", m_name); + else msg_format("%^s crumples.", m_name); #endif } - - /* Snakes, Hydrae, Reptiles, Mimics */ - else if (strchr("JMR", r_ptr->d_char) || !isalpha(r_ptr->d_char)) + else if(my_strchr("JMR", r_ptr->d_char) || !isalpha(r_ptr->d_char)) // Snakes, Hydrae, Reptiles, Mimics { - if (percentage > 95) -#ifdef JP -msg_format("%^s¤Ï¤Û¤È¤ó¤Éµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); -#else - msg_format("%^s barely notices.", m_name); -#endif - else if (percentage > 75) -#ifdef JP -msg_format("%^s¤Ï¥·¡¼¥Ã¤ÈÌĤ¤¤¿¡£", m_name); -#else - msg_format("%^s hisses.", m_name); -#endif - else if (percentage > 50) -#ifdef JP -msg_format("%^s¤ÏÅܤäÆƬ¤ò¾å¤²¤¿¡£", m_name); -#else - msg_format("%^s rears up in anger.", m_name); -#endif - else if (percentage > 35) -#ifdef JP -msg_format("%^s¤ÏÌÔÁ³¤È°Ò³Å¤·¤¿¡£", m_name); -#else - msg_format("%^s hisses furiously.", m_name); -#endif - else if (percentage > 20) -#ifdef JP -msg_format("%^s¤Ï¿È¤â¤À¤¨¤·¤¿¡£", m_name); -#else - msg_format("%^s writhes about.", m_name); -#endif - else if (percentage > 10) -#ifdef JP -msg_format("%^s¤Ï¶ìÄˤǿȤâ¤À¤¨¤·¤¿¡£", m_name); -#else - msg_format("%^s writhes in agony.", m_name); -#endif - else #ifdef JP -msg_format("%^s¤Ï¤°¤Ë¤ã¤°¤Ë¤ã¤ÈáÛÚ»¤·¤¿¡£", m_name); + if(percentage > 95) msg_format("%^s¤Ï¤Û¤È¤ó¤Éµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + else if(percentage > 75) msg_format("%^s¤Ï¥·¡¼¥Ã¤ÈÌĤ¤¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤ÏÅܤäÆƬ¤ò¾å¤²¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤ÏÌÔÁ³¤È°Ò³Å¤·¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤Ï¿È¤â¤À¤¨¤·¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¶ìÄˤǿȤâ¤À¤¨¤·¤¿¡£", m_name); + else msg_format("%^s¤Ï¤°¤Ë¤ã¤°¤Ë¤ã¤ÈáÛÚ»¤·¤¿¡£", m_name); #else - msg_format("%^s jerks limply.", m_name); + if(percentage > 95) msg_format("%^s barely notices.", m_name); + else if(percentage > 75) msg_format("%^s hisses.", m_name); + else if(percentage > 50) msg_format("%^s rears up in anger.", m_name); + else if(percentage > 35) msg_format("%^s hisses furiously.", m_name); + else if(percentage > 20) msg_format("%^s writhes about.", m_name); + else if(percentage > 10) msg_format("%^s writhes in agony.", m_name); + else msg_format("%^s jerks limply.", m_name); #endif } - - /* Felines */ - else if (strchr("f", r_ptr->d_char)) + else if(my_strchr("f", r_ptr->d_char)) { - if (percentage > 95) -#ifdef JP -msg_format("%s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); -#else - msg_format("%^s shrugs off the attack.", m_name); -#endif - else if (percentage > 75) -#ifdef JP -msg_format("%^s¤ÏËʤ¨¤¿¡£", m_name); -#else - msg_format("%^s roars.", m_name); -#endif - else if (percentage > 50) #ifdef JP -msg_format("%^s¤ÏÅܤäÆËʤ¨¤¿¡£", m_name); + if(percentage > 95) msg_format("%s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); + else if(percentage > 75) msg_format("%^s¤ÏËʤ¨¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤ÏÅܤäÆËʤ¨¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤ÏÄˤߤǥ·¡¼¥Ã¤ÈÌĤ¤¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤ÏÄˤߤǼ塹¤·¤¯ÌĤ¤¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¶ìÄˤˤ¦¤á¤¤¤¿¡£", m_name); + else msg_format("%s¤Ï°¥¤ì¤ÊÌĤ­À¼¤ò½Ð¤·¤¿¡£", m_name); #else - msg_format("%^s growls angrily.", m_name); -#endif - else if (percentage > 35) -#ifdef JP -msg_format("%^s¤ÏÄˤߤǥ·¡¼¥Ã¤ÈÌĤ¤¤¿¡£", m_name); -#else - msg_format("%^s hisses with pain.", m_name); -#endif - else if (percentage > 20) -#ifdef JP -msg_format("%^s¤ÏÄˤߤǼ塹¤·¤¯ÌĤ¤¤¿¡£", m_name); -#else - msg_format("%^s mewls in pain.", m_name); -#endif - else if (percentage > 10) -#ifdef JP -msg_format("%^s¤Ï¶ìÄˤˤ¦¤á¤¤¤¿¡£", m_name); -#else - msg_format("%^s hisses in agony.", m_name); -#endif - else -#ifdef JP -msg_format("%s¤Ï°¥¤ì¤ÊÌĤ­À¼¤ò½Ð¤·¤¿¡£", m_name); -#else - msg_format("%^s mewls pitifully.", m_name); + if(percentage > 95) msg_format("%^s shrugs off the attack.", m_name); + else if(percentage > 75) msg_format("%^s roars.", m_name); + else if(percentage > 50) msg_format("%^s growls angrily.", m_name); + else if(percentage > 35) msg_format("%^s hisses with pain.", m_name); + else if(percentage > 20) msg_format("%^s mewls in pain.", m_name); + else if(percentage > 10) msg_format("%^s hisses in agony.", m_name); + else msg_format("%^s mewls pitifully.", m_name); #endif } - - /* Ants, Centipedes, Flies, Insects, Beetles, Spiders */ - else if (strchr("acFIKS", r_ptr->d_char)) + else if(my_strchr("acFIKS", r_ptr->d_char)) // Ants, Centipedes, Flies, Insects, Beetles, Spiders { - if (percentage > 95) -#ifdef JP -msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); -#else - msg_format("%^s ignores the attack.", m_name); -#endif - else if (percentage > 75) -#ifdef JP -msg_format("%^s¤Ï¥­¡¼¥­¡¼ÌĤ¤¤¿¡£", m_name); -#else - msg_format("%^s chitters.", m_name); -#endif - - else if (percentage > 50) #ifdef JP -msg_format("%^s¤Ï¥è¥í¥è¥íƨ¤²²ó¤Ã¤¿¡£", m_name); + if(percentage > 95) msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + else if(percentage > 75) msg_format("%^s¤Ï¥­¡¼¥­¡¼ÌĤ¤¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤Ï¥è¥í¥è¥íƨ¤²²ó¤Ã¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤Ï¤¦¤ë¤µ¤¯ÌĤ¤¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤ÏÄˤߤËáÛÚ»¤·¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¶ìÄˤÇáÛÚ»¤·¤¿¡£", m_name); + else msg_format("%^s¤Ï¥Ô¥¯¥Ô¥¯¤Ò¤­¤Ä¤Ã¤¿¡£", m_name); #else - msg_format("%^s scuttles about.", m_name); + if(percentage > 95) msg_format("%^s ignores the attack.", m_name); + else if(percentage > 75) msg_format("%^s chitters.", m_name); + else if(percentage > 50) msg_format("%^s scuttles about.", m_name); + else if(percentage > 35) msg_format("%^s twitters.", m_name); + else if(percentage > 20) msg_format("%^s jerks in pain.", m_name); + else if(percentage > 10) msg_format("%^s jerks in agony.", m_name); + else msg_format("%^s twitches.", m_name); #endif - - else if (percentage > 35) -#ifdef JP -msg_format("%^s¤Ï¤¦¤ë¤µ¤¯ÌĤ¤¤¿¡£", m_name); -#else - msg_format("%^s twitters.", m_name); -#endif - - else if (percentage > 20) -#ifdef JP -msg_format("%^s¤ÏÄˤߤËáÛÚ»¤·¤¿¡£", m_name); -#else - msg_format("%^s jerks in pain.", m_name); -#endif - - else if (percentage > 10) -#ifdef JP -msg_format("%^s¤Ï¶ìÄˤÇáÛÚ»¤·¤¿¡£", m_name); -#else - msg_format("%^s jerks in agony.", m_name); -#endif - - else -#ifdef JP -msg_format("%^s¤Ï¥Ô¥¯¥Ô¥¯¤Ò¤­¤Ä¤Ã¤¿¡£", m_name); -#else - msg_format("%^s twitches.", m_name); -#endif - } - - /* Birds */ - else if (strchr("B", r_ptr->d_char)) - { - if (percentage > 95) -#ifdef JP -msg_format("%^s¤Ï¤µ¤¨¤º¤Ã¤¿¡£", m_name); -#else - msg_format("%^s chirps.", m_name); -#endif - - else if (percentage > 75) -#ifdef JP -msg_format("%^s¤Ï¥Ô¡¼¥Ô¡¼ÌĤ¤¤¿¡£", m_name); -#else - msg_format("%^s twitters.", m_name); -#endif - - else if (percentage > 50) -#ifdef JP -msg_format("%^s¤Ï¥®¥ã¡¼¥®¥ã¡¼ÌĤ¤¤¿¡£", m_name); -#else - msg_format("%^s squawks.", m_name); -#endif - - else if (percentage > 35) -#ifdef JP -msg_format("%^s¤Ï¥®¥ã¡¼¥®¥ã¡¼ÌĤ­¤ï¤á¤¤¤¿¡£", m_name); -#else - msg_format("%^s chatters.", m_name); -#endif - - else if (percentage > 20) -#ifdef JP -msg_format("%^s¤Ï¶ì¤·¤ó¤À¡£", m_name); -#else - msg_format("%^s jeers.", m_name); -#endif - - else if (percentage > 10) + else if(my_strchr("B", r_ptr->d_char)) // Birds + { #ifdef JP -msg_format("%^s¤Ï¤Î¤¿¤¦¤Á²ó¤Ã¤¿¡£", m_name); + if(percentage > 95) msg_format("%^s¤Ï¤µ¤¨¤º¤Ã¤¿¡£", m_name); + else if(percentage > 75) msg_format("%^s¤Ï¥Ô¡¼¥Ô¡¼ÌĤ¤¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤Ï¥®¥ã¡¼¥®¥ã¡¼ÌĤ¤¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤Ï¥®¥ã¡¼¥®¥ã¡¼ÌĤ­¤ï¤á¤¤¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤Ï¶ì¤·¤ó¤À¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¤Î¤¿¤¦¤Á²ó¤Ã¤¿¡£", m_name); + else msg_format("%^s¤Ï¥­¡¼¥­¡¼¤ÈÌĤ­¶«¤ó¤À¡£", m_name); #else - msg_format("%^s flutters about.", m_name); + if(percentage > 95) msg_format("%^s chirps.", m_name); + else if(percentage > 75) msg_format("%^s twitters.", m_name); + else if(percentage > 50) msg_format("%^s squawks.", m_name); + else if(percentage > 35) msg_format("%^s chatters.", m_name); + else if(percentage > 20) msg_format("%^s jeers.", m_name); + else if(percentage > 10) msg_format("%^s flutters about.", m_name); + else msg_format("%^s squeaks.", m_name); #endif - - else -#ifdef JP -msg_format("%^s¤Ï¥­¡¼¥­¡¼¤ÈÌĤ­¶«¤ó¤À¡£", m_name); -#else - msg_format("%^s squeaks.", m_name); -#endif - } - - /* Dragons, Demons, High Undead */ - else if (strchr("duDLUW", r_ptr->d_char)) - { - if (percentage > 95) -#ifdef JP -msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); -#else - msg_format("%^s ignores the attack.", m_name); -#endif - - else if (percentage > 75) -#ifdef JP -msg_format("%^s¤Ï¤·¤ê¹þ¤ß¤·¤¿¡£", m_name); -#else - msg_format("%^s flinches.", m_name); -#endif - - else if (percentage > 50) -#ifdef JP -msg_format("%^s¤ÏÄˤߤǥ·¡¼¥Ã¤ÈÌĤ¤¤¿¡£", m_name); -#else - msg_format("%^s hisses in pain.", m_name); -#endif - - else if (percentage > 35) -#ifdef JP -msg_format("%^s¤ÏÄˤߤǤ¦¤Ê¤Ã¤¿¡£", m_name); -#else - msg_format("%^s snarls with pain.", m_name); -#endif - - else if (percentage > 20) -#ifdef JP -msg_format("%^s¤ÏÄˤߤËËʤ¨¤¿¡£", m_name); -#else - msg_format("%^s roars with pain.", m_name); -#endif - - else if (percentage > 10) + else if(my_strchr("duDLUW", r_ptr->d_char)) // Dragons, Demons, High Undead + { #ifdef JP -msg_format("%^s¤Ï¶ì¤·¤²¤Ë¶«¤ó¤À¡£", m_name); + if(percentage > 95) msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + else if(percentage > 75) msg_format("%^s¤Ï¤·¤ê¹þ¤ß¤·¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤ÏÄˤߤǥ·¡¼¥Ã¤ÈÌĤ¤¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤ÏÄˤߤǤ¦¤Ê¤Ã¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤ÏÄˤߤËËʤ¨¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¶ì¤·¤²¤Ë¶«¤ó¤À¡£", m_name); + else msg_format("%^s¤Ï¼å¡¹¤·¤¯¤¦¤Ê¤Ã¤¿¡£", m_name); #else - msg_format("%^s gasps.", m_name); + if(percentage > 95) msg_format("%^s ignores the attack.", m_name); + else if(percentage > 75) msg_format("%^s flinches.", m_name); + else if(percentage > 50) msg_format("%^s hisses in pain.", m_name); + else if(percentage > 35) msg_format("%^s snarls with pain.", m_name); + else if(percentage > 20) msg_format("%^s roars with pain.", m_name); + else if(percentage > 10) msg_format("%^s gasps.", m_name); + else msg_format("%^s snarls feebly.", m_name); #endif - - else -#ifdef JP -msg_format("%^s¤Ï¼å¡¹¤·¤¯¤¦¤Ê¤Ã¤¿¡£", m_name); -#else - msg_format("%^s snarls feebly.", m_name); -#endif - } - - /* Skeletons */ - else if (strchr("s", r_ptr->d_char)) + else if(my_strchr("s", r_ptr->d_char)) // Skeletons { - if (percentage > 95) -#ifdef JP -msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); -#else - msg_format("%^s ignores the attack.", m_name); -#endif - - else if (percentage > 75) -#ifdef JP -msg_format("%s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); -#else - msg_format("%^s shrugs off the attack.", m_name); -#endif - - else if (percentage > 50) -#ifdef JP -msg_format("%^s¤Ï¥«¥¿¥«¥¿¤È¾Ð¤Ã¤¿¡£", m_name); -#else - msg_format("%^s rattles.", m_name); -#endif - - else if (percentage > 35) -#ifdef JP -msg_format("%^s¤Ï¤è¤í¤á¤¤¤¿¡£", m_name); -#else - msg_format("%^s stumbles.", m_name); -#endif - - else if (percentage > 20) -#ifdef JP -msg_format("%^s¤Ï¥«¥¿¥«¥¿¸À¤Ã¤¿¡£", m_name); -#else - msg_format("%^s rattles.", m_name); -#endif - - else if (percentage > 10) #ifdef JP -msg_format("%^s¤Ï¤è¤í¤á¤¤¤¿¡£", m_name); + if(percentage > 95) msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + else if(percentage > 75) msg_format("%s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤Ï¥«¥¿¥«¥¿¤È¾Ð¤Ã¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤Ï¤è¤í¤á¤¤¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤Ï¥«¥¿¥«¥¿¸À¤Ã¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¤è¤í¤á¤¤¤¿¡£", m_name); + else msg_format("%^s¤Ï¥¬¥¿¥¬¥¿¸À¤Ã¤¿¡£", m_name); #else - msg_format("%^s staggers.", m_name); + if(percentage > 95) msg_format("%^s ignores the attack.", m_name); + else if(percentage > 75) msg_format("%^s shrugs off the attack.", m_name); + else if(percentage > 50) msg_format("%^s rattles.", m_name); + else if(percentage > 35) msg_format("%^s stumbles.", m_name); + else if(percentage > 20) msg_format("%^s rattles.", m_name); + else if(percentage > 10) msg_format("%^s staggers.", m_name); + else msg_format("%^s clatters.", m_name); #endif - - else -#ifdef JP -msg_format("%^s¤Ï¥¬¥¿¥¬¥¿¸À¤Ã¤¿¡£", m_name); -#else - msg_format("%^s clatters.", m_name); -#endif - } - - /* Zombies */ - else if (strchr("z", r_ptr->d_char)) - { - if (percentage > 95) + else if(my_strchr("z", r_ptr->d_char)) // Zombies + { #ifdef JP -msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + if(percentage > 95) msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + else if(percentage > 75) msg_format("%s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤Ï¤¦¤á¤¤¤¿¡£", m_name); + else if(percentage > 35) msg_format("%s¤Ï¶ì¤·¤²¤Ë¤¦¤á¤¤¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤Ïí´í°¤·¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¤¦¤Ê¤Ã¤¿¡£", m_name); + else msg_format("%^s¤Ï¤è¤í¤á¤¤¤¿¡£", m_name); #else - msg_format("%^s ignores the attack.", m_name); + if(percentage > 95) msg_format("%^s ignores the attack.", m_name); + else if(percentage > 75) msg_format("%^s shrugs off the attack.", m_name); + else if(percentage > 50) msg_format("%^s groans.", m_name); + else if(percentage > 35) msg_format("%^s moans.", m_name); + else if(percentage > 20) msg_format("%^s hesitates.", m_name); + else if(percentage > 10) msg_format("%^s grunts.", m_name); + else msg_format("%^s staggers.", m_name); #endif - - else if (percentage > 75) -#ifdef JP -msg_format("%s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); -#else - msg_format("%^s shrugs off the attack.", m_name); -#endif - - else if (percentage > 50) -#ifdef JP -msg_format("%^s¤Ï¤¦¤á¤¤¤¿¡£", m_name); -#else - msg_format("%^s groans.", m_name); -#endif - - else if (percentage > 35) -#ifdef JP -msg_format("%s¤Ï¶ì¤·¤²¤Ë¤¦¤á¤¤¤¿¡£", m_name); -#else - msg_format("%^s moans.", m_name); -#endif - - else if (percentage > 20) -#ifdef JP -msg_format("%^s¤Ïí´í°¤·¤¿¡£", m_name); -#else - msg_format("%^s hesitates.", m_name); -#endif - - else if (percentage > 10) -#ifdef JP -msg_format("%^s¤Ï¤¦¤Ê¤Ã¤¿¡£", m_name); -#else - msg_format("%^s grunts.", m_name); -#endif - - else -#ifdef JP -msg_format("%^s¤Ï¤è¤í¤á¤¤¤¿¡£", m_name); -#else - msg_format("%^s staggers.", m_name); -#endif - } - - /* Ghosts */ - else if (strchr("G", r_ptr->d_char)) - + else if(my_strchr("G", r_ptr->d_char)) // Ghosts { - if (percentage > 95) -#ifdef JP -msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); -#else - msg_format("%^s ignores the attack.", m_name); -#endif - - else if (percentage > 75) -#ifdef JP -msg_format("%s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); -#else - msg_format("%^s shrugs off the attack.", m_name); -#endif - - else if (percentage > 50) -#ifdef JP -msg_format("%s¤Ï¤¦¤á¤¤¤¿¡£", m_name); -#else - msg_format("%^s moans.", m_name); -#endif - - else if (percentage > 35) -#ifdef JP -msg_format("%^s¤Ïµã¤­¤ï¤á¤¤¤¿¡£", m_name); -#else - msg_format("%^s wails.", m_name); -#endif - - else if (percentage > 20) -#ifdef JP -msg_format("%^s¤ÏËʤ¨¤¿¡£", m_name); -#else - msg_format("%^s howls.", m_name); -#endif - - else if (percentage > 10) -#ifdef JP -msg_format("%s¤Ï¼å¡¹¤·¤¯¤¦¤á¤¤¤¿¡£", m_name); -#else - msg_format("%^s moans softly.", m_name); -#endif - - else #ifdef JP -msg_format("%^s¤Ï¤«¤¹¤«¤Ë¤¦¤á¤¤¤¿¡£", m_name); + if(percentage > 95) msg_format("%s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + else if(percentage > 75) msg_format("%s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); + else if(percentage > 50) msg_format("%s¤Ï¤¦¤á¤¤¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤Ïµã¤­¤ï¤á¤¤¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤ÏËʤ¨¤¿¡£", m_name); + else if(percentage > 10) msg_format("%s¤Ï¼å¡¹¤·¤¯¤¦¤á¤¤¤¿¡£", m_name); + else msg_format("%^s¤Ï¤«¤¹¤«¤Ë¤¦¤á¤¤¤¿¡£", m_name); #else - msg_format("%^s sighs.", m_name); + if(percentage > 95) msg_format("%^s ignores the attack.", m_name); + else if(percentage > 75) msg_format("%^s shrugs off the attack.", m_name); + else if(percentage > 50) msg_format("%^s moans.", m_name); + else if(percentage > 35) msg_format("%^s wails.", m_name); + else if(percentage > 20) msg_format("%^s howls.", m_name); + else if(percentage > 10) msg_format("%^s moans softly.", m_name); + else msg_format("%^s sighs.", m_name); #endif - } - - /* Dogs and Hounds */ - else if (strchr("CZ", r_ptr->d_char)) + else if(my_strchr("CZ", r_ptr->d_char)) // Dogs and Hounds { #ifdef JP - if (percentage > 95) - msg_format("%^s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); - else if (percentage > 75) - msg_format("%^s¤ÏÄˤߤǤ¦¤Ê¤Ã¤¿¡£", m_name); - else if (percentage > 50) - msg_format("%^s¤ÏÄˤߤǥ­¥ã¥ó¥­¥ã¥óËʤ¨¤¿¡£", m_name); - else if (percentage > 35) - msg_format("%^s¤ÏÄˤߤÇÌĤ­¤ï¤á¤¤¤¿¡£", m_name); - else if (percentage > 20) - msg_format("%^s¤Ï¶ìÄˤΤ¢¤Þ¤êÌĤ­¤ï¤á¤¤¤¿¡£", m_name); - else if (percentage > 10) - msg_format("%^s¤Ï¶ìÄˤǤâ¤À¤¨¶ì¤·¤ó¤À¡£", m_name); - else - msg_format("%^s¤Ï¼å¡¹¤·¤¯Ëʤ¨¤¿¡£", m_name); + if(percentage > 95) msg_format("%^s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); + else if(percentage > 75) msg_format("%^s¤ÏÄˤߤǤ¦¤Ê¤Ã¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤ÏÄˤߤǥ­¥ã¥ó¥­¥ã¥óËʤ¨¤¿¡£", m_name); + else if(percentage > 35) msg_format("%^s¤ÏÄˤߤÇÌĤ­¤ï¤á¤¤¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤Ï¶ìÄˤΤ¢¤Þ¤êÌĤ­¤ï¤á¤¤¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¶ìÄˤǤâ¤À¤¨¶ì¤·¤ó¤À¡£", m_name); + else msg_format("%^s¤Ï¼å¡¹¤·¤¯Ëʤ¨¤¿¡£", m_name); #else - if (percentage > 95) - msg_format("%^s shrugs off the attack.", m_name); - else if (percentage > 75) - msg_format("%^s snarls with pain.", m_name); - else if (percentage > 50) - msg_format("%^s yelps in pain.", m_name); - else if (percentage > 35) - msg_format("%^s howls in pain.", m_name); - else if (percentage > 20) - msg_format("%^s howls in agony.", m_name); - else if (percentage > 10) - msg_format("%^s writhes in agony.", m_name); - else - msg_format("%^s yelps feebly.", m_name); + if(percentage > 95) msg_format("%^s shrugs off the attack.", m_name); + else if(percentage > 75) msg_format("%^s snarls with pain.", m_name); + else if(percentage > 50) msg_format("%^s yelps in pain.", m_name); + else if(percentage > 35) msg_format("%^s howls in pain.", m_name); + else if(percentage > 20) msg_format("%^s howls in agony.", m_name); + else if(percentage > 10) msg_format("%^s writhes in agony.", m_name); + else msg_format("%^s yelps feebly.", m_name); #endif - } - /* One type of monsters (ignore,squeal,shriek) */ - else if (strchr("Xbilqrt", r_ptr->d_char)) + else if(my_strchr("Xbilqrt", r_ptr->d_char)) // One type of creatures (ignore,squeal,shriek) { #ifdef JP - if (percentage > 95) - msg_format("%^s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); - else if (percentage > 75) - msg_format("%^s¤ÏÄˤߤǤ¦¤Ê¤Ã¤¿¡£", m_name); - else if (percentage > 50) - msg_format("%^s¤ÏÄˤߤǶ«¤ó¤À¡£", m_name); - else if (percentage > 35) - msg_format("%^s¤ÏÄˤߤÇÀ䶫¤·¤¿¡£", m_name); - else if (percentage > 20) - msg_format("%^s¤Ï¶ìÄˤΤ¢¤Þ¤êÀ䶫¤·¤¿¡£", m_name); - else if (percentage > 10) - msg_format("%^s¤Ï¶ìÄˤǤâ¤À¤¨¶ì¤·¤ó¤À¡£", m_name); - else - msg_format("%^s¤Ï¼å¡¹¤·¤¯¶«¤ó¤À¡£", m_name); + if(percentage > 95) msg_format("%^s¤Ï¹¶·â¤òµ¤¤Ë¤È¤á¤Æ¤¤¤Ê¤¤¡£", m_name); + else if(percentage > 75) msg_format("%^s¤ÏÄˤߤǤ¦¤Ê¤Ã¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤ÏÄˤߤǶ«¤ó¤À¡£", m_name); + else if(percentage > 35) msg_format("%^s¤ÏÄˤߤÇÀ䶫¤·¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤Ï¶ìÄˤΤ¢¤Þ¤êÀ䶫¤·¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¶ìÄˤǤâ¤À¤¨¶ì¤·¤ó¤À¡£", m_name); + else msg_format("%^s¤Ï¼å¡¹¤·¤¯¶«¤ó¤À¡£", m_name); #else - if (percentage > 95) - msg_format("%^s ignores the attack.", m_name); - else if (percentage > 75) - msg_format("%^s grunts with pain.", m_name); - else if (percentage > 50) - msg_format("%^s squeals in pain.", m_name); - else if (percentage > 35) - msg_format("%^s shrieks in pain.", m_name); - else if (percentage > 20) - msg_format("%^s shrieks in agony.", m_name); - else if (percentage > 10) - msg_format("%^s writhes in agony.", m_name); - else - msg_format("%^s cries out feebly.", m_name); + if(percentage > 95) msg_format("%^s ignores the attack.", m_name); + else if(percentage > 75) msg_format("%^s grunts with pain.", m_name); + else if(percentage > 50) msg_format("%^s squeals in pain.", m_name); + else if(percentage > 35) msg_format("%^s shrieks in pain.", m_name); + else if(percentage > 20) msg_format("%^s shrieks in agony.", m_name); + else if(percentage > 10) msg_format("%^s writhes in agony.", m_name); + else msg_format("%^s cries out feebly.", m_name); #endif - } - /* Another type of monsters (shrug,cry,scream) */ - else + else // Another type of creatures (shrug,cry,scream) { #ifdef JP - if (percentage > 95) - msg_format("%^s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); - else if (percentage > 75) - msg_format("%^s¤ÏÄˤߤǤ¦¤Ê¤Ã¤¿¡£", m_name); - else if (percentage > 50) - msg_format("%^s¤ÏÄˤߤǶ«¤ó¤À¡£", m_name); - else if (percentage > 35) - msg_format("%^s¤ÏÄˤߤÇÀ䶫¤·¤¿¡£", m_name); - else if (percentage > 20) - msg_format("%^s¤Ï¶ìÄˤΤ¢¤Þ¤êÀ䶫¤·¤¿¡£", m_name); - else if (percentage > 10) - msg_format("%^s¤Ï¶ìÄˤǤâ¤À¤¨¶ì¤·¤ó¤À¡£", m_name); - else - msg_format("%^s¤Ï¼å¡¹¤·¤¯¶«¤ó¤À¡£", m_name); + if(percentage > 95) msg_format("%^s¤Ï¹¶·â¤Ë¸ª¤ò¤¹¤¯¤á¤¿¡£", m_name); + else if(percentage > 75) msg_format("%^s¤ÏÄˤߤǤ¦¤Ê¤Ã¤¿¡£", m_name); + else if(percentage > 50) msg_format("%^s¤ÏÄˤߤǶ«¤ó¤À¡£", m_name); + else if(percentage > 35) msg_format("%^s¤ÏÄˤߤÇÀ䶫¤·¤¿¡£", m_name); + else if(percentage > 20) msg_format("%^s¤Ï¶ìÄˤΤ¢¤Þ¤êÀ䶫¤·¤¿¡£", m_name); + else if(percentage > 10) msg_format("%^s¤Ï¶ìÄˤǤâ¤À¤¨¶ì¤·¤ó¤À¡£", m_name); + else msg_format("%^s¤Ï¼å¡¹¤·¤¯¶«¤ó¤À¡£", m_name); #else - if (percentage > 95) - msg_format("%^s shrugs off the attack.", m_name); - else if (percentage > 75) - msg_format("%^s grunts with pain.", m_name); - else if (percentage > 50) - msg_format("%^s cries out in pain.", m_name); - else if (percentage > 35) - msg_format("%^s screams in pain.", m_name); - else if (percentage > 20) - msg_format("%^s screams in agony.", m_name); - else if (percentage > 10) - msg_format("%^s writhes in agony.", m_name); - else - msg_format("%^s cries out feebly.", m_name); + if(percentage > 95) msg_format("%^s shrugs off the attack.", m_name); + else if(percentage > 75) msg_format("%^s grunts with pain.", m_name); + else if(percentage > 50) msg_format("%^s cries out in pain.", m_name); + else if(percentage > 35) msg_format("%^s screams in pain.", m_name); + else if(percentage > 20) msg_format("%^s screams in agony.", m_name); + else if(percentage > 10) msg_format("%^s writhes in agony.", m_name); + else msg_format("%^s cries out feebly.", m_name); #endif - } } + + /* * Learn about an "observed" resistance. */ void update_smart_learn(int m_idx, int what) { -#ifdef DRS_SMART_OPTIONS - monster_type *m_ptr = &m_list[m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -4743,31 +4476,31 @@ void update_smart_learn(int m_idx, int what) { case DRS_ACID: if (p_ptr->resist_acid) m_ptr->smart |= (SM_RES_ACID); - if (p_ptr->oppose_acid) m_ptr->smart |= (SM_OPP_ACID); + if (IS_OPPOSE_ACID()) m_ptr->smart |= (SM_OPP_ACID); if (p_ptr->immune_acid) m_ptr->smart |= (SM_IMM_ACID); break; case DRS_ELEC: if (p_ptr->resist_elec) m_ptr->smart |= (SM_RES_ELEC); - if (p_ptr->oppose_elec) m_ptr->smart |= (SM_OPP_ELEC); + if (IS_OPPOSE_ELEC()) m_ptr->smart |= (SM_OPP_ELEC); if (p_ptr->immune_elec) m_ptr->smart |= (SM_IMM_ELEC); break; case DRS_FIRE: if (p_ptr->resist_fire) m_ptr->smart |= (SM_RES_FIRE); - if (p_ptr->oppose_fire) m_ptr->smart |= (SM_OPP_FIRE); + if (IS_OPPOSE_FIRE()) m_ptr->smart |= (SM_OPP_FIRE); if (p_ptr->immune_fire) m_ptr->smart |= (SM_IMM_FIRE); break; case DRS_COLD: if (p_ptr->resist_cold) m_ptr->smart |= (SM_RES_COLD); - if (p_ptr->oppose_cold) m_ptr->smart |= (SM_OPP_COLD); + if (IS_OPPOSE_COLD()) m_ptr->smart |= (SM_OPP_COLD); if (p_ptr->immune_cold) m_ptr->smart |= (SM_IMM_COLD); break; case DRS_POIS: if (p_ptr->resist_pois) m_ptr->smart |= (SM_RES_POIS); - if (p_ptr->oppose_pois) m_ptr->smart |= (SM_OPP_POIS); + if (IS_OPPOSE_POIS()) m_ptr->smart |= (SM_OPP_POIS); break; @@ -4827,9 +4560,6 @@ void update_smart_learn(int m_idx, int what) if (p_ptr->reflect) m_ptr-> smart |= (SM_IMM_REFLECT); break; } - -#endif /* DRS_SMART_OPTIONS */ - } @@ -4870,15 +4600,15 @@ void monster_drop_carried_objects(monster_type *m_ptr) /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; - /* Paranoia */ - o_ptr->held_m_idx = 0; - /* Get local object */ q_ptr = &forge; /* Copy the object */ object_copy(q_ptr, o_ptr); + /* Forget monster */ + q_ptr->held_m_idx = 0; + /* Delete the object */ delete_object_idx(this_o_idx);