}
-void mproc_add(int m_idx)
-{
- m_list[m_idx].mproc_idx = mproc_max;
- mproc_list[mproc_max++] = m_idx;
-}
-
-
-void mproc_remove(int mproc_idx)
-{
- m_list[mproc_list[mproc_idx]].mproc_idx = 0;
- mproc_list[mproc_idx] = mproc_list[--mproc_max];
-}
-
-
/*
* Delete a monster by index.
*
/* Hack -- count the number of "reproducers" */
if (r_ptr->flags2 & (RF2_MULTIPLY)) num_repro--;
- if (m_ptr->mproc_idx) mproc_remove(m_ptr->mproc_idx);
+ 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 (is_pet(m_ptr)) check_pets_num_and_align(m_ptr, FALSE);
+
+
/* Wipe the Monster */
(void)WIPE(m_ptr, monster_type);
/* Wipe the hole */
(void)WIPE(&m_list[i1], monster_type);
- if (m_list[i2].mproc_idx) mproc_list[m_list[i2].mproc_idx] = i2;
+ 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;
+ }
}
/* 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);
{
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++;
}
}
/* Reset "m_cnt" */
m_cnt = 0;
- /* Reset "mproc_max" */
- mproc_max = 1;
+ /* Reset "mproc_max[]" */
+ for (i = 0; i < MAX_MTIMED; i++) mproc_max[i] = 0;
/* Hack -- reset "reproducer" count */
num_repro = 0;
{
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));
}
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;
}
}
- if ((mode & MD_IGNORE_HALLU) && 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));
}
/* Detectable */
flag = TRUE;
- if (is_original_ap(m_ptr))
+ 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);
}
/* Basic telepathy */
- else if (p_ptr->telepathy)
+ /* Snipers get telepathy when they concentrate deeper */
+ else if ((p_ptr->telepathy) || (p_ptr->concent >= CONCENT_TELE_THRESHOLD))
{
/* Empty mind, no telepathy */
if (r_ptr->flags2 & (RF2_EMPTY_MIND))
{
/* Memorize flags */
- if (is_original_ap(m_ptr)) 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 */
/* Detectable */
flag = TRUE;
- if (is_original_ap(m_ptr))
+ if (is_original_ap(m_ptr) && !p_ptr->image)
{
/* Memorize flags */
r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
/* Detectable */
flag = TRUE;
- if (is_original_ap(m_ptr))
+ 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 ((p_ptr->esp_animal) && (r_ptr->flags3 & (RF3_ANIMAL)))
{
flag = TRUE;
- if (is_original_ap(m_ptr)) 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;
- if (is_original_ap(m_ptr)) 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;
- if (is_original_ap(m_ptr)) 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;
- if (is_original_ap(m_ptr)) 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;
- if (is_original_ap(m_ptr)) 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;
- if (is_original_ap(m_ptr)) 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;
- if (is_original_ap(m_ptr)) 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;
- if (is_original_ap(m_ptr)) 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;
- if (is_original_ap(m_ptr)) 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;
- if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
+ if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags3 |= (RF3_GOOD);
}
/* Magical sensing */
((r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) == RF3_NONLIVING))
{
flag = TRUE;
- if (is_original_ap(m_ptr)) 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;
- if (is_original_ap(m_ptr)) r_ptr->r_flags1 |= (RF1_UNIQUE);
+ if (is_original_ap(m_ptr) && !p_ptr->image) r_ptr->r_flags1 |= (RF1_UNIQUE);
}
}
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)
{
/* Visible */
if (flag)
{
- if (is_original_ap(m_ptr))
+ if (is_original_ap(m_ptr) && !p_ptr->image)
{
/* Memorize flags */
if (do_invisible) r_ptr->r_flags2 |= (RF2_INVISIBLE);
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);
}
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);
(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 */
{
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;
}
cptr name = (r_name + r_ptr->name);
+ int cmi;
+
/* DO NOT PLACE A MONSTER IN THE SMALL SCALE WILDERNESS !!! */
if (p_ptr->wild_mode) return FALSE;
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;
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;
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]))
}
/* 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 */
/* Extract the monster base speed */
m_ptr->mspeed = get_mspeed(r_ptr);
- if (mode & PM_HASTE) m_ptr->fast = 100;
+ if (mode & PM_HASTE) (void)set_monster_fast(c_ptr->m_idx, 100);
/* Give a random starting energy */
if (!ironman_nightmare)
if (r_ptr->flags7 & RF7_SELF_LD_MASK)
p_ptr->update |= (PU_MON_LITE);
- else if ((r_ptr->flags7 & RF7_HAS_LD_MASK) && !m_ptr->csleep)
+ else if ((r_ptr->flags7 & RF7_HAS_LD_MASK) && !MON_CSLEEP(m_ptr))
p_ptr->update |= (PU_MON_LITE);
/* Update the monster */
/* Hack -- Count the number of "reproducers" */
if (r_ptr->flags2 & RF2_MULTIPLY) num_repro++;
- if (need_mproc(m_ptr)) mproc_add(c_ptr->m_idx);
- else m_ptr->mproc_idx = 0;
-
/* Hack -- Notice new multi-hued monsters */
{
monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
/*
* Put the Guardian
*/
-bool alloc_guardian(void)
+bool alloc_guardian(bool def_val)
{
int guardian = d_info[dungeon_type].final_guardian;
/* One less try */
try--;
}
+
+ return FALSE;
}
- return FALSE;
+ return def_val;
}
int attempts_left = 10000;
/* Put the Guardian */
- if (alloc_guardian()) return TRUE;
+ if (alloc_guardian(FALSE)) return TRUE;
/* Find a legal, distant, unoccupied, space */
while (attempts_left--)
if (m_ptr->mflag2 & MFLAG2_NOPET) mode |= PM_NO_PET;
- /* Hack -- Shadower spawns Shadower */
- if (m_ptr->mflag2 & MFLAG2_KAGE) mode |= PM_KAGE;
-
/* 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;
/* Hack -- Transfer "clone" flag */
m_list[hack_m_idx_ii].mflag2 |= MFLAG2_NOPET;
}
- /* Hack -- Appearance transfer */
- if (!is_original_ap(m_ptr)) m_list[hack_m_idx_ii].ap_r_idx = m_ptr->ap_r_idx;
-
return TRUE;
}