OSDN Git Service

熟練度に関する数値が直接指定されていた部分を記号定数化.
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 4 May 2003 20:18:55 +0000 (20:18 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 4 May 2003 20:18:55 +0000 (20:18 +0000)
17 files changed:
src/birth.c
src/cmd1.c
src/cmd2.c
src/cmd4.c
src/cmd5.c
src/defines.h
src/dungeon.c
src/externs.h
src/files.c
src/init1.c
src/load.c
src/racial.c
src/spells3.c
src/tables.c
src/wizard2.c
src/xtra1.c
src/xtra2.c

index 13e73c7..0ef7b50 100644 (file)
@@ -2743,17 +2743,17 @@ static void get_extra(bool roll_hitdie)
 
        for (i = 0; i < 64; i++)
        {
-               if (p_ptr->pclass == CLASS_SORCERER) p_ptr->spell_exp[i] = 1600;
-               else if (p_ptr->pclass == CLASS_RED_MAGE) p_ptr->spell_exp[i] = 1200;
-               else p_ptr->spell_exp[i] = 0;
+               if (p_ptr->pclass == CLASS_SORCERER) p_ptr->spell_exp[i] = SPELL_EXP_MASTER;
+               else if (p_ptr->pclass == CLASS_RED_MAGE) p_ptr->spell_exp[i] = SPELL_EXP_SKILLED;
+               else p_ptr->spell_exp[i] = SPELL_EXP_UNSKILLED;
        }
 
        for (i = 0; i < 5; i++)
                for (j = 0; j < 64; j++)
                        p_ptr->weapon_exp[i][j] = s_info[p_ptr->pclass].w_start[i][j];
-       if(p_ptr->pseikaku == SEIKAKU_SEXY)
+       if ((p_ptr->pseikaku == SEIKAKU_SEXY) && (p_ptr->weapon_exp[TV_HAFTED-TV_BOW][SV_WHIP] < WEAPON_EXP_BEGINNER))
        {
-               p_ptr->weapon_exp[TV_HAFTED-TV_BOW][SV_WHIP] = 4000;
+               p_ptr->weapon_exp[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_BEGINNER;
        }
 
        for (i = 0; i < 10; i++)
index 606d783..749609d 100644 (file)
@@ -2034,14 +2034,14 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                {
                        if (p_ptr->skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
                        {
-                               if (p_ptr->skill_exp[GINOU_SUDE] < 4000)
-                                       p_ptr->skill_exp[GINOU_SUDE]+=40;
-                               else if((p_ptr->skill_exp[GINOU_SUDE] < 6000))
-                                       p_ptr->skill_exp[GINOU_SUDE]+=5;
-                               else if((p_ptr->skill_exp[GINOU_SUDE] < 7000) && (p_ptr->lev > 19))
-                                       p_ptr->skill_exp[GINOU_SUDE]+=1;
-                               else if((p_ptr->skill_exp[GINOU_SUDE] < 8000) && (p_ptr->lev > 34))
-                                       if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE]+=1;
+                               if (p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_BEGINNER)
+                                       p_ptr->skill_exp[GINOU_SUDE] += 40;
+                               else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_SKILLED))
+                                       p_ptr->skill_exp[GINOU_SUDE] += 5;
+                               else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19))
+                                       p_ptr->skill_exp[GINOU_SUDE] += 1;
+                               else if ((p_ptr->lev > 34))
+                                       if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE] += 1;
                                p_ptr->update |= (PU_BONUS);
                        }
                }
@@ -2056,10 +2056,10 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                        if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
                        {
                                int amount = 0;
-                               if (now_exp < 4000) amount = 80;
-                               else if(now_exp < 6000) amount = 10;
-                               else if((now_exp < 7000) && (p_ptr->lev > 19)) amount = 1;
-                               else if((p_ptr->lev > 34) && one_in_(2)) amount = 1;
+                               if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
+                               else if (now_exp < WEAPON_EXP_SKILLED) amount = 10;
+                               else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 1;
+                               else if ((p_ptr->lev > 34) && one_in_(2)) amount = 1;
                                p_ptr->weapon_exp[tval][sval] += amount;
                                p_ptr->update |= (PU_BONUS);
                        }
@@ -3243,14 +3243,14 @@ bool py_attack(int y, int x, int mode)
        {
                if ((p_ptr->skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((p_ptr->skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_info[m_ptr->r_idx].level))
                {
-                       if (p_ptr->skill_exp[GINOU_NITOURYU] < 4000)
-                               p_ptr->skill_exp[GINOU_NITOURYU]+=80;
-                       else if(p_ptr->skill_exp[GINOU_NITOURYU] < 6000)
-                               p_ptr->skill_exp[GINOU_NITOURYU]+=4;
-                       else if(p_ptr->skill_exp[GINOU_NITOURYU] < 7000)
-                               p_ptr->skill_exp[GINOU_NITOURYU]+=1;
-                       else if(p_ptr->skill_exp[GINOU_NITOURYU] < 8000)
-                               if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU]+=1;
+                       if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
+                               p_ptr->skill_exp[GINOU_NITOURYU] += 80;
+                       else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_SKILLED)
+                               p_ptr->skill_exp[GINOU_NITOURYU] += 4;
+                       else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_EXPERT)
+                               p_ptr->skill_exp[GINOU_NITOURYU] += 1;
+                       else if(p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_MASTER)
+                               if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU] += 1;
                        p_ptr->update |= (PU_BONUS);
                }
        }
@@ -3262,13 +3262,13 @@ bool py_attack(int y, int x, int mode)
 
                if (p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING])
                {
-                       if (((p_ptr->skill_exp[GINOU_RIDING] - 1000) / 200) < r_info[m_ptr->r_idx].level)
+                       if (((p_ptr->skill_exp[GINOU_RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200) < r_info[m_ptr->r_idx].level)
                                p_ptr->skill_exp[GINOU_RIDING]++;
 
                        /* Extra experience */
                        if ((p_ptr->skill_exp[GINOU_RIDING] / 100) < ridinglevel)
                        {
-                               if (((p_ptr->skill_exp[GINOU_RIDING] + 1500) / 100) < ridinglevel)
+                               if (((p_ptr->skill_exp[GINOU_RIDING] + (RIDING_EXP_SKILLED - RIDING_EXP_BEGINNER)) / 100) < ridinglevel)
                                        p_ptr->skill_exp[GINOU_RIDING] += (1 + (ridinglevel - (p_ptr->skill_exp[GINOU_RIDING] / 100 + 15)));
                                else p_ptr->skill_exp[GINOU_RIDING]++;
                        }
index 67f8324..d3149bc 100644 (file)
@@ -3663,9 +3663,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        /* Actually "fire" the object */
        bonus = (p_ptr->to_h_b + o_ptr->to_h + j_ptr->to_h);
        if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW))
-               chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval])/400 + bonus) * BTH_PLUS_ADJ);
+               chance = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + bonus) * BTH_PLUS_ADJ);
        else
-               chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval]-4000)/200 + bonus) * BTH_PLUS_ADJ);
+               chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + bonus) * BTH_PLUS_ADJ);
 
        energy_use = bow_energy(j_ptr->sval);
        tmul = bow_tmul(j_ptr->sval);
@@ -3821,9 +3821,9 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                if (now_exp < s_info[p_ptr->pclass].w_max[0][j_ptr->sval])
                                {
                                        int amount = 0;
-                                       if (now_exp < 4000) amount = 80;
-                                       else if (now_exp <  6000) amount = 25;
-                                       else if ((now_exp < 7000) && (p_ptr->lev > 19)) amount = 10;
+                                       if (now_exp < SPELL_EXP_BEGINNER) amount = 80;
+                                       else if (now_exp < SPELL_EXP_SKILLED) amount = 25;
+                                       else if ((now_exp < SPELL_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 10;
                                        else if (p_ptr->lev > 34) amount = 2;
                                        p_ptr->weapon_exp[0][j_ptr->sval] += amount;
                                        p_ptr->update |= (PU_BONUS);
@@ -3832,9 +3832,11 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
 
                        if (p_ptr->riding)
                        {
-                               if (p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING] && ((p_ptr->skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_list[p_ptr->riding].r_idx].level) && one_in_(2))
+                               if ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING])
+                                       && ((p_ptr->skill_exp[GINOU_RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < r_info[m_list[p_ptr->riding].r_idx].level)
+                                       && one_in_(2))
                                {
-                                       p_ptr->skill_exp[GINOU_RIDING]+=1;
+                                       p_ptr->skill_exp[GINOU_RIDING] += 1;
                                        p_ptr->update |= (PU_BONUS);
                                }
                        }
index 33c57a8..6817c0e 100644 (file)
@@ -6593,7 +6593,7 @@ static void do_cmd_knowledge_uniques(void)
  */
 static void do_cmd_knowledge_weapon_exp(void)
 {
-       int i,j, num, shougou;
+       int i, j, num, weapon_exp;
 
        FILE *fff;
 
@@ -6612,7 +6612,7 @@ static void do_cmd_knowledge_weapon_exp(void)
            return;
        }
 
-       for(i = 0; i < 5; i++)
+       for (i = 0; i < 5; i++)
        {
                for (num = 0; num < 64; num++)
                {
@@ -6620,22 +6620,18 @@ static void do_cmd_knowledge_weapon_exp(void)
                        {
                                object_kind *k_ptr = &k_info[j];
 
-                               if ((k_ptr->tval == TV_SWORD-i) && (k_ptr->sval == num))
+                               if ((k_ptr->tval == TV_SWORD - i) && (k_ptr->sval == num))
                                {
-                                       if((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
+                                       if ((k_ptr->tval == TV_BOW) && (k_ptr->sval == SV_CRIMSON)) continue;
 
-                                       if(p_ptr->weapon_exp[4-i][num]<4000) shougou=0;
-                                       else if(p_ptr->weapon_exp[4-i][num]<6000) shougou=1;
-                                       else if(p_ptr->weapon_exp[4-i][num]<7000) shougou=2;
-                                       else if(p_ptr->weapon_exp[4-i][num]<8000) shougou=3;
-                                       else shougou=4;
+                                       weapon_exp = p_ptr->weapon_exp[4 - i][num];
                                        strip_name(tmp, j);
-                                       fprintf(fff,"%-25s ",tmp);
-                                       if (p_ptr->weapon_exp[4-i][num] >= s_info[p_ptr->pclass].w_max[4-i][num]) fprintf(fff,"!");
-                                       else fprintf(fff," ");
-                                       fprintf(fff,"%s",shougou_moji[shougou]);
-                                       if (cheat_xtra) fprintf(fff," %d",p_ptr->weapon_exp[4-i][num]);
-                                       fprintf(fff,"\n");
+                                       fprintf(fff, "%-25s ", tmp);
+                                       if (weapon_exp >= s_info[p_ptr->pclass].w_max[4 - i][num]) fprintf(fff, "!");
+                                       else fprintf(fff, " ");
+                                       fprintf(fff, "%s", exp_level_str[weapon_exp_level(weapon_exp)]);
+                                       if (cheat_xtra) fprintf(fff, " %d", weapon_exp);
+                                       fprintf(fff, "\n");
                                        break;
                                }
                        }
@@ -6663,7 +6659,7 @@ static void do_cmd_knowledge_weapon_exp(void)
  */
 static void do_cmd_knowledge_spell_exp(void)
 {
-       int i=0, shougou;
+       int i = 0, spell_exp, exp_level;
 
        FILE *fff;
        magic_type *s_ptr;
@@ -6682,12 +6678,12 @@ static void do_cmd_knowledge_spell_exp(void)
            return;
        }
 
-       if(p_ptr->realm1 != REALM_NONE)
+       if (p_ptr->realm1 != REALM_NONE)
        {
 #ifdef JP
-               fprintf(fff,"%s¤ÎËâË¡½ñ\n",realm_names[p_ptr->realm1]);
+               fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm1]);
 #else
-               fprintf(fff,"%s Spellbook\n",realm_names[p_ptr->realm1]);
+               fprintf(fff, "%s Spellbook\n", realm_names[p_ptr->realm1]);
 #endif
                for (i = 0; i < 32; i++)
                {
@@ -6699,29 +6695,30 @@ static void do_cmd_knowledge_spell_exp(void)
                        {
                                s_ptr = &mp_ptr->info[p_ptr->realm1 - 1][i];
                        }
-                       if(s_ptr->slevel == 99) continue;
-                       if(p_ptr->spell_exp[i]<900) shougou=0;
-                       else if(p_ptr->spell_exp[i]<1200) shougou=1;
-                       else if(p_ptr->spell_exp[i]<1400) shougou=2;
-                       else if(p_ptr->spell_exp[i]<1600) shougou=3;
-                       else shougou=4;
-                       fprintf(fff,"%-25s ",spell_names[technic2magic(p_ptr->realm1)-1][i]);
+                       if (s_ptr->slevel >= 99) continue;
+                       spell_exp = p_ptr->spell_exp[i];
+                       exp_level = spell_exp_level(spell_exp);
+                       fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm1) - 1][i]);
                        if (p_ptr->realm1 == REALM_HISSATSU)
-                               fprintf(fff,"[--]");
+                               fprintf(fff, "[--]");
                        else
                        {
-                               if (shougou == 4) fprintf(fff,"!");
-                               else fprintf(fff," ");
-                               fprintf(fff,"%s",shougou_moji[shougou]);
+                               if (exp_level >= EXP_LEVEL_MASTER) fprintf(fff, "!");
+                               else fprintf(fff, " ");
+                               fprintf(fff, "%s", exp_level_str[exp_level]);
                        }
-                       if (cheat_xtra) fprintf(fff," %d",p_ptr->spell_exp[i]);
-                       fprintf(fff,"\n");
+                       if (cheat_xtra) fprintf(fff, " %d", spell_exp);
+                       fprintf(fff, "\n");
                }
        }
 
-       if(p_ptr->realm2 != REALM_NONE)
+       if (p_ptr->realm2 != REALM_NONE)
        {
-               fprintf(fff,"\n%s Spellbook\n",realm_names[p_ptr->realm2]);
+#ifdef JP
+               fprintf(fff, "%s¤ÎËâË¡½ñ\n", realm_names[p_ptr->realm2]);
+#else
+               fprintf(fff, "\n%s Spellbook\n", realm_names[p_ptr->realm2]);
+#endif
                for (i = 0; i < 32; i++)
                {
                        if (!is_magic(p_ptr->realm1))
@@ -6732,18 +6729,16 @@ static void do_cmd_knowledge_spell_exp(void)
                        {
                                s_ptr = &mp_ptr->info[p_ptr->realm2 - 1][i];
                        }
-                       if(s_ptr->slevel == 99) continue;
+                       if (s_ptr->slevel >= 99) continue;
 
-                       if(p_ptr->spell_exp[i+32]<900) shougou=0;
-                       else if(p_ptr->spell_exp[i+32]<1200) shougou=1;
-                       else if(p_ptr->spell_exp[i+32]<1400) shougou=2;
-                       else shougou=3;
-                       fprintf(fff,"%-25s ",spell_names[technic2magic(p_ptr->realm2)-1][i]);
-                       if (shougou == 3) fprintf(fff,"!");
-                       else fprintf(fff," ");
-                       fprintf(fff,"%s",shougou_moji[shougou]);
-                       if (cheat_xtra) fprintf(fff," %d",p_ptr->spell_exp[i+32]);
-                       fprintf(fff,"\n");
+                       spell_exp = p_ptr->spell_exp[i + 32];
+                       exp_level = spell_exp_level(spell_exp);
+                       fprintf(fff, "%-25s ", spell_names[technic2magic(p_ptr->realm2) - 1][i]);
+                       if (exp_level >= EXP_LEVEL_EXPERT) fprintf(fff, "!");
+                       else fprintf(fff, " ");
+                       fprintf(fff, "%s", exp_level_str[exp_level]);
+                       if (cheat_xtra) fprintf(fff, " %d", spell_exp);
+                       fprintf(fff, "\n");
                }
        }
 
@@ -6768,7 +6763,7 @@ static void do_cmd_knowledge_spell_exp(void)
  */
 static void do_cmd_knowledge_skill_exp(void)
 {
-       int i=0, shougou;
+       int i = 0, skill_exp;
 
        FILE *fff;
 
@@ -6793,28 +6788,13 @@ static void do_cmd_knowledge_skill_exp(void)
 
        for (i = 0; i < 3; i++)
        {
-               if(i == GINOU_RIDING)
-               {
-                       if(p_ptr->skill_exp[i]<500) shougou=0;
-                       else if(p_ptr->skill_exp[i]<2000) shougou=1;
-                       else if(p_ptr->skill_exp[i]<5000) shougou=2;
-                       else if(p_ptr->skill_exp[i]<8000) shougou=3;
-                       else shougou=4;
-               }
-               else
-               {
-                       if(p_ptr->skill_exp[i]<4000) shougou=0;
-                       else if(p_ptr->skill_exp[i]<6000) shougou=1;
-                       else if(p_ptr->skill_exp[i]<7000) shougou=2;
-                       else if(p_ptr->skill_exp[i]<8000) shougou=3;
-                       else shougou=4;
-               }
-               fprintf(fff,"%-20s ",skill_name[i]);
-               if (p_ptr->skill_exp[i] == s_info[p_ptr->pclass].s_max[i]) fprintf(fff,"!");
-               else fprintf(fff," ");
-               fprintf(fff,"%s",shougou_moji[shougou]);
-               if (cheat_xtra) fprintf(fff," %d",p_ptr->skill_exp[i]);
-               fprintf(fff,"\n");
+               skill_exp = p_ptr->skill_exp[i];
+               fprintf(fff, "%-20s ", skill_name[i]);
+               if (skill_exp >= s_info[p_ptr->pclass].s_max[i]) fprintf(fff, "!");
+               else fprintf(fff, " ");
+               fprintf(fff, "%s", exp_level_str[(i == GINOU_RIDING) ? riding_exp_level(skill_exp) : weapon_exp_level(skill_exp)]);
+               if (cheat_xtra) fprintf(fff, " %d", skill_exp);
+               fprintf(fff, "\n");
        }
 
        /* Close the file */
index d979e12..7d44c17 100644 (file)
@@ -555,24 +555,24 @@ s = "
 
 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]);
@@ -799,9 +799,9 @@ msg_format("
 
        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)
@@ -821,31 +821,31 @@ msg_format("
                {
                        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
@@ -882,14 +882,21 @@ msg_format("
        /* 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);
@@ -902,17 +909,12 @@ msg_format("
        {
                /* 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
 
@@ -5112,24 +5114,24 @@ msg_print("An infernal sound echoed.");
                        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;
                }
        }
 
@@ -5497,18 +5499,18 @@ bool rakuba(int dam, bool 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))
+                       if ((dam / 2 + r_ptr->level) > (p_ptr->skill_exp[GINOU_RIDING] / 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 ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING]) && s_info[p_ptr->pclass].s_max[GINOU_RIDING] > (RIDING_EXP_BEGINNER * 2))
                                {
-                                       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));
+                                       if (r_ptr->level * 100 > (p_ptr->skill_exp[GINOU_RIDING] + (RIDING_EXP_SKILLED - RIDING_EXP_BEGINNER)))
+                                               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]++;
                                }
                        }
-                       if (randint0(dam/2 + level*2) < (p_ptr->skill_exp[GINOU_RIDING]/30+10))
+                       if (randint0(dam / 2 + level * 2) < (p_ptr->skill_exp[GINOU_RIDING] / 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;
                                }
@@ -5711,7 +5713,7 @@ msg_print("
 
                        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("¤¦¤Þ¤¯¾è¤ì¤Ê¤«¤Ã¤¿¡£");
index bc5c576..694b2f2 100644 (file)
@@ -4411,6 +4411,34 @@ extern int PlayerUID;
 #define GINOU_NITOURYU   1
 #define GINOU_RIDING      2
 
+/* Proficiency level */
+#define EXP_LEVEL_UNSKILLED 0
+#define EXP_LEVEL_BEGINNER  1
+#define EXP_LEVEL_SKILLED   2
+#define EXP_LEVEL_EXPERT    3
+#define EXP_LEVEL_MASTER    4
+
+/* Proficiency of weapons and misc. skills (except riding) */
+#define WEAPON_EXP_UNSKILLED     0
+#define WEAPON_EXP_BEGINNER   4000
+#define WEAPON_EXP_SKILLED    6000
+#define WEAPON_EXP_EXPERT     7000
+#define WEAPON_EXP_MASTER     8000
+
+/* Proficiency of riding */
+#define RIDING_EXP_UNSKILLED     0
+#define RIDING_EXP_BEGINNER    500
+#define RIDING_EXP_SKILLED    2000
+#define RIDING_EXP_EXPERT     5000
+#define RIDING_EXP_MASTER     8000
+
+/* Proficiency of spells */
+#define SPELL_EXP_UNSKILLED      0
+#define SPELL_EXP_BEGINNER     900
+#define SPELL_EXP_SKILLED     1200
+#define SPELL_EXP_EXPERT      1400
+#define SPELL_EXP_MASTER      1600
+
 #define NO_TOWN 6
 #define SECRET_TOWN 5
 
index 30a84b1..02cb024 100644 (file)
@@ -1492,14 +1492,14 @@ static void check_music(void)
                        p_ptr->redraw |= (PR_STATUS);
                }
        }
-       if (p_ptr->spell_exp[spell] < 900)
-               p_ptr->spell_exp[spell]+=5;
-       else if(p_ptr->spell_exp[spell] < 1200)
-               {if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell]+=1;}
-       else if(p_ptr->spell_exp[spell] < 1400)
-               {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell]+=1;}
-       else if(p_ptr->spell_exp[spell] < 1600)
-               {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell]+=1;}
+       if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
+               p_ptr->spell_exp[spell] += 5;
+       else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
+       { if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
+       else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
+       { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
+       else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
+       { if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
 
        gere_music(p_ptr->magic_num1[0]);
 }
@@ -6466,8 +6466,8 @@ quit("
        panel_col_min = cur_wid;
 
        /* Sexy gal gets bonus to maximum weapon skill of whip */
-       if(p_ptr->pseikaku == SEIKAKU_SEXY)
-               s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = 8000;
+       if (p_ptr->pseikaku == SEIKAKU_SEXY)
+               s_info[p_ptr->pclass].w_max[TV_HAFTED-TV_BOW][SV_WHIP] = WEAPON_EXP_MASTER;
 
        /* Fill the arrays of floors and walls in the good proportions */
        set_floor_and_wall(dungeon_type);
index c56b761..4bee679 100644 (file)
@@ -107,7 +107,7 @@ extern int monk_ave_damage[PY_MAX_LEVEL+1][3];
 extern cptr game_inscriptions[];
 extern kamae kamae_shurui[MAX_KAMAE];
 extern kamae kata_shurui[MAX_KATA];
-extern cptr shougou_moji[5];
+extern cptr exp_level_str[5];
 extern byte conv_terrain2feat[MAX_WILDERNESS];
 extern cptr silly_attacks[MAX_SILLY_ATTACK];
 extern monster_power monster_powers[MAX_MONSPELLS];
@@ -1329,6 +1329,9 @@ extern s16b gain_energy(void);
 extern s16b bow_energy(int sval);
 extern int bow_tmul(int sval);
 extern cptr your_alignment(void);
+extern int weapon_exp_level(int weapon_exp);
+extern int riding_exp_level(int riding_exp);
+extern int spell_exp_level(int spell_exp);
 
 /* mspells1.c */
 extern bool clean_shot(int y1, int x1, int y2, int x2, bool friend);
index 5d81439..27a24cc 100644 (file)
@@ -1758,13 +1758,13 @@ static void display_player_middle(void)
        if (object_known_p(o_ptr)) show_todam += o_ptr->to_d;
 
        if ((o_ptr->sval == SV_LIGHT_XBOW) || (o_ptr->sval == SV_HEAVY_XBOW))
-               show_tohit += (p_ptr->weapon_exp[0][o_ptr->sval])/400;
+               show_tohit += p_ptr->weapon_exp[0][o_ptr->sval] / 400;
        else
-               show_tohit += (p_ptr->weapon_exp[0][o_ptr->sval]-4000)/200;
+               show_tohit += (p_ptr->weapon_exp[0][o_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200;
 
        /* Range attacks */
        display_player_one_line(ENTRY_SHOOT_HIT_DAM, format("(%+d,%+d)", show_tohit, show_todam), TERM_L_BLUE);
-       
+
        if (inventory[INVEN_BOW].k_idx)
        {
                tmul = bow_tmul(inventory[INVEN_BOW].sval);
index 530d48b..d7cd5c2 100644 (file)
@@ -981,13 +981,18 @@ errr parse_s_info(char *buf, header *head)
        else if (buf[0] == 'W')
        {
                int tval, sval, start, max;
-               const s16b exp_conv_table[] = { 0, 4000, 6000, 7000, 8000 };
+               const s16b exp_conv_table[] =
+               {
+                       WEAPON_EXP_UNSKILLED, WEAPON_EXP_BEGINNER, WEAPON_EXP_SKILLED,
+                       WEAPON_EXP_EXPERT, WEAPON_EXP_MASTER
+               };
 
                /* Scan for the values */
                if (4 != sscanf(buf+2, "%d:%d:%d:%d",
                                &tval, &sval, &start, &max)) return (1);
 
-               if (start < 0 || start > 4 || max < 0 || max > 4) return (8);
+               if (start < EXP_LEVEL_UNSKILLED || start > EXP_LEVEL_MASTER
+                       || max < EXP_LEVEL_UNSKILLED || max > EXP_LEVEL_MASTER) return (8);
 
                /* Save the values */
                s_ptr->w_start[tval][sval] = exp_conv_table[start];
@@ -1003,7 +1008,8 @@ errr parse_s_info(char *buf, header *head)
                if (3 != sscanf(buf+2, "%d:%d:%d",
                                &num, &start, &max)) return (1);
 
-               if (start < 0 || start > 8000 || max < 0 || max > 8000) return (8);
+               if (start < WEAPON_EXP_UNSKILLED || start > WEAPON_EXP_MASTER
+                       || max < WEAPON_EXP_UNSKILLED || max > WEAPON_EXP_MASTER) return (8);
 
                /* Save the values */
                s_ptr->s_start[num] = start;
index 0861cfc..24e65de 100644 (file)
@@ -1412,7 +1412,7 @@ static void rd_extra(void)
        for (i = 0; i < 64; i++) rd_s16b(&p_ptr->spell_exp[i]);
        if ((p_ptr->pclass == CLASS_SORCERER) && z_older_than(10, 4, 2))
        {
-               for (i = 0; i < 64; i++) p_ptr->spell_exp[i] = 1600;
+               for (i = 0; i < 64; i++) p_ptr->spell_exp[i] = SPELL_EXP_MASTER;
        }
        if (z_older_than(10, 3, 6))
                for (i = 0; i < 5; i++) for (j = 0; j < 60; j++) rd_s16b(&p_ptr->weapon_exp[i][j]);
index 302e57e..7e7a478 100644 (file)
@@ -1234,7 +1234,10 @@ static bool cmd_racial_power_aux(s32b command)
                        rlev = r_ptr->level;
                        if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
                        if (rlev > 60) rlev = 60+(rlev-60)/2;
-                       if ((randint1(p_ptr->skill_exp[GINOU_RIDING]/120+p_ptr->lev*2/3) > rlev) && one_in_(2) && !p_ptr->inside_arena && !p_ptr->inside_battle && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR)) && (rlev < p_ptr->lev*3/2+randint0(p_ptr->lev/5)))
+                       if ((randint1(p_ptr->skill_exp[GINOU_RIDING] / 120 + p_ptr->lev * 2 / 3) > rlev)
+                           && one_in_(2) && !p_ptr->inside_arena && !p_ptr->inside_battle
+                           && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
+                           && (rlev < p_ptr->lev * 3 / 2 + randint0(p_ptr->lev / 5)))
                        {
 #ifdef JP
                                msg_format("%s¤ò¼ê¤Ê¤º¤±¤¿¡£",m_name);
index cbb8fc4..526bbd5 100644 (file)
@@ -3897,8 +3897,8 @@ strcpy(name, "(Ƚ
  */
 s16b experience_of_spell(int spell, int use_realm)
 {
-       if (p_ptr->pclass == CLASS_SORCERER) return 1600;
-       else if (p_ptr->pclass == CLASS_RED_MAGE) return 1200;
+       if (p_ptr->pclass == CLASS_SORCERER) return SPELL_EXP_MASTER;
+       else if (p_ptr->pclass == CLASS_RED_MAGE) return SPELL_EXP_SKILLED;
        else if (use_realm == p_ptr->realm1) return p_ptr->spell_exp[spell];
        else if (use_realm == p_ptr->realm2) return p_ptr->spell_exp[spell + 32];
        else return 0;
@@ -3968,7 +3968,7 @@ s16b spell_chance(int spell, int use_realm)
        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-p_ptr->skill_exp[GINOU_RIDING]/100-10,0));
+               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 */
        need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
@@ -4021,8 +4021,8 @@ s16b spell_chance(int spell, int use_realm)
            || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
        {
                s16b exp = experience_of_spell(spell, use_realm);
-               if(exp > 1399) chance--;
-               if(exp > 1599) chance--;
+               if (exp >= SPELL_EXP_EXPERT) chance--;
+               if (exp >= SPELL_EXP_MASTER) chance--;
        }
        if(p_ptr->dec_mana) chance--;
        if (p_ptr->heavy_spell) chance += 5;
@@ -4420,7 +4420,7 @@ static void spell_info(char *p, int spell, int use_realm)
  */
 void print_spells(int target_spell, byte *spells, int num, int y, int x, int use_realm)
 {
-       int             i, spell, shougou, increment = 64;
+       int             i, spell, exp_level, increment = 64;
        magic_type      *s_ptr;
        cptr            comment;
        char            info[80];
@@ -4492,20 +4492,16 @@ put_str(buf, y, x + 29);
                        /* Extract mana consumption rate */
                        need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
 
-                       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;
+                       if ((increment == 64) || (s_ptr->slevel >= 99)) exp_level = EXP_LEVEL_UNSKILLED;
+                       else exp_level = spell_exp_level(exp);
 
                        max = FALSE;
-                       if (!increment && (shougou == 4)) max = TRUE;
-                       else if ((increment == 32) && (shougou >= 3)) max = TRUE;
+                       if (!increment && (exp_level == EXP_LEVEL_MASTER)) max = TRUE;
+                       else if ((increment == 32) && (exp_level >= EXP_LEVEL_EXPERT)) max = TRUE;
                        else if (s_ptr->slevel >= 99) max = TRUE;
-                       else if ((p_ptr->pclass == CLASS_RED_MAGE) && (shougou >= 2)) max = TRUE;
+                       else if ((p_ptr->pclass == CLASS_RED_MAGE) && (exp_level >= EXP_LEVEL_SKILLED)) max = TRUE;
 
-                       strncpy(ryakuji,shougou_moji[shougou],4);
+                       strncpy(ryakuji, exp_level_str[exp_level], 4);
                        ryakuji[3] = ']';
                        ryakuji[4] = '\0';
                }
index 2eabe0c..1dc9cfc 100644 (file)
@@ -7829,7 +7829,7 @@ kamae kata_shurui[MAX_KATA] =
 #endif
 };
 
-cptr shougou_moji[5]=
+cptr exp_level_str[5]=
 #ifdef JP
 {"[½é¿´¼Ô]", "[ÆþÌç¼Ô]", "[½ÏÎý¼Ô]", "[¥¨¥­¥¹¥Ñ¡¼¥È]", "[ã¿Í]"};
 #else
index 99bc01a..091caf1 100644 (file)
@@ -380,7 +380,7 @@ static void do_cmd_wiz_change_aux(void)
 
 
        /* Default */
-       sprintf(tmp_val, "8000");
+       sprintf(tmp_val, "%d", WEAPON_EXP_MASTER);
 
        /* Query */
 #ifdef JP
@@ -393,10 +393,10 @@ static void do_cmd_wiz_change_aux(void)
        tmp_s16b = atoi(tmp_val);
 
        /* Verify */
-       if (tmp_s16b < 0) tmp_s16b = 0L;
-       if (tmp_s16b > 8000) tmp_s16b = 8000L;
+       if (tmp_s16b < WEAPON_EXP_UNSKILLED) tmp_s16b = WEAPON_EXP_UNSKILLED;
+       if (tmp_s16b > WEAPON_EXP_MASTER) tmp_s16b = WEAPON_EXP_MASTER;
 
-       for (j = 0; j <= TV_SWORD - TV_BOW;j++)
+       for (j = 0; j <= TV_SWORD - TV_BOW; j++)
        {
                for (i = 0;i < 64;i++)
                {
@@ -412,9 +412,9 @@ static void do_cmd_wiz_change_aux(void)
        }
 
        for (j = 0; j < 32; j++)
-               p_ptr->spell_exp[j] = (tmp_s16b > 1600 ? 1600 : tmp_s16b);
+               p_ptr->spell_exp[j] = (tmp_s16b > SPELL_EXP_MASTER ? SPELL_EXP_MASTER : tmp_s16b);
        for (; j < 64; j++)
-               p_ptr->spell_exp[j] = (tmp_s16b > 1400 ? 1400 : tmp_s16b);
+               p_ptr->spell_exp[j] = (tmp_s16b > SPELL_EXP_EXPERT ? SPELL_EXP_EXPERT : tmp_s16b);
 
        /* Default */
        sprintf(tmp_val, "%ld", (long)(p_ptr->au));
index d81ec9b..ce63c03 100644 (file)
@@ -4524,15 +4524,15 @@ void calc_bonuses(void)
 
        if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
        {
-               p_ptr->to_h[0] += (p_ptr->skill_exp[GINOU_SUDE]-4000)/200;
-               p_ptr->dis_to_h[0] += (p_ptr->skill_exp[GINOU_SUDE]-4000)/200;
+               p_ptr->to_h[0] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
+               p_ptr->dis_to_h[0] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
        }
 
        if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
        {
                int penalty1, penalty2;
-               penalty1 = ((100-p_ptr->skill_exp[GINOU_NITOURYU]/160) - (130-inventory[INVEN_RARM].weight)/8);
-               penalty2 = ((100-p_ptr->skill_exp[GINOU_NITOURYU]/160) - (130-inventory[INVEN_LARM].weight)/8);
+               penalty1 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_RARM].weight) / 8);
+               penalty2 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_LARM].weight) / 8);
                if ((inventory[INVEN_RARM].name1 == ART_QUICKTHORN) && (inventory[INVEN_LARM].name1 == ART_TINYTHORN))
                {
                        penalty1 = penalty1 / 2 - 5;
@@ -4584,7 +4584,7 @@ void calc_bonuses(void)
                int speed = m_list[p_ptr->riding].mspeed;
                if (m_list[p_ptr->riding].mspeed > 110)
                {
-                       p_ptr->pspeed = 110 + (s16b)((speed-110)*(p_ptr->skill_exp[GINOU_RIDING]*3 + p_ptr->lev*160L - 10000L)/(22000L));
+                       p_ptr->pspeed = 110 + (s16b)((speed - 110) * (p_ptr->skill_exp[GINOU_RIDING] * 3 + p_ptr->lev * 160L - 10000L) / (22000L));
                        if (p_ptr->pspeed < 110) p_ptr->pspeed = 110;
                }
                else
@@ -4596,7 +4596,7 @@ void calc_bonuses(void)
                if (r_info[m_list[p_ptr->riding].r_idx].flags7 & RF7_CAN_FLY) p_ptr->ffall = TRUE;
                if (r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE;
 
-               if (p_ptr->skill_exp[GINOU_RIDING] < 2000) j += (p_ptr->wt*3*(2000 - p_ptr->skill_exp[GINOU_RIDING]))/2000;
+               if (p_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED) j += (p_ptr->wt * 3 * (RIDING_EXP_SKILLED - p_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
 
                i = 3000 + r_info[m_list[p_ptr->riding].r_idx].level * 50;
        }
@@ -5113,13 +5113,13 @@ void calc_bonuses(void)
 
        for (i = 0 ; i < 2 ; i++)
        {
-               if(buki_motteruka(INVEN_RARM+i))
+               if (buki_motteruka(INVEN_RARM+i))
                {
                        int tval = inventory[INVEN_RARM+i].tval - TV_BOW;
                        int sval = inventory[INVEN_RARM+i].sval;
 
-                       p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval]-4000)/200;
-                       p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval]-4000)/200;
+                       p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
+                       p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
                        if ((p_ptr->pclass == CLASS_MONK) && !(s_info[CLASS_MONK].w_max[tval][sval]))
                        {
                                p_ptr->to_h[i] -= 40;
@@ -5134,7 +5134,7 @@ void calc_bonuses(void)
                        }
                        else if (p_ptr->pclass == CLASS_NINJA)
                        {
-                               if ((s_info[CLASS_NINJA].w_max[tval][sval] <= 4000) || (inventory[INVEN_LARM-i].tval == TV_SHIELD))
+                               if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (inventory[INVEN_LARM-i].tval == TV_SHIELD))
                                {
                                        p_ptr->to_h[i] -= 40;
                                        p_ptr->dis_to_h[i] -= 40;
index b720214..cfb8b51 100644 (file)
@@ -5946,4 +5946,40 @@ cptr your_alignment(void)
 }
 
 
+/*
+ * Return proficiency level of weapons and misc. skills (except riding)
+ */
+int weapon_exp_level(int weapon_exp)
+{
+       if (weapon_exp < WEAPON_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
+       else if (weapon_exp < WEAPON_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
+       else if (weapon_exp < WEAPON_EXP_EXPERT) return EXP_LEVEL_SKILLED;
+       else if (weapon_exp < WEAPON_EXP_MASTER) return EXP_LEVEL_EXPERT;
+       else return EXP_LEVEL_MASTER;
+}
 
+
+/*
+ * Return proficiency level of riding
+ */
+int riding_exp_level(int riding_exp)
+{
+       if (riding_exp < RIDING_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
+       else if (riding_exp < RIDING_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
+       else if (riding_exp < RIDING_EXP_EXPERT) return EXP_LEVEL_SKILLED;
+       else if (riding_exp < RIDING_EXP_MASTER) return EXP_LEVEL_EXPERT;
+       else return EXP_LEVEL_MASTER;
+}
+
+
+/*
+ * Return proficiency level of spells
+ */
+int spell_exp_level(int spell_exp)
+{
+       if (spell_exp < SPELL_EXP_BEGINNER) return EXP_LEVEL_UNSKILLED;
+       else if (spell_exp < SPELL_EXP_SKILLED) return EXP_LEVEL_BEGINNER;
+       else if (spell_exp < SPELL_EXP_EXPERT) return EXP_LEVEL_SKILLED;
+       else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
+       else return EXP_LEVEL_MASTER;
+}