* @param only_browse 閲覧するだけならばTRUE
* @return 選択した魔力のID、キャンセルならば-1を返す
*/
-static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
+static OBJECT_SUBTYPE_VALUE select_magic_eater(player_type *creature_ptr, bool only_browse)
{
OBJECT_SUBTYPE_VALUE ext = 0;
char choice;
if (repeat_pull(&sn))
{
/* Verify the spell */
- if (sn >= EATER_EXT*2 && !(p_ptr->magic_num1[sn] > k_info[lookup_kind(TV_ROD, sn-EATER_EXT*2)].pval * (p_ptr->magic_num2[sn] - 1) * EATER_ROD_CHARGE))
+ if (sn >= EATER_EXT*2 && !(creature_ptr->magic_num1[sn] > k_info[lookup_kind(TV_ROD, sn-EATER_EXT*2)].pval * (creature_ptr->magic_num2[sn] - 1) * EATER_ROD_CHARGE))
return sn;
- else if (sn < EATER_EXT*2 && !(p_ptr->magic_num1[sn] < EATER_CHARGE))
+ else if (sn < EATER_EXT*2 && !(creature_ptr->magic_num1[sn] < EATER_CHARGE))
return sn;
}
for (i = 0; i < 108; i++)
{
- if (p_ptr->magic_num2[i]) break;
+ if (creature_ptr->magic_num2[i]) break;
}
if (i == 108)
{
}
for (i = ext; i < ext + EATER_EXT; i++)
{
- if (p_ptr->magic_num2[i])
+ if (creature_ptr->magic_num2[i])
{
if (use_menu) menu_line = i-ext+1;
break;
/* Print list */
for (ctr = 0; ctr < EATER_EXT; ctr++)
{
- if (!p_ptr->magic_num2[ctr+ext]) continue;
+ if (!creature_ptr->magic_num2[ctr+ext]) continue;
k_idx = lookup_kind(tval, ctr);
y1 = ((ctr < EATER_EXT/2) ? y + ctr : y + ctr - EATER_EXT/2);
level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
chance = level * 4 / 5 + 20;
- chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
+ chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
level /= 2;
- if (p_ptr->lev > level)
+ if (creature_ptr->lev > level)
{
- chance -= 3 * (p_ptr->lev - level);
+ chance -= 3 * (creature_ptr->lev - level);
}
chance = mod_spell_chance_1(chance);
- chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
+ chance = MAX(chance, adj_mag_fail[creature_ptr->stat_ind[mp_ptr->spell_stat]]);
/* Stunning makes spells harder */
- if (p_ptr->stun > 50) chance += 25;
- else if (p_ptr->stun) chance += 15;
+ if (creature_ptr->stun > 50) chance += 25;
+ else if (creature_ptr->stun) chance += 15;
if (chance > 95) chance = 95;
strcat(dummy, format(
_(" %-22.22s 充填:%2d/%2d%3d%%", " %-22.22s (%2d/%2d) %3d%%"),
k_name + k_info[k_idx].name,
- p_ptr->magic_num1[ctr+ext] ?
- (p_ptr->magic_num1[ctr+ext] - 1) / (EATER_ROD_CHARGE * k_info[k_idx].pval) +1 : 0,
- p_ptr->magic_num2[ctr+ext], chance));
- if (p_ptr->magic_num1[ctr+ext] > k_info[k_idx].pval * (p_ptr->magic_num2[ctr+ext]-1) * EATER_ROD_CHARGE) col = TERM_RED;
+ creature_ptr->magic_num1[ctr+ext] ?
+ (creature_ptr->magic_num1[ctr+ext] - 1) / (EATER_ROD_CHARGE * k_info[k_idx].pval) +1 : 0,
+ creature_ptr->magic_num2[ctr+ext], chance));
+ if (creature_ptr->magic_num1[ctr+ext] > k_info[k_idx].pval * (creature_ptr->magic_num2[ctr+ext]-1) * EATER_ROD_CHARGE) col = TERM_RED;
}
else
{
- strcat(dummy, format(" %-22.22s %2d/%2d %3d%%", k_name + k_info[k_idx].name, (s16b)(p_ptr->magic_num1[ctr+ext]/EATER_CHARGE), p_ptr->magic_num2[ctr+ext], chance));
- if (p_ptr->magic_num1[ctr+ext] < EATER_CHARGE) col = TERM_RED;
+ strcat(dummy, format(" %-22.22s %2d/%2d %3d%%", k_name + k_info[k_idx].name, (s16b)(creature_ptr->magic_num1[ctr+ext]/EATER_CHARGE), creature_ptr->magic_num2[ctr+ext], chance));
+ if (creature_ptr->magic_num1[ctr+ext] < EATER_CHARGE) col = TERM_RED;
}
}
else
{
menu_line += EATER_EXT - 1;
if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
- } while(!p_ptr->magic_num2[menu_line+ext-1]);
+ } while(!creature_ptr->magic_num2[menu_line+ext-1]);
break;
}
{
menu_line++;
if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
- } while(!p_ptr->magic_num2[menu_line+ext-1]);
+ } while(!creature_ptr->magic_num2[menu_line+ext-1]);
break;
}
reverse = TRUE;
}
else menu_line+=EATER_EXT/2;
- while(!p_ptr->magic_num2[menu_line+ext-1])
+ while(!creature_ptr->magic_num2[menu_line+ext-1])
{
if (reverse)
{
}
/* Totally Illegal */
- if ((i < 0) || (i > EATER_EXT) || !p_ptr->magic_num2[i+ext])
+ if ((i < 0) || (i > EATER_EXT) || !creature_ptr->magic_num2[i+ext])
{
bell();
continue;
}
if (tval == TV_ROD)
{
- if (p_ptr->magic_num1[ext+i] > k_info[lookup_kind(tval, i)].pval * (p_ptr->magic_num2[ext+i] - 1) * EATER_ROD_CHARGE)
+ if (creature_ptr->magic_num1[ext+i] > k_info[lookup_kind(tval, i)].pval * (creature_ptr->magic_num2[ext+i] - 1) * EATER_ROD_CHARGE)
{
msg_print(_("その魔法はまだ充填している最中だ。", "The magic are still charging."));
msg_print(NULL);
}
else
{
- if (p_ptr->magic_num1[ext+i] < EATER_CHARGE)
+ if (creature_ptr->magic_num1[ext+i] < EATER_CHARGE)
{
msg_print(_("その魔法は使用回数が切れている。", "The magic has no charges left."));
msg_print(NULL);
if (cmd_limit_confused(p_ptr)) return FALSE;
- item = select_magic_eater(only_browse);
+ item = select_magic_eater(p_ptr, only_browse);
if (item == -1)
{
free_turn(p_ptr);