/* File: xtra2.c */
-/* Purpose: effects of various "objects" */
-
/*
- * 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: effects of various "objects" */
+
#include "angband.h"
#define REWARD_CHANCE 10
*/
void check_experience(void)
{
- int i;
bool level_reward = FALSE;
bool level_mutation = FALSE;
bool level_inc_stat = FALSE;
bool android = (p_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
- /* Note current level */
- i = p_ptr->lev;
-
/* Hack -- lower limit */
if (p_ptr->exp < 0) p_ptr->exp = 0;
{
/* Lose a level */
p_ptr->lev--;
- lite_spot(py, px);
/* Update some stuff */
p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
{
/* Gain a level */
p_ptr->lev++;
- lite_spot(py, px);
/* Save the highest level */
if (p_ptr->lev > p_ptr->max_plv)
}
if (p_ptr->prace == RACE_BEASTMAN)
{
- if (randint(5) == 1) level_mutation = TRUE;
+ if (one_in_(5)) level_mutation = TRUE;
}
level_inc_stat = TRUE;
/* Window stuff */
p_ptr->window |= (PW_PLAYER | PW_SPELL);
-#ifdef JP
- level_up = 1;
-#endif
+ /* HP¤ÈMP¤Î¾å¾ºÎ̤òɽ¼¨ */
+ level_up = 1;
+
/* Handle stuff */
handle_stuff();
-#ifdef JP
- level_up = 0;
-#endif
- if (level_reward)
- {
- gain_level_reward(0);
- level_reward = FALSE;
- }
+ level_up = 0;
if (level_inc_stat)
{
screen_load();
}
else if(!(p_ptr->max_plv % 2))
- do_inc_stat(rand_int(6));
+ do_inc_stat(randint0(6));
}
if (level_mutation)
level_mutation = FALSE;
}
+ /*
+ * Ê󽷤ǥì¥Ù¥ë¤¬¾å¤ë¤ÈºÆµ¢Åª¤Ë check_experience() ¤¬
+ * ¸Æ¤Ð¤ì¤ë¤Î¤Ç½çÈÖ¤òºÇ¸å¤Ë¤¹¤ë¡£
+ */
+ if (level_reward)
+ {
+ gain_level_reward(0);
+ level_reward = FALSE;
+ }
+
/* Update some stuff */
p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
object_kind *k_ptr = &k_info[k_idx];
/* Analyze the item type */
- if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_DAEMON_BOOK))
+ if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK))
{
return (TRUE);
}
object_kind *k_ptr = &k_info[k_idx];
/* Analyze the item type */
- if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_DAEMON_BOOK) && (k_ptr->tval != TV_ARCANE_BOOK) && (k_ptr->sval > 1))
+ if ((k_ptr->tval >= TV_LIFE_BOOK) && (k_ptr->tval <= TV_CRUSADE_BOOK) && (k_ptr->tval != TV_ARCANE_BOOK) && (k_ptr->sval > 1))
{
return (TRUE);
}
p_ptr->inside_quest = 0;
}
- if (!quest[i].flags & QUEST_FLAG_SILENT)
+ if (!(quest[i].flags & QUEST_FLAG_SILENT))
{
#ifdef JP
msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
quest[i].status = QUEST_STATUS_COMPLETED;
quest[i].complev = (byte)p_ptr->lev;
- if (!quest[i].flags & QUEST_FLAG_SILENT)
+ if (!(quest[i].flags & QUEST_FLAG_SILENT))
{
#ifdef JP
msg_print("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª");
if (create_stairs)
{
/* Stagger around */
- while (cave_perma_bold(y, x) || cave[y][x].o_idx)
+ while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
{
/* Pick a location */
scatter(&ny, &nx, y, x, 1, 0);
/* Create stairs down */
cave_set_feat(y, x, FEAT_MORE);
- /* Delete invisible trap */
- cave[y][x].info &= ~(CAVE_TRAP);
-
/* Remember to update everything */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS);
}
/* Make a great object */
make_object(q_ptr, TRUE, TRUE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
int d_side = r_ptr->blow[i].d_side;
int damage = damroll(d_dice, d_side);
- switch (r_ptr->blow[i].effect)
- {
- case RBE_HURT: typ = GF_MISSILE; break;
- case RBE_POISON: typ = GF_POIS; break;
- case RBE_UN_BONUS: typ = GF_DISENCHANT; break;
- case RBE_UN_POWER: typ = GF_MISSILE; break; /* ToDo: Apply the correct effects */
- case RBE_EAT_GOLD: typ = GF_MISSILE; break;
- case RBE_EAT_ITEM: typ = GF_MISSILE; break;
- case RBE_EAT_FOOD: typ = GF_MISSILE; break;
- case RBE_EAT_LITE: typ = GF_MISSILE; break;
- case RBE_ACID: typ = GF_ACID; break;
- case RBE_ELEC: typ = GF_ELEC; break;
- case RBE_FIRE: typ = GF_FIRE; break;
- case RBE_COLD: typ = GF_COLD; break;
- case RBE_BLIND: typ = GF_MISSILE; break;
- case RBE_CONFUSE: typ = GF_CONFUSION; break;
- case RBE_TERRIFY: typ = GF_MISSILE; break;
- case RBE_PARALYZE: typ = GF_MISSILE; break;
- case RBE_LOSE_STR: typ = GF_MISSILE; break;
- case RBE_LOSE_DEX: typ = GF_MISSILE; break;
- case RBE_LOSE_CON: typ = GF_MISSILE; break;
- case RBE_LOSE_INT: typ = GF_MISSILE; break;
- case RBE_LOSE_WIS: typ = GF_MISSILE; break;
- case RBE_LOSE_CHR: typ = GF_MISSILE; break;
- case RBE_LOSE_ALL: typ = GF_MISSILE; break;
- case RBE_SHATTER: typ = GF_ROCKET; break;
- case RBE_EXP_10: typ = GF_MISSILE; break;
- case RBE_EXP_20: typ = GF_MISSILE; break;
- case RBE_EXP_40: typ = GF_MISSILE; break;
- case RBE_EXP_80: typ = GF_MISSILE; break;
- case RBE_DISEASE: typ = GF_POIS; break;
- case RBE_TIME: typ = GF_TIME; break;
- case RBE_EXP_VAMP: typ = GF_MISSILE; break;
- case RBE_DR_MANA: typ = GF_MANA; break;
- case RBE_SUPERHURT: typ = GF_MISSILE; break;
- }
if (m_ptr->r_idx == MON_ROLENTO)
{
typ = GF_FIRE;
- damage = damroll(20,10);
+ damage = damroll(20, 10);
}
+ else typ = mbe_info[r_ptr->blow[i].effect].explode_type;
project(m_idx, 3, y, x, damage, typ, flg, -1);
break;
}
}
- if (m_ptr->mflag2 & MFLAG_CHAMELEON)
+ if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
{
choose_new_monster(m_idx, TRUE, MON_CHAMELEON);
r_ptr = &r_info[m_ptr->r_idx];
#endif
}
- if (arena_shouhin[p_ptr->arena_number])
+ if (arena_info[p_ptr->arena_number].tval)
{
/* Get local object */
q_ptr = &forge;
- /* Prepare to make a Blade of Chaos */
- object_prep(q_ptr, lookup_kind(k_info[arena_shouhin[p_ptr->arena_number]].tval, k_info[arena_shouhin[p_ptr->arena_number]].sval));
+ /* Prepare to make a prize */
+ object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval));
apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
}
/* Drop a dead corpse? */
- if ((randint(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) == 1) &&
+ if (one_in_(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) &&
((r_ptr->flags9 & RF9_DROP_CORPSE) ||
- (r_ptr->flags9 & RF9_DROP_SKELETON)) &&
- !(p_ptr->inside_arena || p_ptr->inside_battle || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
+ (r_ptr->flags9 & RF9_DROP_SKELETON)) &&
+ !(p_ptr->inside_arena || p_ptr->inside_battle || (m_ptr->smart & SM_CLONED) || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
{
/* Assume skeleton */
bool corpse = FALSE;
/* Lots of damage in one blow */
if ((0 - ((m_ptr->maxhp) / 4)) > m_ptr->hp)
{
- if (randint(5) == 1) corpse = TRUE;
+ if (one_in_(5)) corpse = TRUE;
}
else
{
- if (randint(5) != 1) corpse = TRUE;
+ if (!one_in_(5)) corpse = TRUE;
}
}
/* Get local object */
q_ptr = &forge;
- /* Prepare to make a Blade of Chaos */
+ /* Prepare to make an object */
object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON)));
apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
q_ptr->pval = m_ptr->r_idx;
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
if (m_ptr->r_idx == MON_DAWN &&
!(p_ptr->inside_arena || p_ptr->inside_battle))
{
- if (randint(7) != 1)
+ if (!one_in_(7))
{
int wy = py, wx = px;
int attempts = 100;
if (attempts > 0)
{
- if (summon_specific((pet ? -1 : 0), wy, wx, 100, SUMMON_DAWN, FALSE, is_friendly(m_ptr), pet, FALSE, FALSE))
+ u32b mode = 0L;
+ if (pet) mode |= PM_FORCE_PET;
+
+ if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_DAWN, mode))
{
if (player_can_see_bold(wy, wx))
#ifdef JP
{
int wy = y, wx = x;
bool pet = is_pet(m_ptr);
+ u32b mode = 0L;
+
+ if (pet) mode |= PM_FORCE_PET;
- if (summon_specific((pet ? -1 : 0), wy, wx, 100, SUMMON_BLUE_HORROR, FALSE, is_friendly(m_ptr), pet, FALSE, FALSE))
+ if (summon_specific((pet ? -1 : m_idx), wy, wx, 100, SUMMON_BLUE_HORROR, mode))
{
if (player_can_see_bold(wy, wx))
notice = TRUE;
/* Bloodletters of Khorne may drop a blade of chaos */
else if (m_ptr->r_idx == MON_BLOODLETTER &&
- (randint(100) < 15) &&
+ (randint1(100) < 15) &&
!(p_ptr->inside_arena || p_ptr->inside_battle))
{
/* Get local object */
apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
/* Prepare allocation table */
get_obj_num_prep();
- /* Make a great object */
+ /* Make a book */
make_object(q_ptr, FALSE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
/* Get local object */
q_ptr = &forge;
- /* Prepare to make a Blade of Chaos */
- object_prep(q_ptr, lookup_kind(TV_SWORD, randint(2)));
-
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
+ /* Prepare to make a broken sword */
+ object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
- else if ((r_ptr->d_char == '|') && !(r_ptr->flags1 & RF1_DROP_CHOSEN) &&
+ else if ((r_ptr->d_char == '|') && !(m_ptr->r_idx == MON_STORMBRINGER) &&
!(p_ptr->inside_arena || p_ptr->inside_battle))
{
/* Get local object */
/* Prepare allocation table */
get_obj_num_prep();
- /* Make a great object */
+ /* Make a sword */
make_object(q_ptr, FALSE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
/* Prepare allocation table */
get_obj_num_prep();
- /* Make a great object */
+ /* Make a cloak */
make_object(q_ptr, FALSE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
/* Prepare allocation table */
get_obj_num_prep();
- /* Make a great object */
+ /* Make a poleweapon */
make_object(q_ptr, FALSE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
/* Prepare allocation table */
get_obj_num_prep();
- /* Make a great object */
+ /* Make a hard armor */
make_object(q_ptr, FALSE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
/* Get local object */
q_ptr = &forge;
- /* Prepare to make a Blade of Chaos */
- object_prep(q_ptr, lookup_kind(TV_CHEST, 50));
+ /* Prepare to make a Can of Toys */
+ object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME));
apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
/* Mega-Hack -- drop "winner" treasures */
- else if (r_ptr->flags1 & RF1_DROP_CHOSEN)
+ else
{
if (m_ptr->r_idx == MON_SERPENT)
-
{
/* Get local object */
q_ptr = &forge;
/* Mega-Hack -- Actually create "Grond" */
apply_magic(q_ptr, -1, TRUE, TRUE, TRUE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
/* Get local object */
q_ptr = &forge;
- /* Mega-Hack -- Prepare to make "Morgoth" */
- object_prep(q_ptr, lookup_kind(TV_CROWN, SV_MORGOTH));
+ /* Mega-Hack -- Prepare to make "Chaos" */
+ object_prep(q_ptr, lookup_kind(TV_CROWN, SV_CHAOS));
- /* Mega-Hack -- Mark this item as "Morgoth" */
- q_ptr->name1 = ART_MORGOTH;
+ /* Mega-Hack -- Mark this item as "Chaos" */
+ q_ptr->name1 = ART_CHAOS;
- /* Mega-Hack -- Actually create "Morgoth" */
+ /* Mega-Hack -- Actually create "Chaos" */
apply_magic(q_ptr, -1, TRUE, TRUE, TRUE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
else
{
- byte a_idx = 0;
+ int a_idx = 0;
int chance = 0;
- if (m_ptr->r_idx == MON_OBERON)
+ switch (m_ptr->r_idx)
{
- if (randint(3) == 1)
+ case MON_OBERON:
+ if (one_in_(3))
{
- a_idx = ART_THRAIN;
+ a_idx = ART_JUDGE;
chance = 33;
}
else
{
- a_idx = ART_GONDOR;
+ a_idx = ART_AMBER;
chance = 50;
}
- }
- else if ((m_ptr->r_idx == MON_UNICORN_ORD ||
- m_ptr->r_idx == MON_MORGOTH ||
- m_ptr->r_idx == MON_ONE_RING)
- && (p_ptr->pseikaku == SEIKAKU_NAMAKE))
- {
- do
+ break;
+
+ case MON_UNICORN_ORD:
+ case MON_MORGOTH:
+ case MON_ONE_RING:
+ if (p_ptr->pseikaku == SEIKAKU_NAMAKE)
{
- if (one_in_(3))
- {
- a_idx = ART_NAMAKE_HAMMER;
- chance = 100;
- }
- else if (one_in_(2))
- {
- a_idx = ART_NAMAKE_BOW;
- chance = 100;
- }
- else
+ do
{
- a_idx = ART_NAMAKE_ARMOR;
- chance = 100;
+ switch (randint0(3))
+ {
+ case 0:
+ a_idx = ART_NAMAKE_HAMMER;
+ break;
+ case 1:
+ a_idx = ART_NAMAKE_BOW;
+ break;
+ case 2:
+ a_idx = ART_NAMAKE_ARMOR;
+ break;
+ }
}
+ while (a_info[a_idx].cur_num);
+
+ chance = 100;
}
- while (a_info[a_idx].cur_num);
- }
- else if (m_ptr->r_idx == MON_GHB)
- {
+ break;
+
+ case MON_GHB:
a_idx = ART_GHB;
chance = 100;
- }
- else if (m_ptr->r_idx == MON_STORMBRINGER)
- {
+ break;
+
+ case MON_STORMBRINGER:
a_idx = ART_STORMBRINGER;
chance = 100;
- }
- else if (m_ptr->r_idx == MON_ECHIZEN)
- {
+ break;
+
+ case MON_ECHIZEN:
a_idx = ART_CRIMSON;
chance = 50;
- }
- else if (m_ptr->r_idx == MON_GANDALF)
- {
+ break;
+
+ case MON_GANDALF:
a_idx = ART_ICANUS;
chance = 20;
- }
- else if (m_ptr->r_idx == MON_OROCHI)
- {
+ break;
+
+ case MON_OROCHI:
a_idx = ART_KUSANAGI;
chance = 25;
- }
- else if (m_ptr->r_idx == MON_DWORKIN)
- {
- a_idx = ART_THRAIN;
+ break;
+
+ case MON_DWORKIN:
+ a_idx = ART_JUDGE;
chance = 20;
- }
- else if (m_ptr->r_idx == MON_SAURON)
- {
- if (randint(10) == 1)
+ break;
+
+ case MON_SAURON:
+ if (one_in_(10))
{
a_idx = ART_POWER;
chance = 100;
a_idx = ART_AHO;
chance = 100;
}
- }
- else if (m_ptr->r_idx == MON_BRAND)
- {
- if (randint(3) != 1)
+ break;
+
+ case MON_BRAND:
+ if (!one_in_(3))
{
a_idx = ART_BRAND;
chance = 25;
}
else
{
- a_idx = ART_ANGUIREL;
+ a_idx = ART_WEREWINDLE;
chance = 33;
}
- }
- else if (m_ptr->r_idx == MON_CORWIN)
- {
- if (randint(3) != 1)
+ break;
+
+ case MON_CORWIN:
+ if (!one_in_(3))
{
a_idx = ART_GRAYSWANDIR;
chance = 33;
a_idx = ART_CORWIN;
chance = 33;
}
- }
- else if (m_ptr->r_idx == MON_SURTUR)
- {
- a_idx = ART_MORMEGIL;
+ break;
+
+ case MON_SURTUR:
+ a_idx = ART_TWILIGHT;
chance = 66;
- }
- else if (m_ptr->r_idx == MON_SARUMAN)
- {
+ break;
+
+ case MON_SARUMAN:
a_idx = ART_ELENDIL;
chance = 33;
- }
- else if (m_ptr->r_idx == MON_FIONA)
- {
- a_idx = ART_BELANGIL;
+ break;
+
+ case MON_FIONA:
+ a_idx = ART_FIONA;
chance = 50;
- }
- else if (m_ptr->r_idx == MON_JULIAN)
- {
- a_idx = ART_CELEBORN;
+ break;
+
+ case MON_JULIAN:
+ a_idx = ART_JULIAN;
chance = 45;
- }
- else if (m_ptr->r_idx == MON_KLING)
- {
- a_idx = ART_OROME;
+ break;
+
+ case MON_KLING:
+ a_idx = ART_DESTINY;
chance = 40;
- }
- else if (m_ptr->r_idx == MON_GOEMON)
- {
+ break;
+
+ case MON_GOEMON:
a_idx = ART_ZANTETSU;
chance = 75;
- }
- else if (m_ptr->r_idx == MON_HAGEN)
- {
- a_idx = ART_NIMLOTH;
+ break;
+
+ case MON_HAGEN:
+ a_idx = ART_HAGEN;
chance = 66;
- }
- else if (m_ptr->r_idx == MON_CAIN)
- {
- a_idx = ART_ANGRIST;
+ break;
+
+ case MON_CAINE:
+ a_idx = ART_CAINE;
chance = 50;
- }
- else if (m_ptr->r_idx == MON_BULLGATES)
- {
+ break;
+
+ case MON_BULLGATES:
a_idx = ART_WINBLOWS;
chance = 66;
- }
- else if (m_ptr->r_idx == MON_LUNGORTHIN)
- {
+ break;
+
+ case MON_LUNGORTHIN:
a_idx = ART_CALRIS;
chance = 50;
- }
- else if (m_ptr->r_idx == MON_JACK_SHADOWS)
- {
+ break;
+
+ case MON_JACK_SHADOWS:
a_idx = ART_JACK;
chance = 15;
- }
- else if (m_ptr->r_idx == MON_DIO)
- {
+ break;
+
+ case MON_DIO:
a_idx = ART_STONEMASK;
chance = 20;
- }
- else if (m_ptr->r_idx == MON_BELD)
- {
+ break;
+
+ case MON_BELD:
a_idx = ART_SOULCRUSH;
chance = 10;
- }
- else if (m_ptr->r_idx == MON_PIP)
- {
+ break;
+
+ case MON_PIP:
a_idx = ART_EXCALIBUR_J;
chance = 50;
- }
+ break;
- else if (m_ptr->r_idx == MON_SHUTEN)
- {
+ case MON_SHUTEN:
a_idx = ART_SHUTEN_DOJI;
chance = 33;
- }
+ break;
- else if (m_ptr->r_idx == MON_GOTHMOG)
- {
+ case MON_GOTHMOG:
a_idx = ART_GOTHMOG;
chance = 33;
- }
+ break;
- else if (m_ptr->r_idx == MON_FUNDIN)
- {
+ case MON_FUNDIN:
a_idx = ART_FUNDIN;
chance = 5;
+ break;
}
- if ((a_idx > 0) && ((randint(99) < chance) || (wizard)))
+ if ((a_idx > 0) && ((randint0(100) < chance) || (p_ptr->wizard)))
{
if (a_info[a_idx].cur_num == 0)
{
}
if ((r_ptr->flags7 & RF7_GUARDIAN) && !p_ptr->inside_battle && (d_info[dungeon_type].final_guardian == m_ptr->r_idx))
{
+ int k_idx = lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT); /* Acquirement */;
+
+ if (d_info[dungeon_type].final_object)
+ k_idx = d_info[dungeon_type].final_object;
+
if (d_info[dungeon_type].final_artifact)
{
- byte a_idx = d_info[dungeon_type].final_artifact;
+ int a_idx = d_info[dungeon_type].final_artifact;
if (a_info[a_idx].cur_num == 0)
{
/* Create the artifact */
create_named_art(a_idx, y, x);
a_info[a_idx].cur_num = 1;
+ k_idx = 0;
}
}
- else
- {
- s16b k_idx;
-
- if (d_info[dungeon_type].final_object)
- k_idx = d_info[dungeon_type].final_object;
- else k_idx = 198;/* Acquirement */
+ if (k_idx)
+ {
/* Get local object */
q_ptr = &forge;
apply_magic(q_ptr, object_level, FALSE, TRUE, FALSE, FALSE);
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
}
/* Determine how much we can drop */
- if ((r_ptr->flags1 & RF1_DROP_60) && (rand_int(100) < 60)) number++;
- if ((r_ptr->flags1 & RF1_DROP_90) && (rand_int(100) < 90)) number++;
+ if ((r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60)) number++;
+ if ((r_ptr->flags1 & RF1_DROP_90) && (randint0(100) < 90)) number++;
if (r_ptr->flags1 & RF1_DROP_1D2) number += damroll(1, 2);
if (r_ptr->flags1 & RF1_DROP_2D2) number += damroll(2, 2);
if (r_ptr->flags1 & RF1_DROP_3D2) number += damroll(3, 2);
if (r_ptr->flags1 & RF1_DROP_4D2) number += damroll(4, 2);
- if (cloned) number = 0; /* Clones drop no stuff */
- if (is_pet(m_ptr) || p_ptr->inside_battle || p_ptr->inside_arena) number = 0; /* Pets drop no stuff */
+ if (cloned && !(r_ptr->flags1 & RF1_UNIQUE))
+ number = 0; /* Clones drop no stuff unless Cloning Pits */
+
+ if (is_pet(m_ptr) || p_ptr->inside_battle || p_ptr->inside_arena)
+ number = 0; /* Pets drop no stuff */
if (!drop_item && (r_ptr->d_char != '$')) number = 0;
/* Hack -- handle creeping coins */
object_wipe(q_ptr);
/* Make Gold */
- if (do_gold && (!do_item || (rand_int(100) < 50)))
+ if (do_gold && (!do_item || (randint0(100) < 50)))
{
/* Make some gold */
if (!make_gold(q_ptr)) continue;
dump_item++;
}
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
}
lore_treasure(m_idx, dump_item, dump_gold);
}
-#ifdef USE_SCRIPT
- kill_monster_callback(m_idx);
-#endif /* USE_SCRIPT */
-
/* Only process "Quest Monsters" */
if (!(r_ptr->flags1 & RF1_QUESTOR)) return;
if (p_ptr->inside_battle) return;
if (m_ptr->r_idx == MON_SERPENT)
{
/* Total winner */
- total_winner = TRUE;
+ p_ptr->total_winner = TRUE;
/* Redraw the "title" */
p_ptr->redraw |= (PR_TITLE);
#ifdef JP
do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "¸«»ö¤ËÊѶòÈÚÅܤξ¡Íø¼Ô¤È¤Ê¤Ã¤¿¡ª");
#else
- do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "become *WINNER* of Hengband finly!");
+ do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "become *WINNER* of Hengband finely!");
#endif
if (p_ptr->pclass == CLASS_CHAOS_WARRIOR)
if ((r_ptr->flags3 & RF3_RES_ALL) && dam > 0)
{
dam /= 100;
- if((dam == 0) && (randint(3) == 1)) dam = 1;
+ if((dam == 0) && one_in_(3)) dam = 1;
}
if (m_ptr->invulner)
#endif
}
}
- else if (!(randint(PENETRATE_INVULNERABILITY) == 1))
+ else if (!one_in_(PENETRATE_INVULNERABILITY))
{
return (0);
}
div *= r_ptr->hdice * (r_ptr->hside + 1);
}
- if (!dun_level && ((r_ptr->flags8 & RF8_DUNGEON) || !(r_ptr->flags1 & RF1_UNIQUE))) div *= 5;
+ if (!dun_level && (!(r_ptr->flags8 & RF8_WILD_ONLY) || !(r_ptr->flags1 & RF1_UNIQUE))) div *= 5;
div_h = div/0x10000L;
div_l = div%0x10000L;
div_h *= (m_ptr->max_maxhp*2);
#define M_INT_RSHIFT63(h1,l1) {l1=(l1>>1)|(h1<<30);h1>>=1;}
#define M_INT_DIV63(h1,l1,h2,l2,result) \
do{ \
- int bit=1; \
- result = 0; \
+ int bit=1; \
+ result = 0; \
while( M_INT_GREATER63(h1,l1, h2, l2) ){M_INT_LSHIFT63(h2, l2); bit<<=1;} \
for(bit>>=1; bit>=1; bit>>=1){ \
M_INT_RSHIFT63(h2, l2); \
if(M_INT_GREATER63(h1, l1, h2, l2)) \
{result|=bit;M_INT_SUB63(h1, l1, h2, l2);} \
} \
- } while(0)
+ } while(0)
/* Give some experience for the kill */
M_INT_DIV63(m_exp_h, m_exp_l, div_h, div_l, new_exp);
{
char m_name[80];
+ if (r_info[m_ptr->r_idx].flags7 & RF7_TANUKI)
+ {
+ /* You might have unmasked Tanuki first time */
+ r_ptr = &r_info[m_ptr->r_idx];
+ m_ptr->ap_r_idx = m_ptr->r_idx;
+ if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
+ }
+
+ if (m_ptr->mflag2 & MFLAG2_CHAMELEON)
+ {
+ /* You might have unmasked Chameleon first time */
+ r_ptr = real_r_ptr(m_ptr);
+ if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
+ }
+
+ /* When the player kills a Unique, it stays dead */
+ if (r_ptr->flags1 & RF1_UNIQUE && !(m_ptr->smart & SM_CLONED))
+ r_ptr->max_num = 0;
+
+ /* When the player kills a Nazgul, it stays dead */
+ if (r_ptr->flags7 & RF7_UNIQUE_7) r_ptr->max_num--;
+
+ /* Recall even invisible uniques or winners */
+ if (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE))
+ {
+ /* Count kills this life */
+ if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
+ else if (r_ptr->r_pkills < MAX_SHORT) r_ptr->r_pkills++;
+
+ /* Count kills in all lives */
+ if ((m_ptr->mflag2 & MFLAG2_KAGE) && (r_info[MON_KAGE].r_tkills < MAX_SHORT)) r_info[MON_KAGE].r_tkills++;
+ else if (r_ptr->r_tkills < MAX_SHORT) r_ptr->r_tkills++;
+
+ /* Hack -- Auto-recall */
+ monster_race_track(m_ptr->ap_r_idx);
+ }
+
/* Extract monster name */
monster_desc(m_name, m_ptr, 0x100);
/* Don't kill Amberites */
- if ((r_ptr->flags3 & RF3_AMBERITE) && (randint(2) == 1))
+ if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
{
- int curses = 1 + randint(3);
+ int curses = 1 + randint1(3);
bool stop_ty = FALSE;
int count = 0;
#endif
msg_format("%^s %s", m_name, line_got);
+
+#ifdef WORLD_SCORE
+ if (m_ptr->r_idx == MON_SERPENT)
+ {
+ /* Make screen dump */
+ screen_dump = make_screen_dump();
+ }
+#endif
}
if (!(d_info[dungeon_type].flags1 & DF1_BEGINNER))
}
else if (r_ptr->level > dun_level)
{
- if (randint(10) <= (r_ptr->level - dun_level))
+ if (randint1(10) <= (r_ptr->level - dun_level))
chg_virtue(V_VALOUR, 1);
}
if (r_ptr->level > 60)
chg_virtue(V_VITALITY, -2);
}
- if ((r_ptr->flags1 & RF1_UNIQUE) & (randint(3)==1))
+ if ((r_ptr->flags1 & RF1_UNIQUE) && one_in_(3))
chg_virtue(V_INDIVIDUALISM, -1);
if (m_ptr->r_idx == MON_BEGGAR || m_ptr->r_idx == MON_LEPER)
}
if ((r_ptr->flags3 & RF3_GOOD) &&
- ((r_ptr->level) / 10 + (3 * dun_level) >= randint(100)))
+ ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
chg_virtue(V_UNLIFE, 1);
{
if (r_ptr->flags1 & RF1_UNIQUE)
chg_virtue(V_FAITH, -2);
- else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint(100))
+ else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
{
if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
else chg_virtue(V_FAITH, 1);
{
if (r_ptr->flags1 & RF1_UNIQUE)
chg_virtue(V_FAITH, 2);
- else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint(100))
+ else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
chg_virtue(V_FAITH, 1);
}
{
chg_virtue(V_HONOUR, 10);
}
- else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint(100))
+ else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
{
chg_virtue(V_HONOUR, 1);
}
if (r_ptr->flags1 & RF1_UNIQUE)
chg_virtue(V_JUSTICE, 3);
else if (1+((r_ptr->level) / 10 + (2 * dun_level))
- >= randint(100))
+ >= randint1(100))
chg_virtue(V_JUSTICE, 1);
}
if ((r_ptr->flags3 & RF3_ANIMAL) && !(r_ptr->flags3 & RF3_EVIL) && !(r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) && !(r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) && !(r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
{
- if (randint(4)==1) chg_virtue(V_NATURE, -1);
+ if (one_in_(4)) chg_virtue(V_NATURE, -1);
}
- if((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
- do_cmd_write_nikki(NIKKI_UNIQUE, 0, r_name + r_ptr->name);
+ if ((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
+ {
+ char m_name[160];
+#ifdef JP
+ sprintf("%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(¥¯¥í¡¼¥ó)" : "");
+#else
+ sprintf("%s%s", r_name + r_ptr->name, (m_ptr->smart & SM_CLONED) ? "(Clone)" : "");
+#endif
+ do_cmd_write_nikki(NIKKI_UNIQUE, 0, m_name);
+ }
/* Make a sound */
sound(SOUND_KILL);
#endif
}
- if (r_ptr->flags1 & RF1_UNIQUE)
+ if (r_ptr->flags1 & RF1_UNIQUE && !(m_ptr->smart & SM_CLONED))
{
for (i = 0; i < MAX_KUBI; i++)
{
- if ((kubi_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG_CHAMELEON))
+ if ((kubi_r_idx[i] == m_ptr->r_idx) && !(m_ptr->mflag2 & MFLAG2_CHAMELEON))
{
#ifdef JP
msg_format("%s¤Î¼ó¤Ë¤Ï¾Þ¶â¤¬¤«¤«¤Ã¤Æ¤¤¤ë¡£", m_name);
/* Generate treasure */
monster_death(m_idx, TRUE);
- if (m_ptr->mflag2 & MFLAG_CHAMELEON)
- {
- if (r_ptr->flags1 & RF1_UNIQUE)
- r_ptr = &r_info[MON_CHAMELEON_K];
- else
- r_ptr = &r_info[MON_CHAMELEON];
- if (r_ptr->r_sights < MAX_SHORT) r_ptr->r_sights++;
- }
-
- /* When the player kills a Unique, it stays dead */
- if (r_ptr->flags1 & RF1_UNIQUE) r_ptr->max_num = 0;
-
- /* When the player kills a Nazgul, it stays dead */
- if (r_ptr->flags7 & RF7_UNIQUE_7) r_ptr->max_num--;
-
- /* Recall even invisible uniques or winners */
- if (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE))
- {
- /* Count kills this life */
- if ((m_ptr->mflag2 & MFLAG_KAGE) && (r_info[MON_KAGE].r_pkills < MAX_SHORT)) r_info[MON_KAGE].r_pkills++;
- else if (r_ptr->r_pkills < MAX_SHORT) r_ptr->r_pkills++;
-
- /* Count kills in all lives */
- if ((m_ptr->mflag2 & MFLAG_KAGE) && (r_info[MON_KAGE].r_tkills < MAX_SHORT)) r_info[MON_KAGE].r_tkills++;
- else if (r_ptr->r_tkills < MAX_SHORT) r_ptr->r_tkills++;
-
- /* Hack -- Auto-recall */
- monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
- }
-
if ((m_ptr->r_idx == MON_BANOR) || (m_ptr->r_idx == MON_LUPART))
{
r_info[MON_BANORLUPART].max_num = 0;
{
int dummy_y = m_ptr->fy;
int dummy_x = m_ptr->fx;
- bool friend = is_friendly(m_ptr);
- bool pet = is_pet(m_ptr);
+ u32b mode = 0L;
+
+ if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
/* Delete the monster */
delete_monster_idx(m_idx);
- if (summon_named_creature(dummy_y, dummy_x, MON_BIKETAL, FALSE, FALSE, friend, pet))
+ if (summon_named_creature(0, dummy_y, dummy_x, MON_BIKETAL, mode))
{
#ifdef JP
msg_print("¡Ö¥Ï¥¡¥Ã¥Ï¥Ã¥Ï¥Ã¥Ï¡ª¡ª»ä¤¬¥Ð¥¤¥±¥¿¥ë¤À¡ª¡ª¡×");
/* Mega-Hack -- Pain cancels fear */
if (m_ptr->monfear && (dam > 0))
{
- int tmp = randint(dam);
+ int tmp = randint1(dam);
/* Cure a little fear */
if (tmp < m_ptr->monfear)
* Run (sometimes) if at 10% or less of max hit points,
* or (usually) when hit for half its current hit points
*/
- if (((percentage <= 10) && (rand_int(10) < percentage)) ||
- ((dam >= m_ptr->hp) && (rand_int(100) < 80)))
+ if ((randint1(10) >= percentage) ||
+ ((dam >= m_ptr->hp) && (randint0(100) < 80)))
{
/* Hack -- note fear */
(*fear) = TRUE;
/* XXX XXX XXX Hack -- Add some timed fear */
- m_ptr->monfear = (randint(10) +
- (((dam >= m_ptr->hp) && (percentage > 7)) ?
- 20 : ((11 - percentage) * 5)));
+ m_ptr->monfear = (randint1(10) +
+ (((dam >= m_ptr->hp) && (percentage > 7)) ?
+ 20 : ((11 - percentage) * 5)));
}
}
}
-
/*
- * Calculates current boundaries
- * Called below and from "do_cmd_locate()".
+ * Get term size and calculate screen size
*/
-void panel_bounds(void)
+void get_screen_size(int *wid_p, int *hgt_p)
{
- panel_row_min = panel_row * (SCREEN_HGT / 2);
- panel_row_max = panel_row_min + SCREEN_HGT - 1;
- panel_row_prt = panel_row_min - 1;
- panel_col_min = panel_col * (SCREEN_WID / 2);
- panel_col_max = panel_col_min + SCREEN_WID - 1;
- panel_col_prt = panel_col_min - 13;
+ Term_get_size(wid_p, hgt_p);
+ *hgt_p -= ROW_MAP + 2;
+ *wid_p -= COL_MAP + 2;
+ if (use_bigtile) *wid_p /= 2;
}
/*
* Calculates current boundaries
* Called below and from "do_cmd_locate()".
- * Modified for "centering player on screen"
*/
void panel_bounds_center(void)
{
- panel_row = panel_row_min / (SCREEN_HGT / 2);
- panel_row_max = panel_row_min + SCREEN_HGT - 1;
+ int wid, hgt;
+
+ /* Get size */
+ get_screen_size(&wid, &hgt);
+
+ panel_row_max = panel_row_min + hgt - 1;
panel_row_prt = panel_row_min - 1;
- panel_col = panel_col_min / (SCREEN_WID / 2);
- panel_col_max = panel_col_min + SCREEN_WID - 1;
+ panel_col_max = panel_col_min + wid - 1;
panel_col_prt = panel_col_min - 13;
}
/*
- * Handle a request to change the current panel
- *
- * Return TRUE if the panel was changed.
- *
- * Also used in do_cmd_locate
+ * Map resizing whenever the main term changes size
*/
-bool change_panel(int dy, int dx)
+void resize_map(void)
{
- /* Apply the motion */
- int y = panel_row_min + dy * (SCREEN_HGT / 2);
- int x = panel_col_min + dx * (SCREEN_WID / 2);
+ /* Only if the dungeon exists */
+ if (!character_dungeon) return;
+
+ /* Mega-Hack -- no panel yet */
+ panel_row_max = 0;
+ panel_col_max = 0;
- /* Verify the row */
- if (y > max_panel_rows * (SCREEN_HGT / 2)) y = max_panel_rows * (SCREEN_HGT / 2);
- else if (y < 0) y = 0;
+ /* Reset the panels */
+ panel_row_min = cur_hgt;
+ panel_col_min = cur_wid;
+
+ verify_panel();
- /* Verify the col */
- if (x > max_panel_cols * (SCREEN_WID / 2)) x = max_panel_cols * (SCREEN_WID / 2);
- else if (x < 0) x = 0;
+ /* Update stuff */
+ p_ptr->update |= (PU_TORCH | PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
- /* Handle "changes" */
- if ((y != panel_row_min) || (x != panel_col_min))
- {
+ /* Forget lite/view */
+ p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
+
+ /* Update lite/view */
+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
+
+ /* Update monsters */
+ p_ptr->update |= (PU_MONSTERS);
+
+ /* Redraw everything */
+ p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY);
+
+ /* Hack -- update */
+ handle_stuff();
+
+ /* Redraw */
+ Term_redraw();
+
+ /*
+ * Waiting command;
+ * Place the cursor on the player
+ */
+ if (can_save) move_cursor_relative(py, px);
+
+ /* Refresh */
+ Term_fresh();
+}
+
+/*
+ * Redraw a term when it is resized
+ */
+void redraw_window(void)
+{
+ /* Only if the dungeon exists */
+ if (!character_dungeon) return;
+
+ /* Hack - Activate term zero for the redraw */
+ Term_activate(&term_screen[0]);
+
+ /* Hack -- react to changes */
+ Term_xtra(TERM_XTRA_REACT, 0);
+
+ /* Window stuff */
+ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
+
+ /* Window stuff */
+ p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
+
+ /* Hack -- update */
+ handle_stuff();
+
+ /* Redraw */
+ Term_redraw();
+
+ /* Refresh */
+ Term_fresh();
+}
+
+
+/*
+ * Handle a request to change the current panel
+ *
+ * Return TRUE if the panel was changed.
+ *
+ * Also used in do_cmd_locate
+ */
+bool change_panel(int dy, int dx)
+{
+ int y, x;
+ int wid, hgt;
+
+ /* Get size */
+ get_screen_size(&wid, &hgt);
+
+ /* Apply the motion */
+ y = panel_row_min + dy * hgt / 2;
+ x = panel_col_min + dx * wid / 2;
+
+ /* Verify the row */
+ if (y > cur_hgt - hgt) y = cur_hgt - hgt;
+ if (y < 0) y = 0;
+
+ /* Verify the col */
+ if (x > cur_wid - wid) x = cur_wid - wid;
+ if (x < 0) x = 0;
+
+ /* Handle "changes" */
+ if ((y != panel_row_min) || (x != panel_col_min))
+ {
/* Save the new panel info */
panel_row_min = y;
panel_col_min = x;
{
int y = py;
int x = px;
+ int wid, hgt;
- /* Center on player */
- if (center_player && (center_running || !running))
- {
- int prow_min;
- int pcol_min;
+ int prow_min;
+ int pcol_min;
+ int max_prow_min;
+ int max_pcol_min;
- int max_prow_min = max_panel_rows * (SCREEN_HGT / 2);
- int max_pcol_min = max_panel_cols * (SCREEN_WID / 2);
+ /* Get size */
+ get_screen_size(&wid, &hgt);
- /* Center vertically */
- prow_min = y - SCREEN_HGT / 2;
- if (prow_min > max_prow_min) prow_min = max_prow_min;
- else if (prow_min < 0) prow_min = 0;
-
- /* Center horizontally */
- pcol_min = x - SCREEN_WID / 2;
- if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
- else if (pcol_min < 0) pcol_min = 0;
+ max_prow_min = cur_hgt - hgt;
+ max_pcol_min = cur_wid - wid;
- /* Check for "no change" */
- if ((prow_min == panel_row_min) && (pcol_min == panel_col_min)) return;
+ /* Bounds checking */
+ if (max_prow_min < 0) max_prow_min = 0;
+ if (max_pcol_min < 0) max_pcol_min = 0;
- /* Save the new panel info */
- panel_row_min = prow_min;
- panel_col_min = pcol_min;
+ /* Center on player */
+ if (center_player && (center_running || !running))
+ {
+ /* Center vertically */
+ prow_min = y - hgt / 2;
+ if (prow_min < 0) prow_min = 0;
+ else if (prow_min > max_prow_min) prow_min = max_prow_min;
- /* Recalculate the boundaries */
- panel_bounds_center();
+ /* Center horizontally */
+ pcol_min = x - wid / 2;
+ if (pcol_min < 0) pcol_min = 0;
+ else if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
}
-
else
- {
- int prow = panel_row;
- int pcol = panel_col;
+ {
+ prow_min = panel_row_min;
+ pcol_min = panel_col_min;
/* Scroll screen when 2 grids from top/bottom edge */
- if ((y < panel_row_min + 2) || (y > panel_row_max - 2))
+ if (y > panel_row_max - 2)
{
- prow = ((y - SCREEN_HGT / 4) / (SCREEN_HGT / 2));
- if (prow > max_panel_rows) prow = max_panel_rows;
- else if (prow < 0) prow = 0;
+ while (y > prow_min + hgt-1 - 2)
+ {
+ prow_min += (hgt / 2);
+ }
}
+ if (y < panel_row_min + 2)
+ {
+ while (y < prow_min + 2)
+ {
+ prow_min -= (hgt / 2);
+ }
+ }
+
+ if (prow_min > max_prow_min) prow_min = max_prow_min;
+ if (prow_min < 0) prow_min = 0;
+
/* Scroll screen when 4 grids from left/right edge */
- if ((x < panel_col_min + 4) || (x > panel_col_max - 4))
+ if (x > panel_col_max - 4)
{
- pcol = ((x - SCREEN_WID / 4) / (SCREEN_WID / 2));
- if (pcol > max_panel_cols) pcol = max_panel_cols;
- else if (pcol < 0) pcol = 0;
+ while (x > pcol_min + wid-1 - 4)
+ {
+ pcol_min += (wid / 2);
+ }
+ }
+
+ if (x < panel_col_min + 4)
+ {
+ while (x < pcol_min + 4)
+ {
+ pcol_min -= (wid / 2);
+ }
}
- /* Check for "no change" */
- if ((prow == panel_row) && (pcol == panel_col)) return;
+ if (pcol_min > max_pcol_min) pcol_min = max_pcol_min;
+ if (pcol_min < 0) pcol_min = 0;
+ }
- /* Hack -- optional disturb on "panel change" */
- if (disturb_panel && !center_player) disturb(0, 0);
+ /* Check for "no change" */
+ if ((prow_min == panel_row_min) && (pcol_min == panel_col_min)) return;
- /* Save the new panel info */
- panel_row = prow;
- panel_col = pcol;
+ /* Save the new panel info */
+ panel_row_min = prow_min;
+ panel_col_min = pcol_min;
- /* Recalculate the boundaries */
- panel_bounds();
- }
+ /* Hack -- optional disturb on "panel change" */
+ if (disturb_panel && !center_player) disturb(0, 0);
+
+ /* Recalculate the boundaries */
+ panel_bounds_center();
/* Update stuff */
p_ptr->update |= (PU_MONSTERS);
/*
* Monster health description
*/
-cptr look_mon_desc(int m_idx)
+cptr look_mon_desc(int m_idx, u32b mode)
{
monster_type *m_ptr = &m_list[m_idx];
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
+ monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
bool living;
int perc;
-
+ cptr desc;
+ cptr attitude;
+ cptr clone;
/* Determine if the monster is "living" */
- living = monster_living(r_ptr);
+ living = monster_living(ap_r_ptr);
+ /* Calculate a health "percentage" */
+ perc = 100L * m_ptr->hp / m_ptr->maxhp;
/* Healthy monsters */
if (m_ptr->hp >= m_ptr->maxhp)
{
/* No damage */
#ifdef JP
-return (living ? "̵½ý" : "̵¥À¥á¡¼¥¸");
+ desc = living ? "̵½ý" : "̵¥À¥á¡¼¥¸";
#else
- return (living ? "unhurt" : "undamaged");
+ desc = living ? "unhurt" : "undamaged";
#endif
}
+ else if (perc >= 60)
+ {
+#ifdef JP
+ desc = living ? "·Ú½ý" : "¾®¥À¥á¡¼¥¸";
+#else
+ desc = living ? "somewhat wounded" : "somewhat damaged";
+#endif
- /* Calculate a health "percentage" */
- perc = 100L * m_ptr->hp / m_ptr->maxhp;
+ }
- if (perc >= 60)
+ else if (perc >= 25)
{
#ifdef JP
-return (living ? "·Ú½ý" : "¾®¥À¥á¡¼¥¸");
+ desc = living ? "Éé½ý" : "Ãæ¥À¥á¡¼¥¸";
#else
- return (living ? "somewhat wounded" : "somewhat damaged");
+ desc = living ? "wounded" : "damaged";
#endif
}
- if (perc >= 25)
+ else if (perc >= 10)
{
#ifdef JP
-return (living ? "Éé½ý" : "Ãæ¥À¥á¡¼¥¸");
+ desc = living ? "½Å½ý" : "Âç¥À¥á¡¼¥¸";
#else
- return (living ? "wounded" : "damaged");
+ desc = living ? "badly wounded" : "badly damaged";
#endif
}
- if (perc >= 10)
+ else
{
#ifdef JP
-return (living ? "½Å½ý" : "Âç¥À¥á¡¼¥¸");
+ desc = living ? "Ⱦ»àȾÀ¸" : "Åݤ줫¤±";
#else
- return (living ? "badly wounded" : "badly damaged");
+ desc = living ? "almost dead" : "almost destroyed";
#endif
-
}
+
+ /* Need attitude information? */
+ if (!(mode & 0x01))
+ {
+ /* Full information is not needed */
+ attitude = "";
+ }
+ else if (is_pet(m_ptr))
+ {
#ifdef JP
-return (living ? "Ⱦ»àȾÀ¸" : "Åݤ줫¤±");
+ attitude = ", ¥Ú¥Ã¥È";
#else
- return (living ? "almost dead" : "almost destroyed");
+ attitude = ", pet";
#endif
+ }
+ else if (is_friendly(m_ptr))
+ {
+#ifdef JP
+ attitude = ", ͧ¹¥Åª";
+#else
+ attitude = ", friendly";
+#endif
+ }
+ else
+ {
+#ifdef JP
+ attitude = "";
+#else
+ attitude = "";
+#endif
+ }
+
+ /* Clone monster? */
+ if (m_ptr->smart & SM_CLONED)
+ {
+ clone = ", clone";
+ }
+ else
+ {
+ clone = "";
+ }
+
+ /* Display monster's level --- idea borrowed from ToME */
+ if (ap_r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE))
+ {
+#ifdef JP
+ return format("¥ì¥Ù¥ë%d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
+#else
+ return format("Level %d, %s%s%s", ap_r_ptr->level, desc, attitude, clone);
+#endif
+ }
+ else
+ {
+#ifdef JP
+ return format("¥ì¥Ù¥ë???, %s%s%s", desc, attitude, clone);
+#else
+ return format("Level ???, %s%s%s", desc, attitude, clone);
+#endif
+ }
}
s16b this_o_idx, next_o_idx = 0;
+ /* Bounds */
+ if (!(in_bounds(y, x))) return (FALSE);
/* Player grid is always interesting */
if ((y == py) && (x == px)) return (TRUE);
/* Interesting memorized features */
if (c_ptr->info & (CAVE_MARK))
{
+ byte feat;
+
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
+
/* Notice glyphs */
- if (c_ptr->feat == FEAT_GLYPH) return (TRUE);
- if (c_ptr->feat == FEAT_MINOR_GLYPH) return (TRUE);
- if (c_ptr->feat == FEAT_MIRROR) return (TRUE);
+ if (c_ptr->info & CAVE_OBJECT) return (TRUE);
/* Notice the Pattern */
- if ((c_ptr->feat <= FEAT_PATTERN_XTRA2) &&
- (c_ptr->feat >= FEAT_PATTERN_START))
+ if ((feat <= FEAT_PATTERN_XTRA2) &&
+ (feat >= FEAT_PATTERN_START))
return (TRUE);
/* Notice doors */
- if (c_ptr->feat == FEAT_OPEN) return (TRUE);
- if (c_ptr->feat == FEAT_BROKEN) return (TRUE);
+ if (feat == FEAT_OPEN) return (TRUE);
+ if (feat == FEAT_BROKEN) return (TRUE);
/* Notice stairs */
- if (c_ptr->feat == FEAT_LESS) return (TRUE);
- if (c_ptr->feat == FEAT_MORE) return (TRUE);
- if (c_ptr->feat == FEAT_LESS_LESS) return (TRUE);
- if (c_ptr->feat == FEAT_MORE_MORE) return (TRUE);
+ if (feat == FEAT_LESS) return (TRUE);
+ if (feat == FEAT_MORE) return (TRUE);
+ if (feat == FEAT_LESS_LESS) return (TRUE);
+ if (feat == FEAT_MORE_MORE) return (TRUE);
/* Notice shops */
- if ((c_ptr->feat >= FEAT_SHOP_HEAD) &&
- (c_ptr->feat <= FEAT_SHOP_TAIL)) return (TRUE);
+ if ((feat >= FEAT_SHOP_HEAD) &&
+ (feat <= FEAT_SHOP_TAIL)) return (TRUE);
- if (c_ptr->feat == FEAT_MUSEUM) return (TRUE);
+ if (feat == FEAT_MUSEUM) return (TRUE);
/* Notice buildings -KMW- */
- if ((c_ptr->feat >= FEAT_BLDG_HEAD) &&
- (c_ptr->feat <= FEAT_BLDG_TAIL)) return (TRUE);
+ if ((feat >= FEAT_BLDG_HEAD) &&
+ (feat <= FEAT_BLDG_TAIL)) return (TRUE);
/* Notice traps */
- if (is_trap(c_ptr->feat)) return (TRUE);
+ if (is_trap(feat)) return (TRUE);
/* Notice doors */
- if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
- (c_ptr->feat <= FEAT_DOOR_TAIL)) return (TRUE);
+ if ((feat >= FEAT_DOOR_HEAD) &&
+ (feat <= FEAT_DOOR_TAIL)) return (TRUE);
+#if 0
/* Notice rubble */
- if (c_ptr->feat == FEAT_RUBBLE) return (TRUE);
+ /* I think FEAT_RUBBLEs should not be "interesting" */
+ if (feat == FEAT_RUBBLE) return (TRUE);
/* Notice veins with treasure */
- if (c_ptr->feat == FEAT_MAGMA_K) return (TRUE);
- if (c_ptr->feat == FEAT_QUARTZ_K) return (TRUE);
+ /* Now veins with treasure are too many */
+ if (feat == FEAT_MAGMA_K) return (TRUE);
+ if (feat == FEAT_QUARTZ_K) return (TRUE);
+#endif
/* Notice quest features */
- if (c_ptr->feat == FEAT_QUEST_ENTER) return (TRUE);
- if (c_ptr->feat == FEAT_QUEST_EXIT) return (TRUE);
- if (c_ptr->feat == FEAT_QUEST_DOWN) return (TRUE);
- if (c_ptr->feat == FEAT_QUEST_UP) return (TRUE);
- if (c_ptr->feat == FEAT_TOWN) return (TRUE);
- if (c_ptr->feat == FEAT_ENTRANCE) return (TRUE);
+ if (feat == FEAT_QUEST_ENTER) return (TRUE);
+ if (feat == FEAT_QUEST_EXIT) return (TRUE);
+ if (feat == FEAT_QUEST_DOWN) return (TRUE);
+ if (feat == FEAT_QUEST_UP) return (TRUE);
+ if (feat == FEAT_TOWN) return (TRUE);
+ if (feat == FEAT_ENTRANCE) return (TRUE);
}
/* Nope */
{
for (x = panel_col_min; x <= panel_col_max; x++)
{
- cave_type *c_ptr = &cave[y][x];
+ cave_type *c_ptr;
/* Require line of sight, unless "look" is "expanded" */
if (!expand_look && !player_has_los_bold(y, x)) continue;
/* Require "interesting" contents */
if (!target_set_accept(y, x)) continue;
+ c_ptr = &cave[y][x];
+
/* Require target_able monsters for "TARGET_KILL" */
if ((mode & (TARGET_KILL)) && !target_able(c_ptr->m_idx)) continue;
/*
+ * Evaluate number of kill needed to gain level
+ */
+static void evaluate_monster_exp(char *buf, monster_type *m_ptr)
+{
+#define M_INT_GREATER(h1,l1,h2,l2) ( (h1>h2)||( (h1==h2)&&(l1>=l2)))
+#define M_INT_SUB(h1,l1, h2,l2) {h1-=h2;if(l1<l2){l1+=0x10000;h1--;}l1-=l2;}
+#define M_INT_ADD(h1,l1, h2,l2) {h1+=h2;l1+=l2;if(l1>=0x10000L){l1&=0xFFFF;h1++;}}
+#define M_INT_LSHIFT(h1,l1) {h1=(h1<<1)|(l1>>15);l1=(l1<<1)&0xffff;}
+#define M_INT_RSHIFT(h1,l1) {l1=(l1>>1)|((h1&1)<<15);h1>>=1;}
+#define M_INT_MULT(h1,l1,mul,h2,l2) {l2=(l1*mul)&0xffff;h2=((l1*mul)>>16)+h1*mul;}
+
+ monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
+
+ u32b tmp_h,tmp_l;
+ int bit,result;
+ u32b exp_mon= (ap_r_ptr->mexp)*(ap_r_ptr->level);
+ u32b exp_mon_h= exp_mon / (p_ptr->max_plv+2);
+ u32b exp_mon_l= ((exp_mon % (p_ptr->max_plv+2))*0x10000/(p_ptr->max_plv+2))&0xFFFF;
+
+ u32b exp_adv_h = player_exp[p_ptr->lev -1] * p_ptr->expfact /100;
+ u32b exp_adv_l = ((player_exp[p_ptr->lev -1]%100) * p_ptr->expfact *0x10000/100)&0xFFFF;
+
+ M_INT_SUB(exp_adv_h, exp_adv_l, p_ptr->exp, p_ptr->exp_frac);
+ if ((p_ptr->lev>=PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID))
+ sprintf(buf,"**");
+ else if (!ap_r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG2_KAGE))
+ sprintf(buf,"??");
+ else if (M_INT_GREATER(exp_mon_h, exp_mon_l, exp_adv_h, exp_adv_l))
+ sprintf(buf,"001");
+ else
+ {
+ M_INT_MULT(exp_mon_h, exp_mon_l, 1000,tmp_h, tmp_l);
+ if( M_INT_GREATER(exp_adv_h, exp_adv_l, tmp_h, tmp_l) )
+ sprintf(buf,"999");
+ else
+ {
+ bit=1; result=0;
+ M_INT_ADD(exp_adv_h, exp_adv_l, exp_mon_h, exp_mon_l);
+ M_INT_SUB(exp_adv_h, exp_adv_l, 0, 1);
+ while(M_INT_GREATER(exp_adv_h, exp_adv_l, exp_mon_h,exp_mon_l))
+ {
+ M_INT_LSHIFT(exp_mon_h,exp_mon_l);
+ bit <<= 1;
+ }
+ M_INT_RSHIFT(exp_mon_h,exp_mon_l);bit>>=1;
+ for(;bit>=1;bit>>=1)
+ {
+ if(M_INT_GREATER(exp_adv_h,exp_adv_l,exp_mon_h,exp_mon_l))
+ {
+ result |= bit;
+ M_INT_SUB(exp_adv_h,exp_adv_l,exp_mon_h,exp_mon_l);
+ }
+ M_INT_RSHIFT(exp_mon_h,exp_mon_l);
+ }
+ sprintf(buf,"%03d",result);
+ }
+ }
+}
+
+
+/*
* Examine a grid, return a keypress.
*
* The "mode" argument contains the "TARGET_LOOK" bit flag, which
static int target_set_aux(int y, int x, int mode, cptr info)
{
cave_type *c_ptr = &cave[y][x];
-
s16b this_o_idx, next_o_idx = 0;
-
- cptr s1, s2, s3;
-
- bool boring;
-
- int feat;
-
- int query;
-
+ cptr s1 = "", s2 = "", s3 = "", x_info = "";
+ bool boring = TRUE;
+ byte feat;
+ int query = '\001';
char out_val[MAX_NLEN+80];
+#ifdef ALLOW_EASY_FLOOR
+ int floor_list[23], floor_num = 0;
- /* Repeat forever */
- while (1)
+ /* Scan all objects in the grid */
+ if (easy_floor)
{
- /* Paranoia */
- query = ' ';
-
- /* Assume boring */
- boring = TRUE;
+ floor_num = scan_floor(floor_list, y, x, 0x02);
- /* Default */
+ if (floor_num)
+ {
#ifdef JP
-s1 = "";
+ x_info = "xʪ ";
#else
- s1 = "You see ";
+ x_info = "x,";
#endif
+ }
+ }
- s2 = "";
- s3 = "";
+#endif /* ALLOW_EASY_FLOOR */
- /* Hack -- under the player */
- if ((y == py) && (x == px))
- {
- /* Description */
+ /* Hack -- under the player */
+ if ((y == py) && (x == px))
+ {
+ /* Description */
#ifdef JP
- s1 = "¤¢¤Ê¤¿¤Ï";
- s2 = "¤Î¾å";
- s3 = "¤Ë¤¤¤ë";
+ s1 = "¤¢¤Ê¤¿¤Ï";
+ s2 = "¤Î¾å";
+ s3 = "¤Ë¤¤¤ë";
#else
- s1 = "You are ";
+ s1 = "You are ";
- /* Preposition */
- s2 = "on ";
-#endif
-
- }
- else
- {
-#ifdef JP
- s1 = "¥¿¡¼¥²¥Ã¥È:";
-#else
- s1 = "Target:";
+ /* Preposition */
+ s2 = "on ";
#endif
- }
-
- /* Hack -- hallucination */
- if (p_ptr->image)
- {
+ }
+ else
+ {
#ifdef JP
-cptr name = "²¿¤«´ñ̯¤Êʪ";
+ s1 = "¥¿¡¼¥²¥Ã¥È:";
#else
- cptr name = "something strange";
+ s1 = "Target:";
#endif
+ }
-
- /* Display a message */
+ /* Hack -- hallucination */
+ if (p_ptr->image)
+ {
#ifdef JP
- sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info);
+ cptr name = "²¿¤«´ñ̯¤Êʪ";
#else
- sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
+ cptr name = "something strange";
#endif
- prt(out_val, 0, 0);
- move_cursor_relative(y, x);
- query = inkey();
-
- /* Stop on everything but "return" */
- if ((query != '\r') && (query != '\n')) break;
-
- /* Repeat forever */
- continue;
- }
-
-
- /* Actual monsters */
- if (c_ptr->m_idx)
- {
- monster_type *m_ptr = &m_list[c_ptr->m_idx];
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Visible */
- if (m_ptr->ml)
- {
- bool recall = FALSE;
-
- char m_name[80];
-
- /* Not boring */
- boring = FALSE;
-
- /* Get the monster name ("a kobold") */
- monster_desc(m_name, m_ptr, 0x08);
-
- /* Hack -- track this monster race */
- monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
-
- /* Hack -- health bar for this monster */
- health_track(c_ptr->m_idx);
- /* Hack -- handle stuff */
- handle_stuff();
-
- /* Interact */
- while (1)
- {
- /* Recall */
- if (recall)
- {
- /* Save */
- screen_save();
-
- /* Recall on screen */
- if (m_ptr->mflag2 & MFLAG_KAGE) screen_roff(MON_KAGE,0);
- else screen_roff(m_ptr->r_idx, 0);
-
- /* Hack -- Complete the prompt (again) */
+ /* Display a message */
#ifdef JP
-Term_addstr(-1, TERM_WHITE, format(" [r»× %s]", info));
+ sprintf(out_val, "%s%s%s%s [%s]", s1, name, s2, s3, info);
#else
- Term_addstr(-1, TERM_WHITE, format(" [r,%s]", info));
+ sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
#endif
+ prt(out_val, 0, 0);
+ move_cursor_relative(y, x);
+ query = inkey();
- /* Command */
- query = inkey();
+ /* Stop on everything but "return" */
+ if ((query != '\r') && (query != '\n')) return query;
- /* Restore */
- screen_load();
- }
+ /* Repeat forever */
+ return 0;
+ }
- /* Normal */
- else
- {
- cptr attitude;
- cptr tekitou;
- if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx))
- {
-#ifdef JP
- tekitou = "(¥Ú¥Ã¥È)";
-#else
- tekitou = "(pet)";
-#endif
- }
- else
- {
- tekitou = "";
- }
+ /* Actual monsters */
+ if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml)
+ {
+ monster_type *m_ptr = &m_list[c_ptr->m_idx];
+ monster_race *ap_r_ptr = &r_info[m_ptr->ap_r_idx];
+ char m_name[80];
+ bool recall = FALSE;
- if (is_pet(m_ptr) && (p_ptr->riding != c_ptr->m_idx))
-#ifdef JP
-attitude = " (¥Ú¥Ã¥È) ";
-#else
- attitude = " (pet) ";
-#endif
+ /* Not boring */
+ boring = FALSE;
- else if (is_friendly(m_ptr))
-#ifdef JP
-attitude = " (ͧ¹¥Åª) ";
-#else
- attitude = " (friendly) ";
-#endif
+ /* Get the monster name ("a kobold") */
+ monster_desc(m_name, m_ptr, 0x08);
- else
-#ifdef JP
-attitude = " ";
-#else
- attitude = " ";
-#endif
+ /* Hack -- track this monster race */
+ monster_race_track(m_ptr->ap_r_idx);
+ /* Hack -- health bar for this monster */
+ health_track(c_ptr->m_idx);
- /* Describe, and prompt for recall */
-{
-#define M_INT_GREATER(h1,l1,h2,l2) ( (h1>h2)||( (h1==h2)&&(l1>=l2)))
-#define M_INT_SUB(h1,l1, h2,l2) {h1-=h2;if(l1<l2){l1+=0x10000;h1--;}l1-=l2;}
-#define M_INT_ADD(h1,l1, h2,l2) {h1+=h2;l1+=l2;if(l1>=0x10000L){l1&=0xFFFF;h1++;}}
-#define M_INT_LSHIFT(h1,l1) {h1=(h1<<1)|(l1>>15);l1=(l1<<1)&0xffff;}
-#define M_INT_RSHIFT(h1,l1) {l1=(l1>>1)|((h1&1)<<15);h1>>=1;}
-#define M_INT_MULT(h1,l1,mul,h2,l2) {l2=(l1*mul)&0xffff;h2=((l1*mul)>>16)+h1*mul;}
- char acount[10];
- u32b tmp_h,tmp_l;
- int bit,result;
- u32b exp_mon= (r_ptr->mexp)*(r_ptr->level);
- u32b exp_mon_h= exp_mon / (p_ptr->max_plv+2);
- u32b exp_mon_l= ((exp_mon % (p_ptr->max_plv+2))*0x10000/(p_ptr->max_plv+2))&0xFFFF;
-
- u32b exp_adv_h = player_exp[p_ptr->lev -1] * p_ptr->expfact /100;
- u32b exp_adv_l = ((player_exp[p_ptr->lev -1]%100) * p_ptr->expfact *0x10000/100)&0xFFFF;
-
- M_INT_SUB(exp_adv_h, exp_adv_l, p_ptr->exp, p_ptr->exp_frac);
- if ((p_ptr->lev>=PY_MAX_LEVEL) || (p_ptr->prace == RACE_ANDROID))
- sprintf(acount,"[**]");
- else if (!r_ptr->r_tkills || (m_ptr->mflag2 & MFLAG_KAGE))
- sprintf(acount,"[??]");
- else if (M_INT_GREATER(exp_mon_h, exp_mon_l, exp_adv_h, exp_adv_l))
- sprintf(acount,"[001]");
- else
- {
- M_INT_MULT(exp_mon_h, exp_mon_l, 1000,tmp_h, tmp_l);
- if( M_INT_GREATER(exp_adv_h, exp_adv_l, tmp_h, tmp_l) )
- sprintf(acount,"[999]");
- else
+ /* Hack -- handle stuff */
+ handle_stuff();
+
+ /* Interact */
+ while (1)
{
- bit=1; result=0;
- M_INT_ADD(exp_adv_h, exp_adv_l, exp_mon_h, exp_mon_l);
- M_INT_SUB(exp_adv_h, exp_adv_l, 0, 1);
- while(M_INT_GREATER(exp_adv_h, exp_adv_l, exp_mon_h,exp_mon_l))
- {
- M_INT_LSHIFT(exp_mon_h,exp_mon_l);
- bit <<= 1;
- }
- M_INT_RSHIFT(exp_mon_h,exp_mon_l);bit>>=1;
- for(;bit>=1;bit>>=1)
+ char acount[10];
+
+ /* Recall */
+ if (recall)
{
- if(M_INT_GREATER(exp_adv_h,exp_adv_l,exp_mon_h,exp_mon_l))
- {
- result |= bit;
- M_INT_SUB(exp_adv_h,exp_adv_l,exp_mon_h,exp_mon_l);
- }
- M_INT_RSHIFT(exp_mon_h,exp_mon_l);
+ /* Save */
+ screen_save();
+
+ /* Recall on screen */
+ screen_roff(m_ptr->ap_r_idx, 0);
+
+ /* Hack -- Complete the prompt (again) */
+#ifdef JP
+ Term_addstr(-1, TERM_WHITE, format(" [r»× %s%s]", x_info, info));
+#else
+ Term_addstr(-1, TERM_WHITE, format(" [r,%s%s]", x_info, info));
+#endif
+
+ /* Command */
+ query = inkey();
+
+ /* Restore */
+ screen_load();
+
+ /* Normal commands */
+ if (query != 'r') break;
+
+ /* Toggle recall */
+ recall = FALSE;
+
+ /* Cleare recall text and repeat */
+ continue;
}
- sprintf(acount,"[%03d]",result);
- }
- }
- sprintf(out_val,
+
+ /*** Normal ***/
+
+ /* Describe, and prompt for recall */
+ evaluate_monster_exp(acount, m_ptr);
+
#ifdef JP
- "%s%s%s(%s)%s%s%s%s%s[r»× %s]",
- acount, s1, m_name, look_mon_desc(c_ptr->m_idx), tekitou, s2, s3,
+ sprintf(out_val, "[%s]%s%s(%s)%s%s [r»× %s%s]", acount, s1, m_name, look_mon_desc(c_ptr->m_idx, 0x01), s2, s3, x_info, info);
#else
- "%s%s%s%s%s(%s)%s%s%s[r, %s]",
- acount, s1, s2, s3, m_name, look_mon_desc(c_ptr->m_idx), tekitou,
+ sprintf(out_val, "[%s]%s%s%s%s(%s) [r, %s%s]", acount, s1, s2, s3, m_name, look_mon_desc(c_ptr->m_idx, 0x01), x_info, info);
#endif
- (m_ptr->smart & SM_CLONED ? " (clone)": ""),
- attitude,info);
-}
- prt(out_val, 0, 0);
+ prt(out_val, 0, 0);
- /* Place cursor */
- move_cursor_relative(y, x);
+ /* Place cursor */
+ move_cursor_relative(y, x);
- /* Command */
- query = inkey();
- }
+ /* Command */
+ query = inkey();
- /* Normal commands */
- if (query != 'r') break;
+ /* Normal commands */
+ if (query != 'r') break;
- /* Toggle recall */
- recall = !recall;
- }
+ /* Toggle recall */
+ recall = TRUE;
+ }
- /* Always stop at "normal" keys */
- if ((query != '\r') && (query != '\n') && (query != ' ')) break;
+ /* Always stop at "normal" keys */
+ if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
- /* Sometimes stop at "space" key */
- if ((query == ' ') && !(mode & (TARGET_LOOK))) break;
+ /* Sometimes stop at "space" key */
+ if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
- /* Change the intro */
+ /* Change the intro */
#ifdef JP
-s1 = "¤½¤ì¤Ï";
+ s1 = "¤½¤ì¤Ï";
#else
- s1 = "It is ";
+ s1 = "It is ";
#endif
- /* Hack -- take account of gender */
+ /* Hack -- take account of gender */
#ifdef JP
-if (r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï";
+ if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "Èà½÷¤Ï";
#else
- if (r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is ";
+ if (ap_r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is ";
#endif
#ifdef JP
-else if (r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï";
+ else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "Èà¤Ï";
#else
- else if (r_ptr->flags1 & (RF1_MALE)) s1 = "He is ";
+ else if (ap_r_ptr->flags1 & (RF1_MALE)) s1 = "He is ";
#endif
- /* Use a preposition */
+ /* Use a preposition */
#ifdef JP
- s2 = "¤ò";
- s3 = "»ý¤Ã¤Æ¤¤¤ë";
+ s2 = "¤ò";
+ s3 = "»ý¤Ã¤Æ¤¤¤ë";
#else
- s2 = "carrying ";
+ s2 = "carrying ";
#endif
- /* Scan all objects being carried */
- for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
- {
- char o_name[MAX_NLEN];
+ /* Scan all objects being carried */
+ for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
+ {
+ char o_name[MAX_NLEN];
- object_type *o_ptr;
+ object_type *o_ptr;
- /* Acquire object */
- o_ptr = &o_list[this_o_idx];
+ /* Acquire object */
+ o_ptr = &o_list[this_o_idx];
- /* Acquire next object */
- next_o_idx = o_ptr->next_o_idx;
+ /* Acquire next object */
+ next_o_idx = o_ptr->next_o_idx;
- /* Obtain an object description */
- object_desc(o_name, o_ptr, TRUE, 3);
+ /* Obtain an object description */
+ object_desc(o_name, o_ptr, TRUE, 3);
- /* Describe the object */
+ /* Describe the object */
#ifdef JP
- sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
+ sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
#else
- sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
+ sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
#endif
- prt(out_val, 0, 0);
- move_cursor_relative(y, x);
- query = inkey();
+ prt(out_val, 0, 0);
+ move_cursor_relative(y, x);
+ query = inkey();
- /* Always stop at "normal" keys */
- if ((query != '\r') && (query != '\n') && (query != ' ')) break;
+ /* Always stop at "normal" keys */
+ if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
- /* Sometimes stop at "space" key */
- if ((query == ' ') && !(mode & (TARGET_LOOK))) break;
+ /* Sometimes stop at "space" key */
+ if ((query == ' ') && !(mode & (TARGET_LOOK))) return query;
- /* Change the intro */
+ /* Change the intro */
#ifdef JP
-s2 = "¤ò¤Þ¤¿";
+ s2 = "¤ò¤Þ¤¿";
#else
- s2 = "also carrying ";
+ s2 = "also carrying ";
#endif
+ }
- }
-
- /* Double break */
- if (this_o_idx) break;
-
- /* Use a preposition */
+ /* Use a preposition */
#ifdef JP
- s2 = "¤Î¾å";
- s3 = "¤Ë¤¤¤ë";
+ s2 = "¤Î¾å";
+ s3 = "¤Ë¤¤¤ë";
#else
- s2 = "on ";
+ s2 = "on ";
#endif
-
- }
- }
+ }
#ifdef ALLOW_EASY_FLOOR
+ if (floor_num)
+ {
+ int min_width = 0;
- /* Scan all objects in the grid */
- if (easy_floor)
+ while (1)
{
- int floor_list[23], floor_num;
-
- if (scan_floor(floor_list, &floor_num, y, x, 0x02))
+ if (floor_num == 1)
{
- /* Not boring */
- boring = FALSE;
-
- while (1)
- {
- if (floor_num == 1)
- {
- char o_name[MAX_NLEN];
+ char o_name[MAX_NLEN];
- object_type *o_ptr;
+ object_type *o_ptr;
- /* Acquire object */
- o_ptr = &o_list[floor_list[0]];
+ /* Acquire object */
+ o_ptr = &o_list[floor_list[0]];
- /* Describe the object */
- object_desc(o_name, o_ptr, TRUE, 3);
+ /* Describe the object */
+ object_desc(o_name, o_ptr, TRUE, 3);
- /* Message */
+ /* Message */
#ifdef JP
-sprintf(out_val, "%s%s%s%s[%s]",
-s1, o_name, s2, s3, info);
+ sprintf(out_val, "%s%s%s%s[%s]",
+ s1, o_name, s2, s3, info);
#else
- sprintf(out_val, "%s%s%s%s [%s]",
- s1, s2, s3, o_name, info);
+ sprintf(out_val, "%s%s%s%s [%s]",
+ s1, s2, s3, o_name, info);
#endif
- }
- else
- {
- /* Message */
+ prt(out_val, 0, 0);
+ move_cursor_relative(y, x);
+
+ /* Command */
+ query = inkey();
+
+ /* End this grid */
+ return query;
+ }
+
+ /* Provide one cushion before item listing */
+ if (boring)
+ {
+ /* Display rough information about items */
#ifdef JP
- sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s ['x'¤Ç°ìÍ÷, %s]",
- s1, floor_num, s2, s3, info);
+ sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s ['x'¤Ç°ìÍ÷, %s]",
+ s1, floor_num, s2, s3, info);
#else
- sprintf(out_val, "%s%s%sa pile of %d items [x,%s]",
- s1, s2, s3, floor_num, info);
+ sprintf(out_val, "%s%s%sa pile of %d items [x,%s]",
+ s1, s2, s3, floor_num, info);
#endif
- }
+ prt(out_val, 0, 0);
+ move_cursor_relative(y, x);
- prt(out_val, 0, 0);
- move_cursor_relative(y, x);
+ /* Command */
+ query = inkey();
- /* Command */
- query = inkey();
+ /* No request for listing */
+ if (query != 'x' && query != ' ') return query;
+ }
- /* Display list of items (query == "el", not "won") */
- if ((floor_num > 1) && (query == 'x'))
- {
- /* Save screen */
- screen_save();
- /* Display */
- (void)show_floor(0, y, x);
+ /** Display list of items **/
- /* Prompt */
+ /* Continue scrolling list if requested */
+ while (1)
+ {
+ int i, o_idx;
+ cave_type *c_ptr;
+
+ /* Save screen */
+ screen_save();
+
+ /* Display */
+ (void)show_floor(0, y, x, &min_width);
+
+ /* Prompt */
#ifdef JP
-prt("²¿¤«¥¡¼¤ò²¡¤¹¤È¥²¡¼¥à¤ËÌá¤ê¤Þ¤¹", 0, 0);
+ sprintf(out_val, "%s %d¸Ä¤Î¥¢¥¤¥Æ¥à%s%s [Enter¤Ç¼¡¤Ø, %s]",
+ s1, floor_num, s2, s3, info);
#else
- prt("Hit any key to continue", 0, 0);
+ sprintf(out_val, "%s%s%sa pile of %d items [Enter,%s]",
+ s1, s2, s3, floor_num, info);
#endif
+ prt(out_val, 0, 0);
- /* Wait */
- (void) inkey();
+ /* Wait */
+ query = inkey();
- /* Load screen */
- screen_load();
- }
- else
- {
- /* Stop */
- break;
- }
+ /* Load screen */
+ screen_load();
+
+ /* Exit unless 'Enter' */
+ if (query != '\n' && query != '\r')
+ {
+ return query;
}
- /* Stop */
- break;
+ /* Get the object being moved. */
+ c_ptr = &cave[y][x];
+ o_idx = c_ptr->o_idx;
+
+ /* Only rotate a pile of two or more objects. */
+ if (!(o_idx && o_list[o_idx].next_o_idx)) continue;
+
+ /* Remove the first object from the list. */
+ excise_object_idx(o_idx);
+
+ /* Find end of the list. */
+ i = c_ptr->o_idx;
+ while (o_list[i].next_o_idx)
+ i = o_list[i].next_o_idx;
+
+ /* Add after the last object. */
+ o_list[i].next_o_idx = o_idx;
+
+ /* Loop and re-display the list */
}
}
+ /* NOTREACHED */
+ }
#endif /* ALLOW_EASY_FLOOR */
- /* Scan all objects in the grid */
- for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
- {
- object_type *o_ptr;
+ /* Scan all objects in the grid */
+ for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
+ {
+ object_type *o_ptr;
- /* Acquire object */
- o_ptr = &o_list[this_o_idx];
+ /* Acquire object */
+ o_ptr = &o_list[this_o_idx];
- /* Acquire next object */
- next_o_idx = o_ptr->next_o_idx;
+ /* Acquire next object */
+ next_o_idx = o_ptr->next_o_idx;
- /* Describe it */
- if (o_ptr->marked)
- {
- char o_name[MAX_NLEN];
+ /* Describe it */
+ if (o_ptr->marked)
+ {
+ char o_name[MAX_NLEN];
- /* Not boring */
- boring = FALSE;
+ /* Not boring */
+ boring = FALSE;
- /* Obtain an object description */
- object_desc(o_name, o_ptr, TRUE, 3);
+ /* Obtain an object description */
+ object_desc(o_name, o_ptr, TRUE, 3);
- /* Describe the object */
+ /* Describe the object */
#ifdef JP
-sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
+ sprintf(out_val, "%s%s%s%s[%s]", s1, o_name, s2, s3, info);
#else
- sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
+ sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, o_name, info);
#endif
- prt(out_val, 0, 0);
- move_cursor_relative(y, x);
- query = inkey();
+ prt(out_val, 0, 0);
+ move_cursor_relative(y, x);
+ query = inkey();
- /* Always stop at "normal" keys */
- if ((query != '\r') && (query != '\n') && (query != ' ')) break;
+ /* Always stop at "normal" keys */
+ if ((query != '\r') && (query != '\n') && (query != ' ') && (query != 'x')) return query;
- /* Sometimes stop at "space" key */
- if ((query == ' ') && !(mode & TARGET_LOOK)) break;
+ /* Sometimes stop at "space" key */
+ if ((query == ' ') && !(mode & TARGET_LOOK)) return query;
- /* Change the intro */
+ /* Change the intro */
#ifdef JP
-s1 = "¤½¤ì¤Ï";
+ s1 = "¤½¤ì¤Ï";
#else
- s1 = "It is ";
+ s1 = "It is ";
#endif
- /* Plurals */
+ /* Plurals */
#ifdef JP
-if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï";
+ if (o_ptr->number != 1) s1 = "¤½¤ì¤é¤Ï";
#else
- if (o_ptr->number != 1) s1 = "They are ";
+ if (o_ptr->number != 1) s1 = "They are ";
#endif
- /* Preposition */
+ /* Preposition */
#ifdef JP
- s2 = "¤Î¾å";
- s3 = "¤Ë¸«¤¨¤ë";
+ s2 = "¤Î¾å";
+ s3 = "¤Ë¸«¤¨¤ë";
#else
- s2 = "on ";
+ s2 = "on ";
#endif
- }
}
+ }
- /* Double break */
- if (this_o_idx) break;
- if (c_ptr->mimic)
- {
- feat = c_ptr->mimic;
- }
- else
- {
- feat = f_info[c_ptr->feat].mimic;
- }
+ /* Feature code (applying "mimic" field) */
+ feat = c_ptr->mimic ? c_ptr->mimic : f_info[c_ptr->feat].mimic;
- /* Require knowledge about grid, or ability to see grid */
- if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
+ /* Require knowledge about grid, or ability to see grid */
+ if (!(c_ptr->info & CAVE_MARK) && !player_can_see_bold(y, x))
+ {
+ /* Forget feature */
+ feat = FEAT_NONE;
+ }
+
+ /* Terrain feature if needed */
+ if (boring || (feat > FEAT_INVIS))
+ {
+ cptr name;
+
+ /* Hack -- special handling for building doors */
+ if ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL))
{
- /* Forget feature */
- feat = FEAT_NONE;
+ name = building[feat - FEAT_BLDG_HEAD].name;
}
-
- /* Terrain feature if needed */
- if (boring || (feat > FEAT_INVIS))
+ else if (feat == FEAT_ENTRANCE)
{
- cptr name;
-
- /* Hack -- special handling for building doors */
- if ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL))
- {
- name = building[feat - FEAT_BLDG_HEAD].name;
- }
- else if (feat == FEAT_ENTRANCE)
- {
-#ifdef JP
- name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
-#else
- name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
-#endif
- }
- else if (feat == FEAT_TOWN)
- {
- name = town[c_ptr->special].name;
- }
- else if (p_ptr->wild_mode && (feat == FEAT_FLOOR))
- {
#ifdef JP
- name = "ƻ";
+ name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
#else
- name = "road";
+ name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
#endif
- }
- else
- {
- name = f_name + f_info[feat].name;
- }
-
- /* Hack -- handle unknown grids */
+ }
+ else if (feat == FEAT_TOWN)
+ {
+ name = town[c_ptr->special].name;
+ }
+ else if (p_ptr->wild_mode && (feat == FEAT_FLOOR))
+ {
#ifdef JP
-if (feat == FEAT_NONE) name = "̤ÃΤÎÃÏ·Á";
+ name = "ƻ";
#else
- if (feat == FEAT_NONE) name = "unknown grid";
+ name = "road";
#endif
+ }
+ else
+ {
+ name = f_name + f_info[feat].name;
+ }
- /* Pick a prefix */
- if (*s2 && ((feat >= FEAT_MINOR_GLYPH) &&
- (feat <= FEAT_PATTERN_XTRA2)))
- {
+ /* Pick a prefix */
+ if (*s2 && ((feat >= FEAT_MINOR_GLYPH) &&
+ (feat <= FEAT_PATTERN_XTRA2)))
+ {
#ifdef JP
-s2 = "¤Î¾å";
+ s2 = "¤Î¾å";
#else
- s2 = "on ";
+ s2 = "on ";
#endif
- }
- else if (*s2 && ((feat >= FEAT_DOOR_HEAD) &&
- (feat <= FEAT_PERM_SOLID)))
- {
+ }
+ else if (*s2 && ((feat >= FEAT_DOOR_HEAD) &&
+ (feat <= FEAT_PERM_SOLID)))
+ {
#ifdef JP
-s2 = "¤ÎÃæ";
+ s2 = "¤ÎÃæ";
#else
- s2 = "in ";
+ s2 = "in ";
#endif
- }
- else if (*s2 && (feat == FEAT_TOWN))
- {
+ }
+ else if (*s2 && (feat == FEAT_TOWN))
+ {
#ifdef JP
-s2 = "¤ÎÃæ";
+ s2 = "¤ÎÃæ";
#else
- s2 = "in ";
+ s2 = "in ";
#endif
- }
+ }
- /* Hack -- special introduction for store & building doors -KMW- */
- if (((feat >= FEAT_SHOP_HEAD) && (feat <= FEAT_SHOP_TAIL)) ||
- ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) ||
- (feat == FEAT_MUSEUM) ||
- (feat == FEAT_ENTRANCE))
- {
+ /* Hack -- special introduction for store & building doors -KMW- */
+ if (((feat >= FEAT_SHOP_HEAD) && (feat <= FEAT_SHOP_TAIL)) ||
+ ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) ||
+ (feat == FEAT_MUSEUM) ||
+ (feat == FEAT_ENTRANCE))
+ {
#ifdef JP
-s2 = "¤ÎÆþ¸ý";
+ s2 = "¤ÎÆþ¸ý";
#else
- s3 = "";
+ s3 = "";
#endif
- }
- else if ((feat == FEAT_TOWN) || (feat == FEAT_FLOOR) || (feat == FEAT_DIRT) || (feat == FEAT_FLOWER))
- {
- s3 ="";
- }
- else
- {
- /* Pick proper indefinite article */
+ }
+ else if ((feat == FEAT_TOWN) || (feat == FEAT_FLOOR) || (feat == FEAT_DIRT) || (feat == FEAT_FLOWER))
+ {
#ifndef JP
- s3 = (is_a_vowel(name[0])) ? "an " : "a ";
+ s3 ="";
#endif
- }
+ }
+ else
+ {
+ /* Pick proper indefinite article */
+#ifndef JP
+ s3 = (is_a_vowel(name[0])) ? "an " : "a ";
+#endif
+ }
- /* Display a message */
- if (wizard)
+ /* Display a message */
+ if (p_ptr->wizard)
#ifdef JP
- sprintf(out_val, "%s%s%s%s[%s] %x %d %d %d %d", s1, name, s2, s3, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when);
+ sprintf(out_val, "%s%s%s%s[%s] %x %d %d %d %d (%d,%d)", s1, name, s2, s3, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
#else
- sprintf(out_val, "%s%s%s%s [%s] %x %d %d %d %d", s1, s2, s3, name, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when);
+ sprintf(out_val, "%s%s%s%s [%s] %x %d %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
#endif
- else
+ else
#ifdef JP
sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info);
#else
- sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
+ sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
#endif
- prt(out_val, 0, 0);
- move_cursor_relative(y, x);
- query = inkey();
-
- /* Always stop at "normal" keys */
- if ((query != '\r') && (query != '\n') && (query != ' ')) break;
- }
+ prt(out_val, 0, 0);
+ move_cursor_relative(y, x);
+ query = inkey();
- /* Stop on everything but "return" */
- if ((query != '\r') && (query != '\n')) break;
+ /* Always stop at "normal" keys */
+ if ((query != '\r') && (query != '\n') && (query != ' ')) return query;
}
- /* Keep going */
- return (query);
+ /* Stop on everything but "return" */
+ if ((query != '\r') && (query != '\n')) return query;
+
+ /* Repeat forever */
+ return 0;
}
cave_type *c_ptr;
+ int wid, hgt;
+
+
+ /* Get size */
+ get_screen_size(&wid, &hgt);
/* Cancel target */
target_who = 0;
}
/* Describe and Prompt */
- query = target_set_aux(y, x, mode, info);
+ while (!(query = target_set_aux(y, x, mode, info)));
/* Cancel tracking */
/* health_track(0); */
y += dy;
/* Do not move horizontally if unnecessary */
- if (((x < panel_col_min + SCREEN_WID / 2) && (dx > 0)) ||
- ((x > panel_col_min + SCREEN_WID / 2) && (dx < 0)))
+ if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
+ ((x > panel_col_min + wid / 2) && (dx < 0)))
{
dx = 0;
}
/* Do not move vertically if unnecessary */
- if (((y < panel_row_min + SCREEN_HGT / 2) && (dy > 0)) ||
- ((y > panel_row_min + SCREEN_HGT / 2) && (dy < 0)))
+ if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
+ ((y > panel_row_min + hgt / 2) && (dy < 0)))
{
dy = 0;
}
/* Apply the motion */
- if ((y >= panel_row_min+SCREEN_HGT) || (y < panel_row_min) ||
- (x >= panel_col_min+SCREEN_WID) || (x < panel_col_min))
+ if ((y >= panel_row_min+hgt) || (y < panel_row_min) ||
+ (x >= panel_col_min+wid) || (x < panel_col_min))
{
if (change_panel(dy, dx)) target_set_prepare(mode);
}
/* Arbitrary grids */
else
{
+ bool move_fast = FALSE;
+
if (!(mode & TARGET_LOOK)) prt_path(y, x);
/* Access */
/* Describe and Prompt (enable "TARGET_LOOK") */
- query = target_set_aux(y, x, mode | TARGET_LOOK, info);
+ while (!(query = target_set_aux(y, x, mode | TARGET_LOOK, info)));
/* Cancel tracking */
/* health_track(0); */
/* Extract the action (if any) */
d = get_keymap_dir(query);
+ /* XTRA HACK MOVEFAST */
+ if (isupper(query)) move_fast = TRUE;
+
if (!d) bell();
break;
}
int dx = ddx[d];
int dy = ddy[d];
- /* Move */
- x += dx;
- y += dy;
+ /* XTRA HACK MOVEFAST */
+ if (move_fast)
+ {
+ int mag = MIN(wid / 2, hgt / 2);
+ x += dx * mag;
+ y += dy * mag;
+ }
+ else
+ {
+ x += dx;
+ y += dy;
+ }
/* Do not move horizontally if unnecessary */
- if (((x < panel_col_min + SCREEN_WID / 2) && (dx > 0)) ||
- ((x > panel_col_min + SCREEN_WID / 2) && (dx < 0)))
+ if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
+ ((x > panel_col_min + wid / 2) && (dx < 0)))
{
dx = 0;
}
/* Do not move vertically if unnecessary */
- if (((y < panel_row_min + SCREEN_HGT / 2) && (dy > 0)) ||
- ((y > panel_row_min + SCREEN_HGT / 2) && (dy < 0)))
+ if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
+ ((y > panel_row_min + hgt / 2) && (dy < 0)))
{
dy = 0;
}
/* Apply the motion */
- if ((y >= panel_row_min + SCREEN_HGT) || (y < panel_row_min) ||
- (x >= panel_col_min + SCREEN_WID) || (x < panel_col_min))
+ if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
+ (x >= panel_col_min + wid) || (x < panel_col_min))
{
if (change_panel(dy, dx)) target_set_prepare(mode);
}
{
/* XXX XXX XXX */
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
/* Notice confusion */
if (p_ptr->confused)
{
/* Standard confusion */
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
}
else if (p_ptr->riding)
if (m_ptr->confused)
{
/* Standard confusion */
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
}
- else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (rand_int(100) < 50))
+ else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
{
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
- else if ((r_ptr->flags1 & RF1_RAND_50) && (rand_int(100) < 25))
+ else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
{
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
}
if (p_ptr->confused)
{
/* Standard confusion */
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
}
else if (!(p_ptr->lev % 13)) nasty_chance = 3;
else if (!(p_ptr->lev % 14)) nasty_chance = 12;
- if (randint(nasty_chance) == 1)
- type = randint(20); /* Allow the 'nasty' effects */
+ if (one_in_(nasty_chance))
+ type = randint1(20); /* Allow the 'nasty' effects */
else
- type = randint(15) + 5; /* Or disallow them */
+ type = randint1(15) + 5; /* Or disallow them */
if (type < 1) type = 1;
if (type > 20) type = 20;
effect = chaos_rewards[p_ptr->chaos_patron][type];
- if ((randint(6) == 1) && !chosen_reward)
+ if (one_in_(6) && !chosen_reward)
{
#ifdef JP
msg_format("%^s¤ÏË«Èþ¤È¤·¤Æ¤¢¤Ê¤¿¤òÆÍÁ³ÊÑ°Û¤µ¤»¤¿¡£",
/* Get local object */
q_ptr = &forge;
dummy = TV_SWORD;
- switch (randint(p_ptr->lev))
+ switch (randint1(p_ptr->lev))
{
case 0: case 1:
dummy2 = SV_DAGGER;
}
object_prep(q_ptr, lookup_kind(dummy, dummy2));
- q_ptr->to_h = 3 + randint(dun_level) % 10;
- q_ptr->to_d = 3 + randint(dun_level) % 10;
- random_resistance(q_ptr, FALSE, randint(34) + 4);
+ q_ptr->to_h = 3 + randint1(dun_level) % 10;
+ q_ptr->to_d = 3 + randint1(dun_level) % 10;
+ one_resistance(q_ptr);
q_ptr->name2 = EGO_CHAOTIC;
-#ifdef USE_SCRIPT
- q_ptr->python = object_create_callback(q_ptr);
-#endif /* USE_SCRIPT */
-
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, py, px);
#ifdef JP
msg_print("'Thy deed hath earned thee a worthy reward.'");
#endif
- acquirement(py, px, randint(2) + 1, FALSE, FALSE);
+ acquirement(py, px, randint1(2) + 1, FALSE, FALSE);
#ifdef JP
reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
#else
msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
#endif
- acquirement(py, px, randint(2) + 1, TRUE, FALSE);
+ acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
#ifdef JP
reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
#else
msg_print("'My pets, destroy the arrogant mortal!'");
#endif
- for (dummy = 0; dummy < randint(5) + 1; dummy++)
+ for (dummy = 0; dummy < randint1(5) + 1; dummy++)
{
- (void)summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
+ (void)summon_specific(0, py, px, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
}
#ifdef JP
reward = "¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤µ¤ì¤¿¡£";
msg_print("'Stay, mortal, and let me mold thee.'");
#endif
- if ((randint(3) == 1) && !(chaos_stats[p_ptr->chaos_patron] < 0))
+ if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
do_inc_stat(chaos_stats[p_ptr->chaos_patron]);
else
- do_inc_stat(rand_int(6));
+ do_inc_stat(randint0(6));
#ifdef JP
reward = "ǽÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
#else
msg_print("'I grow tired of thee, mortal.'");
#endif
- if ((randint(3) == 1) && !(chaos_stats[p_ptr->chaos_patron] < 0))
+ if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
else
- (void)do_dec_stat(rand_int(6));
+ (void)do_dec_stat(randint0(6));
#ifdef JP
reward = "ǽÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
#else
for (dummy = 0; dummy < 6; dummy++)
{
- (void)dec_stat(dummy, 10 + randint(15), TRUE);
+ (void)dec_stat(dummy, 10 + randint1(15), TRUE);
}
#ifdef JP
reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
msg_print("'Now thou shalt pay for annoying me.'");
#endif
- switch (randint(4))
+ switch (randint1(4))
{
case 1:
(void)activate_ty_curse(FALSE, &count);
#endif
break;
case 3:
- if (randint(2) == 1)
+ if (one_in_(2))
{
if (!buki_motteruka(INVEN_RARM)) break;
object_desc(o_name, &inventory[INVEN_RARM], TRUE, 0);
default:
for (dummy = 0; dummy < 6; dummy++)
{
- (void)dec_stat(dummy, 10 + randint(15), TRUE);
+ (void)dec_stat(dummy, 10 + randint1(15), TRUE);
}
#ifdef JP
reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
for (dummy = 0; dummy < 6; dummy++)
{
- (void)dec_stat(dummy, 10 + randint(15), FALSE);
+ (void)dec_stat(dummy, 10 + randint1(15), FALSE);
}
activate_hi_summon(py, px, FALSE);
(void)activate_ty_curse(FALSE, &count);
- if (randint(2) == 1) (void)curse_weapon(FALSE, INVEN_RARM);
- if (randint(2) == 1) (void)curse_armor();
+ if (one_in_(2)) (void)curse_weapon(FALSE, INVEN_RARM);
+ if (one_in_(2)) (void)curse_armor();
break;
case REW_DESTRUCT:
#ifdef JP
msg_print("'Death and destruction! This pleaseth me!'");
#endif
- destroy_area(py, px, 25, TRUE);
+ destroy_area(py, px, 25);
#ifdef JP
reward = "¥À¥ó¥¸¥ç¥ó¤¬*Ç˲õ*¤µ¤ì¤¿¡£";
#else
msg_format("%s rewards you with a demonic servant!",chaos_patrons[p_ptr->chaos_patron]);
#endif
- if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, FALSE, TRUE, TRUE, FALSE, FALSE))
+ if (!summon_specific(-1, py, px, dun_level, SUMMON_DEMON, PM_FORCE_PET))
#ifdef JP
msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
#else
msg_format("%s rewards you with a servant!",chaos_patrons[p_ptr->chaos_patron]);
#endif
- if (!summon_specific(-1, py, px, dun_level, 0, FALSE, TRUE, TRUE, FALSE, FALSE))
+ if (!summon_specific(-1, py, px, dun_level, 0, PM_FORCE_PET))
#ifdef JP
msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
#else
msg_format("%s rewards you with an undead servant!",chaos_patrons[p_ptr->chaos_patron]);
#endif
- if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, FALSE, TRUE, TRUE, FALSE, FALSE))
+ if (!summon_specific(-1, py, px, dun_level, SUMMON_UNDEAD, PM_FORCE_PET))
#ifdef JP
msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿...");
#else
int d, x, y;
bool success = FALSE;
+ int wid, hgt;
+
+ /* Get size */
+ get_screen_size(&wid, &hgt);
+
x = px;
y = py;
int dx = ddx[d];
int dy = ddy[d];
- /* XTRA HACK MOVEFAST */
- if (move_fast)
- {
- x += dx * SCREEN_WID / 2;
- y += dy * SCREEN_HGT / 2;
- } else {
- x += dx;
- y += dy;
- }
+ /* XTRA HACK MOVEFAST */
+ if (move_fast)
+ {
+ int mag = MIN(wid / 2, hgt / 2);
+ x += dx * mag;
+ y += dy * mag;
+ }
+ else
+ {
+ x += dx;
+ y += dy;
+ }
/* Do not move horizontally if unnecessary */
- if (((x < panel_col_min + SCREEN_WID / 2) && (dx > 0)) ||
- ((x > panel_col_min + SCREEN_WID / 2) && (dx < 0)))
+ if (((x < panel_col_min + wid / 2) && (dx > 0)) ||
+ ((x > panel_col_min + wid / 2) && (dx < 0)))
{
dx = 0;
}
/* Do not move vertically if unnecessary */
- if (((y < panel_row_min + SCREEN_HGT / 2) && (dy > 0)) ||
- ((y > panel_row_min + SCREEN_HGT / 2) && (dy < 0)))
+ if (((y < panel_row_min + hgt / 2) && (dy > 0)) ||
+ ((y > panel_row_min + hgt / 2) && (dy < 0)))
{
dy = 0;
}
/* Apply the motion */
- if ((y >= panel_row_min + SCREEN_HGT) || (y < panel_row_min) ||
- (x >= panel_col_min + SCREEN_WID) || (x < panel_col_min))
+ if ((y >= panel_row_min + hgt) || (y < panel_row_min) ||
+ (x >= panel_col_min + wid) || (x < panel_col_min))
{
/* if (change_panel(dy, dx)) target_set_prepare(mode); */
change_panel(dy, dx);
{
/* XXX XXX XXX */
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
/* Notice confusion */
s32b energy_result = 10;
s32b tmp;
- tmp = rand_int(Go_no_JuuJou);
+ tmp = randint0(Go_no_JuuJou);
for (i = 0; i < 9; i ++){
energy_result += tmp % 5;
return (tmul);
}
+
+/*
+ * Return alignment title
+ */
+cptr your_alignment(void)
+{
+#ifdef JP
+ if (p_ptr->align > 150) return "ÂçÁ±";
+ else if (p_ptr->align > 50) return "ÃæÁ±";
+ else if (p_ptr->align > 10) return "¾®Á±";
+ else if (p_ptr->align > -11) return "ÃæΩ";
+ else if (p_ptr->align > -51) return "¾®°";
+ else if (p_ptr->align > -151) return "Ãæ°";
+ else return "Âç°";
+#else
+ if (p_ptr->align > 150) return "Lawful";
+ else if (p_ptr->align > 50) return "Good";
+ else if (p_ptr->align > 10) return "Neutral Good";
+ else if (p_ptr->align > -11) return "Neutral";
+ else if (p_ptr->align > -51) return "Neutral Evil";
+ else if (p_ptr->align > -151) return "Evil";
+ else return "Chaotic";
+#endif
+}
+
+
+/*
+ * Return proficiency level of weapons and misc. skills (except riding)
+ */
+int weapon_exp_level(int weapon_exp)
+{
+ if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
+ else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
+ else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
+ else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
+ else return EXP_LEVEL_MASTER;
+}
+
+
+/*
+ * Return proficiency level of riding
+ */
+int riding_exp_level(int riding_exp)
+{
+ if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
+ else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
+ else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
+ else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
+ else return EXP_LEVEL_MASTER;
+}
+
+
+/*
+ * Return proficiency level of spells
+ */
+int spell_exp_level(int spell_exp)
+{
+ if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
+ else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
+ else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
+ else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
+ else return EXP_LEVEL_MASTER;
+}