/* Forgotten */
else if ((j < 1) ?
- ((spell_forgotten1 & (1L << i))) :
- ((spell_forgotten2 & (1L << (i % 32)))))
+ ((p_ptr->spell_forgotten1 & (1L << i))) :
+ ((p_ptr->spell_forgotten2 & (1L << (i % 32)))))
{
/* Forgotten */
a = TERM_ORANGE;
/* Unknown */
else if (!((j < 1) ?
- (spell_learned1 & (1L << i)) :
- (spell_learned2 & (1L << (i % 32)))))
+ (p_ptr->spell_learned1 & (1L << i)) :
+ (p_ptr->spell_learned2 & (1L << (i % 32)))))
{
/* Unknown */
a = TERM_RED;
/* Untried */
else if (!((j < 1) ?
- (spell_worked1 & (1L << i)) :
- (spell_worked2 & (1L << (i % 32)))))
+ (p_ptr->spell_worked1 & (1L << i)) :
+ (p_ptr->spell_worked2 & (1L << (i % 32)))))
{
/* Untried */
a = TERM_YELLOW;
}
+/*
+ * Returns experience of a spell
+ */
+s16b experience_of_spell(int spell, int realm)
+{
+ if (p_ptr->pclass == CLASS_SORCERER) return 1600;
+ else if (p_ptr->pclass == CLASS_RED_MAGE) return 1200;
+ else if (realm+1 == p_ptr->realm1) return p_ptr->spell_exp[spell];
+ else if (realm+1 == p_ptr->realm2) return p_ptr->spell_exp[spell + 32];
+ else return 0;
+}
+
/*
* Returns spell chance of failure for spell -RAK-
chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
if (p_ptr->riding)
- chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level-skill_exp[GINOU_RIDING]/100-10,0));
-
- if (p_ptr->pclass == CLASS_SORCERER)
- shouhimana = s_ptr->smana*2200 + 2399;
- else if (p_ptr->pclass == CLASS_RED_MAGE)
- shouhimana = s_ptr->smana*2600 + 2399;
- else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
- shouhimana = (s_ptr->smana*(3800-spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)])+2399);
- else shouhimana = s_ptr->smana*3800;
- if(p_ptr->dec_mana)
- shouhimana *= 3;
+ chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level-p_ptr->skill_exp[GINOU_RIDING]/100-10,0));
+
+ /* Extract mana consumption rate */
+ shouhimana = s_ptr->smana*(3800 - experience_of_spell(spell, realm)) + 2399;
+
+ if(p_ptr->dec_mana) shouhimana *= 3;
else shouhimana *= 4;
+
shouhimana /= 9600;
if(shouhimana < 1) shouhimana = 1;
if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
{
- if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1399) chance--;
- if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1599) chance--;
+ s16b exp = experience_of_spell(spell, realm);
+ if(exp > 1399) chance--;
+ if(exp > 1599) chance--;
}
if(p_ptr->dec_mana) chance--;
if (p_ptr->heavy_spell) chance += 5;
/* Spell is forgotten */
if ((realm == p_ptr->realm2 - 1) ?
- (spell_forgotten2 & (1L << spell)) :
- (spell_forgotten1 & (1L << spell)))
+ (p_ptr->spell_forgotten2 & (1L << spell)) :
+ (p_ptr->spell_forgotten1 & (1L << spell)))
{
/* Never okay */
return (FALSE);
/* Spell is learned */
if ((realm == p_ptr->realm2 - 1) ?
- (spell_learned2 & (1L << spell)) :
- (spell_learned1 & (1L << spell)))
+ (p_ptr->spell_learned2 & (1L << spell)) :
+ (p_ptr->spell_learned1 & (1L << spell)))
{
/* Always true */
return (!study_pray);
bool max = FALSE;
- if (((realm < 0) || (realm > MAX_REALM - 1)) && wizard)
+ if (((realm < 0) || (realm > MAX_REALM - 1)) && p_ptr->wizard)
#ifdef JP
msg_print("·Ù¹ð¡ª print_spell ¤¬Îΰè¤Ê¤·¤Ë¸Æ¤Ð¤ì¤¿");
#else
shouhimana = s_ptr->smana;
else
{
- if (p_ptr->pclass == CLASS_SORCERER)
- shouhimana = s_ptr->smana*2200 + 2399;
- else if (p_ptr->pclass == CLASS_RED_MAGE)
- shouhimana = s_ptr->smana*2600 + 2399;
- else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
- shouhimana = (s_ptr->smana*(3800-spell_exp[(spell+increment)])+2399);
- else
- shouhimana = s_ptr->smana*3800+2399;
- if(p_ptr->dec_mana)
- shouhimana *= 3;
+ s16b exp = experience_of_spell(spell, realm);
+
+ /* Extract mana consumption rate */
+ shouhimana = s_ptr->smana*(3800 - exp) + 2399;
+
+ if(p_ptr->dec_mana) shouhimana *= 3;
else shouhimana *= 4;
+
shouhimana /= 9600;
if(shouhimana < 1) shouhimana = 1;
- }
- if ((increment == 64) || (s_ptr->slevel >= 99)) shougou = 0;
- else if (spell_exp[spell+increment]<900) shougou = 0;
- else if (spell_exp[spell+increment]<1200) shougou = 1;
- else if (spell_exp[spell+increment]<1400) shougou = 2;
- else if (spell_exp[spell+increment]<1600) shougou = 3;
- else shougou = 4;
- max = FALSE;
- if (!increment && (shougou == 4)) max = TRUE;
- else if ((increment == 32) && (shougou == 3)) max = TRUE;
- else if (s_ptr->slevel >= 99) max = TRUE;
- else if (p_ptr->pclass == CLASS_RED_MAGE) max = TRUE;
-
- strncpy(ryakuji,shougou_moji[shougou],4);
- ryakuji[3] = ']';
- ryakuji[4] = '\0';
+ if ((increment == 64) || (s_ptr->slevel >= 99)) shougou = 0;
+ else if (exp < 900) shougou = 0;
+ else if (exp < 1200) shougou = 1;
+ else if (exp < 1400) shougou = 2;
+ else if (exp < 1600) shougou = 3;
+ else shougou = 4;
+
+ max = FALSE;
+ if (!increment && (shougou == 4)) max = TRUE;
+ else if ((increment == 32) && (shougou == 3)) max = TRUE;
+ else if (s_ptr->slevel >= 99) max = TRUE;
+ else if (p_ptr->pclass == CLASS_RED_MAGE) max = TRUE;
+
+ strncpy(ryakuji,shougou_moji[shougou],4);
+ ryakuji[3] = ']';
+ ryakuji[4] = '\0';
+ }
if (use_menu && target_spell)
{
line_attr = TERM_L_BLUE;
}
else if ((realm + 1 == p_ptr->realm1) ?
- ((spell_forgotten1 & (1L << spell))) :
- ((spell_forgotten2 & (1L << spell))))
+ ((p_ptr->spell_forgotten1 & (1L << spell))) :
+ ((p_ptr->spell_forgotten2 & (1L << spell))))
{
#ifdef JP
comment = " ˺µÑ";
line_attr = TERM_YELLOW;
}
else if (!((realm + 1 == p_ptr->realm1) ?
- (spell_learned1 & (1L << spell)) :
- (spell_learned2 & (1L << spell))))
+ (p_ptr->spell_learned1 & (1L << spell)) :
+ (p_ptr->spell_learned2 & (1L << spell))))
{
#ifdef JP
comment = " ̤ÃÎ";
line_attr = TERM_L_BLUE;
}
else if (!((realm + 1 == p_ptr->realm1) ?
- (spell_worked1 & (1L << spell)) :
- (spell_worked2 & (1L << spell))))
+ (p_ptr->spell_worked1 & (1L << spell)) :
+ (p_ptr->spell_worked2 & (1L << spell))))
{
#ifdef JP
comment = " ̤·Ð¸³";