case SV_FOOD_RESTORE_STR:
{
- if (do_res_stat(A_STR)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_STR)) ident = TRUE;
break;
}
case SV_FOOD_RESTORE_CON:
{
- if (do_res_stat(A_CON)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_CON)) ident = TRUE;
break;
}
break;
case SV_POTION_RES_STR:
- if (do_res_stat(A_STR)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_STR)) ident = TRUE;
break;
case SV_POTION_RES_INT:
- if (do_res_stat(A_INT)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_INT)) ident = TRUE;
break;
case SV_POTION_RES_WIS:
- if (do_res_stat(A_WIS)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_WIS)) ident = TRUE;
break;
case SV_POTION_RES_DEX:
- if (do_res_stat(A_DEX)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_DEX)) ident = TRUE;
break;
case SV_POTION_RES_CON:
- if (do_res_stat(A_CON)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_CON)) ident = TRUE;
break;
case SV_POTION_RES_CHR:
- if (do_res_stat(A_CHR)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_CHR)) ident = TRUE;
break;
case SV_POTION_INC_STR:
case SV_STAFF_THE_MAGI:
{
- if (do_res_stat(A_INT)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_INT)) ident = TRUE;
ident |= restore_mana(FALSE);
if (set_shero(0, TRUE)) ident = TRUE;
break;
* Note that this function (used by stat potions) now restores\n
* the stat BEFORE increasing it.\n
*/
-bool inc_stat(int stat)
+bool inc_stat(player_type *creature_ptr, int stat)
{
BASE_STATUS value, gain;
/* Then augment the current/max stat */
- value = p_ptr->stat_cur[stat];
+ value = creature_ptr->stat_cur[stat];
/* Cannot go above 18/100 */
- if (value < p_ptr->stat_max_max[stat])
+ if (value < creature_ptr->stat_max_max[stat])
{
/* Gain one (sometimes two) points */
if (value < 18)
}
/* Gain 1/6 to 1/3 of distance to 18/100 */
- else if (value < (p_ptr->stat_max_max[stat]-2))
+ else if (value < (creature_ptr->stat_max_max[stat]-2))
{
/* Approximate gain value */
- gain = (((p_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
+ gain = (((creature_ptr->stat_max_max[stat]) - value) / 2 + 3) / 2;
if (gain < 1) gain = 1;
/* Apply the bonus */
value += randint1(gain) + gain / 2;
/* Maximal value */
- if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
+ if (value > (creature_ptr->stat_max_max[stat]-1)) value = creature_ptr->stat_max_max[stat]-1;
}
/* Gain one point at a time */
}
/* Save the new value */
- p_ptr->stat_cur[stat] = value;
+ creature_ptr->stat_cur[stat] = value;
/* Bring up the maximum too */
- if (value > p_ptr->stat_max[stat])
+ if (value > creature_ptr->stat_max[stat])
{
- p_ptr->stat_max[stat] = value;
+ creature_ptr->stat_max[stat] = value;
}
- p_ptr->update |= (PU_BONUS);
+ creature_ptr->update |= (PU_BONUS);
/* Success */
return (TRUE);
/*
* Restore lost "points" in a stat
*/
-bool do_res_stat(int stat)
+bool do_res_stat(player_type *creature_ptr, int stat)
{
/* Attempt to increase */
- if (res_stat(p_ptr, stat))
+ if (res_stat(creature_ptr, stat))
{
msg_format(_("元通りに%sなった気がする。", "You feel less %s."), desc_stat_pos[stat]);
-
return (TRUE);
}
res = res_stat(p_ptr, stat);
/* Attempt to increase */
- if (inc_stat(stat))
+ if (inc_stat(p_ptr, stat))
{
if (stat == A_WIS)
{
extern bool set_stun(TIME_EFFECT v);
extern bool set_cut(TIME_EFFECT v);
extern bool set_food(TIME_EFFECT v);
-extern bool inc_stat(int stat);
+extern bool inc_stat(player_type *creature_ptr, int stat);
extern bool dec_stat(player_type *creature_ptr, int stat, int amount, int permanent);
extern bool res_stat(player_type *creature_ptr, int stat);
extern bool hp_player(int num);
extern bool do_dec_stat(player_type *creature_ptr, int stat);
-extern bool do_res_stat(int stat);
+extern bool do_res_stat(player_type *creature_ptr, int stat);
extern bool do_inc_stat(int stat);
extern bool restore_level(void);
extern bool lose_all_info(void);
bool restore_all_status(void)
{
bool ident = FALSE;
- if (do_res_stat(A_STR)) ident = TRUE;
- if (do_res_stat(A_INT)) ident = TRUE;
- if (do_res_stat(A_WIS)) ident = TRUE;
- if (do_res_stat(A_DEX)) ident = TRUE;
- if (do_res_stat(A_CON)) ident = TRUE;
- if (do_res_stat(A_CHR)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_STR)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_INT)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_WIS)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_DEX)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_CON)) ident = TRUE;
+ if (do_res_stat(p_ptr, A_CHR)) ident = TRUE;
return ident;
}