#include "angband.h"
-#define TY_CURSE_CHANCE 100
+#define TY_CURSE_CHANCE 200
#define CHAINSWORD_NOISE 100
static bool load = TRUE;
if (broken_p(o_ptr)) return FEEL_BROKEN;
/* Artifacts -- except cursed/broken ones */
- if (artifact_p(o_ptr) || o_ptr->art_name) return FEEL_GOOD;
+ if (artifact_p(o_ptr) || o_ptr->art_name) return FEEL_UNCURSED;
/* Ego-Items -- except cursed/broken ones */
- if (ego_item_p(o_ptr)) return FEEL_GOOD;
+ if (ego_item_p(o_ptr)) return FEEL_UNCURSED;
/* Good armor bonus */
- if (o_ptr->to_a > 0) return FEEL_GOOD;
+ if (o_ptr->to_a > 0) return FEEL_UNCURSED;
/* Good weapon bonuses */
- if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_GOOD;
+ if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_UNCURSED;
/* No feeling */
return FEEL_NONE;
byte feel;
object_type *o_ptr = &inventory[slot];
char o_name[MAX_NLEN];
+ int idx;
/* We know about it already, do not tell us again */
if (o_ptr->ident & (IDENT_SENSE))return;
}
case FEEL_CURSED:
{
- feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
+ if (heavy)
+ feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
+ else
+ feel = FEEL_UNCURSED;
break;
}
case FEEL_AVERAGE:
}
case FEEL_GOOD:
{
- feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
+ if (heavy)
+ feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
+ else
+ feel = FEEL_CURSED;
break;
}
case FEEL_EXCELLENT:
describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]);
#else
msg_format("You feel the %s (%c) you are %s %s %s...",
- o_name, index_to_label(slot), describe_use(slot),
- ((o_ptr->number == 1) ? "is" : "are"),
+ o_name, index_to_label(slot), describe_use(slot),
+ ((o_ptr->number == 1) ? "is" : "are"),
game_inscriptions[feel]);
#endif
o_name, index_to_label(slot),game_inscriptions[feel]);
#else
msg_format("You feel the %s (%c) in your pack %s %s...",
- o_name, index_to_label(slot),
- ((o_ptr->number == 1) ? "is" : "are"),
+ o_name, index_to_label(slot),
+ ((o_ptr->number == 1) ? "is" : "are"),
game_inscriptions[feel]);
#endif
/* Set the "inscription" */
o_ptr->feeling = feel;
+ /* Auto-inscription/destroy */
+ idx = is_autopick(o_ptr);
+ auto_inscribe_item(slot, idx);
+ if (destroy_feeling)
+ auto_destroy_item(slot, idx);
+
/* Combine / Reorder the pack (later) */
p_ptr->notice |= (PN_COMBINE | PN_REORDER);
case TV_SOFT_ARMOR:
case TV_HARD_ARMOR:
case TV_DRAG_ARMOR:
+ case TV_CARD:
{
okay = TRUE;
break;
else if (dun_level == 100)
max_level = 100;
}
- else max_level = d_info[dungeon_type].maxdepth;
+ else
+ {
+ max_level = d_info[dungeon_type].maxdepth;
+ min_level = d_info[dungeon_type].mindepth;
+ }
/* Prompt */
#ifdef JP
/* Change level */
dun_level = command_arg;
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
+ leave_quest_check();
+
+ if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
+
+ p_ptr->inside_quest = 0;
+ p_ptr->leftbldg = FALSE;
+ energy_use = 0;
/* Leaving */
p_ptr->leaving = TRUE;
/* The light is getting dim */
else if (o_ptr->name2 == EGO_LITE_LONG)
{
- if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5)) && (turn % 40))
+ if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
+ && (turn % (TURNS_PER_TICK*2)))
{
if (disturb_minor) disturb(0, 0);
#ifdef JP
r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
if (record_rand_quest)
do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
+
+ /* Floor of random quest will be blocked */
+ prepare_change_floor_mode(CFM_NO_RETURN);
}
else if (record_fix_quest)
do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
char o_name[MAX_NLEN];
byte feel;
cptr q, s;
-
+ bool okay = FALSE;
+ int idx;
item_tester_no_ryoute = TRUE;
/* Get an item */
/* Window stuff */
p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+ /* Valid "tval" codes */
+ switch (o_ptr->tval)
+ {
+ case TV_SHOT:
+ case TV_ARROW:
+ case TV_BOLT:
+ case TV_BOW:
+ case TV_DIGGING:
+ case TV_HAFTED:
+ case TV_POLEARM:
+ case TV_SWORD:
+ case TV_BOOTS:
+ case TV_GLOVES:
+ case TV_HELM:
+ case TV_CROWN:
+ case TV_SHIELD:
+ case TV_CLOAK:
+ case TV_SOFT_ARMOR:
+ case TV_HARD_ARMOR:
+ case TV_DRAG_ARMOR:
+ case TV_CARD:
+ case TV_RING:
+ case TV_AMULET:
+ case TV_LITE:
+ case TV_FIGURINE:
+ okay = TRUE;
+ break;
+ }
+
+ /* Auto-inscription/destroy */
+ idx = is_autopick(o_ptr);
+ auto_inscribe_item(item, idx);
+ if (okay && destroy_feeling)
+ auto_destroy_item(item, idx);
+
/* Something happened */
return (TRUE);
}
static void gere_music(s32b music)
{
- switch(music)
- {
- case MUSIC_SLOW:
- slow_monsters();
- break;
- case MUSIC_STUN:
- stun_monsters(damroll(p_ptr->lev/10,2));
- break;
- case MUSIC_L_LIFE:
- hp_player(damroll(2,6));
- break;
- case MUSIC_FEAR:
- project_hack(GF_TURN_ALL, p_ptr->lev);
- break;
- case MUSIC_PSI:
- project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
- break;
- case MUSIC_ID:
- project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
- break;
- case MUSIC_CONF:
- confuse_monsters(p_ptr->lev * 2);
- break;
- case MUSIC_SOUND:
- project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
- break;
- case MUSIC_CHARM:
- charm_monsters(damroll(10 + p_ptr->lev/15,6));
- break;
- case MUSIC_WALL:
+ switch(music)
+ {
+ case MUSIC_SLOW:
+ slow_monsters();
+ break;
+ case MUSIC_STUN:
+ stun_monsters(damroll(p_ptr->lev/10,2));
+ break;
+ case MUSIC_L_LIFE:
+ hp_player(damroll(2,6));
+ break;
+ case MUSIC_FEAR:
+ project_hack(GF_TURN_ALL, p_ptr->lev);
+ break;
+ case MUSIC_PSI:
+ project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
+ break;
+ case MUSIC_ID:
+ project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
+ break;
+ case MUSIC_CONF:
+ confuse_monsters(p_ptr->lev * 2);
+ break;
+ case MUSIC_SOUND:
+ project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
+ break;
+ case MUSIC_CHARM:
+ charm_monsters(damroll(10 + p_ptr->lev/15,6));
+ break;
+ case MUSIC_WALL:
project(0, 0, py, px,
0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
- break;
- case MUSIC_DISPEL:
- dispel_monsters(randint1(p_ptr->lev * 3));
- dispel_evil(randint1(p_ptr->lev * 3));
- break;
- case MUSIC_SARUMAN:
- slow_monsters();
- sleep_monsters();
- break;
- case MUSIC_QUAKE:
- earthquake(py, px, 10);
- break;
- case MUSIC_STASIS:
- stasis_monsters(p_ptr->lev * 4);
- break;
- case MUSIC_SHERO:
- dispel_monsters(randint1(p_ptr->lev * 3));
- break;
- case MUSIC_H_LIFE:
- hp_player(damroll(15,10));
+ break;
+ case MUSIC_DISPEL:
+ dispel_monsters(randint1(p_ptr->lev * 3));
+ dispel_evil(randint1(p_ptr->lev * 3));
+ break;
+ case MUSIC_SARUMAN:
+ slow_monsters();
+ sleep_monsters();
+ break;
+ case MUSIC_QUAKE:
+ earthquake(py, px, 10);
+ break;
+ case MUSIC_STASIS:
+ stasis_monsters(p_ptr->lev * 4);
+ break;
+ case MUSIC_SHERO:
+ dispel_monsters(randint1(p_ptr->lev * 3));
+ break;
+ case MUSIC_H_LIFE:
+ hp_player(damroll(15,10));
set_stun(0);
set_cut(0);
- break;
- case MUSIC_DETECT+19:
+ break;
+ case MUSIC_DETECT+19:
wiz_lite(FALSE, FALSE);
- case MUSIC_DETECT+11:
- case MUSIC_DETECT+12:
- case MUSIC_DETECT+13:
- case MUSIC_DETECT+14:
- case MUSIC_DETECT+15:
- case MUSIC_DETECT+16:
- case MUSIC_DETECT+17:
- case MUSIC_DETECT+18:
+ case MUSIC_DETECT+11:
+ case MUSIC_DETECT+12:
+ case MUSIC_DETECT+13:
+ case MUSIC_DETECT+14:
+ case MUSIC_DETECT+15:
+ case MUSIC_DETECT+16:
+ case MUSIC_DETECT+17:
+ case MUSIC_DETECT+18:
map_area(DETECT_RAD_MAP);
if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
- case MUSIC_DETECT+6:
- case MUSIC_DETECT+7:
- case MUSIC_DETECT+8:
- case MUSIC_DETECT+9:
- case MUSIC_DETECT+10:
+ case MUSIC_DETECT+6:
+ case MUSIC_DETECT+7:
+ case MUSIC_DETECT+8:
+ case MUSIC_DETECT+9:
+ case MUSIC_DETECT+10:
detect_treasure(DETECT_RAD_DEFAULT);
detect_objects_gold(DETECT_RAD_DEFAULT);
detect_objects_normal(DETECT_RAD_DEFAULT);
if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
- case MUSIC_DETECT+3:
- case MUSIC_DETECT+4:
- case MUSIC_DETECT+5:
+ case MUSIC_DETECT+3:
+ case MUSIC_DETECT+4:
+ case MUSIC_DETECT+5:
detect_monsters_invis(DETECT_RAD_DEFAULT);
detect_monsters_normal(DETECT_RAD_DEFAULT);
if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
- case MUSIC_DETECT:
- case MUSIC_DETECT+1:
- case MUSIC_DETECT+2:
- detect_traps(DETECT_RAD_DEFAULT);
+ case MUSIC_DETECT:
+ case MUSIC_DETECT+1:
+ case MUSIC_DETECT+2:
+ detect_traps(DETECT_RAD_DEFAULT, TRUE);
detect_doors(DETECT_RAD_DEFAULT);
detect_stairs(DETECT_RAD_DEFAULT);
if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
break;
- }
+ }
}
/*
}
-static void check_music()
+static void check_music(void)
{
- magic_type *s_ptr;
+ magic_type *s_ptr;
u32b shouhimana;
- /* Music singed by player */
- if(p_ptr->pclass != CLASS_BARD) return;
- if(!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
+ /* Music singed by player */
+ if(p_ptr->pclass != CLASS_BARD) return;
+ if(!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
- s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC - 1][p_ptr->magic_num2[0]];
+ s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][p_ptr->magic_num2[0]];
- shouhimana = (s_ptr->smana*(3800-spell_exp[p_ptr->magic_num2[0]])+2399);
+ shouhimana = (s_ptr->smana*(3800-p_ptr->spell_exp[p_ptr->magic_num2[0]])+2399);
if(p_ptr->dec_mana)
shouhimana *= 3;
else shouhimana *= 4;
shouhimana /= 9600;
if(shouhimana < 1) shouhimana = 1;
- shouhimana *= 0x8000;
- if ((p_ptr->csp < shouhimana / 0x10000) || (p_ptr->anti_magic))
- {
- stop_singing();
+ shouhimana *= 0x8000;
+ if (((u16b)(p_ptr->csp) < (shouhimana / 0x10000)) || (p_ptr->anti_magic))
+ {
+ stop_singing();
return;
- }
- else
- {
- p_ptr->csp -= shouhimana / 0x10000;
- shouhimana = (shouhimana & 0xffff);
- if (p_ptr->csp_frac < shouhimana)
+ }
+ else
+ {
+ p_ptr->csp -= (u16b) (shouhimana / 0x10000);
+ shouhimana = (shouhimana & 0xffff);
+ if (p_ptr->csp_frac < shouhimana)
{
p_ptr->csp--;
p_ptr->csp_frac += (u16b)(0x10000L - shouhimana);
p_ptr->csp_frac -= (u16b)shouhimana;
}
- p_ptr->redraw |= PR_MANA;
+ p_ptr->redraw |= PR_MANA;
if (p_ptr->magic_num1[1])
{
p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
/* Redraw status bar */
p_ptr->redraw |= (PR_STATUS);
}
- }
- if (spell_exp[p_ptr->magic_num2[0]] < 900)
- spell_exp[p_ptr->magic_num2[0]]+=5;
- else if(spell_exp[p_ptr->magic_num2[0]] < 1200)
- {if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) spell_exp[p_ptr->magic_num2[0]]+=1;}
- else if(spell_exp[p_ptr->magic_num2[0]] < 1400)
- {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) spell_exp[p_ptr->magic_num2[0]]+=1;}
- else if(spell_exp[p_ptr->magic_num2[0]] < 1600)
- {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) spell_exp[p_ptr->magic_num2[0]]+=1;}
-
- gere_music(p_ptr->magic_num1[0]);
+ }
+ if (p_ptr->spell_exp[p_ptr->magic_num2[0]] < 900)
+ p_ptr->spell_exp[p_ptr->magic_num2[0]]+=5;
+ else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1200)
+ {if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;}
+ else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1400)
+ {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;}
+ else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1600)
+ {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;}
+
+ gere_music(p_ptr->magic_num1[0]);
}
/* Choose one of items that have cursed flag */
-object_type *choose_cursed_obj_name(u32b flag)
+static object_type *choose_cursed_obj_name(u32b flag)
{
int i;
int choices[INVEN_TOTAL-INVEN_RARM];
object_kind *k_ptr;
const int dec_count = (easy_band ? 2 : 1);
- int hour, min, prev_min;
- s32b len = 20L * TOWN_DAWN;
+ int day, hour, min, prev_min;
+
+ s32b len = TURNS_PER_TICK * TOWN_DAWN;
s32b tick = turn % len + len / 4;
- hour = (24 * tick / len) % 24;
- min = (1440 * tick / len) % 60;
- prev_min = (1440 * (tick - 20) / len) % 60;
+ extract_day_hour_min(&day, &hour, &min);
+ prev_min = (1440 * (tick - TURNS_PER_TICK) / len) % 60;
- if ((turn - old_turn == (3000 - dun_level*20)) && (dun_level) &&
+ if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
+ && (dun_level) &&
!(quest_number(dun_level) && ((quest_number(dun_level) < MIN_RANDOM_QUEST) && !(quest_number(dun_level) == QUEST_OBERON || quest_number(dun_level) == QUEST_SERPENT || !(quest[quest_number(dun_level)].flags & QUEST_FLAG_PRESET)))) &&
!(p_ptr->inside_battle))
do_cmd_feeling();
msg_print("They have kill each other at the same time.");
#endif
msg_print(NULL);
- p_ptr->energy = 100;
+ p_ptr->energy_need = 0;
battle_monsters();
}
else if ((number_mon-1) == 0)
#ifdef JP
msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
#else
- msg_format("You recieved %d gold.", battle_odds);
+ msg_format("You received %d gold.", battle_odds);
#endif
p_ptr->au += battle_odds;
}
#endif
}
msg_print(NULL);
- p_ptr->energy = 100;
+ p_ptr->energy_need = 0;
battle_monsters();
}
- else if(turn - old_turn == 3000L)
+ else if(turn - old_turn == 150*TURNS_PER_TICK)
{
#ifdef JP
msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
#endif
p_ptr->au += kakekin;
msg_print(NULL);
- p_ptr->energy = 100;
+ p_ptr->energy_need = 0;
battle_monsters();
}
}
/* Every 20 game turns */
- if (turn % 20) return;
+ if (turn % TURNS_PER_TICK) return;
/*** Check the Time and Load ***/
- if (!(turn % 1000))
+ if (!(turn % (50*TURNS_PER_TICK)))
{
/* Check time and load */
if ((0 != check_time()) || (0 != check_load()))
/* Stop playing */
- alive = FALSE;
+ p_ptr->playing = FALSE;
/* Leaving */
p_ptr->leaving = TRUE;
/*** Attempt timed autosave ***/
if (autosave_t && autosave_freq && !p_ptr->inside_battle)
{
- if (!(turn % ((s32b)autosave_freq * 20)))
+ if (!(turn % ((s32b)autosave_freq * TURNS_PER_TICK)))
do_cmd_save_game(TRUE);
}
- if (mon_fight)
- {
+ if (mon_fight)
+ {
#ifdef JP
- msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
+ msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
#else
- msg_print("You hear noise.");
+ msg_print("You hear noise.");
#endif
- }
+ }
/*** Handle the wilderness/town (sunshine) ***/
if (!dun_level && !p_ptr->inside_quest && !p_ptr->inside_battle && !p_ptr->inside_arena && !p_ptr->wild_mode)
{
/* Hack -- Daybreak/Nighfall in town */
- if (!(turn % ((20L * TOWN_DAWN) / 2)))
+ if (!(turn % ((TURNS_PER_TICK * TOWN_DAWN) / 2)))
{
bool dawn;
/* Check for dawn */
- dawn = (!(turn % (20L * TOWN_DAWN)));
+ dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN)));
/* Day breaks */
if (dawn)
/* Darken "boring" features */
if ((c_ptr->feat <= FEAT_INVIS) ||
((c_ptr->feat >= FEAT_DEEP_WATER) &&
- (c_ptr->feat <= FEAT_TREES) &&
- (c_ptr->feat != FEAT_MUSEUM)))
+ (c_ptr->feat <= FEAT_MOUNTAIN) &&
+ (c_ptr->feat != FEAT_MUSEUM)) ||
+ (x == 0) || (x == cur_wid-1) ||
+ (y == 0) || (y == cur_hgt-1))
{
/* Forget the grid */
- c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
+ if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
/* Hack -- Notice spot */
note_spot(y, x);
}
/* Set back the rewards once a day */
- if (!(turn % (200L * STORE_TURNS)))
+ if (!(turn % (TURNS_PER_TICK*10 * STORE_TURNS)))
{
int n;
!p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
{
/* Make a new monster */
- (void)alloc_monster(MAX_SIGHT + 5, FALSE);
+ (void)alloc_monster(MAX_SIGHT + 5, 0);
}
/* Hack -- Check for creature regeneration */
- if (!(turn % 200) && !p_ptr->inside_battle) regen_monsters();
- if (!(turn % 60)) regen_captured_monsters();
+ if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
+ if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
/*** Damage over Time ***/
/* (Vampires) Take damage from sunlight */
if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
{
- if (!dun_level && !p_ptr->resist_lite && !p_ptr->invuln &&
- (!((turn / ((20L * TOWN_DAWN) / 2)) % 2)))
+ if (!dun_level && !p_ptr->resist_lite && !p_ptr->invuln && is_daytime())
{
if (cave[py][px].info & CAVE_GLOW)
{
if (p_ptr->food < PY_FOOD_MAX)
{
/* Every 100 game turns */
- if (!(turn % 100))
+ if (!(turn % (TURNS_PER_TICK*5)))
{
/* Basic digestion rate based on speed */
i = /* extract_energy[p_ptr->pspeed] * 2;*/
- ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ?
- 1 : extract_energy[p_ptr->pspeed]));
+ ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ?
+ 1 : extract_energy[p_ptr->pspeed]));
/* Regeneration takes more food */
if (p_ptr->regenerate) i += 20;
regenmana(upkeep_regen/100);
#ifdef TRACK_FRIENDS
- if (wizard)
+ if (p_ptr->wizard)
{
#ifdef JP
msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
(void)set_tim_sh_fire(p_ptr->tim_sh_fire - 1, TRUE);
}
+ /* Timed sh_holy */
+ if (p_ptr->tim_sh_holy)
+ {
+ (void)set_tim_sh_holy(p_ptr->tim_sh_holy - 1, TRUE);
+ }
+
+ /* Timed eyeeye */
+ if (p_ptr->tim_eyeeye)
+ {
+ (void)set_tim_eyeeye(p_ptr->tim_eyeeye - 1, TRUE);
+ }
+
/* Timed resist-magic */
if (p_ptr->resist_magic)
{
/* Decrease life-span */
if (o_ptr->name2 == EGO_LITE_LONG)
{
- if (turn % 40) o_ptr->xtra4--;
+ if (turn % (TURNS_PER_TICK*2)) o_ptr->xtra4--;
}
else o_ptr->xtra4--;
!p_ptr->anti_magic && (randint1(6666) == 666))
{
bool pet = one_in_(6);
- bool not_pet = (bool)(!pet);
+ u32b mode = PM_ALLOW_GROUP;
+
+ if (pet) mode |= PM_FORCE_PET;
+ else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
if (summon_specific((pet ? -1 : 0), py, px,
- dun_level, SUMMON_DEMON, TRUE, FALSE, pet, not_pet, not_pet))
+ dun_level, SUMMON_DEMON, mode))
{
#ifdef JP
msg_print("¤¢¤Ê¤¿¤Ï¥Ç¡¼¥â¥ó¤ò°ú¤´ó¤»¤¿¡ª");
!p_ptr->anti_magic && one_in_(7000))
{
bool pet = one_in_(3);
- bool not_pet = (bool)(!pet);
+ u32b mode = PM_ALLOW_GROUP;
- if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL,
- TRUE, FALSE, pet, not_pet, not_pet))
+ if (pet) mode |= PM_FORCE_PET;
+ else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
+
+ if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL, mode))
{
#ifdef JP
msg_print("ưʪ¤ò°ú¤´ó¤»¤¿¡ª");
!p_ptr->anti_magic && one_in_(3000))
{
bool pet = one_in_(5);
- bool not_pet = (bool)(!pet);
+ u32b mode = PM_ALLOW_GROUP;
+
+ if (pet) mode |= PM_FORCE_PET;
+ else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
- if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON,
- TRUE, FALSE, pet, not_pet, not_pet))
+ if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON, mode))
{
#ifdef JP
msg_print("¥É¥é¥´¥ó¤ò°ú¤´ó¤»¤¿¡ª");
* Hack: Uncursed teleporting items (e.g. Trump Weapons)
* can actually be useful!
*/
- if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(100))
+ if ((p_ptr->cursed & TRC_TELEPORT_SELF) && one_in_(200))
{
#ifdef JP
if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
(void)activate_ty_curse(FALSE, &count);
}
/* Handle experience draining */
- if ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4))
+ if (p_ptr->prace != RACE_ANDROID &&
+ ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4)))
{
p_ptr->exp -= (p_ptr->lev+1)/2;
if (p_ptr->exp < 0) p_ptr->exp = 0;
check_experience();
}
/* Add light curse (Later) */
- if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(4000))
+ if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000))
{
u32b new_curse;
- bool changed = FALSE;
object_type *o_ptr;
- char o_name[MAX_NLEN];
o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE);
- object_desc(o_name, o_ptr, FALSE, 0);
new_curse = get_curse(0, o_ptr);
if (!(o_ptr->curse_flags & new_curse))
{
- changed = TRUE;
+ char o_name[MAX_NLEN];
+
+ object_desc(o_name, o_ptr, FALSE, 0);
+
o_ptr->curse_flags |= new_curse;
- }
- if (changed)
- {
#ifdef JP
msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
#else
#endif
o_ptr->feeling = FEEL_NONE;
+
+ p_ptr->update |= (PU_BONUS);
}
- p_ptr->update |= (PU_BONUS);
}
/* Add heavy curse (Later) */
- if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(4000))
+ if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000))
{
u32b new_curse;
- bool changed = FALSE;
object_type *o_ptr;
- char o_name[MAX_NLEN];
o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE);
- object_desc(o_name, o_ptr, FALSE, 0);
new_curse = get_curse(1, o_ptr);
if (!(o_ptr->curse_flags & new_curse))
{
- changed = TRUE;
+ char o_name[MAX_NLEN];
+
+ object_desc(o_name, o_ptr, FALSE, 0);
+
o_ptr->curse_flags |= new_curse;
- }
- if (changed)
- {
#ifdef JP
msg_format("°°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
#else
#endif
o_ptr->feeling = FEEL_NONE;
+
+ p_ptr->update |= (PU_BONUS);
}
- p_ptr->update |= (PU_BONUS);
}
/* Call animal */
- if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(1500))
+ if ((p_ptr->cursed & TRC_CALL_ANIMAL) && one_in_(2500))
{
if (summon_specific(0, py, px, dun_level, SUMMON_ANIMAL,
- TRUE, FALSE, FALSE, TRUE, TRUE))
+ (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
char o_name[MAX_NLEN];
}
}
/* Call demon */
- if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(666))
+ if ((p_ptr->cursed & TRC_CALL_DEMON) && one_in_(1111))
{
- if (summon_specific(0, py, px, dun_level, SUMMON_DEMON,
- TRUE, FALSE, FALSE, TRUE, TRUE))
+ if (summon_specific(0, py, px, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
char o_name[MAX_NLEN];
}
}
/* Call dragon */
- if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(400))
+ if ((p_ptr->cursed & TRC_CALL_DRAGON) && one_in_(800))
{
if (summon_specific(0, py, px, dun_level, SUMMON_DRAGON,
- TRUE, FALSE, FALSE, TRUE, TRUE))
+ (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET)))
{
char o_name[MAX_NLEN];
}
}
/* Teleport player */
- if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(100) && !p_ptr->anti_tele)
+ if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
{
disturb(0, 0);
if (!p_ptr->word_recall)
{
/* Disturbing! */
- disturb(0, 0);
+ disturb(0, 0);
/* Determine the level */
if (dun_level || p_ptr->inside_quest)
msg_print("You feel yourself yanked upwards!");
#endif
- p_ptr->recall_dungeon = dungeon_type;
+ p_ptr->recall_dungeon = dungeon_type;
if (record_stair)
do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
dun_level = 0;
dungeon_type = 0;
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
leave_quest_check();
msg_print("You feel yourself yanked downwards!");
#endif
- dungeon_type = p_ptr->recall_dungeon;
+ dungeon_type = p_ptr->recall_dungeon;
if (record_stair)
do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
}
p_ptr->wild_mode = FALSE;
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
/* Leaving */
p_ptr->leaving = TRUE;
sound(SOUND_TPLEVEL);
}
}
+
+
+ /* Delayed Alter reality */
+ if (p_ptr->alter_reality)
+ {
+ if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
+ do_cmd_save_game(TRUE);
+
+ /* Count down towards alter */
+ p_ptr->alter_reality--;
+
+ p_ptr->redraw |= (PR_STATUS);
+
+ /* Activate the alter reality */
+ if (!p_ptr->alter_reality)
+ {
+ /* Disturbing! */
+ disturb(0, 0);
+
+ /* Determine the level */
+ if (!quest_number(dun_level) && dun_level)
+ {
+#ifdef JP
+ msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
+#else
+ msg_print("The world changes!");
+#endif
+
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
+ /* Leaving */
+ p_ptr->leaving = TRUE;
+ }
+ else
+ {
+#ifdef JP
+ msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
+#else
+ msg_print("The world seems to change for a moment!");
+#endif
+ }
+
+ /* Sound */
+ sound(SOUND_TPLEVEL);
+ }
+ }
}
static bool enter_wizard_mode(void)
{
/* Ask first time */
- if (!noscore)
+ if (!p_ptr->noscore)
{
+ /* Wizard mode is not permitted */
+ if (!allow_debug_opts)
+ {
+#ifdef JP
+ msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
+#else
+ msg_print("Wizard mode is not permitted.");
+#endif
+ return FALSE;
+ }
+
/* Mention effects */
#ifdef JP
msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥â¡¼¥É¤Ç¤¹¡£ ");
}
/* Mark savefile */
- noscore |= 0x0002;
+ p_ptr->noscore |= 0x0002;
}
/* Success */
static bool enter_debug_mode(void)
{
/* Ask first time */
- if (!noscore)
+ if (!p_ptr->noscore)
{
+ /* Debug mode is not permitted */
+ if (!allow_debug_opts)
+ {
+#ifdef JP
+ msg_print("¥Ç¥Ð¥Ã¥°¥³¥Þ¥ó¥É¤Ïµö²Ä¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ");
+#else
+ msg_print("Use of debug command is not permitted.");
+#endif
+ return FALSE;
+ }
+
/* Mention effects */
#ifdef JP
msg_print("¥Ç¥Ð¥°¡¦¥³¥Þ¥ó¥É¤Ï¥Ç¥Ð¥°¤È¼Â¸³¤Î¤¿¤á¤Î¥³¥Þ¥ó¥É¤Ç¤¹¡£ ");
do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
#endif
/* Mark savefile */
- noscore |= 0x0008;
+ p_ptr->noscore |= 0x0008;
}
/* Success */
static bool enter_borg_mode(void)
{
/* Ask first time */
- if (!(noscore & 0x0010))
+ if (!(p_ptr->noscore & 0x0010))
{
/* Mention effects */
#ifdef JP
}
/* Mark savefile */
- noscore |= 0x0010;
+ p_ptr->noscore |= 0x0010;
}
/* Success */
/* Toggle Wizard Mode */
case KTRL('W'):
{
- if (wizard)
+ if (p_ptr->wizard)
{
- wizard = FALSE;
+ p_ptr->wizard = FALSE;
#ifdef JP
msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
#else
}
else if (enter_wizard_mode())
{
- wizard = TRUE;
+ p_ptr->wizard = TRUE;
#ifdef JP
msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
#else
/*** Stairs and Doors and Chests and Traps ***/
/* Enter store */
- case 253:
+ case SPECIAL_KEY_STORE:
{
if (!p_ptr->wild_mode) do_cmd_store();
break;
}
/* Enter building -KMW- */
- case 254:
+ case SPECIAL_KEY_BUILDING:
{
if (!p_ptr->wild_mode) do_cmd_bldg();
break;
}
/* Enter quest level -KMW- */
- case 255:
+ case SPECIAL_KEY_QUEST:
{
if (!p_ptr->wild_mode) do_cmd_quest();
break;
/* Go up staircase */
case '<':
{
- if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
- {
- if (!vanilla_town)
- {
- if(ambush_flag)
+ if(!p_ptr->wild_mode && !dun_level && !p_ptr->inside_arena && !p_ptr->inside_quest)
+ {
+ if (!vanilla_town)
+ {
+ if(ambush_flag)
{
#ifdef JP
- msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
+ msg_print("½±·â¤«¤éƨ¤²¤ë¤Ë¤Ï¥Þ¥Ã¥×¤Îü¤Þ¤Ç°ÜÆ°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£");
#else
- msg_print("To flee the ambush you have to reach the edge of the map.");
+ msg_print("To flee the ambush you have to reach the edge of the map.");
#endif
}
else if (p_ptr->food < PY_FOOD_WEAK)
{
#ifdef JP
- msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
+ msg_print("¤½¤ÎÁ°¤Ë¿©»ö¤ò¤È¤é¤Ê¤¤¤È¡£");
#else
- msg_print("You must eat something here.");
+ msg_print("You must eat something here.");
#endif
}
- else
- {
+ else
+ {
if (change_wild_mode())
{
p_ptr->oldpx = px;
p_ptr->oldpy = py;
}
- }
- }
- }
- else
+ }
+ }
+ }
+ else
do_cmd_go_up();
break;
}
/* Go down staircase */
case '>':
{
- if(!p_ptr->wild_mode) do_cmd_go_down();
- else
- {
+ if(!p_ptr->wild_mode) do_cmd_go_down();
+ else
+ {
p_ptr->wilderness_x = px;
p_ptr->wilderness_y = py;
change_wild_mode();
- }
- break;
+ }
+ break;
}
/* Open a door or chest */
) do_cmd_mind_browse();
else if (p_ptr->pclass == CLASS_SMITH)
do_cmd_kaji(TRUE);
+ else if (p_ptr->pclass == CLASS_MAGIC_EATER)
+ do_cmd_magic_eater(TRUE);
else do_cmd_browse();
break;
}
#ifdef JP
msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
#else
- msg_print("The arena absorbs all attempted magic!");
+ msg_print("The dungeon absorbs all attempted magic!");
#endif
msg_print(NULL);
}
else if (p_ptr->pclass == CLASS_IMITATOR)
do_cmd_mane(FALSE);
else if (p_ptr->pclass == CLASS_MAGIC_EATER)
- do_cmd_magic_eater();
+ do_cmd_magic_eater(FALSE);
else if (p_ptr->pclass == CLASS_SAMURAI)
do_cmd_hissatsu();
else if (p_ptr->pclass == CLASS_BLUE_MAGE)
{
if (!p_ptr->wild_mode)
{
- if (!p_ptr->inside_arena)
do_cmd_throw();
- else
- {
-#ifdef JP
-msg_print("¥¢¥ê¡¼¥Ê¤Ç¤Ï¥¢¥¤¥Æ¥à¤ò»È¤¨¤Ê¤¤¡ª");
-#else
- msg_print("You're in the arena now. This is hand-to-hand!");
-#endif
-
- msg_print(NULL);
- }
}
break;
}
break;
}
+ case '_':
+ {
+ do_cmd_edit_autopick();
+ break;
+ }
+
/* Interact with macros */
case '@':
{
/* Save and quit */
case KTRL('X'):
+ case SPECIAL_KEY_QUIT:
{
do_cmd_save_and_exit();
break;
char error_m[1024];
sound(SOUND_ILLEGAL);
#ifdef JP
- if (!get_rnd_line("error_j.txt", 0, error_m))
+ if (!get_rnd_line("error_j.txt", 0, error_m))
#else
if (!get_rnd_line("error.txt", 0, error_m))
#endif
-bool monster_tsuri(int r_idx)
+static bool monster_tsuri(int r_idx)
{
monster_race *r_ptr = &r_info[r_idx];
}
/* Give the player some energy */
- else if((randint0(60) < ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ? 1 : extract_energy[p_ptr->pspeed]))) && !(load && p_ptr->energy >= 100))
- p_ptr->energy += gain_energy();
+ else if (!(load && p_ptr->energy_need <= 0))
+ {
+ p_ptr->energy_need -= (p_ptr->pspeed > 199 ? 49 : (p_ptr->pspeed < 0 ? 1 : extract_energy[p_ptr->pspeed]));
+ }
/* No turn yet */
- if (p_ptr->energy < 100) return;
+ if (p_ptr->energy_need > 0) return;
if (!command_rep) prt_time();
/*** Check for interupts ***/
!p_ptr->poisoned && !p_ptr->afraid &&
!p_ptr->stun && !p_ptr->cut &&
!p_ptr->slow && !p_ptr->paralyzed &&
- !p_ptr->image && !p_ptr->word_recall)
+ !p_ptr->image && !p_ptr->word_recall &&
+ !p_ptr->alter_reality)
{
set_action(ACTION_NONE);
}
int y, x;
y = py+ddy[tsuri_dir];
x = px+ddx[tsuri_dir];
- if (place_monster_aux(y, x, r_idx, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE))
+ if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE))
{
char m_name[80];
monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
#ifdef JP
msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
#else
- msg_print("Damn! The fish took a bait away!");
+ msg_print("Damn! The fish stole your bait!");
#endif
}
disturb(0, 0);
}
/* Handle "abort" */
- if (avoid_abort)
+ if (check_abort)
{
/* Check for "player abort" (semi-efficiently for resting) */
if (running || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
int d = 1;
/* Make a "saving throw" against stun */
- if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+ if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
{
/* Recover fully */
d = m_ptr->stunned;
int d = 1;
/* Make a "saving throw" against stun */
- if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+ if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
{
/* Recover fully */
d = m_ptr->confused;
int d = 1;
/* Make a "saving throw" against stun */
- if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+ if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
{
/* Recover fully */
d = m_ptr->monfear;
/*** Handle actual user input ***/
/* Repeat until out of energy */
- while (p_ptr->energy >= 100)
+ while (p_ptr->energy_need <= 0)
{
p_ptr->window |= PW_PLAYER;
p_ptr->sutemi = FALSE;
/* Place the cursor on the player */
move_cursor_relative(py, px);
- command_cmd = 254;
+ command_cmd = SPECIAL_KEY_BUILDING;
/* Process the command */
process_command();
if (energy_use)
{
/* Use some energy */
- p_ptr->energy -= energy_use;
-
+ if (!world_player)
+ p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L);
+ else
+ p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10;
/* Hack -- constant hallucination */
if (p_ptr->image) p_ptr->redraw |= (PR_MAP);
}
if (p_ptr->pclass == CLASS_IMITATOR)
{
- if (mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
+ if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
{
- mane_num--;
- for (i = 0; i < mane_num; i++)
+ p_ptr->mane_num--;
+ for (i = 0; i < p_ptr->mane_num; i++)
{
- mane_spell[i] = mane_spell[i+1];
- mane_dam[i] = mane_dam[i+1];
+ p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
+ p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
}
}
new_mane = FALSE;
p_ptr->redraw |= (PR_STATE);
}
- if (world_player && (p_ptr->energy < 1000))
+ if (world_player && (p_ptr->energy_need > - 1000))
{
/* Redraw map */
p_ptr->redraw |= (PR_MAP);
#endif
msg_print(NULL);
world_player = FALSE;
- p_ptr->energy = 0;
+ p_ptr->energy_need = ENERGY_NEED();
handle_stuff();
}
}
/* Hack -- notice death */
- if (!alive || death)
+ if (!p_ptr->playing || p_ptr->is_dead)
{
world_player = FALSE;
break;
*/
static void dungeon(bool load_game)
{
- int quest_num = 0, i, num;
+ int quest_num = 0, i;
/* Set the base level */
base_level = dun_level;
if (record_maxdeapth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
}
- /* No stairs down from Quest */
- if (quest_number(dun_level))
- {
- create_down_stair = 0;
- }
-
- /* Paranoia -- no stairs from town or wilderness */
- if (!dun_level) create_down_stair = create_up_stair = 0;
-
- /* Option -- no connected stairs */
- if (!dungeon_stair) create_down_stair = create_up_stair = 0;
-
- /* Option -- no up stairs */
- if (ironman_downward) create_down_stair = create_up_stair = 0;
-
- /* Make a stairway. */
- if (create_up_stair || create_down_stair)
- {
- /* Place a stairway */
- if (cave_valid_bold(py, px))
- {
- /* XXX XXX XXX */
- delete_object(py, px);
-
- /* Make stairs */
- if (create_down_stair)
- {
- if (create_down_stair == 2) cave_set_feat(py, px, FEAT_MORE_MORE);
- else cave_set_feat(py, px, FEAT_MORE);
- }
- else
- {
- if (create_up_stair == 2) cave_set_feat(py, px, FEAT_LESS_LESS);
- else cave_set_feat(py, px, FEAT_LESS);
- }
- }
-
- /* Cancel the stair request */
- create_down_stair = create_up_stair = 0;
- }
-
/* Validate the panel */
panel_bounds_center();
character_xtra = TRUE;
/* Window stuff */
- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
-
- /* Window stuff */
- p_ptr->window |= (PW_MONSTER);
+ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
/* Redraw dungeon */
p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
/* Redraw map */
p_ptr->redraw |= (PR_MAP);
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
/* Update stuff */
p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
- /* Calculate torch radius */
- p_ptr->update |= (PU_TORCH);
+ /* Update lite/view */
+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
+
+ /* Update monsters */
+ p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
/* Update stuff */
update_stuff();
/* Redraw stuff */
window_stuff();
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_DISTANCE | PU_MON_LITE);
- p_ptr->update |= (PU_MONSTERS);/*¼«Ê¬¤Ç¸÷¤Ã¤Æ¤¤¤ë¥â¥ó¥¹¥¿¡¼¤Î°Ù */
-
- /* Update stuff */
- update_stuff();
-
- /* Redraw stuff */
- redraw_stuff();
-
/* Leave "xtra" mode */
character_xtra = FALSE;
{
if (load_game)
{
- p_ptr->energy = 100;
+ p_ptr->energy_need = 0;
battle_monsters();
}
else
p_ptr->magic_num1[0] = MUSIC_DETECT;
/* Hack -- notice death or departure */
- if (!alive || death) return;
+ if (!p_ptr->playing || p_ptr->is_dead) return;
/* Print quest message if appropriate */
if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
hack_mind = TRUE;
- if (p_ptr->energy < 100 && !p_ptr->inside_battle && (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena)) p_ptr->energy = 100;
+ if (p_ptr->energy_need > 0 && !p_ptr->inside_battle &&
+ (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena))
+ p_ptr->energy_need = 0;
+
/* Not leaving dungeon */
p_ptr->leaving_dungeon = FALSE;
/* Main loop */
while (TRUE)
{
- int i, correct_inven_cnt = 0;
+ int i;
/* Hack -- Compact the monster list occasionally */
if ((m_cnt + 32 > max_m_idx) && !p_ptr->inside_battle) compact_monsters(64);
/* Notice stuff */
if (p_ptr->notice) notice_stuff();
- /* Similar slot? */
- for (i = 0; i < INVEN_PACK; i++)
- {
- object_type *j_ptr = &inventory[i];
-
- /* Skip non-objects */
- if (!j_ptr->k_idx) continue;
-
- correct_inven_cnt++;
- }
-
/* Update stuff */
if (p_ptr->update) update_stuff();
if (fresh_after) Term_fresh();
/* Hack -- Notice death or departure */
- if (!alive || death) break;
+ if (!p_ptr->playing || p_ptr->is_dead) break;
/* Process all of the monsters */
process_monsters();
if (fresh_after) Term_fresh();
/* Hack -- Notice death or departure */
- if (!alive || death) break;
+ if (!p_ptr->playing || p_ptr->is_dead) break;
/* Process the world */
if (fresh_after) Term_fresh();
/* Hack -- Notice death or departure */
- if (!alive || death) break;
+ if (!p_ptr->playing || p_ptr->is_dead) break;
/* Handle "leaving" */
if (p_ptr->leaving) break;
}
/* Not save-and-quit and not dead? */
- if (alive && !death)
+ if (p_ptr->playing && !p_ptr->is_dead)
{
- for(num = 0; num < 21; num++)
- {
- party_mon[num].r_idx = 0;
- }
-
- if (p_ptr->riding)
- {
- COPY(&party_mon[0], &m_list[p_ptr->riding], monster_type);
- }
-
- for(i = m_max - 1, num = 1; (i >= 1 && num < 21); i--)
- {
- monster_type *m_ptr = &m_list[i];
-
- if (!m_ptr->r_idx) continue;
- if (!is_pet(m_ptr)) continue;
- if (i == p_ptr->riding) continue;
-
- if (m_ptr->nickname && (player_has_los_bold(m_ptr->fy, m_ptr->fx) || los(m_ptr->fy, m_ptr->fx, py, px)))
- {
- if (distance(py, px, m_ptr->fy, m_ptr->fx) > 3) continue;
- }
- else
- {
- if (distance(py, px, m_ptr->fy, m_ptr->fx) > 1) continue;
- }
- if (m_ptr->confused || m_ptr->stunned || m_ptr->csleep) continue;
+ /*
+ * Maintain Unique monsters and artifact, save current
+ * floor, then prepare next floor
+ */
+ leave_floor();
- COPY(&party_mon[num], &m_list[i], monster_type);
- delete_monster_idx(i);
- num++;
- }
- if (record_named_pet)
- {
- for (i = m_max - 1; i >=1; i--)
- {
- monster_type *m_ptr = &m_list[i];
- char m_name[80];
-
- if (!m_ptr->r_idx) continue;
- if (!is_pet(m_ptr)) continue;
- if (!m_ptr->nickname) continue;
- if (p_ptr->riding == i) continue;
-
- monster_desc(m_name, m_ptr, 0x88);
- do_cmd_write_nikki(NIKKI_NAMED_PET, 4, m_name);
- }
- }
+ /* 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(void)
{
char buf[1024];
+ errr err;
+
+ /* Access the "user" pref file */
+ sprintf(buf, "user.prf");
+
+ /* Process that file */
+ process_pref_file(buf);
+
+ /* Access the "user" system pref file */
+ sprintf(buf, "user-%s.prf", ANGBAND_SYS);
+
+ /* Process that file */
+ process_pref_file(buf);
/* Access the "race" pref file */
sprintf(buf, "%s.prf", rp_ptr->title);
/* Process that file */
process_pref_file(buf);
+ /* Free old entries */
+ init_autopicker();
+
#ifdef JP
- sprintf(buf, "picktype-%s.prf", player_base);
+ sprintf(buf, "picktype-%s.prf", player_base);
#else
- sprintf(buf, "pickpref-%s.prf", player_base);
+ sprintf(buf, "pickpref-%s.prf", player_base);
#endif
- process_pickpref_file(buf);
+
+ err = process_pickpref_file(buf);
+
+ /* Process 'pick????.prf' if 'pick????-<name>.prf' doesn't exist */
+ if (0 > err)
+ {
#ifdef JP
- process_pickpref_file("picktype.prf");
+ process_pickpref_file("picktype.prf");
#else
- process_pickpref_file("pickpref.prf");
+ process_pickpref_file("pickpref.prf");
#endif
+ }
/* Access the "realm 1" pref file */
if (p_ptr->realm1 != REALM_NONE)
}
/* Report waited score */
- if (wait_report_score)
+ if (p_ptr->wait_report_score)
{
char buf[1024];
bool success;
#ifdef JP
- if (!get_check("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©"))
+ if (!get_check_strict("ÂÔµ¡¤·¤Æ¤¤¤¿¥¹¥³¥¢ÅÐÏ¿¤òº£¹Ô¤Ê¤¤¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
#else
- if (!get_check("Do you register score now? "))
+ if (!get_check_strict("Do you register score now? ", CHECK_NO_HISTORY))
#endif
quit(0);
/* Update stuff */
update_stuff();
- death = TRUE;
+ p_ptr->is_dead = TRUE;
start_time = time(NULL);
character_icky = TRUE;
/* Build the filename */
- path_build(buf, 1024, ANGBAND_DIR_APEX, "scores.raw");
+ 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);
success = send_world_score(TRUE);
#ifdef JP
- if (!success && !get_check("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©"))
+ if (!success && !get_check_strict("¥¹¥³¥¢ÅÐÏ¿¤òÄü¤á¤Þ¤¹¤«¡©", CHECK_NO_HISTORY))
#else
- if (!success && !get_check("Do you give up score registration? "))
+ if (!success && !get_check_strict("Do you give up score registration? ", CHECK_NO_HISTORY))
#endif
{
#ifdef JP
}
else
{
- wait_report_score = FALSE;
+ p_ptr->wait_report_score = FALSE;
top_twenty();
#ifdef JP
if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
/* Prepare to init the RNG */
Rand_quick = TRUE;
+
+ /* Initialize the saved floors data */
+ init_saved_floors();
+ }
+
+ /* Old game is loaded. But new game is requested. */
+ else if (new_game)
+ {
+ /* Delete expanded temporal files */
+ clear_saved_floor_files();
}
/* Process old character */
if(p_ptr->pseikaku == SEIKAKU_SEXY)
s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = 8000;
- /* Fill the arrays of floors and walls in the good proportions */
- for (i = 0; i < 100; i++)
- {
- int lim1, lim2, lim3;
+ /* Fill the arrays of floors and walls in the good proportions */
+ for (i = 0; i < 100; i++)
+ {
+ int lim1, lim2, lim3;
- lim1 = d_info[dungeon_type].floor_percent1;
- lim2 = lim1 + d_info[dungeon_type].floor_percent2;
- lim3 = lim2 + d_info[dungeon_type].floor_percent3;
+ lim1 = d_info[dungeon_type].floor_percent1;
+ lim2 = lim1 + d_info[dungeon_type].floor_percent2;
+ lim3 = lim2 + d_info[dungeon_type].floor_percent3;
if (i < lim1)
floor_type[i] = d_info[dungeon_type].floor1;
fill_type[i] = d_info[dungeon_type].fill_type2;
else if (i < lim3)
fill_type[i] = d_info[dungeon_type].fill_type3;
- }
+ }
/* Flavor the objects */
flavor_init();
/* Hack -- Enter wizard mode */
- if (arg_wizard && enter_wizard_mode()) wizard = TRUE;
+ if (arg_wizard)
+ {
+ if (enter_wizard_mode()) p_ptr->wizard = TRUE;
+ else if (p_ptr->is_dead) quit("Already dead.");
+ }
/* Initialize the town-buildings if necessary */
if (!dun_level && !p_ptr->inside_quest)
{
/* Init the wilderness */
-process_dungeon_file("w_info_j.txt", 0, 0, max_wild_y, max_wild_x);
+ process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x);
/* Init the town */
init_flags = INIT_ONLY_BUILDINGS;
-process_dungeon_file("t_info_j.txt", 0, 0, MAX_HGT, MAX_WID);
+ process_dungeon_file("t_info.txt", 0, 0, MAX_HGT, MAX_WID);
}
#endif
/* Generate a dungeon level if needed */
- if (!character_dungeon) generate_cave();
+ if (!character_dungeon) change_floor();
/* Character is now "complete" */
/* Start game */
- alive = TRUE;
+ p_ptr->playing = TRUE;
/* Reset the visual mappings */
reset_visuals();
if (arg_force_roguelike) rogue_like_commands = TRUE;
/* Hack -- Enforce "delayed death" */
- if (p_ptr->chp < 0) death = TRUE;
+ if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
monster_type *m_ptr;
int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE);
monster_race *r_ptr = &r_info[pet_r_idx];
- place_monster_aux(py, px - 1, pet_r_idx,
- FALSE, FALSE, TRUE, TRUE, TRUE, FALSE);
+ place_monster_aux(0, py, px - 1, pet_r_idx,
+ (PM_FORCE_PET | PM_NO_KAGE));
m_ptr = &m_list[hack_m_idx_ii];
m_ptr->mspeed = r_ptr->speed;
m_ptr->maxhp = r_ptr->hdice*(r_ptr->hside+1)/2;
m_ptr->max_maxhp = m_ptr->maxhp;
m_ptr->hp = r_ptr->hdice*(r_ptr->hside+1)/2;
- m_ptr->energy = -100;
+ m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
}
/* Process */
clear_mon_lite();
/* Handle "quit and save" */
- if (!alive && !death) break;
+ if (!p_ptr->playing && !p_ptr->is_dead) break;
/* Erase the old cave */
wipe_o_list();
- if (!death) wipe_m_list();
+ if (!p_ptr->is_dead) wipe_m_list();
/* XXX XXX XXX */
load_game = FALSE;
/* Accidental Death */
- if (alive && death)
+ if (p_ptr->playing && p_ptr->is_dead)
{
if (p_ptr->inside_arena)
{
p_ptr->arena_number++;
else
p_ptr->arena_number = 99;
- death = FALSE;
+ p_ptr->is_dead = FALSE;
p_ptr->chp = 0;
p_ptr->chp_frac = 0;
p_ptr->exit_bldg = TRUE;
{
/* Mega-Hack -- Allow player to cheat death */
#ifdef JP
-if ((wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
+if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
#else
- if ((wizard || cheat_live) && !get_check("Die? "))
+ if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
#endif
{
p_ptr->age++;
/* Mark savefile */
- noscore |= 0x0001;
+ p_ptr->noscore |= 0x0001;
/* Message */
#ifdef JP
p_ptr->redraw |= (PR_STATUS);
}
+ /* Hack -- cancel alter */
+ if (p_ptr->alter_reality)
+ {
+ /* Hack -- Prevent alter */
+ p_ptr->alter_reality = 0;
+ p_ptr->redraw |= (PR_STATUS);
+ }
+
/* Note cause of death XXX XXX XXX */
#ifdef JP
-(void)strcpy(died_from, "»à¤Îµ½¤");
+(void)strcpy(p_ptr->died_from, "»à¤Îµ½¤");
#else
- (void)strcpy(died_from, "Cheating death");
+ (void)strcpy(p_ptr->died_from, "Cheating death");
#endif
/* Do not die */
- death = FALSE;
+ p_ptr->is_dead = FALSE;
dun_level = 0;
p_ptr->inside_arena = FALSE;
}
/* Handle "death" */
- if (death) break;
+ if (p_ptr->is_dead) break;
/* Make a new level */
- generate_cave();
+ change_floor();
}
/* Close stuff */
(p_ptr->prace == RACE_SKELETON) ||
(p_ptr->prace == RACE_ZOMBIE) ||
(p_ptr->prace == RACE_SPECTRE))
- return hoge-(60L * TOWN_DAWN) / 4;
+ return hoge-(TURNS_PER_TICK * TOWN_DAWN *3/ 4);
else
return hoge;
}