*/
#include "angband.h"
+#include "io/signal-handlers.h"
#include "util.h"
+#include "main/music-definitions-table.h"
+#include "main/sound-definitions-table.h"
#include "core.h"
#include "inet.h"
-#include "term.h"
+#include "gameterm.h"
+#include "chuukei.h"
#include "creature.h"
#include "birth.h"
-#include "bldg.h"
-#include "cmd-activate.h"
-#include "cmd-dump.h"
-#include "cmd-eat.h"
-#include "cmd-hissatsu.h"
-#include "cmd-item.h"
-#include "cmd-magiceat.h"
-#include "cmd-mane.h"
-#include "cmd-quaff.h"
-#include "cmd-read.h"
-#include "cmd-smith.h"
-#include "cmd-usestaff.h"
-#include "cmd-zaprod.h"
-#include "cmd-zapwand.h"
-#include "cmd-pet.h"
-#include "cmd-basic.h"
+#include "market/building.h"
+#include "io/write-diary.h"
+#include "cmd/cmd-activate.h"
+#include "cmd/cmd-diary.h"
+#include "cmd/cmd-draw.h"
+#include "cmd/cmd-dump.h"
+#include "cmd/cmd-process-screen.h"
+#include "cmd/cmd-eat.h"
+#include "cmd/cmd-help.h"
+#include "cmd/cmd-hissatsu.h"
+#include "cmd/cmd-item.h"
+#include "cmd/cmd-knowledge.h"
+#include "cmd/cmd-magiceat.h"
+#include "cmd/cmd-mane.h"
+#include "cmd/cmd-macro.h"
+#include "cmd/cmd-quaff.h"
+#include "cmd/cmd-read.h"
+#include "cmd/cmd-save.h"
+#include "cmd/cmd-smith.h"
+#include "cmd/cmd-usestaff.h"
+#include "cmd/cmd-zaprod.h"
+#include "cmd/cmd-zapwand.h"
+#include "cmd/cmd-pet.h"
+#include "cmd/cmd-basic.h"
+#include "cmd/cmd-visuals.h"
#include "racial.h"
#include "snipe.h"
#include "dungeon.h"
#include "object-ego.h"
#include "object-curse.h"
#include "object-flavor.h"
-#include "store.h"
+#include "knowledge/knowledge-autopick.h"
+#include "knowledge/knowledge-quests.h"
+#include "market/store.h"
#include "spells.h"
#include "spells-summon.h"
#include "spells-object.h"
#include "mind.h"
#include "world.h"
#include "mutation.h"
+#include "market/arena-info-table.h"
+#include "market/store-util.h"
#include "quest.h"
#include "artifact.h"
#include "avatar.h"
+#include "view/display-player.h"
+#include "player/process-name.h"
#include "player-move.h"
#include "player-status.h"
#include "player-class.h"
#include "player-effects.h"
#include "cmd-spell.h"
#include "realm-hex.h"
-#include "objectkind.h"
+#include "object/object-kind.h"
#include "object-hook.h"
#include "wild.h"
#include "monster-process.h"
#include "player-skill.h"
#include "player-inventory.h"
-#include "view-mainwindow.h"
+#include "view/display-main-window.h"
#include "dungeon-file.h"
+#include "io/uid-checker.h"
+#include "player/process-death.h"
+#include "io/read-pref-file.h"
#include "files.h"
#include "scores.h"
-#include "autopick.h"
+#include "autopick/autopick.h"
+#include "autopick/autopick-reader-writer.h"
#include "save.h"
#include "realm.h"
#include "realm-song.h"
"are included in all such copies."
};
-bool can_save = FALSE; /* Game can be saved */
+bool can_save = FALSE;
COMMAND_CODE now_message;
-bool repair_monsters; /* Hack -- optimize detect monsters */
-bool repair_objects; /* Hack -- optimize detect objects */
+bool repair_monsters;
+bool repair_objects;
-concptr ANGBAND_SYS = "xxx"; //!< Hack -- The special Angband "System Suffix" This variable is used to choose an appropriate "pref-xxx" file
+concptr ANGBAND_SYS = "xxx";
#ifdef JP
-concptr ANGBAND_KEYBOARD = "JAPAN"; //!< Hack -- The special Angband "Keyboard Suffix" This variable is used to choose an appropriate macro-trigger definition
+concptr ANGBAND_KEYBOARD = "JAPAN";
#else
concptr ANGBAND_KEYBOARD = "0";
#endif
-concptr ANGBAND_GRAF = "ascii"; //!< Hack -- The special Angband "Graphics Suffix" This variable is used to choose an appropriate "graf-xxx" file
+concptr ANGBAND_GRAF = "ascii";
static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
static int wild_regen = 20; /*!<広域マップ移動時の自然回復処理カウンタ(広域マップ1マス毎に20回処理を基本とする)*/
byte feel;
object_type *o_ptr = &creature_ptr->inventory_list[slot];
GAME_TEXT o_name[MAX_NLEN];
-
- /* We know about it already, do not tell us again */
if (o_ptr->ident & (IDENT_SENSE))return;
-
- /* It is fully known, no information needed */
if (object_is_known(o_ptr)) return;
- /* Check for a feeling */
feel = (heavy ? value_check_aux1(o_ptr) : value_check_aux2(o_ptr));
-
- /* Skip non-feelings */
if (!feel) return;
- /* Bad luck */
if ((creature_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
{
switch (feel)
}
}
- /* Stop everything */
if (disturb_minor) disturb(creature_ptr, FALSE, FALSE);
- /* Get an object description */
object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-
- /* Message (equipment) */
if (slot >= INVEN_RARM)
{
#ifdef JP
}
o_ptr->ident |= (IDENT_SENSE);
-
- /* Set the "inscription" */
o_ptr->feeling = feel;
- /* Auto-inscription/destroy */
autopick_alter_item(creature_ptr, slot, destroy_feeling);
creature_ptr->update |= (PU_COMBINE | PU_REORDER);
creature_ptr->window |= (PW_INVEN | PW_EQUIP);
*/
static void sense_inventory1(player_type *creature_ptr)
{
- INVENTORY_IDX i;
PLAYER_LEVEL plev = creature_ptr->lev;
bool heavy = FALSE;
object_type *o_ptr;
-
-
- /*** Check for "sensing" ***/
-
- /* No sensing when confused */
if (creature_ptr->confused) return;
- /* Analyze the class */
switch (creature_ptr->pclass)
{
case CLASS_WARRIOR:
case CLASS_SAMURAI:
case CLASS_CAVALRY:
{
- /* Good sensing */
if (0 != randint0(9000L / (plev * plev + 40))) return;
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
-
case CLASS_SMITH:
{
- /* Good sensing */
if (0 != randint0(6000L / (plev * plev + 50))) return;
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
-
case CLASS_MAGE:
case CLASS_HIGH_MAGE:
case CLASS_SORCERER:
case CLASS_MAGIC_EATER:
{
- /* Very bad (light) sensing */
if (0 != randint0(240000L / (plev + 5))) return;
break;
}
-
case CLASS_PRIEST:
case CLASS_BARD:
{
- /* Good (light) sensing */
if (0 != randint0(10000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_ROGUE:
case CLASS_NINJA:
{
- /* Okay sensing */
if (0 != randint0(20000L / (plev * plev + 40))) return;
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
-
case CLASS_RANGER:
{
- /* Bad sensing */
if (0 != randint0(95000L / (plev * plev + 40))) return;
- /* Changed! */
heavy = TRUE;
-
break;
}
-
case CLASS_PALADIN:
case CLASS_SNIPER:
{
- /* Bad sensing */
if (0 != randint0(77777L / (plev * plev + 40))) return;
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
-
case CLASS_WARRIOR_MAGE:
case CLASS_RED_MAGE:
{
- /* Bad sensing */
if (0 != randint0(75000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_MINDCRAFTER:
case CLASS_IMITATOR:
case CLASS_BLUE_MAGE:
case CLASS_MIRROR_MASTER:
{
- /* Bad sensing */
if (0 != randint0(55000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_CHAOS_WARRIOR:
{
- /* Bad sensing */
if (0 != randint0(80000L / (plev * plev + 40))) return;
- /* Changed! */
heavy = TRUE;
-
break;
}
-
case CLASS_MONK:
case CLASS_FORCETRAINER:
{
- /* Okay sensing */
if (0 != randint0(20000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_TOURIST:
{
- /* Good sensing */
if (0 != randint0(20000L / ((plev + 50)*(plev + 50)))) return;
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
-
case CLASS_BEASTMASTER:
{
- /* Bad sensing */
if (0 != randint0(65000L / (plev * plev + 40))) return;
break;
}
case CLASS_BERSERKER:
{
- /* Heavy sensing */
heavy = TRUE;
-
break;
}
}
if (compare_virtue(creature_ptr, V_KNOWLEDGE, 100, VIRTUE_LARGE)) heavy = TRUE;
- /*** Sense everything ***/
-
- /* Check everything */
- for (i = 0; i < INVEN_TOTAL; i++)
+ for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++)
{
bool okay = FALSE;
o_ptr = &creature_ptr->inventory_list[i];
- /* Skip empty slots */
if (!o_ptr->k_idx) continue;
- /* Valid "tval" codes */
switch (o_ptr->tval)
{
case TV_SHOT:
}
}
- /* Skip non-sense machines */
if (!okay) continue;
-
- /* Occasional failure on creature_ptr->inventory_list items */
if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
- /* Good luck */
if ((creature_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
{
heavy = TRUE;
}
}
+
/*!
* @brief 1プレイヤーターン毎に武器、防具以外の擬似鑑定が行われるかを判定する。
* @return なし
*/
static void sense_inventory2(player_type *creature_ptr)
{
- INVENTORY_IDX i;
PLAYER_LEVEL plev = creature_ptr->lev;
object_type *o_ptr;
-
- /*** Check for "sensing" ***/
-
- /* No sensing when confused */
if (creature_ptr->confused) return;
- /* Analyze the class */
switch (creature_ptr->pclass)
{
case CLASS_WARRIOR:
{
return;
}
-
case CLASS_SMITH:
case CLASS_PALADIN:
case CLASS_CHAOS_WARRIOR:
case CLASS_BEASTMASTER:
case CLASS_NINJA:
{
- /* Very bad (light) sensing */
if (0 != randint0(240000L / (plev + 5))) return;
break;
}
-
case CLASS_RANGER:
case CLASS_WARRIOR_MAGE:
case CLASS_RED_MAGE:
case CLASS_MONK:
{
- /* Bad sensing */
if (0 != randint0(95000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_PRIEST:
case CLASS_BARD:
case CLASS_ROGUE:
case CLASS_FORCETRAINER:
case CLASS_MINDCRAFTER:
{
- /* Good sensing */
if (0 != randint0(20000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_MAGE:
case CLASS_HIGH_MAGE:
case CLASS_SORCERER:
case CLASS_MIRROR_MASTER:
case CLASS_BLUE_MAGE:
{
- /* Good sensing */
if (0 != randint0(9000L / (plev * plev + 40))) return;
break;
}
-
case CLASS_TOURIST:
{
- /* Good sensing */
if (0 != randint0(20000L / ((plev + 50)*(plev + 50)))) return;
break;
}
}
- /*** Sense everything ***/
-
- /* Check everything */
- for (i = 0; i < INVEN_TOTAL; i++)
+ for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++)
{
bool okay = FALSE;
-
o_ptr = &creature_ptr->inventory_list[i];
-
- /* Skip empty slots */
if (!o_ptr->k_idx) continue;
- /* Valid "tval" codes */
switch (o_ptr->tval)
{
case TV_RING:
}
}
- /* Skip non-sense machines */
if (!okay) continue;
-
- /* Occasional failure on creature_ptr->inventory_list items */
if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
sense_inventory_aux(creature_ptr, i, TRUE);
DEPTH min_level = 0;
DEPTH max_level = 99;
- /* Ask for level */
if (get_check(_("他の階にテレポートしますか?", "Teleport level? ")))
{
char ppp[80];
char tmp_val[160];
- /* Only downward in ironman mode */
if (ironman_downward)
min_level = creature_ptr->current_floor_ptr->dun_level;
- /* Maximum level */
if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
{
if (creature_ptr->current_floor_ptr->dun_level > 100)
min_level = d_info[creature_ptr->dungeon_idx].mindepth;
}
- /* Prompt */
sprintf(ppp, _("テレポート先:(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level);
-
- /* Default */
sprintf(tmp_val, "%d", (int)creature_ptr->current_floor_ptr->dun_level);
-
- /* Ask for a level */
if (!get_string(ppp, tmp_val, 10)) return;
- /* Extract request */
command_arg = (COMMAND_ARG)atoi(tmp_val);
}
else if (get_check(_("通常テレポート?", "Normal teleport? ")))
{
return;
}
+
if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
- /* Accept request */
msg_format(_("%d 階にテレポートしました。", "You teleport to dungeon level %d."), command_arg);
-
if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
- /* Change level */
creature_ptr->current_floor_ptr->dun_level = command_arg;
-
leave_quest_check(creature_ptr);
-
if (record_stair) exe_write_diary(creature_ptr, DIARY_PAT_TELE, 0, NULL);
creature_ptr->current_floor_ptr->inside_quest = 0;
creature_ptr->leaving = TRUE;
}
+
/*!
* @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
* @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
*/
static bool pattern_effect(player_type *creature_ptr)
{
- int pattern_type;
-
floor_type *floor_ptr = creature_ptr->current_floor_ptr;
if (!pattern_tile(floor_ptr, creature_ptr->y, creature_ptr->x)) return FALSE;
wreck_the_pattern(creature_ptr);
}
- pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
-
+ int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
switch (pattern_type)
{
case PATTERN_TILE_END:
*/
static void regenhp(player_type *creature_ptr, int percent)
{
- HIT_POINT new_chp;
- u32b new_chp_frac;
- HIT_POINT old_chp;
-
if (creature_ptr->special_defense & KATA_KOUKIJIN) return;
if (creature_ptr->action == ACTION_HAYAGAKE) return;
- /* Save the old hitpoints */
- old_chp = creature_ptr->chp;
+ HIT_POINT old_chp = creature_ptr->chp;
/*
* Extract the new hitpoints
*
* 'percent' is the Regen factor in unit (1/2^16)
*/
- new_chp = 0;
- new_chp_frac = (creature_ptr->mhp * percent + PY_REGEN_HPBASE);
-
- /* Convert the unit (1/2^16) to (1/2^32) */
+ HIT_POINT new_chp = 0;
+ u32b new_chp_frac = (creature_ptr->mhp * percent + PY_REGEN_HPBASE);
s64b_LSHIFT(new_chp, new_chp_frac, 16);
-
- /* Regenerating */
s64b_add(&(creature_ptr->chp), &(creature_ptr->chp_frac), new_chp, new_chp_frac);
-
-
- /* Fully healed */
if (0 < s64b_cmp(creature_ptr->chp, creature_ptr->chp_frac, creature_ptr->mhp, 0))
{
creature_ptr->chp = creature_ptr->mhp;
creature_ptr->chp_frac = 0;
}
- /* Notice changes */
if (old_chp != creature_ptr->chp)
{
creature_ptr->redraw |= (PR_HP);
*/
if (creature_ptr->csp > creature_ptr->msp)
{
- /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
s32b decay = 0;
u32b decay_frac = (creature_ptr->msp * 32 * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
-
- /* Convert the unit (1/2^16) to (1/2^32) */
s64b_LSHIFT(decay, decay_frac, 16);
-
- /* Decay */
s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), decay, decay_frac);
-
- /* Stop decaying */
if (creature_ptr->csp < creature_ptr->msp)
{
creature_ptr->csp = creature_ptr->msp;
/* Regenerating mana (unless the player has excess mana) */
else if (regen_rate > 0)
{
- /* (percent/100) is the Regen factor in unit (1/2^16) */
MANA_POINT new_mana = 0;
u32b new_mana_frac = (creature_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE);
-
- /* Convert the unit (1/2^16) to (1/2^32) */
s64b_LSHIFT(new_mana, new_mana_frac, 16);
-
- /* Regenerate */
s64b_add(&(creature_ptr->csp), &(creature_ptr->csp_frac), new_mana, new_mana_frac);
-
- /* Must set frac to zero even if equal */
if (creature_ptr->csp >= creature_ptr->msp)
{
creature_ptr->csp = creature_ptr->msp;
}
}
-
/* Reduce mana (even when the player has excess mana) */
if (regen_rate < 0)
{
- /* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
s32b reduce_mana = 0;
u32b reduce_mana_frac = (creature_ptr->msp * (-1) * regen_rate / 100 + PY_REGEN_MNBASE);
-
- /* Convert the unit (1/2^16) to (1/2^32) */
s64b_LSHIFT(reduce_mana, reduce_mana_frac, 16);
-
- /* Reduce mana */
s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), reduce_mana, reduce_mana_frac);
-
- /* Check overflow */
if (creature_ptr->csp < 0)
{
creature_ptr->csp = 0;
}
}
+
/*!
* @brief プレイヤーのMP自然回復処理 / Regenerate magic regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
* @param regen_amount 回復量
static void regenmagic(player_type *creature_ptr, int regen_amount)
{
MANA_POINT new_mana;
- int i;
int dev = 30;
int mult = (dev + adj_mag_mana[creature_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
- for (i = 0; i < EATER_EXT * 2; i++)
+ for (int i = 0; i < EATER_EXT * 2; i++)
{
if (!creature_ptr->magic_num2[i]) continue;
if (creature_ptr->magic_num1[i] == ((long)creature_ptr->magic_num2[i] << 16)) continue;
{
creature_ptr->magic_num1[i] = ((long)creature_ptr->magic_num2[i] << 16);
}
+
wild_regen = 20;
}
- for (i = EATER_EXT * 2; i < EATER_EXT * 3; i++)
+
+ for (int i = EATER_EXT * 2; i < EATER_EXT * 3; i++)
{
if (!creature_ptr->magic_num1[i]) continue;
if (!creature_ptr->magic_num2[i]) continue;
{
for (int i = 1; i < player_ptr->current_floor_ptr->m_max; i++)
{
- /* Check the i'th monster */
monster_type *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!monster_is_valid(m_ptr)) continue;
- /* Allow regeneration (if needed) */
if (m_ptr->hp < m_ptr->maxhp)
{
- /* Hack -- Base regeneration */
int frac = m_ptr->maxhp / 100;
-
- /* Hack -- Minimal regeneration rate */
if (!frac) if (one_in_(2)) frac = 1;
- /* Hack -- Some monsters regenerate quickly */
if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
- /* Hack -- Regenerate */
m_ptr->hp += frac;
-
- /* Do not over-regenerate */
if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
- /* Redraw (later) if needed */
if (player_ptr->health_who == i) player_ptr->redraw |= (PR_HEALTH);
if (player_ptr->riding == i) player_ptr->redraw |= (PR_UHEALTH);
}
*/
static void regenerate_captured_monsters(player_type *creature_ptr)
{
- int i, frac;
bool heal = FALSE;
-
- /* Regenerate everyone */
- for (i = 0; i < INVEN_TOTAL; i++)
+ for (int i = 0; i < INVEN_TOTAL; i++)
{
monster_race *r_ptr;
object_type *o_ptr = &creature_ptr->inventory_list[i];
-
if (!o_ptr->k_idx) continue;
if (o_ptr->tval != TV_CAPTURE) continue;
if (!o_ptr->pval) continue;
heal = TRUE;
-
r_ptr = &r_info[o_ptr->pval];
-
- /* Allow regeneration (if needed) */
if (o_ptr->xtra4 < o_ptr->xtra5)
{
- /* Hack -- Base regeneration */
- frac = o_ptr->xtra5 / 100;
-
- /* Hack -- Minimal regeneration rate */
+ int frac = o_ptr->xtra5 / 100;
if (!frac) if (one_in_(2)) frac = 1;
- /* Hack -- Some monsters regenerate quickly */
if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
- /* Hack -- Regenerate */
o_ptr->xtra4 += (XTRA16)frac;
-
- /* Do not over-regenerate */
if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5;
}
}
if (heal)
{
- /* Combine pack */
creature_ptr->update |= (PU_COMBINE);
creature_ptr->window |= (PW_INVEN);
creature_ptr->window |= (PW_EQUIP);
}
}
+
/*!
* @brief 寿命つき光源の警告メッセージ処理
* @param creature_ptr プレーヤーへの参照ポインタ
*/
static void notice_lite_change(player_type *creature_ptr, object_type *o_ptr)
{
- /* Hack -- notice interesting fuel steps */
if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100)))
{
creature_ptr->window |= (PW_EQUIP);
}
- /* Hack -- Special treatment when blind */
if (creature_ptr->blind)
{
- /* Hack -- save some light for later */
if (o_ptr->xtra4 == 0) o_ptr->xtra4++;
}
-
- /* The light is now out */
else if (o_ptr->xtra4 == 0)
{
disturb(creature_ptr, FALSE, TRUE);
msg_print(_("明かりが消えてしまった!", "Your light has gone out!"));
-
- /* Recalculate torch radius */
creature_ptr->update |= (PU_TORCH);
-
- /* Some ego light lose its effects without fuel */
creature_ptr->update |= (PU_BONUS);
}
-
- /* The light is getting dim */
else if (o_ptr->name2 == EGO_LITE_LONG)
{
if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
msg_print(_("明かりが微かになってきている。", "Your light is growing faint."));
}
}
-
- /* The light is getting dim */
else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
{
if (disturb_minor) disturb(creature_ptr, FALSE, TRUE);
*/
static void recharged_notice(player_type *owner_ptr, object_type *o_ptr)
{
- GAME_TEXT o_name[MAX_NLEN];
-
- concptr s;
-
- /* No inscription */
if (!o_ptr->inscription) return;
- /* Find a '!' */
- s = my_strchr(quark_str(o_ptr->inscription), '!');
-
- /* Process notification request. */
+ concptr s = my_strchr(quark_str(o_ptr->inscription), '!');
while (s)
{
- /* Find another '!' */
if (s[1] == '!')
{
- /* Describe (briefly) */
+ GAME_TEXT o_name[MAX_NLEN];
object_desc(owner_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-
- /* Notify the player */
#ifdef JP
msg_format("%sは再充填された。", o_name);
#else
else
msg_format("Your %s is recharged.", o_name);
#endif
-
disturb(owner_ptr, FALSE, FALSE);
-
- /* Done. */
return;
}
- /* Keep looking for '!'s */
s = my_strchr(s + 1, '!');
}
}
+
/*!
* @brief プレイヤーの歌に関する継続処理
* @return なし
*/
static void check_music(player_type *caster_ptr)
{
- const magic_type *s_ptr;
- int spell;
- MANA_POINT need_mana;
- u32b need_mana_frac;
-
- /* Music singed by player */
if (caster_ptr->pclass != CLASS_BARD) return;
if (!SINGING_SONG_EFFECT(caster_ptr) && !INTERUPTING_SONG_EFFECT(caster_ptr)) return;
return;
}
- spell = SINGING_SONG_ID(caster_ptr);
+ int spell = SINGING_SONG_ID(caster_ptr);
+ const magic_type *s_ptr;
s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
- need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, REALM_MUSIC);
- need_mana_frac = 0;
+ MANA_POINT need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, REALM_MUSIC);
+ u32b need_mana_frac = 0;
- /* Divide by 2 */
s64b_RSHIFT(need_mana, need_mana_frac, 1);
-
if (s64b_cmp(caster_ptr->csp, caster_ptr->csp_frac, need_mana, need_mana_frac) < 0)
{
stop_singing(caster_ptr);
caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
}
}
+
if (caster_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
caster_ptr->spell_exp[spell] += 5;
else if (caster_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
if (one_in_(5) && ((caster_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && (caster_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) caster_ptr->spell_exp[spell] += 1;
}
- /* Do any effects of continual song */
exe_spell(caster_ptr, REALM_MUSIC, spell, SPELL_CONT);
}
+
/*!
* @brief 現在呪いを保持している装備品を一つランダムに探し出す / Choose one of items that have cursed flag
* @param flag 探し出したい呪いフラグ配列
*/
static object_type *choose_cursed_obj_name(player_type *player_ptr, BIT_FLAGS flag)
{
- int i;
int choices[INVEN_TOTAL - INVEN_RARM];
int number = 0;
-
- /* Paranoia -- Player has no warning-item */
if (!(player_ptr->cursed & flag)) return NULL;
- /* Search Inventry */
- for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
object_type *o_ptr = &player_ptr->inventory_list[i];
-
if (o_ptr->curse_flags & flag)
{
choices[number] = i;
}
+/*!
+ * @brief 10ゲームターンが進行するごとにプレイヤーの空腹状態を飢餓方向に向かわせる
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return なし
+ */
static void process_world_aux_digestion(player_type *creature_ptr)
{
- if (!creature_ptr->phase_out)
- {
- /* Digest quickly when gorged */
- if (creature_ptr->food >= PY_FOOD_MAX)
- {
- /* Digest a lot of food */
- (void)set_food(creature_ptr, creature_ptr->food - 100);
- }
-
- /* Digest normally -- Every 50 game turns */
- else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
- {
- /* Basic digestion rate based on speed */
- int digestion = SPEED_TO_ENERGY(creature_ptr->pspeed);
-
- /* Regeneration takes more food */
- if (creature_ptr->regenerate)
- digestion += 20;
- if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
- digestion += 20;
- if (creature_ptr->cursed & TRC_FAST_DIGEST)
- digestion += 30;
-
- /* Slow digestion takes less food */
- if (creature_ptr->slow_digest)
- digestion -= 5;
+ if (creature_ptr->phase_out) return;
- /* Minimal digestion */
- if (digestion < 1) digestion = 1;
- /* Maximal digestion */
- if (digestion > 100) digestion = 100;
+ if (creature_ptr->food >= PY_FOOD_MAX)
+ {
+ (void)set_food(creature_ptr, creature_ptr->food - 100);
+ }
+ else if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 5)))
+ {
+ int digestion = SPEED_TO_ENERGY(creature_ptr->pspeed);
+ if (creature_ptr->regenerate)
+ digestion += 20;
+ if (creature_ptr->special_defense & (KAMAE_MASK | KATA_MASK))
+ digestion += 20;
+ if (creature_ptr->cursed & TRC_FAST_DIGEST)
+ digestion += 30;
- /* Digest some food */
- (void)set_food(creature_ptr, creature_ptr->food - digestion);
- }
+ if (creature_ptr->slow_digest)
+ digestion -= 5;
+ if (digestion < 1) digestion = 1;
+ if (digestion > 100) digestion = 100;
- /* Getting Faint */
- if ((creature_ptr->food < PY_FOOD_FAINT))
- {
- /* Faint occasionally */
- if (!creature_ptr->paralyzed && (randint0(100) < 10))
- {
- msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
- disturb(creature_ptr, TRUE, TRUE);
+ (void)set_food(creature_ptr, creature_ptr->food - digestion);
+ }
- /* Hack -- faint (bypass free action) */
- (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 1 + randint0(5));
- }
+ if ((creature_ptr->food >= PY_FOOD_FAINT)) return;
- /* Starve to death (slowly) */
- if (creature_ptr->food < PY_FOOD_STARVE)
- {
- /* Calculate damage */
- HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
+ if (!creature_ptr->paralyzed && (randint0(100) < 10))
+ {
+ msg_print(_("あまりにも空腹で気絶してしまった。", "You faint from the lack of food."));
+ disturb(creature_ptr, TRUE, TRUE);
+ (void)set_paralyzed(creature_ptr, creature_ptr->paralyzed + 1 + randint0(5));
+ }
- if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
- }
- }
+ if (creature_ptr->food < PY_FOOD_STARVE)
+ {
+ HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
+ if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
}
}
+
/*!
* @brief 10ゲームターンが進行するごとにプレイヤーのHPとMPの増減処理を行う。
* / Handle timed damage and regeneration every 10 game turns
feature_type *f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
bool cave_no_regen = FALSE;
int upkeep_factor = 0;
-
- /* Default regeneration */
int regen_amount = PY_REGEN_NORMAL;
-
-
- /*** Damage over Time ***/
-
- /* Take damage from poison */
if (creature_ptr->poisoned && !IS_INVULN(creature_ptr))
{
take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
}
- /* Take damage from cuts */
if (creature_ptr->cut && !IS_INVULN(creature_ptr))
{
HIT_POINT dam;
-
- /* Mortal wound or Deep Gash */
if (creature_ptr->cut > 1000)
{
dam = 200;
}
-
else if (creature_ptr->cut > 200)
{
dam = 80;
}
-
- /* Severe cut */
else if (creature_ptr->cut > 100)
{
dam = 32;
}
-
else if (creature_ptr->cut > 50)
{
dam = 16;
}
-
else if (creature_ptr->cut > 25)
{
dam = 7;
}
-
else if (creature_ptr->cut > 10)
{
dam = 3;
}
-
- /* Other cuts */
else
{
dam = 1;
take_hit(creature_ptr, DAMAGE_NOESCAPE, dam, _("致命傷", "a fatal wound"), -1);
}
- /* (Vampires) Take damage from sunlight */
if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE))
{
if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN(creature_ptr) && is_daytime())
object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
GAME_TEXT o_name[MAX_NLEN];
char ouch[MAX_NLEN + 40];
-
- /* Get an object description */
object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sがあなたのアンデッドの肉体を焼き焦がした!", "The %s scorches your undead flesh!"), o_name);
cave_no_regen = TRUE;
-
- /* Get an object description */
object_desc(creature_ptr, o_name, o_ptr, OD_NAME_ONLY);
sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
}
}
-
- /*** handle regeneration ***/
-
- /* Getting Weak */
if (creature_ptr->food < PY_FOOD_WEAK)
{
- /* Lower regeneration */
if (creature_ptr->food < PY_FOOD_STARVE)
{
regen_amount = 0;
}
}
- /* Are we walking the pattern? */
if (pattern_effect(creature_ptr))
{
cave_no_regen = TRUE;
}
else
{
- /* Regeneration ability */
if (creature_ptr->regenerate)
{
regen_amount = regen_amount * 2;
}
}
-
- /* Searching or Resting */
if ((creature_ptr->action == ACTION_SEARCH) || (creature_ptr->action == ACTION_REST))
{
regen_amount = regen_amount * 2;
}
upkeep_factor = calculate_upkeep(creature_ptr);
-
- /* No regeneration while special action */
if ((creature_ptr->action == ACTION_LEARN) ||
(creature_ptr->action == ACTION_HAYAGAKE) ||
(creature_ptr->special_defense & KATA_KOUKIJIN))
upkeep_factor += 100;
}
- /* Regenerate the mana */
regenmana(creature_ptr, upkeep_factor, regen_amount);
-
-
- /* Recharge magic eater's power */
if (creature_ptr->pclass == CLASS_MAGIC_EATER)
{
regenmagic(creature_ptr, regen_amount);
}
}
- /* Poisoned or cut yields no healing */
if (creature_ptr->poisoned) regen_amount = 0;
if (creature_ptr->cut) regen_amount = 0;
-
- /* Special floor -- Pattern, in a wall -- yields no healing */
if (cave_no_regen) regen_amount = 0;
regen_amount = (regen_amount * creature_ptr->mutant_regenerate_mod) / 100;
-
- /* Regenerate Hit Points if needed */
if ((creature_ptr->chp < creature_ptr->mhp) && !cave_no_regen)
{
regenhp(creature_ptr, regen_amount);
}
}
+
/*!
* @brief 10ゲームターンが進行するごとに魔法効果の残りターンを減らしていく処理
* / Handle timeout every 10 game turns
static void process_world_aux_timeout(player_type *creature_ptr)
{
const int dec_count = (easy_band ? 2 : 1);
-
- /*** Timeout Various Things ***/
-
- /* Mimic */
if (creature_ptr->tim_mimic)
{
(void)set_mimic(creature_ptr, creature_ptr->tim_mimic - 1, creature_ptr->mimic_form, TRUE);
}
- /* Hack -- Hallucinating */
if (creature_ptr->image)
{
(void)set_image(creature_ptr, creature_ptr->image - dec_count);
}
- /* Blindness */
if (creature_ptr->blind)
{
(void)set_blind(creature_ptr, creature_ptr->blind - dec_count);
}
- /* Times see-invisible */
if (creature_ptr->tim_invis)
{
(void)set_tim_invis(creature_ptr, creature_ptr->tim_invis - 1, TRUE);
creature_ptr->suppress_multi_reward = FALSE;
}
- /* Timed esp */
if (creature_ptr->tim_esp)
{
(void)set_tim_esp(creature_ptr, creature_ptr->tim_esp - 1, TRUE);
}
- /* Timed temporary elemental brands. -LM- */
if (creature_ptr->ele_attack)
{
creature_ptr->ele_attack--;
-
- /* Clear all temporary elemental brands. */
if (!creature_ptr->ele_attack) set_ele_attack(creature_ptr, 0, 0);
}
- /* Timed temporary elemental immune. -LM- */
if (creature_ptr->ele_immune)
{
creature_ptr->ele_immune--;
-
- /* Clear all temporary elemental brands. */
if (!creature_ptr->ele_immune) set_ele_immune(creature_ptr, 0, 0);
}
- /* Timed infra-vision */
if (creature_ptr->tim_infra)
{
(void)set_tim_infra(creature_ptr, creature_ptr->tim_infra - 1, TRUE);
}
- /* Timed stealth */
if (creature_ptr->tim_stealth)
{
(void)set_tim_stealth(creature_ptr, creature_ptr->tim_stealth - 1, TRUE);
}
- /* Timed levitation */
if (creature_ptr->tim_levitation)
{
(void)set_tim_levitation(creature_ptr, creature_ptr->tim_levitation - 1, TRUE);
}
- /* Timed sh_touki */
if (creature_ptr->tim_sh_touki)
{
(void)set_tim_sh_touki(creature_ptr, creature_ptr->tim_sh_touki - 1, TRUE);
}
- /* Timed sh_fire */
if (creature_ptr->tim_sh_fire)
{
(void)set_tim_sh_fire(creature_ptr, creature_ptr->tim_sh_fire - 1, TRUE);
}
- /* Timed sh_holy */
if (creature_ptr->tim_sh_holy)
{
(void)set_tim_sh_holy(creature_ptr, creature_ptr->tim_sh_holy - 1, TRUE);
}
- /* Timed eyeeye */
if (creature_ptr->tim_eyeeye)
{
(void)set_tim_eyeeye(creature_ptr, creature_ptr->tim_eyeeye - 1, TRUE);
}
- /* Timed resist-magic */
if (creature_ptr->resist_magic)
{
(void)set_resist_magic(creature_ptr, creature_ptr->resist_magic - 1, TRUE);
}
- /* Timed regeneration */
if (creature_ptr->tim_regen)
{
(void)set_tim_regen(creature_ptr, creature_ptr->tim_regen - 1, TRUE);
}
- /* Timed resist nether */
if (creature_ptr->tim_res_nether)
{
(void)set_tim_res_nether(creature_ptr, creature_ptr->tim_res_nether - 1, TRUE);
}
- /* Timed resist time */
if (creature_ptr->tim_res_time)
{
(void)set_tim_res_time(creature_ptr, creature_ptr->tim_res_time - 1, TRUE);
}
- /* Timed reflect */
if (creature_ptr->tim_reflect)
{
(void)set_tim_reflect(creature_ptr, creature_ptr->tim_reflect - 1, TRUE);
}
- /* Multi-shadow */
if (creature_ptr->multishadow)
{
(void)set_multishadow(creature_ptr, creature_ptr->multishadow - 1, TRUE);
}
- /* Timed Robe of dust */
if (creature_ptr->dustrobe)
{
(void)set_dustrobe(creature_ptr, creature_ptr->dustrobe - 1, TRUE);
}
- /* Timed infra-vision */
if (creature_ptr->kabenuke)
{
(void)set_kabenuke(creature_ptr, creature_ptr->kabenuke - 1, TRUE);
}
- /* Paralysis */
if (creature_ptr->paralyzed)
{
(void)set_paralyzed(creature_ptr, creature_ptr->paralyzed - dec_count);
}
- /* Confusion */
if (creature_ptr->confused)
{
(void)set_confused(creature_ptr, creature_ptr->confused - dec_count);
}
- /* Afraid */
if (creature_ptr->afraid)
{
(void)set_afraid(creature_ptr, creature_ptr->afraid - dec_count);
}
- /* Fast */
if (creature_ptr->fast)
{
(void)set_fast(creature_ptr, creature_ptr->fast - 1, TRUE);
}
- /* Slow */
if (creature_ptr->slow)
{
(void)set_slow(creature_ptr, creature_ptr->slow - dec_count, TRUE);
}
- /* Protection from evil */
if (creature_ptr->protevil)
{
(void)set_protevil(creature_ptr, creature_ptr->protevil - 1, TRUE);
}
- /* Invulnerability */
if (creature_ptr->invuln)
{
(void)set_invuln(creature_ptr, creature_ptr->invuln - 1, TRUE);
}
- /* Wraith form */
if (creature_ptr->wraith_form)
{
(void)set_wraith_form(creature_ptr, creature_ptr->wraith_form - 1, TRUE);
}
- /* Heroism */
if (creature_ptr->hero)
{
(void)set_hero(creature_ptr, creature_ptr->hero - 1, TRUE);
}
- /* Super Heroism */
if (creature_ptr->shero)
{
(void)set_shero(creature_ptr, creature_ptr->shero - 1, TRUE);
}
- /* Blessed */
if (creature_ptr->blessed)
{
(void)set_blessed(creature_ptr, creature_ptr->blessed - 1, TRUE);
}
- /* Shield */
if (creature_ptr->shield)
{
(void)set_shield(creature_ptr, creature_ptr->shield - 1, TRUE);
}
- /* Tsubureru */
if (creature_ptr->tsubureru)
{
(void)set_tsubureru(creature_ptr, creature_ptr->tsubureru - 1, TRUE);
}
- /* Magicdef */
if (creature_ptr->magicdef)
{
(void)set_magicdef(creature_ptr, creature_ptr->magicdef - 1, TRUE);
}
- /* Tsuyoshi */
if (creature_ptr->tsuyoshi)
{
(void)set_tsuyoshi(creature_ptr, creature_ptr->tsuyoshi - 1, TRUE);
}
- /* Oppose Acid */
if (creature_ptr->oppose_acid)
{
(void)set_oppose_acid(creature_ptr, creature_ptr->oppose_acid - 1, TRUE);
}
- /* Oppose Lightning */
if (creature_ptr->oppose_elec)
{
(void)set_oppose_elec(creature_ptr, creature_ptr->oppose_elec - 1, TRUE);
}
- /* Oppose Fire */
if (creature_ptr->oppose_fire)
{
(void)set_oppose_fire(creature_ptr, creature_ptr->oppose_fire - 1, TRUE);
}
- /* Oppose Cold */
if (creature_ptr->oppose_cold)
{
(void)set_oppose_cold(creature_ptr, creature_ptr->oppose_cold - 1, TRUE);
}
- /* Oppose Poison */
if (creature_ptr->oppose_pois)
{
(void)set_oppose_pois(creature_ptr, creature_ptr->oppose_pois - 1, TRUE);
(void)set_ultimate_res(creature_ptr, creature_ptr->ult_res - 1, TRUE);
}
- /*** Poison and Stun and Cut ***/
-
- /* Poison */
if (creature_ptr->poisoned)
{
int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
-
- /* Apply some healing */
(void)set_poisoned(creature_ptr, creature_ptr->poisoned - adjust);
}
- /* Stun */
if (creature_ptr->stun)
{
int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
-
- /* Apply some healing */
(void)set_stun(creature_ptr, creature_ptr->stun - adjust);
}
- /* Cut */
if (creature_ptr->cut)
{
int adjust = adj_con_fix[creature_ptr->stat_ind[A_CON]] + 1;
-
- /* Hack -- Truly "mortal" wound */
if (creature_ptr->cut > 1000) adjust = 0;
-
- /* Apply some healing */
(void)set_cut(creature_ptr, creature_ptr->cut - adjust);
}
}
*/
static void process_world_aux_light(player_type *creature_ptr)
{
- /* Check for light being wielded */
object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
-
- /* Burn some fuel in the current lite */
if (o_ptr->tval == TV_LITE)
{
- /* Hack -- Use some fuel (except on artifacts) */
if (!(object_is_fixed_artifact(o_ptr) || o_ptr->sval == SV_LITE_FEANOR) && (o_ptr->xtra4 > 0))
{
- /* Decrease life-span */
if (o_ptr->name2 == EGO_LITE_LONG)
{
if (current_world_ptr->game_turn % (TURNS_PER_TICK * 2)) o_ptr->xtra4--;
}
else o_ptr->xtra4--;
- /* Notice interesting fuel steps */
notice_lite_change(creature_ptr, o_ptr);
}
}
*/
static void process_world_aux_mutation(player_type *creature_ptr)
{
- /* No mutation with effects */
if (!creature_ptr->muta2) return;
-
- /* No effect on monster arena */
if (creature_ptr->phase_out) return;
-
- /* No effect on the global map */
if (creature_ptr->wild_mode) return;
if ((creature_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
msg_print(NULL);
if (one_in_(3)) lose_all_info(creature_ptr);
else wiz_dark(creature_ptr);
- (void)teleport_player_aux(creature_ptr, 100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
+ (void)teleport_player_aux(creature_ptr, 100, FALSE, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
wiz_dark(creature_ptr);
msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head..."));
msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing or how you got here!"));
if (!creature_ptr->current_floor_ptr->dun_level && creature_ptr->town_num)
{
int n;
-
- /* Pick a random shop (except home) */
do
{
n = randint0(MAX_STORES);
msg_print(_("影につつまれた。", "A shadow passes over you."));
msg_print(NULL);
- /* Absorb light from the current possition */
if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
{
hp_player(creature_ptr, 10);
o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
- /* Absorb some fuel in the current lite */
if (o_ptr->tval == TV_LITE)
{
- /* Use some fuel (except on artifacts) */
if (!object_is_fixed_artifact(o_ptr) && (o_ptr->xtra4 > 0))
{
- /* Heal the player a bit */
hp_player(creature_ptr, o_ptr->xtra4 / 20);
-
- /* Decrease life-span of lite */
o_ptr->xtra4 /= 2;
msg_print(_("光源からエネルギーを吸収した!", "You absorb energy from your light!"));
-
- /* Notice interesting fuel steps */
notice_lite_change(creature_ptr, o_ptr);
}
}
msg_print(NULL);
fire_ball(creature_ptr, GF_CHAOS, 0, creature_ptr->lev, 8);
}
+
if ((creature_ptr->muta2 & MUT2_NORMALITY) && one_in_(5000))
{
if (!lose_mutation(creature_ptr, 0))
msg_print(_("奇妙なくらい普通になった気がする。", "You feel oddly normal."));
}
+
if ((creature_ptr->muta2 & MUT2_WRAITH) && !creature_ptr->anti_magic && one_in_(3000))
{
disturb(creature_ptr, FALSE, TRUE);
msg_print(NULL);
set_wraith_form(creature_ptr, randint1(creature_ptr->lev / 2) + (creature_ptr->lev / 2), FALSE);
}
+
if ((creature_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
{
do_poly_wounds(creature_ptr);
}
+
if ((creature_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
{
int which_stat = randint0(A_MAX);
(void)dec_stat(creature_ptr, which_stat, randint1(6) + 6, one_in_(3));
}
}
+
if ((creature_ptr->muta2 & MUT2_ATT_DRAGON) && !creature_ptr->anti_magic && one_in_(3000))
{
bool pet = one_in_(5);
disturb(creature_ptr, FALSE, TRUE);
}
}
+
if ((creature_ptr->muta2 & MUT2_WEIRD_MIND) && !creature_ptr->anti_magic && one_in_(3000))
{
if (creature_ptr->tim_esp > 0)
set_tim_esp(creature_ptr, creature_ptr->lev, FALSE);
}
}
+
if ((creature_ptr->muta2 & MUT2_NAUSEA) && !creature_ptr->slow_digest && one_in_(9000))
{
disturb(creature_ptr, FALSE, TRUE);
if ((creature_ptr->muta2 & MUT2_WARNING) && one_in_(1000))
{
int danger_amount = 0;
- MONSTER_IDX monster;
-
- for (monster = 0; monster < creature_ptr->current_floor_ptr->m_max; monster++)
+ for (MONSTER_IDX monster = 0; monster < creature_ptr->current_floor_ptr->m_max; monster++)
{
monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[monster];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if ((creature_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
{
- INVENTORY_IDX slot = 0;
- object_type *o_ptr = NULL;
-
disturb(creature_ptr, FALSE, TRUE);
msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->wt / 6), _("転倒", "tripping"), -1);
-
- msg_print(NULL);
- if (has_melee_weapon(creature_ptr, INVEN_RARM))
- {
- slot = INVEN_RARM;
- o_ptr = &creature_ptr->inventory_list[INVEN_RARM];
-
- if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2))
- {
- o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
- slot = INVEN_LARM;
- }
- }
- else if (has_melee_weapon(creature_ptr, INVEN_LARM))
- {
- o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
- slot = INVEN_LARM;
- }
- if (slot && !object_is_cursed(o_ptr))
- {
- msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
- drop_from_inventory(creature_ptr, slot, 1);
- }
+ drop_weapons(creature_ptr);
}
-
}
+
/*!
* @brief 10ゲームターンが進行するごとに装備効果の発動判定を行う処理
* / Handle curse effects once every 10 game turns
{
GAME_TEXT o_name[MAX_NLEN];
object_type *o_ptr;
- int i, i_keep = 0, count = 0;
-
- /* Scan the equipment with random teleport ability */
- for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+ int i_keep = 0, count = 0;
+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
disturb(creature_ptr, TRUE, TRUE);
}
}
- /* Make a chainsword noise */
+
if ((creature_ptr->cursed & TRC_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
{
char noise[1024];
msg_print(noise);
disturb(creature_ptr, FALSE, FALSE);
}
- /* TY Curse */
+
if ((creature_ptr->cursed & TRC_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
{
int count = 0;
(void)activate_ty_curse(creature_ptr, FALSE, &count);
}
- /* Handle experience draining */
+
if (creature_ptr->prace != RACE_ANDROID && ((creature_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
{
creature_ptr->exp -= (creature_ptr->lev + 1) / 2;
if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
check_experience(creature_ptr);
}
- /* Add light curse (Later) */
+
if ((creature_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
{
- BIT_FLAGS new_curse;
object_type *o_ptr;
-
o_ptr = choose_cursed_obj_name(creature_ptr, TRC_ADD_L_CURSE);
-
- new_curse = get_curse(0, o_ptr);
+ BIT_FLAGS new_curse = get_curse(0, o_ptr);
if (!(o_ptr->curse_flags & new_curse))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-
o_ptr->curse_flags |= new_curse;
msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding your %s..."), o_name);
-
o_ptr->feeling = FEEL_NONE;
-
creature_ptr->update |= (PU_BONUS);
}
}
- /* Add heavy curse (Later) */
+
if ((creature_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
{
- BIT_FLAGS new_curse;
object_type *o_ptr;
-
o_ptr = choose_cursed_obj_name(creature_ptr, TRC_ADD_H_CURSE);
-
- new_curse = get_curse(1, o_ptr);
+ BIT_FLAGS new_curse = get_curse(1, o_ptr);
if (!(o_ptr->curse_flags & new_curse))
{
GAME_TEXT o_name[MAX_NLEN];
creature_ptr->update |= (PU_BONUS);
}
}
- /* Call animal */
+
if ((creature_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
{
if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_ANIMAL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sが動物を引き寄せた!", "Your %s has attracted an animal!"), o_name);
disturb(creature_ptr, FALSE, TRUE);
}
}
- /* Call demon */
+
if ((creature_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
{
if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sが悪魔を引き寄せた!", "Your %s has attracted a demon!"), o_name);
disturb(creature_ptr, FALSE, TRUE);
}
}
- /* Call dragon */
+
if ((creature_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
{
if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_DRAGON,
(PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sがドラゴンを引き寄せた!", "Your %s has attracted an dragon!"), o_name);
disturb(creature_ptr, FALSE, TRUE);
}
}
- /* Call undead */
+
if ((creature_ptr->cursed & TRC_CALL_UNDEAD) && one_in_(1111))
{
if (summon_specific(creature_ptr, 0, creature_ptr->y, creature_ptr->x, creature_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD,
(PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sが死霊を引き寄せた!", "Your %s has attracted an undead!"), o_name);
disturb(creature_ptr, FALSE, TRUE);
}
}
+
if ((creature_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
{
if (!creature_ptr->resist_fear)
set_afraid(creature_ptr, creature_ptr->afraid + 13 + randint1(26));
}
}
- /* Teleport player */
+
if ((creature_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !creature_ptr->anti_tele)
{
disturb(creature_ptr, FALSE, TRUE);
-
- /* Teleport player */
teleport_player(creature_ptr, 40, TELEPORT_PASSIVE);
}
- /* Handle HP draining */
+
if ((creature_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_DRAIN_HP), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sはあなたの体力を吸収した!", "Your %s drains HP from you!"), o_name);
take_hit(creature_ptr, DAMAGE_LOSELIFE, MIN(creature_ptr->lev * 2, 100), o_name, -1);
}
- /* Handle mana draining */
+
if ((creature_ptr->cursed & TRC_DRAIN_MANA) && creature_ptr->csp && one_in_(666))
{
GAME_TEXT o_name[MAX_NLEN];
-
object_desc(creature_ptr, o_name, choose_cursed_obj_name(creature_ptr, TRC_DRAIN_MANA), (OD_OMIT_PREFIX | OD_NAME_ONLY));
msg_format(_("%sはあなたの魔力を吸収した!", "Your %s drains mana from you!"), o_name);
creature_ptr->csp -= MIN(creature_ptr->lev, 50);
creature_ptr->csp = 0;
creature_ptr->csp_frac = 0;
}
+
creature_ptr->redraw |= PR_MANA;
}
}
- /* Rarely, take damage from the Jewel of Judgement */
if (one_in_(999) && !creature_ptr->anti_magic)
{
object_type *o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
-
if (o_ptr->name1 == ART_JUDGE)
{
if (object_is_known(o_ptr))
int i;
bool changed;
- /* Process equipment */
for (changed = FALSE, i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
- /* Get the object */
object_type *o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx) continue;
- /* Recharge activatable objects */
if (o_ptr->timeout > 0)
{
- /* Recharge */
o_ptr->timeout--;
-
- /* Notice changes */
if (!o_ptr->timeout)
{
recharged_notice(creature_ptr, o_ptr);
}
}
- /* Notice changes */
if (changed)
{
creature_ptr->window |= (PW_EQUIP);
object_kind *k_ptr = &k_info[o_ptr->k_idx];
if (!o_ptr->k_idx) continue;
- /* Examine all charging rods or stacks of charging rods. */
if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
{
- /* Determine how many rods are charging. */
TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval;
if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number;
- /* Decrease timeout by that number. */
o_ptr->timeout -= temp;
-
- /* Boundary control. */
if (o_ptr->timeout < 0) o_ptr->timeout = 0;
- /* Notice changes, provide message if object is inscribed. */
if (!(o_ptr->timeout))
{
recharged_notice(creature_ptr, o_ptr);
changed = TRUE;
}
-
- /* One of the stack of rod is charged */
else if (o_ptr->timeout % k_ptr->pval)
{
changed = TRUE;
}
}
- /* Notice changes */
if (changed)
{
creature_ptr->window |= (PW_INVEN);
wild_regen = 20;
}
- /* Process objects on floor */
for (i = 1; i < creature_ptr->current_floor_ptr->o_max; i++)
{
object_type *o_ptr = &creature_ptr->current_floor_ptr->o_list[i];
-
if (!OBJECT_IS_VALID(o_ptr)) continue;
- /* Recharge rods on the ground. No messages. */
if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout))
{
- /* Charge it */
o_ptr->timeout -= (TIME_EFFECT)o_ptr->number;
-
- /* Boundary control. */
if (o_ptr->timeout < 0) o_ptr->timeout = 0;
}
}
static void process_world_aux_movement(player_type *creature_ptr)
{
floor_type *floor_ptr = creature_ptr->current_floor_ptr;
- /* Delayed Word-of-Recall */
if (creature_ptr->word_recall)
{
/*
if (autosave_l && (creature_ptr->word_recall == 1) && !creature_ptr->phase_out)
do_cmd_save_game(creature_ptr, TRUE);
- /* Count down towards recall */
creature_ptr->word_recall--;
-
creature_ptr->redraw |= (PR_STATUS);
-
- /* Activate the recall */
if (!creature_ptr->word_recall)
{
- /* Disturbing! */
disturb(creature_ptr, FALSE, TRUE);
-
- /* Determine the level */
if (floor_ptr->dun_level || creature_ptr->current_floor_ptr->inside_quest || creature_ptr->enter_dungeon)
{
msg_print(_("上に引っ張りあげられる感じがする!", "You feel yourself yanked upwards!"));
-
if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
if (record_stair)
exe_write_diary(creature_ptr, DIARY_RECALL, floor_ptr->dun_level, NULL);
floor_ptr->dun_level = 0;
creature_ptr->dungeon_idx = 0;
-
leave_quest_check(creature_ptr);
leave_tower_check(creature_ptr);
-
creature_ptr->current_floor_ptr->inside_quest = 0;
-
creature_ptr->leaving = TRUE;
}
else
{
msg_print(_("下に引きずり降ろされる感じがする!", "You feel yourself yanked downwards!"));
-
creature_ptr->dungeon_idx = creature_ptr->recall_dungeon;
-
if (record_stair)
exe_write_diary(creature_ptr, DIARY_RECALL, floor_ptr->dun_level, NULL);
- /* New depth */
floor_ptr->dun_level = max_dlv[creature_ptr->dungeon_idx];
if (floor_ptr->dun_level < 1) floor_ptr->dun_level = 1;
-
- /* Nightmare mode makes recall more dangerous */
if (ironman_nightmare && !randint0(666) && (creature_ptr->dungeon_idx == DUNGEON_ANGBAND))
{
if (floor_ptr->dun_level < 50)
}
else
{
- /* Save player position */
creature_ptr->oldpx = creature_ptr->x;
creature_ptr->oldpy = creature_ptr->y;
}
+
creature_ptr->wild_mode = FALSE;
/*
if (creature_ptr->dungeon_idx == DUNGEON_ANGBAND)
{
- int i;
-
- for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
+ for (int i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
{
quest_type* const q_ptr = &quest[i];
-
-
if ((q_ptr->type == QUEST_TYPE_RANDOM) &&
(q_ptr->status == QUEST_STATUS_TAKEN) &&
(q_ptr->level < floor_ptr->dun_level))
}
}
-
- /* Delayed Alter reality */
if (creature_ptr->alter_reality)
{
if (autosave_l && (creature_ptr->alter_reality == 1) && !creature_ptr->phase_out)
do_cmd_save_game(creature_ptr, TRUE);
- /* Count down towards alter */
creature_ptr->alter_reality--;
-
creature_ptr->redraw |= (PR_STATUS);
-
- /* Activate the alter reality */
if (!creature_ptr->alter_reality)
{
- /* Disturbing! */
disturb(creature_ptr, FALSE, TRUE);
-
- /* Determine the level */
if (!quest_number(creature_ptr, floor_ptr->dun_level) && floor_ptr->dun_level)
{
msg_print(_("世界が変わった!", "The world changes!"));
}
}
+
/*!
* @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
* / Handle certain things once every 10 game turns
*/
static void process_world(player_type *player_ptr)
{
- int day, hour, min;
-
const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
s32b prev_turn_in_today = ((current_world_ptr->game_turn - TURNS_PER_TICK) % A_DAY + A_DAY / 4) % A_DAY;
int prev_min = (1440 * prev_turn_in_today / A_DAY) % 60;
+ int day, hour, min;
extract_day_hour_min(player_ptr, &day, &hour, &min);
-
- /* Update dungeon feeling, and announce it if changed */
update_dungeon_feeling(player_ptr);
/* 帰還無しモード時のレベルテレポバグ対策 / Fix for level teleport bugs on ironman_downward.*/
player_ptr->leaving = TRUE;
}
- /*** Check monster arena ***/
if (player_ptr->phase_out && !player_ptr->leaving)
{
- int i2, j2;
int win_m_idx = 0;
int number_mon = 0;
-
- /* Count all hostile monsters */
- for (i2 = 0; i2 < floor_ptr->width; ++i2)
- for (j2 = 0; j2 < floor_ptr->height; j2++)
+ for (int i2 = 0; i2 < floor_ptr->width; ++i2)
+ {
+ for (int j2 = 0; j2 < floor_ptr->height; j2++)
{
grid_type *g_ptr = &floor_ptr->grid_array[j2][i2];
-
if ((g_ptr->m_idx > 0) && (g_ptr->m_idx != player_ptr->riding))
{
number_mon++;
win_m_idx = g_ptr->m_idx;
}
}
+ }
if (number_mon == 0)
{
{
GAME_TEXT m_name[MAX_NLEN];
monster_type *wm_ptr;
-
wm_ptr = &floor_ptr->m_list[win_m_idx];
-
monster_desc(player_ptr, m_name, wm_ptr, 0);
msg_format(_("%sが勝利した!", "%s won!"), m_name);
msg_print(NULL);
{
msg_print(_("残念でした。", "You lost gold."));
}
+
msg_print(NULL);
player_ptr->energy_need = 0;
update_gambling_monsters(player_ptr);
}
}
- /* Every 10 game turns */
if (current_world_ptr->game_turn % TURNS_PER_TICK) return;
- /*** Attempt timed autosave ***/
if (autosave_t && autosave_freq && !player_ptr->phase_out)
{
if (!(current_world_ptr->game_turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
msg_print(_("何かが聞こえた。", "You hear noise."));
}
- /*** Handle the wilderness/town (sunshine) ***/
-
- /* While in town/wilderness */
if (!floor_ptr->dun_level && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)
{
- /* Hack -- Daybreak/Nighfall in town */
if (!(current_world_ptr->game_turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
{
- bool dawn;
-
- /* Check for dawn */
- dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
-
+ bool dawn = (!(current_world_ptr->game_turn % (TURNS_PER_TICK * TOWN_DAWN)));
if (dawn) day_break(player_ptr);
else night_falls(player_ptr);
}
}
-
- /* While in the dungeon (vanilla_town or lite_town mode only) */
else if ((vanilla_town || (lite_town && !floor_ptr->inside_quest && !player_ptr->phase_out && !floor_ptr->inside_arena)) && floor_ptr->dun_level)
{
- /*** Shuffle the Storekeepers ***/
-
- /* Chance is only once a day (while in dungeon) */
if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * STORE_TICKS)))
{
- /* Sometimes, shuffle the shop-keepers */
if (one_in_(STORE_SHUFFLE))
{
int n;
- FEAT_IDX i;
-
- /* Pick a random shop (except home and museum) */
do
{
n = randint0(MAX_STORES);
} while ((n == STORE_HOME) || (n == STORE_MUSEUM));
- /* Check every feature */
- for (i = 1; i < max_f_idx; i++)
+ for (FEAT_IDX i = 1; i < max_f_idx; i++)
{
feature_type *f_ptr = &f_info[i];
-
- /* Skip empty index */
if (!f_ptr->name) continue;
-
- /* Skip non-store features */
if (!have_flag(f_ptr->flags, FF_STORE)) continue;
- /* Verify store type */
if (f_ptr->subtype == n)
{
- if (cheat_xtra) msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
+ if (cheat_xtra)
+ msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name);
- /* Shuffle it */
store_shuffle(player_ptr, n);
-
break;
}
}
}
}
- /*** Process the monsters ***/
-
- /* Check for creature generation. */
if (one_in_(d_info[player_ptr->dungeon_idx].max_m_alloc_chance) &&
!floor_ptr->inside_arena && !floor_ptr->inside_quest && !player_ptr->phase_out)
{
- /* Make a new monster */
(void)alloc_monster(player_ptr, MAX_SIGHT + 5, 0);
}
- /* Hack -- Check for creature regeneration */
- if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !player_ptr->phase_out) regenerate_monsters(player_ptr);
- if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3))) regenerate_captured_monsters(player_ptr);
+ if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 10)) && !player_ptr->phase_out)
+ regenerate_monsters(player_ptr);
+ if (!(current_world_ptr->game_turn % (TURNS_PER_TICK * 3)))
+ regenerate_captured_monsters(player_ptr);
if (!player_ptr->leaving)
{
- int i;
-
- /* Hack -- Process the counters of monsters if needed */
- for (i = 0; i < MAX_MTIMED; i++)
+ for (int i = 0; i < MAX_MTIMED; i++)
{
if (floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(player_ptr, i);
}
}
- /* Date changes */
if (!hour && !min)
{
if (min != prev_min)
* Nightmare mode activates the TY_CURSE at midnight
* Require exact minute -- Don't activate multiple times in a minute
*/
-
if (ironman_nightmare && (min != prev_min))
{
-
- /* Every 15 minutes after 11:00 pm */
if ((hour == 23) && !(min % 15))
{
disturb(player_ptr, FALSE, TRUE);
-
switch (min / 15)
{
case 0:
}
}
- /* TY_CURSE activates at midnight! */
if (!hour && !min)
{
-
disturb(player_ptr, TRUE, TRUE);
msg_print(_("遠くで鐘が何回も鳴り、死んだような静けさの中へ消えていった。", "A distant bell tolls many times, fading into an deathly silence."));
-
if (player_ptr->wild_mode)
{
- /* Go into large wilderness view */
player_ptr->oldpy = randint1(MAX_HGT - 2);
player_ptr->oldpx = randint1(MAX_WID - 2);
change_wild_mode(player_ptr, TRUE);
-
- /* Give first move to monsters */
take_turn(player_ptr, 100);
}
process_world_aux_movement(player_ptr);
}
+
/*!
* @brief ウィザードモードへの導入処理
* / Verify use of "wizard" mode
*/
static bool enter_wizard_mode(player_type *player_ptr)
{
- /* Ask first time */
if (!current_world_ptr->noscore)
{
- /* Wizard mode is not permitted */
if (!allow_debug_opts || arg_wizard)
{
msg_print(_("ウィザードモードは許可されていません。 ", "Wizard mode is not permitted."));
return FALSE;
}
- /* Mention effects */
msg_print(_("ウィザードモードはデバッグと実験のためのモードです。 ", "Wizard mode is for debugging and experimenting."));
msg_print(_("一度ウィザードモードに入るとスコアは記録されません。", "The game will not be scored if you enter wizard mode."));
msg_print(NULL);
-
- /* Verify request */
if (!get_check(_("本当にウィザードモードに入りたいのですか? ", "Are you sure you want to enter wizard mode? ")))
{
return FALSE;
}
- exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "give up recording score to enter wizard mode."));
- /* Mark savefile */
+ exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("ウィザードモードに突入してスコアを残せなくなった。", "gave up recording score to enter wizard mode."));
current_world_ptr->noscore |= 0x0002;
}
- /* Success */
return TRUE;
}
-#ifdef ALLOW_WIZARD
-
/*!
* @brief デバッグコマンドへの導入処理
* / Verify use of "debug" commands
*/
static bool enter_debug_mode(player_type *player_ptr)
{
- /* Ask first time */
if (!current_world_ptr->noscore)
{
- /* Debug mode is not permitted */
if (!allow_debug_opts)
{
msg_print(_("デバッグコマンドは許可されていません。 ", "Use of debug command is not permitted."));
return FALSE;
}
- /* Mention effects */
msg_print(_("デバッグ・コマンドはデバッグと実験のためのコマンドです。 ", "The debug commands are for debugging and experimenting."));
msg_print(_("デバッグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use debug commands."));
-
msg_print(NULL);
-
- /* Verify request */
if (!get_check(_("本当にデバッグ・コマンドを使いますか? ", "Are you sure you want to use debug commands? ")))
{
return FALSE;
}
- exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("デバッグモードに突入してスコアを残せなくなった。", "give up sending score to use debug commands."));
- /* Mark savefile */
+ exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, _("デバッグモードに突入してスコアを残せなくなった。", "gave up sending score to use debug commands."));
current_world_ptr->noscore |= 0x0008;
}
- /* Success */
return TRUE;
}
/*
+ * todo これが多重インクルード問題の原因 (の1つ)かもしれない、wizard2.cに同名の関数が存在する
* Hack -- Declare the Debug Routines
*/
extern void do_cmd_debug(player_type *creature_ptr);
-#endif /* ALLOW_WIZARD */
-
-
-#ifdef ALLOW_BORG
-
-/*!
- * @brief ボーグコマンドへの導入処理
- * / Verify use of "borg" commands
- * @return 実際にボーグコマンドへ移行したらTRUEを返す。
- */
-static bool enter_borg_mode(void)
-{
- /* Ask first time */
- if (!(current_world_ptr->noscore & 0x0010))
- {
- /* Mention effects */
- msg_print(_("ボーグ・コマンドはデバッグと実験のためのコマンドです。 ", "The borg commands are for debugging and experimenting."));
- msg_print(_("ボーグ・コマンドを使うとスコアは記録されません。", "The game will not be scored if you use borg commands."));
-
- msg_print(NULL);
-
- /* Verify request */
- if (!get_check(_("本当にボーグ・コマンドを使いますか? ", "Are you sure you want to use borg commands? ")))
- {
- return FALSE;
- }
-
- exe_write_diary(p_ptr, NIKKI_BUNSHOU, 0, _("ボーグ・コマンドを使用してスコアを残せなくなった。", "give up recording score to use borg commands."));
- /* Mark savefile */
- current_world_ptr->noscore |= 0x0010;
- }
-
- /* Success */
- return TRUE;
-}
-
-/*
- * Hack -- Declare the Ben Borg
- */
-extern void do_cmd_borg(void);
-
-#endif /* ALLOW_BORG */
-
-
/*!
* @brief プレイヤーから受けた入力コマンドの分岐処理。
* / Parse and execute the current command Give "Warning" on illegal commands.
static void process_command(player_type *creature_ptr)
{
COMMAND_CODE old_now_message = now_message;
-
- /* Handle repeating the last command */
repeat_check();
-
now_message = 0;
-
- /* Sniper */
if ((creature_ptr->pclass == CLASS_SNIPER) && (creature_ptr->concent))
creature_ptr->reset_concent = TRUE;
- /* Parse the command */
floor_type *floor_ptr = creature_ptr->current_floor_ptr;
switch (command_cmd)
{
- /* Ignore */
case ESCAPE:
case ' ':
{
+ /* Ignore */
break;
}
-
- /* Ignore return */
case '\r':
case '\n':
{
+ /* todo 嘘。returnしていない
+ * Ignore return
+ */
break;
}
-
- /*** Wizard Commands ***/
case KTRL('W'):
{
if (current_world_ptr->wizard)
break;
}
-
-
-#ifdef ALLOW_WIZARD
-
- /* Special "debug" commands */
case KTRL('A'):
{
if (enter_debug_mode(creature_ptr))
}
break;
}
-
-#endif /* ALLOW_WIZARD */
-
-
-#ifdef ALLOW_BORG
-
- /* Special "borg" commands */
- case KTRL('Z'):
- {
- if (enter_borg_mode())
- {
- if (!creature_ptr->wild_mode) do_cmd_borg();
- }
- break;
- }
-
-#endif /* ALLOW_BORG */
-
-
-
- /*** Inventory Commands ***/
-
- /* Wear/wield equipment */
case 'w':
{
if (!creature_ptr->wild_mode) do_cmd_wield(creature_ptr);
break;
}
-
- /* Take off equipment */
case 't':
{
if (!creature_ptr->wild_mode) do_cmd_takeoff(creature_ptr);
break;
}
-
- /* Drop an item */
case 'd':
{
if (!creature_ptr->wild_mode) do_cmd_drop(creature_ptr);
break;
}
-
- /* Destroy an item */
case 'k':
{
do_cmd_destroy(creature_ptr);
break;
}
-
- /* Equipment list */
case 'e':
{
do_cmd_equip(creature_ptr);
break;
}
-
- /* Inventory list */
case 'i':
{
do_cmd_inven(creature_ptr);
break;
}
-
-
- /*** Various commands ***/
-
- /* Identify an object */
case 'I':
{
do_cmd_observe(creature_ptr);
toggle_inventory_equipment(creature_ptr);
break;
}
-
-
- /*** Standard "Movement" Commands ***/
-
- /* Alter a grid */
case '+':
{
if (!creature_ptr->wild_mode) do_cmd_alter(creature_ptr);
break;
}
-
- /* Dig a tunnel */
case 'T':
{
if (!creature_ptr->wild_mode) do_cmd_tunnel(creature_ptr);
break;
}
-
- /* Move (usually pick up things) */
case ';':
{
do_cmd_walk(creature_ptr, FALSE);
break;
}
-
- /* Move (usually do not pick up) */
case '-':
{
do_cmd_walk(creature_ptr, TRUE);
break;
}
-
-
- /*** Running, Resting, Searching, Staying */
-
- /* Begin Running -- Arg is Max Distance */
case '.':
{
if (!creature_ptr->wild_mode) do_cmd_run(creature_ptr);
break;
}
-
- /* Stay still (usually pick things up) */
case ',':
{
do_cmd_stay(creature_ptr, always_pickup);
break;
}
-
- /* Stay still (usually do not pick up) */
case 'g':
{
do_cmd_stay(creature_ptr, !always_pickup);
break;
}
-
- /* Rest -- Arg is time */
case 'R':
{
do_cmd_rest(creature_ptr);
break;
}
-
- /* Search for traps/doors */
case 's':
{
do_cmd_search(creature_ptr);
break;
}
-
case 'S':
{
if (creature_ptr->action == ACTION_SEARCH) set_action(creature_ptr, ACTION_NONE);
else set_action(creature_ptr, ACTION_SEARCH);
break;
}
-
-
- /*** Stairs and Doors and Chests and Traps ***/
-
- /* Enter store */
case SPECIAL_KEY_STORE:
{
do_cmd_store(creature_ptr);
break;
}
-
- /* Enter building -KMW- */
case SPECIAL_KEY_BUILDING:
{
do_cmd_bldg(creature_ptr);
break;
}
-
- /* Enter quest level -KMW- */
case SPECIAL_KEY_QUEST:
{
do_cmd_quest(creature_ptr);
break;
}
-
- /* Go up staircase */
case '<':
{
if (!creature_ptr->wild_mode && !floor_ptr->dun_level && !floor_ptr->inside_arena && !floor_ptr->inside_quest)
}
else
do_cmd_go_up(creature_ptr);
+
break;
}
-
- /* Go down staircase */
case '>':
{
if (creature_ptr->wild_mode)
do_cmd_go_down(creature_ptr);
break;
}
-
- /* Open a door or chest */
case 'o':
{
do_cmd_open(creature_ptr);
break;
}
-
- /* Close a door */
case 'c':
{
do_cmd_close(creature_ptr);
break;
}
-
- /* Jam a door with spikes */
case 'j':
{
do_cmd_spike(creature_ptr);
break;
}
-
- /* Bash a door */
case 'B':
{
do_cmd_bash(creature_ptr);
break;
}
-
- /* Disarm a trap or chest */
case 'D':
{
do_cmd_disarm(creature_ptr);
break;
}
-
-
- /*** Magic and Prayers ***/
-
- /* Gain new spells/prayers */
case 'G':
{
if ((creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE))
do_cmd_study(creature_ptr);
break;
}
-
- /* Browse a book */
case 'b':
{
if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
else do_cmd_browse(creature_ptr);
break;
}
-
- /* Cast a spell */
case 'm':
{
- /* -KMW- */
if (!creature_ptr->wild_mode)
{
if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_ARCHER) || (creature_ptr->pclass == CLASS_CAVALRY))
do_cmd_cast(creature_ptr);
}
}
+
break;
}
-
- /* Issue a pet command */
case 'p':
{
do_cmd_pet(creature_ptr);
break;
}
-
- /*** Use various objects ***/
-
- /* Inscribe an object */
case '{':
{
do_cmd_inscribe(creature_ptr);
break;
}
-
- /* Uninscribe an object */
case '}':
{
do_cmd_uninscribe(creature_ptr);
break;
}
-
- /* Activate an artifact */
case 'A':
{
do_cmd_activate(creature_ptr);
break;
}
-
- /* Eat some food */
case 'E':
{
do_cmd_eat_food(creature_ptr);
break;
}
-
- /* Fuel your lantern/torch */
case 'F':
{
do_cmd_refill(creature_ptr);
break;
}
-
- /* Fire an item */
case 'f':
{
do_cmd_fire(creature_ptr, SP_NONE);
break;
}
-
- /* Throw an item */
case 'v':
{
do_cmd_throw(creature_ptr, 1, FALSE, -1);
break;
}
-
- /* Aim a wand */
case 'a':
{
do_cmd_aim_wand(creature_ptr);
break;
}
-
- /* Zap a rod */
case 'z':
{
if (use_command && rogue_like_commands)
}
break;
}
-
- /* Quaff a potion */
case 'q':
{
do_cmd_quaff_potion(creature_ptr);
break;
}
-
- /* Read a scroll */
case 'r':
{
do_cmd_read_scroll(creature_ptr);
break;
}
-
- /* Use a staff */
case 'u':
{
if (use_command && !rogue_like_commands)
do_cmd_use_staff(creature_ptr);
break;
}
-
- /* Use racial power */
case 'U':
{
do_cmd_racial_power(creature_ptr);
break;
}
-
-
- /*** Looking at Things (nearby or on map) ***/
-
- /* Full dungeon map */
case 'M':
{
do_cmd_view_map(creature_ptr);
break;
}
-
- /* Locate player on map */
case 'L':
{
do_cmd_locate(creature_ptr);
break;
}
-
- /* Look around */
case 'l':
{
do_cmd_look(creature_ptr);
break;
}
-
- /* Target monster or location */
case '*':
{
do_cmd_target(creature_ptr);
break;
}
-
-
-
- /*** Help and Such ***/
-
- /* Help */
case '?':
{
do_cmd_help(creature_ptr);
break;
}
-
- /* Identify symbol */
case '/':
{
do_cmd_query_symbol(creature_ptr);
break;
}
-
- /* Character description */
case 'C':
{
do_cmd_player_status(creature_ptr);
break;
}
-
-
- /*** System Commands ***/
-
- /* Hack -- User interface */
case '!':
{
(void)Term_user(0);
break;
}
-
- /* Single line from a pref file */
case '"':
{
do_cmd_pref(creature_ptr);
break;
}
-
case '$':
{
do_cmd_reload_autopick(creature_ptr);
break;
}
-
case '_':
{
do_cmd_edit_autopick(creature_ptr);
break;
}
-
- /* Interact with macros */
case '@':
{
do_cmd_macros(creature_ptr);
break;
}
-
- /* Interact with visuals */
case '%':
{
do_cmd_visuals(creature_ptr);
do_cmd_redraw(creature_ptr);
break;
}
-
- /* Interact with colors */
case '&':
{
do_cmd_colors(creature_ptr);
do_cmd_redraw(creature_ptr);
break;
}
-
- /* Interact with options */
case '=':
{
do_cmd_options();
do_cmd_redraw(creature_ptr);
break;
}
-
- /*** Misc Commands ***/
-
- /* Take notes */
case ':':
{
do_cmd_note();
break;
}
-
- /* Version info */
case 'V':
{
do_cmd_version();
break;
}
-
- /* Repeat level feeling */
case KTRL('F'):
{
do_cmd_feeling(creature_ptr);
break;
}
-
- /* Show previous message */
case KTRL('O'):
{
do_cmd_message_one();
break;
}
-
- /* Show previous messages */
case KTRL('P'):
{
do_cmd_messages(old_now_message);
break;
}
-
- /* Show quest status -KMW- */
case KTRL('Q'):
{
do_cmd_checkquest(creature_ptr);
break;
}
-
- /* Redraw the screen */
case KTRL('R'):
{
now_message = old_now_message;
do_cmd_redraw(creature_ptr);
break;
}
-
-#ifndef VERIFY_SAVEFILE
-
- /* Hack -- Save and don't quit */
case KTRL('S'):
{
do_cmd_save_game(creature_ptr, FALSE);
break;
}
-
-#endif /* VERIFY_SAVEFILE */
-
case KTRL('T'):
{
do_cmd_time(creature_ptr);
break;
}
-
- /* Save and quit */
case KTRL('X'):
case SPECIAL_KEY_QUIT:
{
do_cmd_save_and_exit(creature_ptr);
break;
}
-
- /* Quit (commit suicide) */
case 'Q':
{
do_cmd_suicide(creature_ptr);
break;
}
-
case '|':
{
do_cmd_diary(creature_ptr);
break;
}
-
- /* Check artifacts, uniques, objects */
case '~':
{
do_cmd_knowledge(creature_ptr);
break;
}
-
- /* Load "screen dump" */
case '(':
{
do_cmd_load_screen();
break;
}
-
- /* Save "screen dump" */
case ')':
{
- do_cmd_save_screen(creature_ptr);
+ do_cmd_save_screen(creature_ptr, handle_stuff);
break;
}
-
- /* Record/stop "Movie" */
case ']':
{
prepare_movie_hooks();
break;
}
-
- /* Make random artifact list */
case KTRL('V'):
{
spoil_random_artifact(creature_ptr, "randifact.txt");
break;
}
-
-#ifdef TRAVEL
case '`':
{
if (!creature_ptr->wild_mode) do_cmd_travel(creature_ptr);
}
break;
}
-#endif
-
- /* Hack -- Unknown command */
default:
{
if (flush_failure) flush();
break;
}
}
+
if (!creature_ptr->energy_use && !now_message)
now_message = old_now_message;
}
+
/*!
* @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理 / Hack -- Pack Overflow
* @return なし
GAME_TEXT o_name[MAX_NLEN];
object_type *o_ptr;
-
- /* Is auto-destroy done? */
update_creature(owner_ptr);
if (!owner_ptr->inventory_list[INVEN_PACK].k_idx) return;
- /* Access the slot to be dropped */
o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
-
disturb(owner_ptr, FALSE, TRUE);
-
- /* Warning */
msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
- object_desc(owner_ptr, o_name, o_ptr, 0);
+ object_desc(owner_ptr, o_name, o_ptr, 0);
msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
-
- /* Drop it (carefully) near the player */
(void)drop_near(owner_ptr, o_ptr, 0, owner_ptr->y, owner_ptr->x);
vary_item(owner_ptr, INVEN_PACK, -255);
handle_stuff(owner_ptr);
}
+
/*!
* @brief プレイヤーの行動エネルギーが充填される(=プレイヤーのターンが回る)毎に行われる処理 / process the effects per 100 energy at player speed.
* @return なし
*/
static void process_upkeep_with_speed(player_type *creature_ptr)
{
- /* Give the player some energy */
if (!load && creature_ptr->enchant_energy_need > 0 && !creature_ptr->leaving)
{
creature_ptr->enchant_energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
}
- /* No turn yet */
if (creature_ptr->enchant_energy_need > 0) return;
while (creature_ptr->enchant_energy_need <= 0)
{
- /* Handle the player song */
if (!load) check_music(creature_ptr);
-
- /* Hex - Handle the hex spells */
if (!load) check_hex(creature_ptr);
if (!load) revenge_spell(creature_ptr);
- /* There is some randomness of needed energy */
creature_ptr->enchant_energy_need += ENERGY_NEED();
}
}
+
static void process_fishing(player_type *creature_ptr)
{
Term_xtra(TERM_XTRA_DELAY, 10);
MONRACE_IDX r_idx;
bool success = FALSE;
get_mon_num_prep(creature_ptr, monster_is_fishing_target, NULL);
- r_idx = get_mon_num(creature_ptr, creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level);
+ r_idx = get_mon_num(creature_ptr, creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level, 0);
msg_print(NULL);
if (r_idx && one_in_(2))
{
success = TRUE;
}
}
+
if (!success)
{
msg_print(_("餌だけ食われてしまった!くっそ~!", "Damn! The fish stole your bait!"));
}
+
disturb(creature_ptr, FALSE, TRUE);
}
}
+
/*!
* @brief プレイヤーの行動処理 / Process the player
* @return なし
*/
static void process_player(player_type *creature_ptr)
{
- MONSTER_IDX m_idx;
-
- /*** Apply energy ***/
-
if (creature_ptr->hack_mutation)
{
msg_print(_("何か変わった気がする!", "You feel different!"));
if (creature_ptr->phase_out)
{
- for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
+ for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
{
monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
-
if (!monster_is_valid(m_ptr)) continue;
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
print_time(creature_ptr);
}
-
- /* Give the player some energy */
else if (!(load && creature_ptr->energy_need <= 0))
{
creature_ptr->energy_need -= SPEED_TO_ENERGY(creature_ptr->pspeed);
}
- /* No turn yet */
if (creature_ptr->energy_need > 0) return;
if (!command_rep) print_time(creature_ptr);
- /*** Check for interupts ***/
-
- /* Complete resting */
if (creature_ptr->resting < 0)
{
- /* Basic resting */
if (creature_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
{
- /* Stop resting */
if ((creature_ptr->chp == creature_ptr->mhp) &&
(creature_ptr->csp >= creature_ptr->msp))
{
set_action(creature_ptr, ACTION_NONE);
}
}
-
- /* Complete resting */
else if (creature_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
{
- /* Stop resting */
if ((creature_ptr->chp == creature_ptr->mhp) &&
(creature_ptr->csp >= creature_ptr->msp) &&
!creature_ptr->blind && !creature_ptr->confused &&
if (creature_ptr->action == ACTION_FISH) process_fishing(creature_ptr);
- /* Handle "abort" */
if (check_abort)
{
- /* Check for "player abort" (semi-efficiently for resting) */
if (creature_ptr->running || travel.run || command_rep || (creature_ptr->action == ACTION_REST) || (creature_ptr->action == ACTION_FISH))
{
- /* Do not wait */
inkey_scan = TRUE;
-
- /* Check for a key */
if (inkey())
{
- flush(); /* Flush input */
-
+ flush();
disturb(creature_ptr, FALSE, TRUE);
-
- /* Hack -- Show a Message */
msg_print(_("中断しました。", "Canceled."));
}
}
{
monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
if (MON_CSLEEP(m_ptr))
{
GAME_TEXT m_name[MAX_NLEN];
-
- /* Recover fully */
(void)set_monster_csleep(creature_ptr, creature_ptr->riding, 0);
monster_desc(creature_ptr, m_name, m_ptr, 0);
msg_format(_("%^sを起こした。", "You have woken %s up."), m_name);
if (MON_STUNNED(m_ptr))
{
- /* Hack -- Recover from stun */
if (set_monster_stunned(creature_ptr, creature_ptr->riding,
(randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
{
if (MON_CONFUSED(m_ptr))
{
- /* Hack -- Recover from confusion */
if (set_monster_confused(creature_ptr, creature_ptr->riding,
(randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
{
if (MON_MONFEAR(m_ptr))
{
- /* Hack -- Recover from fear */
if (set_monster_monfear(creature_ptr, creature_ptr->riding,
(randint0(r_ptr->level) < creature_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
{
}
load = FALSE;
-
- /* Fast */
if (creature_ptr->lightspeed)
{
(void)set_lightspeed(creature_ptr, creature_ptr->lightspeed - 1, TRUE);
}
+
if ((creature_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
{
if (P_PTR_KI < 40) P_PTR_KI = 0;
else P_PTR_KI -= 40;
creature_ptr->update |= (PU_BONUS);
}
+
if (creature_ptr->action == ACTION_LEARN)
{
s32b cost = 0L;
u32b cost_frac = (creature_ptr->msp + 30L) * 256L;
-
- /* Convert the unit (1/2^16) to (1/2^32) */
s64b_LSHIFT(cost, cost_frac, 16);
-
if (s64b_cmp(creature_ptr->csp, creature_ptr->csp_frac, cost, cost_frac) < 0)
{
- /* Mana run out */
creature_ptr->csp = 0;
creature_ptr->csp_frac = 0;
set_action(creature_ptr, ACTION_NONE);
}
else
{
- /* Reduce mana */
s64b_sub(&(creature_ptr->csp), &(creature_ptr->csp_frac), cost, cost_frac);
}
+
creature_ptr->redraw |= PR_MANA;
}
}
/*** Handle actual user input ***/
-
- /* Repeat until out of energy */
while (creature_ptr->energy_need <= 0)
{
creature_ptr->window |= PW_PLAYER;
creature_ptr->now_damaged = FALSE;
handle_stuff(creature_ptr);
-
- /* Place the cursor on the player */
move_cursor_relative(creature_ptr->y, creature_ptr->x);
-
- /* Refresh (optional) */
if (fresh_before) Term_fresh();
- /* Hack -- Pack Overflow */
pack_overflow(creature_ptr);
-
- /* Hack -- cancel "lurking browse mode" */
if (!command_new) command_see = FALSE;
- /* Assume free turn */
free_turn(creature_ptr);
-
if (creature_ptr->phase_out)
{
- /* Place the cursor on the player */
move_cursor_relative(creature_ptr->y, creature_ptr->x);
-
command_cmd = SPECIAL_KEY_BUILDING;
-
- /* Process the command */
process_command(creature_ptr);
}
-
- /* Paralyzed or Knocked Out */
else if (creature_ptr->paralyzed || (creature_ptr->stun >= 100))
{
take_turn(creature_ptr, 100);
}
-
- /* Resting */
else if (creature_ptr->action == ACTION_REST)
{
- /* Timed rest */
if (creature_ptr->resting > 0)
{
- /* Reduce rest count */
creature_ptr->resting--;
-
if (!creature_ptr->resting) set_action(creature_ptr, ACTION_NONE);
creature_ptr->redraw |= (PR_STATE);
}
take_turn(creature_ptr, 100);
}
-
- /* Fishing */
else if (creature_ptr->action == ACTION_FISH)
{
take_turn(creature_ptr, 100);
}
-
- /* Running */
else if (creature_ptr->running)
{
- /* Take a step */
run_step(creature_ptr, 0);
}
-
-#ifdef TRAVEL
- /* Traveling */
else if (travel.run)
{
- /* Take a step */
travel_step(creature_ptr);
}
-#endif
-
- /* Repeated command */
else if (command_rep)
{
- /* Count this execution */
command_rep--;
-
creature_ptr->redraw |= (PR_STATE);
handle_stuff(creature_ptr);
-
- /* Hack -- Assume messages were seen */
msg_flag = FALSE;
-
- /* Clear the top line */
prt("", 0, 0);
-
- /* Process the command */
process_command(creature_ptr);
}
-
- /* Normal command */
else
{
- /* Place the cursor on the player */
move_cursor_relative(creature_ptr->y, creature_ptr->x);
-
can_save = TRUE;
- /* Get a command (normal) */
request_command(creature_ptr, FALSE);
can_save = FALSE;
-
- /* Process the command */
process_command(creature_ptr);
}
- /* Hack -- Pack Overflow */
pack_overflow(creature_ptr);
-
- /*** Clean up ***/
-
- /* Significant */
if (creature_ptr->energy_use)
{
- /* Use some energy */
if (creature_ptr->timewalk || creature_ptr->energy_use > 400)
{
- /* The Randomness is irrelevant */
creature_ptr->energy_need += creature_ptr->energy_use * TURNS_PER_TICK / 10;
}
else
{
- /* There is some randomness of needed energy */
creature_ptr->energy_need += (s16b)((s32b)creature_ptr->energy_use * ENERGY_NEED() / 100L);
}
- /* Hack -- constant hallucination */
if (creature_ptr->image) creature_ptr->redraw |= (PR_MAP);
- /* Shimmer multi-hued monsters */
- for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
+ for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
{
monster_type *m_ptr;
monster_race *r_ptr;
-
m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
if (!monster_is_valid(m_ptr)) continue;
-
- /* Skip unseen monsters */
if (!m_ptr->ml) continue;
- /* Access the monster race */
r_ptr = &r_info[m_ptr->ap_r_idx];
-
- /* Skip non-multi-hued monsters */
if (!(r_ptr->flags1 & (RF1_ATTR_MULTI | RF1_SHAPECHANGER)))
continue;
- /* Redraw regardless */
lite_spot(creature_ptr, m_ptr->fy, m_ptr->fx);
}
-
- /* Handle monster detection */
if (repair_monsters)
{
- /* Reset the flag */
repair_monsters = FALSE;
-
- /* Rotate detection flags */
- for (m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
+ for (MONSTER_IDX m_idx = 1; m_idx < creature_ptr->current_floor_ptr->m_max; m_idx++)
{
monster_type *m_ptr;
m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
if (!monster_is_valid(m_ptr)) continue;
- /* Nice monsters get mean */
if (m_ptr->mflag & MFLAG_NICE)
{
- /* Nice monsters get mean */
m_ptr->mflag &= ~(MFLAG_NICE);
}
- /* Handle memorized monsters */
if (m_ptr->mflag2 & MFLAG2_MARK)
{
- /* Maintain detection */
if (m_ptr->mflag2 & MFLAG2_SHOW)
{
- /* Forget flag */
m_ptr->mflag2 &= ~(MFLAG2_SHOW);
-
- /* Still need repairs */
repair_monsters = TRUE;
}
-
- /* Remove detection */
else
{
- /* Forget flag */
m_ptr->mflag2 &= ~(MFLAG2_MARK);
-
- /* Assume invisible */
m_ptr->ml = FALSE;
update_monster(creature_ptr, m_idx, FALSE);
-
if (creature_ptr->health_who == m_idx) creature_ptr->redraw |= (PR_HEALTH);
if (creature_ptr->riding == m_idx) creature_ptr->redraw |= (PR_UHEALTH);
- /* Redraw regardless */
lite_spot(creature_ptr, m_ptr->fy, m_ptr->fx);
}
}
}
}
+
if (creature_ptr->pclass == CLASS_IMITATOR)
{
- int j;
if (creature_ptr->mane_num > (creature_ptr->lev > 44 ? 3 : creature_ptr->lev > 29 ? 2 : 1))
{
creature_ptr->mane_num--;
- for (j = 0; j < creature_ptr->mane_num; j++)
+ for (int j = 0; j < creature_ptr->mane_num; j++)
{
creature_ptr->mane_spell[j] = creature_ptr->mane_spell[j + 1];
creature_ptr->mane_dam[j] = creature_ptr->mane_dam[j + 1];
}
}
+
creature_ptr->new_mane = FALSE;
creature_ptr->redraw |= (PR_IMITATION);
}
+
if (creature_ptr->action == ACTION_LEARN)
{
creature_ptr->new_mane = FALSE;
}
}
- /* Hack -- notice death */
if (!creature_ptr->playing || creature_ptr->is_dead)
{
creature_ptr->timewalk = FALSE;
break;
}
- /* Sniper */
- if (creature_ptr->energy_use && creature_ptr->reset_concent) reset_concentration(creature_ptr, TRUE);
+ if (creature_ptr->energy_use && creature_ptr->reset_concent)
+ reset_concentration(creature_ptr, TRUE);
- /* Handle "leaving" */
if (creature_ptr->leaving) break;
}
- /* Update scent trail */
update_smell(creature_ptr->current_floor_ptr, creature_ptr);
}
+
/*!
* @brief 現在プレイヤーがいるダンジョンの全体処理 / Interact with the current dungeon level.
* @return なし
*/
static void dungeon(player_type *player_ptr, bool load_game)
{
- int quest_num = 0;
-
- /* Set the base level */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
floor_ptr->base_level = floor_ptr->dun_level;
-
- /* Reset various flags */
current_world_ptr->is_loading_now = FALSE;
-
- /* Not leaving */
player_ptr->leaving = FALSE;
- /* Reset the "command" vars */
command_cmd = 0;
command_rep = 0;
command_arg = 0;
command_dir = 0;
- /* Cancel the target */
target_who = 0;
player_ptr->pet_t_m_idx = 0;
player_ptr->riding_t_m_idx = 0;
player_ptr->ambush_flag = FALSE;
-
health_track(player_ptr, 0);
-
- /* Check visual effects */
repair_monsters = TRUE;
repair_objects = TRUE;
-
disturb(player_ptr, TRUE, TRUE);
-
- /* Get index of current quest (if any) */
- quest_num = quest_number(player_ptr, floor_ptr->dun_level);
-
- /* Inside a quest? */
+ int quest_num = quest_num = quest_number(player_ptr, floor_ptr->dun_level);
if (quest_num)
{
- /* Mark the quest monster */
r_info[quest[quest_num].r_idx].flags1 |= RF1_QUESTOR;
}
- /* Track maximum player level */
if (player_ptr->max_plv < player_ptr->lev)
{
player_ptr->max_plv = player_ptr->lev;
}
-
- /* Track maximum dungeon level (if not in quest -KMW-) */
if ((max_dlv[player_ptr->dungeon_idx] < floor_ptr->dun_level) && !floor_ptr->inside_quest)
{
max_dlv[player_ptr->dungeon_idx] = floor_ptr->dun_level;
}
(void)calculate_upkeep(player_ptr);
-
- /* Validate the panel */
panel_bounds_center();
-
- /* Verify the panel */
verify_panel(player_ptr);
-
msg_erase();
-
- /* Enter "xtra" mode */
current_world_ptr->character_xtra = TRUE;
-
player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
player_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH | PU_MONSTERS | PU_DISTANCE | PU_FLOW);
-
handle_stuff(player_ptr);
- /* Leave "xtra" mode */
current_world_ptr->character_xtra = FALSE;
-
player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
player_ptr->update |= (PU_COMBINE | PU_REORDER);
handle_stuff(player_ptr);
if (quest_num && (is_fixed_quest_idx(quest_num) &&
!((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
- !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) do_cmd_feeling(player_ptr);
+ !(quest[quest_num].flags & QUEST_FLAG_PRESET))))
+ do_cmd_feeling(player_ptr);
if (player_ptr->phase_out)
{
if ((player_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(player_ptr) > MUSIC_DETECT))
SINGING_SONG_EFFECT(player_ptr) = MUSIC_DETECT;
- /* Hack -- notice death or departure */
if (!player_ptr->playing || player_ptr->is_dead) return;
- /* Print quest message if appropriate */
if (!floor_ptr->inside_quest && (player_ptr->dungeon_idx == DUNGEON_ANGBAND))
{
quest_discovery(random_quest_number(player_ptr, floor_ptr->dun_level));
if (!load_game && (player_ptr->special_defense & NINJA_S_STEALTH)) set_superstealth(player_ptr, FALSE);
- /*** Process this dungeon level ***/
-
- /* Reset the monster generation level */
floor_ptr->monster_level = floor_ptr->base_level;
-
- /* Reset the object generation level */
floor_ptr->object_level = floor_ptr->base_level;
-
current_world_ptr->is_loading_now = TRUE;
-
if (player_ptr->energy_need > 0 && !player_ptr->phase_out &&
(floor_ptr->dun_level || player_ptr->leaving_dungeon || floor_ptr->inside_arena))
player_ptr->energy_need = 0;
- /* Not leaving dungeon */
player_ptr->leaving_dungeon = FALSE;
-
- /* Initialize monster process */
mproc_init(floor_ptr);
- /* Main loop */
while (TRUE)
{
- /* Hack -- Compact the monster list occasionally */
- if ((floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out) compact_monsters(player_ptr, 64);
-
- /* Hack -- Compress the monster list occasionally */
- if ((floor_ptr->m_cnt + 32 < floor_ptr->m_max) && !player_ptr->phase_out) compact_monsters(player_ptr, 0);
+ if ((floor_ptr->m_cnt + 32 > current_world_ptr->max_m_idx) && !player_ptr->phase_out)
+ compact_monsters(player_ptr, 64);
+ if ((floor_ptr->m_cnt + 32 < floor_ptr->m_max) && !player_ptr->phase_out)
+ compact_monsters(player_ptr, 0);
- /* Hack -- Compact the object list occasionally */
- if (floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx) compact_objects(player_ptr, 64);
+ if (floor_ptr->o_cnt + 32 > current_world_ptr->max_o_idx)
+ compact_objects(player_ptr, 64);
- /* Hack -- Compress the object list occasionally */
- if (floor_ptr->o_cnt + 32 < floor_ptr->o_max) compact_objects(player_ptr, 0);
+ if (floor_ptr->o_cnt + 32 < floor_ptr->o_max)
+ compact_objects(player_ptr, 0);
- /* Process the player */
process_player(player_ptr);
process_upkeep_with_speed(player_ptr);
-
handle_stuff(player_ptr);
- /* Hack -- Hilite the player */
move_cursor_relative(player_ptr->y, player_ptr->x);
-
- /* Optional fresh */
if (fresh_after) Term_fresh();
- /* Hack -- Notice death or departure */
if (!player_ptr->playing || player_ptr->is_dead) break;
- /* Process all of the monsters */
process_monsters(player_ptr);
-
handle_stuff(player_ptr);
- /* Hack -- Hilite the player */
move_cursor_relative(player_ptr->y, player_ptr->x);
-
- /* Optional fresh */
if (fresh_after) Term_fresh();
- /* Hack -- Notice death or departure */
if (!player_ptr->playing || player_ptr->is_dead) break;
- /* Process the world */
process_world(player_ptr);
-
handle_stuff(player_ptr);
- /* Hack -- Hilite the player */
move_cursor_relative(player_ptr->y, player_ptr->x);
-
- /* Optional fresh */
if (fresh_after) Term_fresh();
- /* Hack -- Notice death or departure */
if (!player_ptr->playing || player_ptr->is_dead) break;
- /* Count game turns */
current_world_ptr->game_turn++;
-
if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
{
if (!player_ptr->wild_mode || wild_regen) current_world_ptr->dungeon_turn++;
prevent_turn_overflow(player_ptr);
- /* Handle "leaving" */
if (player_ptr->leaving) break;
if (wild_regen) wild_regen--;
}
- /* Inside a quest and non-unique questor? */
if (quest_num && !(r_info[quest[quest_num].r_idx].flags1 & RF1_UNIQUE))
{
- /* Un-mark the quest monster */
r_info[quest[quest_num].r_idx].flags1 &= ~RF1_QUESTOR;
}
- /* Not save-and-quit and not dead? */
if (player_ptr->playing && !player_ptr->is_dead)
{
/*
* floor, then prepare next floor
*/
leave_floor(player_ptr);
-
- /* Forget the flag */
reinit_wilderness = FALSE;
}
- /* Write about current level on the play record once per level */
write_level = TRUE;
}
static void load_all_pref_files(player_type *player_ptr)
{
char buf[1024];
-
- /* Access the "user" pref file */
sprintf(buf, "user.prf");
-
- /* Process that file */
process_pref_file(player_ptr, buf);
-
- /* Access the "user" system pref file */
sprintf(buf, "user-%s.prf", ANGBAND_SYS);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
-
- /* Access the "race" pref file */
sprintf(buf, "%s.prf", rp_ptr->title);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
-
- /* Access the "class" pref file */
sprintf(buf, "%s.prf", cp_ptr->title);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
-
- /* Access the "character" pref file */
sprintf(buf, "%s.prf", player_ptr->base_name);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
-
- /* Access the "realm 1" pref file */
if (player_ptr->realm1 != REALM_NONE)
{
sprintf(buf, "%s.prf", realm_names[player_ptr->realm1]);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
}
- /* Access the "realm 2" pref file */
if (player_ptr->realm2 != REALM_NONE)
{
sprintf(buf, "%s.prf", realm_names[player_ptr->realm2]);
-
- /* Process that file */
process_pref_file(player_ptr, buf);
}
-
- /* Load an autopick preference file */
autopick_load_pref(player_ptr, FALSE);
}
*/
void play_game(player_type *player_ptr, bool new_game)
{
- MONSTER_IDX i;
bool load_game = TRUE;
bool init_random_seed = FALSE;
}
player_ptr->hack_mutation = FALSE;
-
- /* Hack -- Character is "icky" */
current_world_ptr->character_icky = TRUE;
-
- /* Make sure main term is active */
Term_activate(angband_term[0]);
-
- /* Initialise the resize hooks */
angband_term[0]->resize_hook = resize_map;
-
- for (i = 1; i < 8; i++)
+ for (MONSTER_IDX i = 1; i < 8; i++)
{
- /* Does the term exist? */
if (angband_term[i])
{
- /* Add the redraw on resize hook */
angband_term[i]->resize_hook = redraw_window;
}
}
- /* Hack -- turn off the cursor */
(void)Term_set_cursor(0);
-
-
- /* Attempt to load */
if (!load_player(player_ptr))
{
quit(_("セーブファイルが壊れています", "broken savefile"));
}
- /* Extract the options */
extract_option_vars();
-
- /* Report waited score */
if (player_ptr->wait_report_score)
{
char buf[1024];
player_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
update_creature(player_ptr);
-
player_ptr->is_dead = TRUE;
-
current_world_ptr->start_time = (u32b)time(NULL);
-
- /* No suspending now */
signals_ignore_tstp();
-
- /* Hack -- Character is now "icky" */
current_world_ptr->character_icky = TRUE;
path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
-
- /* Open the high score file, for reading/writing */
highscore_fd = fd_open(buf, O_RDWR);
/* 町名消失バグ対策(#38205)のためここで世界マップ情報を読み出す */
process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
-
- /* Handle score, show Top scores */
- success = send_world_score(player_ptr, TRUE);
+ success = send_world_score(player_ptr, TRUE, update_playtime, display_player, map_name);
if (!success && !get_check_strict(_("スコア登録を諦めますか?", "Do you give up score registration? "), CHECK_NO_HISTORY))
{
top_twenty(player_ptr);
if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
}
- /* Shut the high score file */
- (void)fd_close(highscore_fd);
- /* Forget the high score fd */
+ (void)fd_close(highscore_fd);
highscore_fd = -1;
-
- /* Allow suspending now */
signals_handle_tstp();
quit(0);
current_world_ptr->creating_savefile = new_game;
- /* Nothing loaded */
if (!current_world_ptr->character_loaded)
{
- /* Make new player */
new_game = TRUE;
-
- /* The dungeon is not ready */
current_world_ptr->character_dungeon = FALSE;
-
- /* Prepare to init the RNG */
init_random_seed = TRUE;
-
- /* Initialize the saved floors data */
init_saved_floors(player_ptr, FALSE);
}
-
- /* Old game is loaded. But new game is requested. */
else if (new_game)
{
- /* Initialize the saved floors data */
init_saved_floors(player_ptr, TRUE);
}
- /* Process old character */
if (!new_game)
{
- /* Process the player name */
process_player_name(player_ptr, FALSE);
}
- /* Init the RNG */
if (init_random_seed)
{
Rand_state_init();
}
- /* Roll new character */
floor_type *floor_ptr = player_ptr->current_floor_ptr;
if (new_game)
{
- /* The dungeon is not ready */
current_world_ptr->character_dungeon = FALSE;
- /* Start in town */
floor_ptr->dun_level = 0;
floor_ptr->inside_quest = 0;
floor_ptr->inside_arena = FALSE;
player_ptr->phase_out = FALSE;
-
write_level = TRUE;
- /* Hack -- seed for flavors */
current_world_ptr->seed_flavor = randint0(0x10000000);
-
- /* Hack -- seed for town layout */
current_world_ptr->seed_town = randint0(0x10000000);
- /* Roll up a new character */
player_birth(player_ptr);
-
counts_write(player_ptr, 2, 0);
player_ptr->count = 0;
-
load = FALSE;
-
determine_bounty_uniques(player_ptr);
determine_daily_bounty(player_ptr, FALSE);
-
- /* Initialize object array */
wipe_o_list(floor_ptr);
}
else
{
write_level = FALSE;
-
exe_write_diary(player_ptr, DIARY_GAMESTART, 1,
_(" ----ゲーム再開----",
- " ---- Restart Game ----"));
+ " --- Restarted Game ---"));
/*
+ * todo もう2.2.Xなので互換性は打ち切ってもいいのでは?
* 1.0.9 以前はセーブ前に player_ptr->riding = -1 としていたので、再設定が必要だった。
* もう不要だが、以前のセーブファイルとの互換のために残しておく。
*/
if (player_ptr->riding == -1)
{
player_ptr->riding = 0;
- for (i = floor_ptr->m_max; i > 0; i--)
+ for (MONSTER_IDX i = floor_ptr->m_max; i > 0; i--)
{
if (player_bold(player_ptr, floor_ptr->m_list[i].fy, floor_ptr->m_list[i].fx))
{
current_world_ptr->start_time = time(NULL) - 1;
record_o_name[0] = '\0';
- /* Reset map panel */
panel_row_min = floor_ptr->height;
panel_col_min = floor_ptr->width;
-
- /* Sexy gal gets bonus to maximum weapon skill of whip */
if (player_ptr->pseikaku == SEIKAKU_SEXY)
s_info[player_ptr->pclass].w_max[TV_HAFTED - TV_WEAPON_BEGIN][SV_WHIP] = WEAPON_EXP_MASTER;
- /* Fill the arrays of floors and walls in the good proportions */
set_floor_and_wall(player_ptr->dungeon_idx);
-
- /* Flavor the objects */
flavor_init();
-
- /* Flash a message */
prt(_("お待ち下さい...", "Please wait..."), 0, 0);
-
- /* Flush the message */
Term_fresh();
-
- /* Hack -- Enter wizard mode */
if (arg_wizard)
{
if (enter_wizard_mode(player_ptr))
if (player_ptr->is_dead || !player_ptr->y || !player_ptr->x)
{
- /* Initialize the saved floors data */
init_saved_floors(player_ptr, TRUE);
-
- /* Avoid crash */
floor_ptr->inside_quest = 0;
-
- /* Avoid crash in update_view() */
player_ptr->y = player_ptr->x = 10;
}
}
}
}
- /* Initialize the town-buildings if necessary */
if (!floor_ptr->dun_level && !floor_ptr->inside_quest)
{
process_dungeon_file(player_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
select_floor_music(player_ptr);
}
- /* Generate a dungeon level if needed */
if (!current_world_ptr->character_dungeon)
{
change_floor(player_ptr);
}
else
{
- /* HACK -- Restore from panic-save */
if (player_ptr->panic_save)
{
- /* No player? -- Try to regenerate floor */
if (!player_ptr->y || !player_ptr->x)
{
msg_print(_("プレイヤーの位置がおかしい。フロアを再生成します。", "What a strange player location, regenerate the dungeon floor."));
change_floor(player_ptr);
}
- /* Still no player? -- Try to locate random place */
if (!player_ptr->y || !player_ptr->x) player_ptr->y = player_ptr->x = 10;
- /* No longer in panic */
player_ptr->panic_save = 0;
}
}
- /* Character is now "complete" */
current_world_ptr->character_generated = TRUE;
-
- /* Hack -- Character is no longer "icky" */
current_world_ptr->character_icky = FALSE;
if (new_game)
{
char buf[80];
- sprintf(buf, _("%sに降り立った。", "You are standing in the %s."), map_name(player_ptr));
+ sprintf(buf, _("%sに降り立った。", "arrived in %s."), map_name(player_ptr));
exe_write_diary(player_ptr, DIARY_DESCRIPTION, 0, buf);
}
- /* Start game */
player_ptr->playing = TRUE;
-
- /* Reset the visual mappings */
reset_visuals(player_ptr);
-
- /* Load the "pref" files */
load_all_pref_files(player_ptr);
-
- /* Give startup outfit (after loading pref files) */
if (new_game)
{
player_outfit(player_ptr);
}
- /* React to changes */
Term_xtra(TERM_XTRA_REACT, 0);
player_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
player_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT);
handle_stuff(player_ptr);
- /* Set or clear "rogue_like_commands" if requested */
if (arg_force_original) rogue_like_commands = FALSE;
if (arg_force_roguelike) rogue_like_commands = TRUE;
- /* Hack -- Enforce "delayed death" */
if (player_ptr->chp < 0) player_ptr->is_dead = TRUE;
if (player_ptr->prace == RACE_ANDROID) calc_android_exp(player_ptr);
(void)combine_and_reorder_home(STORE_HOME);
(void)combine_and_reorder_home(STORE_MUSEUM);
-
select_floor_music(player_ptr);
- /* Process */
while (TRUE)
{
- /* Process the level */
dungeon(player_ptr, load_game);
-
- /* Hack -- prevent "icky" message */
current_world_ptr->character_xtra = TRUE;
-
handle_stuff(player_ptr);
current_world_ptr->character_xtra = FALSE;
-
- /* Cancel the target */
target_who = 0;
-
health_track(player_ptr, 0);
-
forget_lite(floor_ptr);
forget_view(floor_ptr);
clear_mon_lite(floor_ptr);
-
- /* Handle "quit and save" */
if (!player_ptr->playing && !player_ptr->is_dead) break;
wipe_o_list(floor_ptr);
if (!player_ptr->is_dead) wipe_monsters_list(player_ptr);
-
msg_print(NULL);
-
load_game = FALSE;
-
- /* Accidental Death */
if (player_ptr->playing && player_ptr->is_dead)
{
if (floor_ptr->inside_arena)
player_ptr->chp_frac = 0;
player_ptr->exit_bldg = TRUE;
reset_tim_flags(player_ptr);
-
- /* Leave through the exit */
prepare_change_floor_mode(player_ptr, CFM_SAVE_FLOORS | CFM_RAND_CONNECT);
-
- /* prepare next floor */
leave_floor(player_ptr);
}
else
{
- /* Mega-Hack -- Allow player to cheat death */
if ((current_world_ptr->wizard || cheat_live) && !get_check(_("死にますか? ", "Die? ")))
{
cheat_death(player_ptr);
}
}
- /* Handle "death" */
if (player_ptr->is_dead) break;
- /* Make a new level */
change_floor(player_ptr);
}
- /* Close stuff */
close_game(player_ptr);
-
- /* Quit */
quit(NULL);
}
+
/*!
* @brief ゲームターンからの実時間換算を行うための補正をかける
* @param hoge ゲームターン
*/
void prevent_turn_overflow(player_type *player_ptr)
{
- int rollback_days, i, j;
- s32b rollback_turns;
-
if (current_world_ptr->game_turn < current_world_ptr->game_turn_limit) return;
- rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
- rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
+ int rollback_days = 1 + (current_world_ptr->game_turn - current_world_ptr->game_turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
+ s32b rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
else current_world_ptr->game_turn = 1;
if (player_ptr->feeling_turn > rollback_turns) player_ptr->feeling_turn -= rollback_turns;
else player_ptr->feeling_turn = 1;
- for (i = 1; i < max_towns; i++)
+ for (int i = 1; i < max_towns; i++)
{
- for (j = 0; j < MAX_STORES; j++)
+ for (int j = 0; j < MAX_STORES; j++)
{
- store_type *st_ptr = &town_info[i].store[j];
+ store_type *store_ptr = &town_info[i].store[j];
- if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
+ if (store_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
{
- st_ptr->last_visit -= rollback_turns;
- if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
+ store_ptr->last_visit -= rollback_turns;
+ if (store_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) store_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
}
- if (st_ptr->store_open)
+ if (store_ptr->store_open)
{
- st_ptr->store_open -= rollback_turns;
- if (st_ptr->store_open < 1) st_ptr->store_open = 1;
+ store_ptr->store_open -= rollback_turns;
+ if (store_ptr->store_open < 1) store_ptr->store_open = 1;
}
}
}
{
char buf[1024];
bool do_send = TRUE;
-
- /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
handle_stuff(player_ptr);
- /* Flush the messages */
msg_print(NULL);
-
- /* Flush the input */
flush();
-
- /* No suspending now */
signals_ignore_tstp();
-
- /* Hack -- Character is now "icky" */
current_world_ptr->character_icky = TRUE;
-
path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
-
- /* Grab permissions */
safe_setuid_grab();
-
- /* Open the high score file, for reading/writing */
highscore_fd = fd_open(buf, O_RDWR);
-
- /* Drop permissions */
safe_setuid_drop();
- /* Handle death */
if (player_ptr->is_dead)
{
- /* Handle retirement */
if (current_world_ptr->total_winner) kingly(player_ptr);
- /* Save memories */
if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
{
if (!save_player(player_ptr)) msg_print(_("セーブ失敗!", "death save failed!"));
}
else do_send = FALSE;
- /* You are dead */
print_tomb(player_ptr);
-
flush();
- /* Show more info */
- show_info(player_ptr);
+ show_info(player_ptr, handle_stuff, update_playtime, display_player, map_name);
Term_clear();
if (check_score(player_ptr))
{
- if ((!send_world_score(player_ptr, do_send)))
+ if ((!send_world_score(player_ptr, do_send, update_playtime, display_player, map_name)))
{
if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
(CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
display_scores_aux(0, 10, -1, NULL);
}
}
-
- /* Still alive */
else
{
- /* Save the game */
do_cmd_save_game(player_ptr, FALSE);
-
- /* Prompt for scores */
prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
-
- /* Predict score (or ESCAPE) */
if (inkey() != ESCAPE) predict_score(player_ptr);
}
-
- /* Shut the high score file */
(void)fd_close(highscore_fd);
-
- /* Forget the high score fd */
highscore_fd = -1;
-
- /* Kill all temporary files */
clear_saved_floor_files(player_ptr);
-
- /* Allow suspending now */
signals_handle_tstp();
}