}
case CLASS_PALADIN:
+ case CLASS_SNIPER:
{
/* Bad sensing */
if (0 != randint0(77777L / (plev * plev + 40))) return;
case CLASS_SAMURAI:
case CLASS_CAVALRY:
case CLASS_BERSERKER:
+ case CLASS_SNIPER:
{
return;
}
/*
* Regenerate mana points
*/
-static void regenmana(int percent)
+static void regenmana(int upkeep_factor, int regen_amount)
{
s32b old_csp = p_ptr->csp;
+ s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL;
/*
* Excess mana will decay 32 times faster than normal
}
/* Regenerating mana (unless the player has excess mana) */
- else if (percent > 0)
+ else if (regen_rate > 0)
{
/* (percent/100) is the Regen factor in unit (1/2^16) */
s32b new_mana = 0;
- u32b new_mana_frac = (p_ptr->msp * percent / 100 + PY_REGEN_MNBASE);
+ u32b new_mana_frac = (p_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);
/* Reduce mana (even when the player has excess mana) */
- if (percent < 0)
+ if (regen_rate < 0)
{
/* PY_REGEN_NORMAL is the Regen factor in unit (1/2^16) */
s32b reduce_mana = 0;
- u32b reduce_mana_frac = (p_ptr->msp * PY_REGEN_NORMAL + PY_REGEN_MNBASE);
+ u32b reduce_mana_frac = (p_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);
/*
* Regenerate magic
+ * regen_amount: PY_REGEN_NORMAL * 2 (if resting) * 2 (if having regenarate)
*/
-static void regenmagic(int percent)
+static void regenmagic(int regen_amount)
{
- s32b new_mana;
+ s32b new_mana;
int i;
+ int dev = 30;
+ int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */
for (i = 0; i < EATER_EXT*2; i++)
{
if (!p_ptr->magic_num2[i]) continue;
if (p_ptr->magic_num1[i] == ((long)p_ptr->magic_num2[i] << 16)) continue;
- new_mana = ((long)p_ptr->magic_num2[i]+adj_mag_mana[A_INT]+13) * percent / 8;
+
+ /* Increase remaining charge number like float value */
+ new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 13)) / (dev * 8);
p_ptr->magic_num1[i] += new_mana;
/* Check maximum charge */
{
if (!p_ptr->magic_num1[i]) continue;
if (!p_ptr->magic_num2[i]) continue;
- p_ptr->magic_num1[i] -= (long)(p_ptr->magic_num2[i] * (adj_mag_mana[A_INT] + 10)) * EATER_ROD_CHARGE/16;
+
+ /* Decrease remaining period for charging */
+ new_mana = (regen_amount * mult * ((long)p_ptr->magic_num2[i] + 10) * EATER_ROD_CHARGE)
+ / (dev * 16 * PY_REGEN_NORMAL);
+ p_ptr->magic_num1[i] -= new_mana;
+
+ /* Check minimum remaining period for charging */
if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
wild_regen = 20;
}
{
quest[leaving_quest].status = QUEST_STATUS_FAILED;
quest[leaving_quest].complev = (byte)p_ptr->lev;
- if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
+
+ /* Additional settings */
+ switch (quest[leaving_quest].type)
{
+ case QUEST_TYPE_TOWER:
+ quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
+ quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
+ break;
+ case QUEST_TYPE_FIND_ARTIFACT:
+ a_info[quest[leaving_quest].k_idx].gen_flags &= ~(TRG_QUESTITEM);
+ break;
+ case QUEST_TYPE_RANDOM:
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);
+ break;
+ }
+
+ /* Record finishing a quest */
+ if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
+ {
+ if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
+ }
+ else
+ {
+ if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
+ }
+ }
+}
+
+void leave_tower_check(void)
+{
+ leaving_quest = p_ptr->inside_quest;
+ /* Check for Tower Quest */
+ if (leaving_quest &&
+ (quest[leaving_quest].type == QUEST_TYPE_TOWER) &&
+ (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))
+ {
+ if(quest[leaving_quest].type == QUEST_TYPE_TOWER)
+ {
+ quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
+ quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
}
- else if (record_fix_quest)
- do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
}
}
/* "Inscribe" it */
o_ptr->feeling = feel;
+ /* Player touches it */
+ o_ptr->marked |= OM_TOUCHED;
+
/* Combine / Reorder the pack (later) */
p_ptr->notice |= (PN_COMBINE | PN_REORDER);
static void check_music(void)
{
- magic_type *s_ptr;
+ const magic_type *s_ptr;
int spell;
s32b need_mana;
u32b need_mana_frac;
choices[number] = i;
number++;
}
+ else if ((flag == TRC_ADD_L_CURSE) || (flag == TRC_ADD_H_CURSE))
+ {
+ u32b cf = (flag == TRC_ADD_L_CURSE) ? TR_ADD_L_CURSE : TR_ADD_H_CURSE;
+ u32b flgs[4];
+ object_flags(o_ptr, flgs);
+ if (have_flag(flgs, cf))
+ {
+ choices[number] = i;
+ number++;
+ }
+ }
}
/* Choice one of them */
feature_type *f_ptr = &f_info[cave[py][px].feat];
bool cave_no_regen = FALSE;
int upkeep_factor = 0;
- int upkeep_regen;
/* Default regeneration */
int regen_amount = PY_REGEN_NORMAL;
}
/* Regenerate the mana */
- upkeep_regen = (100 - upkeep_factor) * regen_amount;
- regenmana(upkeep_regen);
+ regenmana(upkeep_factor, regen_amount);
/* Recharge magic eater's power */
#endif
(void)set_shero(10 + randint1(p_ptr->lev), FALSE);
+ (void)set_afraid(0);
}
if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
msg_print(NULL);
set_food(PY_FOOD_WEAK);
if (music_singing_any()) stop_singing();
+ if (hex_spelling_any()) stop_hex_spell_all();
}
if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
}
}
-
/*
* Handle curse effects once every 10 game turns
*/
{
char o_name[MAX_NLEN];
object_type *o_ptr;
- int i;
+ int i, i_keep = 0, count = 0;
/* Scan the equipment with random teleport ability */
for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
u32b flgs[TR_FLAG_SIZE];
o_ptr = &inventory[i];
-
+
/* Skip non-objects */
if (!o_ptr->k_idx) continue;
-
+
/* Extract the item flags */
object_flags(o_ptr, flgs);
-
- if (have_flag(flgs, TR_TELEPORT)) break;
+
+ if (have_flag(flgs, TR_TELEPORT))
+ {
+ /* {.} will stop random teleportation. */
+ if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
+ {
+ count++;
+ if (one_in_(count)) i_keep = i;
+ }
+ }
}
+ o_ptr = &inventory[i_keep];
object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
#ifdef JP
take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
}
/* Handle mana draining */
- if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
+ if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
{
char o_name[MAX_NLEN];
disturb(0, 0);
/* Determine the level */
- if (dun_level || p_ptr->inside_quest)
+ if (dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon)
{
-#ifdef JP
-msg_print("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
-#else
- msg_print("You feel yourself yanked upwards!");
-#endif
+ msg_print(_("¾å¤Ë°ú¤ÃÄ¥¤ê¤¢¤²¤é¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª",
+ "You feel yourself yanked upwards!"));
- p_ptr->recall_dungeon = dungeon_type;
+ if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
if (record_stair)
do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
dungeon_type = 0;
leave_quest_check();
+ leave_tower_check();
p_ptr->inside_quest = 0;
}
else
{
-#ifdef JP
-msg_print("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª");
-#else
- msg_print("You feel yourself yanked downwards!");
-#endif
+ msg_print(_("²¼¤Ë°ú¤¤º¤ê¹ß¤í¤µ¤ì¤ë´¶¤¸¤¬¤¹¤ë¡ª",
+ "You feel yourself yanked downwards!"));
dungeon_type = p_ptr->recall_dungeon;
if (!o_ptr->k_idx) continue;
/* Skip known objects */
- if (object_is_known(o_ptr)) continue;
+ if (object_is_known(o_ptr))
+ {
+ /* Touched? */
+ if (o_ptr->marked & OM_TOUCHED) continue;
+ }
/* Skip pseudo-known objects */
if (o_ptr->ident & IDENT_SENSE) continue;
now_message = 0;
+ /* Sniper */
+ if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
+ reset_concent = TRUE;
+
/* Parse the command */
switch (command_cmd)
{
else if (p_ptr->pclass == CLASS_SMITH)
do_cmd_kaji(TRUE);
else if (p_ptr->pclass == CLASS_MAGIC_EATER)
- do_cmd_magic_eater(TRUE);
+ do_cmd_magic_eater(TRUE, FALSE);
+ else if (p_ptr->pclass == CLASS_SNIPER)
+ do_cmd_snipe_browse();
else do_cmd_browse();
break;
}
else if (p_ptr->pclass == CLASS_IMITATOR)
do_cmd_mane(FALSE);
else if (p_ptr->pclass == CLASS_MAGIC_EATER)
- do_cmd_magic_eater(FALSE);
+ do_cmd_magic_eater(FALSE, FALSE);
else if (p_ptr->pclass == CLASS_SAMURAI)
do_cmd_hissatsu();
else if (p_ptr->pclass == CLASS_BLUE_MAGE)
do_cmd_cast_learned();
else if (p_ptr->pclass == CLASS_SMITH)
do_cmd_kaji(FALSE);
+ else if (p_ptr->pclass == CLASS_SNIPER)
+ do_cmd_snipe();
else
do_cmd_cast();
}
case '=':
{
do_cmd_options();
+ (void)combine_and_reorder_home(STORE_HOME);
do_cmd_redraw();
break;
}
break;
}
+ /* Record/stop "Movie" */
+ case ']':
+ {
+ prepare_movie_hooks();
+ break;
+ }
+
/* Make random artifact list */
case KTRL('V'):
{
break;
}
+#ifdef TRAVEL
+ case '`':
+ {
+ if (!p_ptr->wild_mode) do_cmd_travel();
+ if (p_ptr->special_defense & KATA_MUSOU)
+ {
+ set_action(ACTION_NONE);
+ }
+ break;
+ }
+#endif
+
/* Hack -- Unknown command */
default:
{
}
+/* Hack -- Pack Overflow */
+static void pack_overflow(void)
+{
+ if (inventory[INVEN_PACK].k_idx)
+ {
+ char o_name[MAX_NLEN];
+ object_type *o_ptr;
+
+ /* Is auto-destroy done? */
+ notice_stuff();
+ if (!inventory[INVEN_PACK].k_idx) return;
+
+ /* Access the slot to be dropped */
+ o_ptr = &inventory[INVEN_PACK];
+
+ /* Disturbing */
+ disturb(0, 0);
+
+ /* Warning */
+#ifdef JP
+ msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
+#else
+ msg_print("Your pack overflows!");
+#endif
+
+ /* Describe */
+ object_desc(o_name, o_ptr, 0);
+
+ /* Message */
+#ifdef JP
+ msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(INVEN_PACK));
+#else
+ msg_format("You drop %s (%c).", o_name, index_to_label(INVEN_PACK));
+#endif
+
+ /* Drop it (carefully) near the player */
+ (void)drop_near(o_ptr, 0, py, px);
+
+ /* Modify, Describe, Optimize */
+ inven_item_increase(INVEN_PACK, -255);
+ inven_item_describe(INVEN_PACK);
+ inven_item_optimize(INVEN_PACK);
+
+ /* Handle "p_ptr->notice" */
+ notice_stuff();
+
+ /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
+ handle_stuff();
+ }
+}
+
+
/*
* Process the player
*
/* Handle the player song */
if (!load) check_music();
+ /* Hex - Handle the hex spells */
+ if (!load) check_hex();
+ if (!load) revenge_spell();
+
load = FALSE;
/* Fast */
/* Hack -- Pack Overflow */
- if (inventory[INVEN_PACK].k_idx)
- {
- int item = INVEN_PACK;
-
- char o_name[MAX_NLEN];
-
- object_type *o_ptr;
-
- /* Access the slot to be dropped */
- o_ptr = &inventory[item];
-
- /* Disturbing */
- disturb(0, 0);
-
- /* Warning */
-#ifdef JP
-msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
-#else
- msg_print("Your pack overflows!");
-#endif
-
-
- /* Describe */
- object_desc(o_name, o_ptr, 0);
-
- /* Message */
-#ifdef JP
-msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
-#else
- msg_format("You drop %s (%c).", o_name, index_to_label(item));
-#endif
-
-
- /* Drop it (carefully) near the player */
- (void)drop_near(o_ptr, 0, py, px);
-
- /* Modify, Describe, Optimize */
- inven_item_increase(item, -255);
- inven_item_describe(item);
- inven_item_optimize(item);
-
- /* Handle "p_ptr->notice" */
- notice_stuff();
-
- /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
- handle_stuff();
- }
+ pack_overflow();
/* Hack -- cancel "lurking browse mode" */
run_step(0);
}
+#ifdef TRAVEL
+ /* Traveling */
+ else if (travel.run)
+ {
+ /* Take a step */
+ travel_step();
+ }
+#endif
+
/* Repeated command */
else if (command_rep)
{
}
+ /* Hack -- Pack Overflow */
+ pack_overflow();
+
+
/*** Clean up ***/
/* Significant */
}
}
new_mane = FALSE;
- p_ptr->redraw |= (PR_MANE);
+ p_ptr->redraw |= (PR_IMITATION);
}
if (p_ptr->action == ACTION_LEARN)
{
break;
}
+ /* Sniper */
+ if (energy_use && reset_concent) reset_concentration(TRUE);
+
/* Handle "leaving" */
if (p_ptr->leaving) break;
}
if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
}
+ (void)calculate_upkeep();
+
/* Validate the panel */
panel_bounds_center();
/* Count game turns */
turn++;
- if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
- else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
+
+ if (dungeon_turn < dungeon_turn_limit)
+ {
+ if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
+ else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
+ }
+
+ prevent_turn_overflow();
+
if (wild_regen) wild_regen--;
}
}
#endif
+ if (browsing_movie)
+ {
+ reset_visuals();
+ browse_movie();
+ return;
+ }
+
hack_mutation = FALSE;
/* Hack -- Character is "icky" */
quit(0);
}
+ creating_savefile = new_game;
+
/* Nothing loaded */
if (!character_loaded)
{
}
}
+ creating_savefile = FALSE;
+
p_ptr->teleport_town = FALSE;
p_ptr->sutemi = FALSE;
world_monster = FALSE;
m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
}
+ (void)combine_and_reorder_home(STORE_HOME);
+ (void)combine_and_reorder_home(STORE_MUSEUM);
+
/* Process */
while (TRUE)
{
/* Handle "p_ptr->notice" */
notice_stuff();
+ /* Hack -- prevent "icky" message */
+ character_xtra = TRUE;
+
/* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
handle_stuff();
+ character_xtra = FALSE;
+
/* Cancel the target */
target_who = 0;
p_ptr->inside_battle = FALSE;
leaving_quest = 0;
p_ptr->inside_quest = 0;
- p_ptr->recall_dungeon = dungeon_type;
+ if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
dungeon_type = 0;
if (lite_town || vanilla_town)
{
return hoge;
}
}
+
+/*
+ * ¥¿¡¼¥ó¤Î¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤ËÂФ¹¤ëÂнè
+ * ¥¿¡¼¥óµÚ¤Ó¥¿¡¼¥ó¤òµÏ¿¤¹¤ëÊÑ¿ô¤ò¥¿¡¼¥ó¤Î¸Â³¦¤Î1ÆüÁ°¤Þ¤Ç´¬¤Ì᤹.
+ */
+void prevent_turn_overflow(void)
+{
+ int rollback_days, i, j;
+ s32b rollback_turns;
+
+ if (turn < turn_limit) return;
+
+ rollback_days = 1 + (turn - turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
+ rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
+
+ if (turn > rollback_turns) turn -= rollback_turns;
+ else turn = 1; /* Paranoia */
+ if (old_turn > rollback_turns) old_turn -= rollback_turns;
+ else old_turn = 1;
+ if (old_battle > rollback_turns) old_battle -= rollback_turns;
+ else old_battle = 1;
+ if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
+ else p_ptr->feeling_turn = 1;
+
+ for (i = 1; i < max_towns; i++)
+ {
+ for (j = 0; j < MAX_STORES; j++)
+ {
+ store_type *st_ptr = &town[i].store[j];
+
+ if (st_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;
+ }
+
+ if (st_ptr->store_open)
+ {
+ st_ptr->store_open -= rollback_turns;
+ if (st_ptr->store_open < 1) st_ptr->store_open = 1;
+ }
+ }
+ }
+}