/* Get a spell from the user */
- choice = (always_show_list || use_menu) ? ESCAPE:1;
+ choice = (always_show_list || use_menu) ? ESCAPE : 1;
while (!flag)
{
- if( choice==ESCAPE ) choice = ' ';
- else if( !get_com(out_val, &choice, TRUE) )break;
+ if (choice == ESCAPE) choice = ' ';
+ else if (!get_com(out_val, &choice, TRUE))break;
if (use_menu && choice != ' ')
{
- switch(choice)
+ switch (choice)
{
case '0':
{
screen_load();
- return (FALSE);
- break;
+ return FALSE;
}
case '8':
/* Abort if needed */
- if (!flag) return (FALSE);
+ if (!flag) return FALSE;
/* Save the choice */
(*sn) = spell;
#endif /* ALLOW_REPEAT -- TNB */
/* Success */
- return (TRUE);
+ return TRUE;
}
int item, sval, use_realm = 0, j, line;
int spell = -1;
int num = 0;
- int increment = 0;
byte spells[64];
char temp[62*4];
object_type *o_ptr;
- magic_type *s_ptr;
cptr q, s;
sval = o_ptr->sval;
use_realm = tval2realm(o_ptr->tval);
- if ((p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_RED_MAGE) && is_magic(use_realm))
- {
- if (o_ptr->tval == REALM2_BOOK) increment = 32;
- else if (o_ptr->tval != REALM1_BOOK) increment = 64;
- }
/* Track the object kind */
object_kind_track(o_ptr->k_idx);
prt("No spells to browse.", 0, 0);
#endif
(void)inkey();
-
+
/* Restore the screen */
screen_load();
return;
- }
+ }
/* Clear lines, position cursor (really should use strlen here) */
Term_erase(14, 14, 255);
Term_erase(14, 12, 255);
Term_erase(14, 11, 255);
- /* Access the spell */
- if (!is_magic(use_realm))
- {
- s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
- }
- else
- {
- s_ptr = &mp_ptr->info[use_realm - 1][spell];
- }
-
- roff_to_buf(spell_tips[technic2magic(use_realm)-1][spell] ,62, temp, sizeof(temp));
- for(j=0, line = 11;temp[j];j+=(1+strlen(&temp[j])))
+ roff_to_buf(spell_tips[technic2magic(use_realm) - 1][spell], 62, temp, sizeof(temp));
+ for (j = 0, line = 11; temp[j]; j += 1 + strlen(&temp[j]))
{
prt(&temp[j], line, 15);
line++;
static void change_realm2(int next_realm)
{
- int i, j=0;
+ int i, j = 0;
char tmp[80];
for (i = 0; i < 64; i++)
{
p_ptr->spell_order[j] = p_ptr->spell_order[i];
- if(p_ptr->spell_order[i] < 32) j++;
+ if (p_ptr->spell_order[i] < 32) j++;
}
for (; j < 64; j++)
p_ptr->spell_order[j] = 99;
for (i = 32; i < 64; i++)
{
- p_ptr->spell_exp[i] = 0;
+ p_ptr->spell_exp[i] = SPELL_EXP_UNSKILLED;
}
p_ptr->spell_learned2 = 0L;
p_ptr->spell_worked2 = 0L;
- p_ptr->spell_forgotten2 = 0L;
+ p_ptr->spell_forgotten2 = 0L;
#ifdef JP
sprintf(tmp,"ËâË¡¤ÎÎΰè¤ò%s¤«¤é%s¤ËÊѹ¹¤·¤¿¡£", realm_names[p_ptr->realm2], realm_names[next_realm]);
if (learned)
{
- int max_exp = (spell < 32) ? 1600 : 1400;
+ int max_exp = (spell < 32) ? SPELL_EXP_MASTER : SPELL_EXP_EXPERT;
int old_exp = p_ptr->spell_exp[spell];
- int new_rank = 0;
+ int new_rank = EXP_LEVEL_UNSKILLED;
cptr name = spell_names[technic2magic(increment ? p_ptr->realm2 : p_ptr->realm1)-1][spell%32];
if (old_exp >= max_exp)
{
return;
}
- else if (old_exp >= 1400)
+ else if (old_exp >= SPELL_EXP_EXPERT)
{
- p_ptr->spell_exp[spell] = 1600;
- new_rank = 4;
+ p_ptr->spell_exp[spell] = SPELL_EXP_MASTER;
+ new_rank = EXP_LEVEL_MASTER;
}
- else if (old_exp >= 1200)
+ else if (old_exp >= SPELL_EXP_SKILLED)
{
- if (spell >= 32) p_ptr->spell_exp[spell] = 1400;
- else p_ptr->spell_exp[spell] += 200;
- new_rank = 3;
+ if (spell >= 32) p_ptr->spell_exp[spell] = SPELL_EXP_EXPERT;
+ else p_ptr->spell_exp[spell] += SPELL_EXP_EXPERT - SPELL_EXP_SKILLED;
+ new_rank = EXP_LEVEL_EXPERT;
}
- else if (old_exp >= 900)
+ else if (old_exp >= SPELL_EXP_BEGINNER)
{
- p_ptr->spell_exp[spell] = 1200+(old_exp-900)*2/3;
- new_rank = 2;
+ p_ptr->spell_exp[spell] = SPELL_EXP_SKILLED + (old_exp - SPELL_EXP_BEGINNER) * 2 / 3;
+ new_rank = EXP_LEVEL_SKILLED;
}
else
{
- p_ptr->spell_exp[spell] = 900+(old_exp)/3;
- new_rank = 1;
+ p_ptr->spell_exp[spell] = SPELL_EXP_BEGINNER + old_exp / 3;
+ new_rank = EXP_LEVEL_BEGINNER;
}
#ifdef JP
- msg_format("%s¤Î½ÏÎýÅÙ¤¬%s¤Ë¾å¤¬¤Ã¤¿¡£", name, shougou_moji[new_rank]);
+ msg_format("%s¤Î½ÏÎýÅÙ¤¬%s¤Ë¾å¤¬¤Ã¤¿¡£", name, exp_level_str[new_rank]);
#else
- msg_format("Your proficiency of %s is now %s rank.", name, shougou_moji[new_rank]);
+ msg_format("Your proficiency of %s is now %s rank.", name, exp_level_str[new_rank]);
#endif
}
else
/* Take a turn */
energy_use = 100;
- if (mp_ptr->spell_book == TV_LIFE_BOOK)
+ switch (mp_ptr->spell_book)
+ {
+ case TV_LIFE_BOOK:
chg_virtue(V_FAITH, 1);
- else if (mp_ptr->spell_book == TV_DEATH_BOOK)
+ break;
+ case TV_DEATH_BOOK:
chg_virtue(V_UNLIFE, 1);
- else if (mp_ptr->spell_book == TV_NATURE_BOOK)
+ break;
+ case TV_NATURE_BOOK:
chg_virtue(V_NATURE, 1);
- else
+ break;
+ default:
chg_virtue(V_KNOWLEDGE, 1);
+ break;
+ }
/* Sound */
sound(SOUND_STUDY);
{
/* Message */
#ifdef JP
- if( p_ptr->new_spells < 10 ){
- msg_format("¤¢¤È %d ¤Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
- }else{
- msg_format("¤¢¤È %d ¸Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
- }
+ if (p_ptr->new_spells < 10) msg_format("¤¢¤È %d ¤Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
+ else msg_format("¤¢¤È %d ¸Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
#else
- msg_format("You can learn %d more %s%s.",
- p_ptr->new_spells, p,
- (p_ptr->new_spells != 1) ? "s" : "");
+ msg_format("You can learn %d more %s%s.", p_ptr->new_spells, p,
+ (p_ptr->new_spells != 1) ? "s" : "");
#endif
-
}
#endif
fire_ball_hide(GF_WOUNDS, dir, damroll(5+((plev - 5) / 3), 15), 0);
break;
case 21: /* Word of Recall */
- if (!word_of_recall()) return FALSE;
- break;
+ return word_of_recall();
case 22: /* Alter Reality */
alter_reality();
break;
break;
case 19: /* Teleport to town */
return tele_town();
- break;
case 20: /* Self knowledge */
(void)self_knowledge();
break;
(void)teleport_player_level();
break;
case 22: /* Word of Recall */
- if (!word_of_recall()) return FALSE;
- break;
+ return word_of_recall();
case 23: /* Dimension Door */
#ifdef JP
msg_print("¼¡¸µ¤ÎÈ⤬³«¤¤¤¿¡£ÌÜŪÃϤòÁª¤ó¤Ç²¼¤µ¤¤¡£");
int dir;
int beam;
int plev = p_ptr->lev;
- bool no_trump = FALSE;
if (p_ptr->pclass == CLASS_MAGE) beam = plev;
else if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER) beam = plev + 10;
break;
case 14: /* Summon Animals */
if (!(summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET))))
- no_trump = TRUE;
+ {
+#ifdef JP
+ msg_print("ưʪ¤Ï¸½¤ì¤Ê¤«¤Ã¤¿¡£");
+#else
+ msg_print("No animals arrive.");
+#endif
+ }
break;
case 15: /* Herbal Healing */
(void)hp_player(500);
msg_print(NULL);
}
- if (no_trump)
-#ifdef JP
-msg_print("ưʪ¤Ï¸½¤ì¤Ê¤«¤Ã¤¿¡£");
-#else
- msg_print("No animals arrive.");
-#endif
-
-
return TRUE;
}
sleep_monsters();
hp_player(300);
}
- break;
}
break;
case 9: /* Chaos Bolt */
return ident_spell(FALSE);
else
return identify_fully(FALSE);
- break;
case 27: /* Mimic vampire */
(void)set_mimic(10+plev/2 + randint1(10+plev/2), MIMIC_VAMPIRE, FALSE);
break;
static bool cast_trump_spell(int spell, bool success)
{
int dir;
- int beam;
int plev = p_ptr->lev;
int summon_lev = plev * 2 / 3 + randint1(plev/2);
int dummy = 0;
bool no_trump = FALSE;
bool unique_okay = FALSE;
-
- if (p_ptr->pclass == CLASS_MAGE) beam = plev;
- else if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER) beam = plev + 10;
- else beam = plev / 2;
-
if (summon_lev < 1) summon_lev = 1;
if (!success || (randint1(50+plev) < plev/10)) unique_okay = TRUE;
switch (spell)
case 14: /* Word of Recall */
if (success)
{
- if (!word_of_recall()) return FALSE;
+ return word_of_recall();
}
break;
case 15: /* Banish */
int beam;
int plev = p_ptr->lev;
int dummy = 0;
- bool no_trump = FALSE;
if (p_ptr->pclass == CLASS_MAGE) beam = plev;
else if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER) beam = plev + 10;
break;
case 25: /* Conjure Elemental */
if (!summon_specific(-1, py, px, plev, SUMMON_ELEMENTAL, (PM_ALLOW_GROUP | PM_FORCE_PET)))
- no_trump = TRUE;
+ {
+#ifdef JP
+ msg_print("¥¨¥ì¥á¥ó¥¿¥ë¤Ï¸½¤ì¤Ê¤«¤Ã¤¿¡£");
+#else
+ msg_print("No Elementals arrive.");
+#endif
+ }
break;
case 26: /* Teleport Level */
#ifdef JP
(void)detect_all(DETECT_RAD_DEFAULT);
break;
case 30: /* Word of Recall */
- if (!word_of_recall()) return FALSE;
- break;
+ return word_of_recall();
case 31: /* Clairvoyance */
chg_virtue(V_KNOWLEDGE, 1);
chg_virtue(V_ENLIGHTEN, 1);
msg_print(NULL);
}
- if (no_trump)
-#ifdef JP
-msg_print("¥¨¥ì¥á¥ó¥¿¥ë¤Ï¸½¤ì¤Ê¤«¤Ã¤¿¡£");
-#else
- msg_print("No Elementals arrive.");
-#endif
-
return TRUE;
}
{
int plev = p_ptr->lev;
int dummy = 0;
- bool no_trump = FALSE;
switch (spell)
{
break;
case 15: /* Mana Branding */
return choose_ele_attack();
- break;
case 16: /* Telepathy */
(void)set_tim_esp(randint1(30) + 25, FALSE);
break;
if (summon_specific(-1, py, px, plev, SUMMON_GOLEM, PM_FORCE_PET))
{
#ifdef JP
-msg_print("¥´¡¼¥ì¥à¤òºî¤Ã¤¿¡£");
+ msg_print("¥´¡¼¥ì¥à¤òºî¤Ã¤¿¡£");
#else
- msg_print("You make a golem.");
+ msg_print("You make a golem.");
#endif
}
else
{
- no_trump = TRUE;
+#ifdef JP
+ msg_print("¤¦¤Þ¤¯¥´¡¼¥ì¥à¤òºî¤ì¤Ê¤«¤Ã¤¿¡£");
+#else
+ msg_print("No Golems arrive.");
+#endif
}
break;
case 23: /* Magic armor */
break;
case 26: /* Total Knowledge */
return identify_fully(FALSE);
- break;
case 27: /* Enchant Weapon */
return enchant_spell(randint0(4) + 1, randint0(4) + 1, 0);
- break;
case 28: /* Enchant Armor */
return enchant_spell(0, 0, randint0(3) + 2);
- break;
case 29: /* Brand Weapon */
brand_weapon(randint0(18));
break;
#endif
break;
case 31: /* Immune */
- return (choose_ele_immune(13 + randint1(13)));
- break;
+ return choose_ele_immune(13 + randint1(13));
default:
msg_format("You cast an unknown Craft spell: %d.", spell);
msg_print(NULL);
}
- if (no_trump)
-#ifdef JP
-msg_print("¤¦¤Þ¤¯¥´¡¼¥ì¥à¤òºî¤ì¤Ê¤«¤Ã¤¿¡£");
-#else
- msg_print("No Golems arrive.");
-#endif
-
return TRUE;
}
}
if (!p_ptr->magic_num1[0]) return;
- set_action(ACTION_NONE);
+ /* Hack -- if called from set_action(), avoid recursive loop */
+ if (p_ptr->action == ACTION_SING) set_action(ACTION_NONE);
switch(p_ptr->magic_num1[0])
{
s16b cur_exp = p_ptr->spell_exp[(increment ? 32 : 0)+spell];
s16b exp_gain = 0;
- if (cur_exp < 900)
- exp_gain+=60;
- else if(cur_exp < 1200)
+ if (cur_exp < SPELL_EXP_BEGINNER)
+ exp_gain += 60;
+ else if (cur_exp < SPELL_EXP_SKILLED)
{
if ((dun_level > 4) && ((dun_level + 10) > p_ptr->lev))
exp_gain = 8;
}
- else if(cur_exp < 1400)
+ else if (cur_exp < SPELL_EXP_EXPERT)
{
if (((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel))
exp_gain = 2;
}
- else if((cur_exp < 1600) && !increment)
+ else if ((cur_exp < SPELL_EXP_MASTER) && !increment)
{
if (((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel))
exp_gain = 1;
}
- p_ptr->spell_exp[(increment ? 32 : 0)+spell] += exp_gain;
+ p_ptr->spell_exp[(increment ? 32 : 0) + spell] += exp_gain;
}
}
{
if (!force)
{
- int level = r_ptr->level;
- if (p_ptr->riding_ryoute) level += 20;
- if ((dam/2 + r_ptr->level) > (p_ptr->skill_exp[GINOU_RIDING]/30+10))
+ int cur = p_ptr->skill_exp[GINOU_RIDING];
+ int max = s_info[p_ptr->pclass].s_max[GINOU_RIDING];
+ int ridinglevel = r_ptr->level;
+
+ /* ÍîÇϤΤ·¤ä¤¹¤µ */
+ int rakubalevel = r_ptr->level;
+ if (p_ptr->riding_ryoute) rakubalevel += 20;
+
+ if ((cur < max) && (max > 1000) &&
+ (dam / 2 + ridinglevel) > (cur / 30 + 10))
{
- if((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && s_info[p_ptr->pclass].s_max[GINOU_RIDING] > 1000)
- {
- if (r_ptr->level*100 > (p_ptr->skill_exp[GINOU_RIDING] + 1500))
- p_ptr->skill_exp[GINOU_RIDING] += (1+(r_ptr->level - p_ptr->skill_exp[GINOU_RIDING]/100 - 15));
- else p_ptr->skill_exp[GINOU_RIDING]++;
- }
+ int inc = 0;
+
+ if (ridinglevel > (cur / 100 + 15))
+ inc += 1 + (ridinglevel - cur / 100 - 15);
+ else
+ inc += 1;
+
+ p_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
}
- if (randint0(dam/2 + level*2) < (p_ptr->skill_exp[GINOU_RIDING]/30+10))
+
+ /* ¥ì¥Ù¥ë¤ÎÄ㤤¾èÇϤ«¤é¤ÏÍîÇϤ·¤Ë¤¯¤¤ */
+ if (randint0(dam / 2 + rakubalevel * 2) < cur / 30 + 10)
{
- if ((((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) && !p_ptr->riding_ryoute) || !one_in_(p_ptr->lev*(p_ptr->riding_ryoute ? 2 : 3)+30))
+ if ((((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) && !p_ptr->riding_ryoute) || !one_in_(p_ptr->lev*(p_ptr->riding_ryoute ? 2 : 3) + 30))
{
return FALSE;
}
}
}
+
/* Check around the player */
for (i = 0; i < 8; i++)
{
return FALSE;
}
- if (r_info[m_ptr->r_idx].level > randint1((p_ptr->skill_exp[GINOU_RIDING]/50 + p_ptr->lev/2 +20)))
+ if (r_info[m_ptr->r_idx].level > randint1((p_ptr->skill_exp[GINOU_RIDING] / 50 + p_ptr->lev / 2 + 20)))
{
#ifdef JP
msg_print("¤¦¤Þ¤¯¾è¤ì¤Ê¤«¤Ã¤¿¡£");