/*
* 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;
}
/* The light is now out */
else if (o_ptr->xtra4 == 0)
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("ÌÀ¤«¤ê¤¬¾Ã¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª");
#else
if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5))
&& (turn % (TURNS_PER_TICK*2)))
{
- if (disturb_minor) disturb(0, 0);
+ if (disturb_minor) disturb(0, 1);
#ifdef JP
msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
#else
/* The light is getting dim */
else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10)))
{
- if (disturb_minor) disturb(0, 0);
+ if (disturb_minor) disturb(0, 1);
#ifdef JP
msg_print("ÌÀ¤«¤ê¤¬Èù¤«¤Ë¤Ê¤Ã¤Æ¤¤Æ¤¤¤ë¡£");
#else
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 */
if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("¥¦¥¬¥¡¥¡¥¢¡ª");
msg_print("·ãÅܤÎȯºî¤Ë½±¤ï¤ì¤¿¡ª");
{
if (!p_ptr->resist_fear)
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
#else
if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
!p_ptr->anti_tele)
{
- disturb(0, 0);
+ disturb(0, 1);
/* Teleport player */
#ifdef JP
{
if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
{
- disturb(0, 0);
+ disturb(0, 1);
p_ptr->redraw |= PR_EXTRA;
#ifdef JP
msg_print("¤¤¤Ò¤¤¬¤â¡¼¤í¡¼¤È¤Ò¤Æ¤¤¿¤¤¬¤Õ¤ë...¥Ò¥Ã¥¯¡ª");
{
if (!p_ptr->resist_chaos)
{
- disturb(0, 0);
+ disturb(0, 1);
p_ptr->redraw |= PR_EXTRA;
(void)set_image(p_ptr->image + randint0(50) + 20);
}
if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("¥Ö¥¥¡¼¡¼¥Ã¡ª¤ª¤Ã¤È¡£");
!p_ptr->anti_magic && one_in_(9000))
{
int dire = 0;
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("ËâË¡¤Î¥¨¥Í¥ë¥®¡¼¤¬ÆÍÁ³¤¢¤Ê¤¿¤ÎÃæ¤Ëή¤ì¹þ¤ó¤Ç¤¤¿¡ª¥¨¥Í¥ë¥®¡¼¤ò²òÊü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡ª");
#else
msg_print("You have attracted a demon!");
#endif
- disturb(0, 0);
+ disturb(0, 1);
}
}
if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
{
- disturb(0, 0);
+ disturb(0, 1);
if (one_in_(2))
{
#ifdef JP
}
if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("ÆÍÁ³¤Û¤È¤ó¤É¸ÉÆȤˤʤ俵¤¤¬¤¹¤ë¡£");
#else
msg_print("You have attracted an animal!");
#endif
- disturb(0, 0);
+ disturb(0, 1);
}
}
if ((p_ptr->muta2 & MUT2_RAW_CHAOS) &&
!p_ptr->anti_magic && one_in_(8000))
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ëµ¤¤¬¤¹¤ë¡ª");
#else
}
if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000))
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("Èóʪ¼Á²½¤·¤¿¡ª");
#else
if (!sustained)
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("¼«Ê¬¤¬¿ê¼å¤·¤Æ¤¤¤¯¤Î¤¬Ê¬¤«¤ë¡ª");
#else
msg_print("You have attracted a dragon!");
#endif
- disturb(0, 0);
+ disturb(0, 1);
}
}
if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic &&
if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest &&
one_in_(9000))
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("°ß¤¬áÛÚ»¤·¡¢¿©»ö¤ò¼º¤Ã¤¿¡ª");
#else
if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic &&
one_in_(5000))
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("̵Ũ¤Êµ¤¤¬¤¹¤ë¡ª");
#else
int slot = 0;
object_type *o_ptr = NULL;
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
if (get_check_strict("Teleport? ", CHECK_OKAY_CANCEL))
#endif
{
- disturb(0, 0);
+ disturb(0, 1);
teleport_player(50, 0L);
}
else
#else
msg_format("You can inscribe {.} on your %s to disable random teleportation. ", o_name);
#endif
- disturb(1, 0);
+ disturb(1, 1);
}
}
/* Make a chainsword noise */
msg_format("Your %s have attracted an animal!", o_name);
#endif
- disturb(0, 0);
+ disturb(0, 1);
}
}
/* Call demon */
msg_format("Your %s have attracted a demon!", o_name);
#endif
- disturb(0, 0);
+ disturb(0, 1);
}
}
/* Call dragon */
msg_format("Your %s have attracted an animal!", o_name);
#endif
- disturb(0, 0);
+ disturb(0, 1);
}
}
if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500))
{
if (!p_ptr->resist_fear)
{
- disturb(0, 0);
+ disturb(0, 1);
#ifdef JP
msg_print("¤È¤Æ¤â°Å¤¤... ¤È¤Æ¤â¶²¤¤¡ª");
#else
/* Teleport player */
if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele)
{
- disturb(0, 0);
+ disturb(0, 1);
/* Teleport player */
teleport_player(40, TELEPORT_PASSIVE);
if (!p_ptr->word_recall)
{
/* Disturbing! */
- disturb(0, 0);
+ disturb(0, 1);
/* 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!"));
if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
if (record_stair)
}
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 (!p_ptr->alter_reality)
{
/* Disturbing! */
- disturb(0, 0);
+ disturb(0, 1);
/* Determine the level */
if (!quest_number(dun_level) && dun_level)
if (closing_flag <= 2)
{
/* Disturb */
- disturb(0, 0);
+ disturb(0, 1);
/* Count warnings */
closing_flag++;
if ((hour == 23) && !(min % 15))
{
/* Disturbing */
- disturb(0, 0);
+ disturb(0, 1);
switch (min / 15)
{
{
int count = 0;
- disturb(1, 0);
+ disturb(1, 1);
#ifdef JP
msg_print("±ó¤¯¤Ç¾â¤¬²¿²ó¤âÌĤꡢ»à¤ó¤À¤è¤¦¤ÊÀŤ±¤µ¤ÎÃæ¤Ø¾Ã¤¨¤Æ¤¤¤Ã¤¿¡£");
#else
msg_print("You faint from the lack of food.");
#endif
- disturb(1, 0);
+ disturb(1, 1);
/* Hack -- faint (bypass free action) */
(void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
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();
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)
o_ptr = &inventory[INVEN_PACK];
/* Disturbing */
- disturb(0, 0);
+ disturb(0, 1);
/* Warning */
#ifdef JP
}
}
+/*
+ * process the effects per 100 energy at player speed.
+ */
+static void process_upkeep_with_speed(void)
+{
+ /* Give the player some energy */
+ if (!load && p_ptr->enchant_energy_need > 0 && !p_ptr->leaving)
+ {
+ p_ptr->enchant_energy_need -= SPEED_TO_ENERGY(p_ptr->pspeed);
+ }
+
+ /* No turn yet */
+ if (p_ptr->enchant_energy_need > 0) return;
+
+ while (p_ptr->enchant_energy_need <= 0)
+ {
+ /* Handle the player song */
+ if (!load) check_music();
+
+ /* Hex - Handle the hex spells */
+ if (!load) check_hex();
+ if (!load) revenge_spell();
+
+ /* There is some randomness of needed energy */
+ p_ptr->enchant_energy_need += ENERGY_NEED();
+ }
+}
+
/*
* Process the player
msg_print("Damn! The fish stole your bait!");
#endif
}
- disturb(0, 0);
+ disturb(0, 1);
}
}
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))
+ if (running || travel.run || command_rep || (p_ptr->action == ACTION_REST) || (p_ptr->action == ACTION_FISH))
{
/* Do not wait */
inkey_scan = TRUE;
flush();
/* Disturb */
- disturb(0, 0);
+ disturb(0, 1);
/* Hack -- Show a Message */
#ifdef JP
/* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
handle_stuff();
}
-
- /* Handle the player song */
- if (!load) check_music();
-
- /* Hex - Handle the hex spells */
- if (!load) check_hex();
- if (!load) revenge_spell();
-
+
load = FALSE;
/* Fast */
/* Disturb */
- disturb(1, 0);
+ disturb(1, 1);
/* Get index of current quest (if any) */
quest_num = quest_number(dun_level);
/* Hack -- Compress the object list occasionally */
if (o_cnt + 32 < o_max) compact_objects(0);
-
+
/* Process the player */
process_player();
+
+ process_upkeep_with_speed();
/* Handle "p_ptr->notice" */
notice_stuff();