};
-
/*!
* @brief 基本必要経験値テーブル /
* Base experience levels, may be adjusted up for race and/or class
5000000L
};
-
/*!
* @brief 基本必要強化値テーブル(アンドロイド専用)
*/
5000000L
};
-
/*!
* 知力/賢さによるレベル毎の習得可能魔法数テーブル
* Stat Table (INT/WIS) -- Number of half-spells per level
6 /* 18/220+ */
};
-
/*!
* 知力/賢さによるMP修正テーブル
* Stat Table (INT/WIS) -- extra 1/4-mana-points per level
30 /* 18/220+ */
};
-
/*!
* 知力/賢さによる最低魔法失敗率テーブル
* Stat Table (INT/WIS) -- Minimum failure rate (percentage)
0 /* 18/220+ */
};
-
/*!
* 知力/賢さによる魔法失敗率修正テーブル
* Stat Table (INT/WIS) -- Various things
20 /* 18/220+ */
};
-
/*!
* 魅力による店での取引修正テーブル
* Stat Table (CHR) -- payment percentages
78 /* 18/220+ */
};
-
/*!
* 知力による魔道具使用修正テーブル
* Stat Table (INT) -- Magic devices
20 /* 18/220+ */
};
-
/*!
* 賢さによる魔法防御修正テーブル
* Stat Table (WIS) -- Saving throw
19 /* 18/220+ */
};
-
/*!
* 器用さによるトラップ解除修正テーブル
* Stat Table (DEX) -- disarming
10 /* 18/220+ */
};
-
/*!
* 知力によるトラップ解除修正テーブル
* Stat Table (INT) -- disarming
20 /* 18/220+ */
};
-
/*!
* 器用さによるAC修正テーブル
* Stat Table (DEX) -- bonus to ac (plus 128)
128 + 16 /* 18/220+ */
};
-
/*!
* 腕力によるダメージ修正テーブル
* Stat Table (STR) -- bonus to dam (plus 128)
128 + 20 /* 18/220+ */
};
-
/*!
* 器用度による命中修正テーブル
* Stat Table (DEX) -- bonus to hit (plus 128)
128 + 16 /* 18/220+ */
};
-
/*!
* 腕力による命中修正テーブル
* Stat Table (STR) -- bonus to hit (plus 128)
128 + 16 /* 18/220+ */
};
-
/*!
* 腕力による基本所持重量値テーブル
* Stat Table (STR) -- weight limit in deca-pounds
39 /* 18/220+ */
};
-
/*!
* 腕力による武器重量限界値テーブル
* Stat Table (STR) -- weapon weight limit in pounds
50 /* 18/220+ */
};
-
/*!
* 腕力による採掘能力修正値テーブル
* Stat Table (STR) -- digging value
100 /* 18/220+ */
};
-
/*!
* 耐久による基本HP自然治癒値テーブル /
* Stat Table (CON) -- base regeneration rate
9 /* 18/220+ */
};
-
/*!
* 耐久による基本HP自然治癒値テーブル /
* Stat Table (CON) -- extra 1/4-hitpoints per level (plus 128)
128 + 48 /* 18/220+ */
};
-
/*!
* 魅力による魅了能力修正テーブル /
* Stat Table (CHR) -- charm
85 /* 18/220+ */
};
-
/*** Player information ***/
/*
*/
void calc_bonuses(player_type *creature_ptr)
{
- int i, j, hold;
+ int hold;
int new_speed;
int default_hand = 0;
int empty_hands_status = empty_hands(creature_ptr, TRUE);
bool yoiyami = FALSE;
bool down_saving = FALSE;
-#if 0
- bool have_dd_s = FALSE, have_dd_t = FALSE;
-#endif
bool have_sw = FALSE, have_kabe = FALSE;
bool easy_2weapon = FALSE;
bool riding_levitation = FALSE;
bool old_mighty_throw = creature_ptr->mighty_throw;
/* Current feature under player. */
- feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ feature_type *f_ptr = &f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
/* Save the old armor class */
ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac;
ARMOUR_CLASS old_dis_to_a = creature_ptr->dis_to_a;
-
/* Clear extra blows/shots */
extra_blows[0] = extra_blows[1] = 0;
/* Clear the stat modifiers */
- for (i = 0; i < A_MAX; i++) creature_ptr->stat_add[i] = 0;
+ for (int i = 0; i < A_MAX; i++) creature_ptr->stat_add[i] = 0;
/* Clear the Displayed/Real armor class */
if (!creature_ptr->migite) default_hand = 1;
}
- if (CAN_TWO_HANDS_WIELDING())
+ if (can_two_hands_wielding(creature_ptr))
{
if (creature_ptr->migite && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) &&
object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM]))
{
creature_ptr->resist_neth = TRUE;
}
+
if (creature_ptr->tim_sh_fire)
{
creature_ptr->sh_fire = TRUE;
}
+
if (creature_ptr->tim_res_time)
{
creature_ptr->resist_time = TRUE;
new_speed += (creature_ptr->lev) / 10 + 5;
}
- if (music_singing(p_ptr, MUSIC_WALL))
+ if (music_singing(creature_ptr, MUSIC_WALL))
{
creature_ptr->kill_wall = TRUE;
}
/* Hack -- apply racial/class stat maxes */
/* Apply the racial modifiers */
- for (i = 0; i < A_MAX; i++)
+ for (int i = 0; i < A_MAX; i++)
{
/* Modify the stats for "race" */
creature_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
}
-
/* I'm adding the mutations here for the lack of a better place... */
if (creature_ptr->muta3)
{
}
/* Scan the usable creature_ptr->inventory_list */
- for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
int bonus_to_h, bonus_to_d;
o_ptr = &creature_ptr->inventory_list[i];
creature_ptr->dis_to_h[i - INVEN_RIGHT] += (s16b)bonus_to_h;
creature_ptr->dis_to_d[i - INVEN_RIGHT] += (s16b)bonus_to_d;
}
+
+ continue;
}
- else if (creature_ptr->migite && creature_ptr->hidarite)
+
+ if (creature_ptr->migite && creature_ptr->hidarite)
{
/* Apply the bonuses to hit/damage */
creature_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
creature_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
/* Apply the mental bonuses tp hit/damage, if known */
- if (object_is_known(o_ptr))
- {
- creature_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
- creature_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
- creature_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
- creature_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
- }
- }
- else
- {
- /* Apply the bonuses to hit/damage */
- creature_ptr->to_h[default_hand] += (s16b)bonus_to_h;
- creature_ptr->to_d[default_hand] += (s16b)bonus_to_d;
+ if (!object_is_known(o_ptr)) continue;
- /* Apply the mental bonuses to hit/damage, if known */
- if (object_is_known(o_ptr))
- {
- creature_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h;
- creature_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d;
- }
+ creature_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
+ creature_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
+ creature_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
+ creature_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
+ continue;
}
+
+ /* Apply the bonuses to hit/damage */
+ creature_ptr->to_h[default_hand] += (s16b)bonus_to_h;
+ creature_ptr->to_d[default_hand] += (s16b)bonus_to_d;
+
+ /* Apply the mental bonuses to hit/damage, if known */
+ if (!object_is_known(o_ptr)) continue;
+
+ creature_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h;
+ creature_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d;
}
/* Shield skill bonus */
if (creature_ptr->special_defense & KATA_KOUKIJIN)
{
- for (i = 0; i < A_MAX; i++)
+ for (int i = 0; i < A_MAX; i++)
creature_ptr->stat_add[i] += 5;
creature_ptr->to_a -= 50;
creature_ptr->dis_to_a -= 50;
/* Hex bonuses */
if (creature_ptr->realm1 == REALM_HEX)
{
- if (hex_spelling_any(p_ptr)) creature_ptr->skill_stl -= (1 + CASTING_HEX_NUM(creature_ptr));
- if (hex_spelling(HEX_DETECT_EVIL)) creature_ptr->esp_evil = TRUE;
- if (hex_spelling(HEX_XTRA_MIGHT)) creature_ptr->stat_add[A_STR] += 4;
- if (hex_spelling(HEX_BUILDING))
+ if (hex_spelling_any(creature_ptr)) creature_ptr->skill_stl -= (1 + CASTING_HEX_NUM(creature_ptr));
+ if (hex_spelling(creature_ptr, HEX_DETECT_EVIL)) creature_ptr->esp_evil = TRUE;
+ if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) creature_ptr->stat_add[A_STR] += 4;
+ if (hex_spelling(creature_ptr, HEX_BUILDING))
{
creature_ptr->stat_add[A_STR] += 4;
creature_ptr->stat_add[A_DEX] += 4;
creature_ptr->stat_add[A_CON] += 4;
}
- if (hex_spelling(HEX_DEMON_AURA))
+
+ if (hex_spelling(creature_ptr, HEX_DEMON_AURA))
{
creature_ptr->sh_fire = TRUE;
creature_ptr->regenerate = TRUE;
}
- if (hex_spelling(HEX_ICE_ARMOR))
+
+ if (hex_spelling(creature_ptr, HEX_ICE_ARMOR))
{
creature_ptr->sh_cold = TRUE;
creature_ptr->to_a += 30;
creature_ptr->dis_to_a += 30;
}
- if (hex_spelling(HEX_SHOCK_CLOAK))
+
+ if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK))
{
creature_ptr->sh_elec = TRUE;
new_speed += 3;
}
- for (i = INVEN_RARM; i <= INVEN_FEET; i++)
+
+ for (int i = INVEN_RARM; i <= INVEN_FEET; i++)
{
ARMOUR_CLASS ac = 0;
o_ptr = &creature_ptr->inventory_list[i];
}
/* Calculate stats */
- for (i = 0; i < A_MAX; i++)
+ int count = 0;
+ for (int i = 0; i < A_MAX; i++)
{
int top, use, ind;
creature_ptr->window |= (PW_PLAYER);
}
-
/* Extract the new "stat_use" value for the stat */
use = modify_stat_value(creature_ptr->stat_cur[i], creature_ptr->stat_add[i]);
creature_ptr->window |= (PW_PLAYER);
}
-
/* Values: 3, 4, ..., 17 */
if (use <= 18) ind = (use - 3);
else ind = (37);
/* Notice changes */
- if (creature_ptr->stat_ind[i] != ind)
- {
- /* Save the new index */
- creature_ptr->stat_ind[i] = (s16b)ind;
+ if (creature_ptr->stat_ind[i] == ind) continue;
- /* Change in CON affects Hitpoints */
- if (i == A_CON)
- {
- creature_ptr->update |= (PU_HP);
- }
+ /* Save the new index */
+ creature_ptr->stat_ind[i] = (s16b)ind;
+
+ /* Change in CON affects Hitpoints */
+ if (i == A_CON)
+ {
+ creature_ptr->update |= (PU_HP);
+ }
- /* Change in INT may affect Mana/Spells */
- else if (i == A_INT)
+ /* Change in INT may affect Mana/Spells */
+ else if (i == A_INT)
+ {
+ if (mp_ptr->spell_stat == A_INT)
{
- if (mp_ptr->spell_stat == A_INT)
- {
- creature_ptr->update |= (PU_MANA | PU_SPELLS);
- }
+ creature_ptr->update |= (PU_MANA | PU_SPELLS);
}
+ }
- /* Change in WIS may affect Mana/Spells */
- else if (i == A_WIS)
+ /* Change in WIS may affect Mana/Spells */
+ else if (i == A_WIS)
+ {
+ if (mp_ptr->spell_stat == A_WIS)
{
- if (mp_ptr->spell_stat == A_WIS)
- {
- creature_ptr->update |= (PU_MANA | PU_SPELLS);
- }
+ creature_ptr->update |= (PU_MANA | PU_SPELLS);
}
+ }
- /* Change in WIS may affect Mana/Spells */
- else if (i == A_CHR)
+ /* Change in WIS may affect Mana/Spells */
+ else if (i == A_CHR)
+ {
+ if (mp_ptr->spell_stat == A_CHR)
{
- if (mp_ptr->spell_stat == A_CHR)
- {
- creature_ptr->update |= (PU_MANA | PU_SPELLS);
- }
+ creature_ptr->update |= (PU_MANA | PU_SPELLS);
}
-
- creature_ptr->window |= (PW_PLAYER);
}
- }
+ creature_ptr->window |= (PW_PLAYER);
+ count++;
+ }
/* Apply temporary "stun" */
if (creature_ptr->stun > 50)
}
/* Temporary blessing */
- if (IS_BLESSED())
+ if (is_blessed(creature_ptr))
{
creature_ptr->to_a += 5;
creature_ptr->dis_to_a += 5;
}
/* Temporary "telepathy" */
- if (IS_TIM_ESP())
+ if (is_time_limit_esp(creature_ptr))
{
creature_ptr->telepathy = TRUE;
}
creature_ptr->resist_fear = TRUE;
}
-
/* Hack -- Telepathy Change */
if (creature_ptr->telepathy != old_telepathy)
{
if ((creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
penalty2 /= 2;
}
+
if (creature_ptr->inventory_list[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
if (creature_ptr->inventory_list[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
creature_ptr->to_h[0] -= (s16b)penalty1;
}
/* Extract the current weight (in tenth pounds) */
- j = creature_ptr->total_weight;
+ int j = creature_ptr->total_weight;
if (!creature_ptr->riding)
{
/* Extract the "weight limit" (in tenth pounds) */
- i = (int)weight_limit(creature_ptr);
+ count = (int)weight_limit(creature_ptr);
}
else
{
- monster_type *riding_m_ptr = &p_ptr->current_floor_ptr->m_list[creature_ptr->riding];
+ monster_type *riding_m_ptr = &floor_ptr->m_list[creature_ptr->riding];
monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
SPEED speed = riding_m_ptr->mspeed;
if (creature_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED) j += (creature_ptr->wt * 3 * (RIDING_EXP_SKILLED - creature_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
/* Extract the "weight limit" */
- i = 1500 + riding_r_ptr->level * 25;
+ count = 1500 + riding_r_ptr->level * 25;
}
/* Apply "encumbrance" from weight */
- if (j > i) new_speed -= ((j - i) / (i / 5));
+ if (j > count) new_speed -= ((j - count) / (count / 5));
/* Searching slows the player down */
if (creature_ptr->action == ACTION_SEARCH) new_speed -= 10;
}
}
-
/* Actual Modifier Bonuses (Un-inflate stat bonuses) */
creature_ptr->to_a += ((int)(adj_dex_ta[creature_ptr->stat_ind[A_DEX]]) - 128);
creature_ptr->to_d[0] += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
creature_ptr->dis_to_h[1] += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
creature_ptr->dis_to_h_b += ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128);
-
/* Obtain the "hold" value */
hold = adj_str_hold[creature_ptr->stat_ind[A_STR]];
-
/* Examine the "current bow" */
o_ptr = &creature_ptr->inventory_list[INVEN_BOW];
if (creature_ptr->ryoute) hold *= 2;
- for (i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
/* Examine the "main weapon" */
o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
creature_ptr->num_blow[i] = 1;
continue;
}
+
/* It is hard to hold a heavy weapon */
if (hold < o_ptr->weight / 10)
{
}
/* Hex - extra mights gives +1 bonus to max blows */
- if (hex_spelling(HEX_XTRA_MIGHT) || hex_spelling(HEX_BUILDING)) { num++; wgt /= 2; mul += 2; }
+ if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT) || hex_spelling(creature_ptr, HEX_BUILDING)) { num++; wgt /= 2; mul += 2; }
/* Enforce a minimum "weight" (tenth pounds) */
div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
if (creature_ptr->special_defense & KATA_FUUJIN) creature_ptr->num_blow[i] -= 1;
- if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) creature_ptr->num_blow[i] = 1;
+ if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) creature_ptr->num_blow[i] = 1;
/* Require at least one blow */
creature_ptr->dis_to_d[i] -= 10;
}
}
+
/* Hex bonuses */
- if (creature_ptr->realm1 == REALM_HEX)
+ if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr))
{
- if (object_is_cursed(o_ptr))
+ if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
+ if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_h[i] += 7; creature_ptr->dis_to_h[i] += 7; }
+ if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_h[i] += 13; creature_ptr->dis_to_h[i] += 13; }
+ if (o_ptr->curse_flags & (TRC_TY_CURSE)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
+ if (hex_spelling(creature_ptr, HEX_RUNESWORD))
{
- if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
- if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_h[i] += 7; creature_ptr->dis_to_h[i] += 7; }
- if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_h[i] += 13; creature_ptr->dis_to_h[i] += 13; }
- if (o_ptr->curse_flags & (TRC_TY_CURSE)) { creature_ptr->to_h[i] += 5; creature_ptr->dis_to_h[i] += 5; }
- if (hex_spelling(HEX_RUNESWORD))
- {
- if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_d[i] += 5; creature_ptr->dis_to_d[i] += 5; }
- if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_d[i] += 7; creature_ptr->dis_to_d[i] += 7; }
- if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_d[i] += 13; creature_ptr->dis_to_d[i] += 13; }
- }
+ if (o_ptr->curse_flags & (TRC_CURSED)) { creature_ptr->to_d[i] += 5; creature_ptr->dis_to_d[i] += 5; }
+ if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { creature_ptr->to_d[i] += 7; creature_ptr->dis_to_d[i] += 7; }
+ if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { creature_ptr->to_d[i] += 13; creature_ptr->dis_to_d[i] += 13; }
}
}
- if (creature_ptr->riding)
+
+ if (creature_ptr->riding == 0) continue;
+
+ if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
{
- if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
- {
- creature_ptr->to_h[i] += 15;
- creature_ptr->dis_to_h[i] += 15;
- creature_ptr->to_dd[i] += 2;
- }
- else if (!(have_flag(flgs, TR_RIDING)))
- {
- int penalty;
- if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
- {
- penalty = 5;
- }
- else
- {
- penalty = r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
- penalty += 30;
- if (penalty < 30) penalty = 30;
- }
- creature_ptr->to_h[i] -= (s16b)penalty;
- creature_ptr->dis_to_h[i] -= (s16b)penalty;
+ creature_ptr->to_h[i] += 15;
+ creature_ptr->dis_to_h[i] += 15;
+ creature_ptr->to_dd[i] += 2;
+ continue;
+ }
- /* Riding weapon */
- creature_ptr->riding_wield[i] = TRUE;
- }
+ if (have_flag(flgs, TR_RIDING)) continue;
+
+ int penalty;
+ if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY))
+ {
+ penalty = 5;
+ }
+ else
+ {
+ penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
+ penalty += 30;
+ if (penalty < 30) penalty = 30;
}
+
+ creature_ptr->to_h[i] -= (s16b)penalty;
+ creature_ptr->dis_to_h[i] -= (s16b)penalty;
+
+ /* Riding weapon */
+ creature_ptr->riding_wield[i] = TRUE;
}
if (creature_ptr->riding)
creature_ptr->riding_ryoute = FALSE;
if (creature_ptr->ryoute || (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_NONE)) creature_ptr->riding_ryoute = TRUE;
- else if (creature_ptr->pet_extra_flags & PF_RYOUTE)
+ else if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
{
switch (creature_ptr->pclass)
{
}
else
{
- penalty = r_info[p_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
+ penalty = r_info[floor_ptr->m_list[creature_ptr->riding].r_idx].level - creature_ptr->skill_exp[GINOU_RIDING] / 80;
penalty += 30;
if (penalty < 30) penalty = 30;
}
+
if (creature_ptr->tval_ammo == TV_BOLT) penalty *= 2;
creature_ptr->to_h_b -= (s16b)penalty;
creature_ptr->dis_to_h_b -= (s16b)penalty;
creature_ptr->monk_armour_aux = TRUE;
}
- for (i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
- if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
- {
- OBJECT_TYPE_VALUE tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
- OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
+ if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) continue;
- creature_ptr->to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
- creature_ptr->dis_to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
- if ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER))
- {
- if (!s_info[creature_ptr->pclass].w_max[tval][sval])
- {
- creature_ptr->to_h[i] -= 40;
- creature_ptr->dis_to_h[i] -= 40;
- creature_ptr->icky_wield[i] = TRUE;
- }
- }
- else if (creature_ptr->pclass == CLASS_NINJA)
+ OBJECT_TYPE_VALUE tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
+ OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
+
+ creature_ptr->to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
+ creature_ptr->dis_to_h[i] += (creature_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
+ if ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER))
+ {
+ if (!s_info[creature_ptr->pclass].w_max[tval][sval])
{
- if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (creature_ptr->inventory_list[INVEN_LARM - i].tval == TV_SHIELD))
- {
- creature_ptr->to_h[i] -= 40;
- creature_ptr->dis_to_h[i] -= 40;
- creature_ptr->icky_wield[i] = TRUE;
- creature_ptr->num_blow[i] /= 2;
- if (creature_ptr->num_blow[i] < 1) creature_ptr->num_blow[i] = 1;
- }
+ creature_ptr->to_h[i] -= 40;
+ creature_ptr->dis_to_h[i] -= 40;
+ creature_ptr->icky_wield[i] = TRUE;
}
+
+ continue;
}
+
+ if (creature_ptr->pclass != CLASS_NINJA) continue;
+
+ if ((s_info[CLASS_NINJA].w_max[tval][sval] > WEAPON_EXP_BEGINNER) && (creature_ptr->inventory_list[INVEN_LARM - i].tval != TV_SHIELD))
+ continue;
+
+ creature_ptr->to_h[i] -= 40;
+ creature_ptr->dis_to_h[i] -= 40;
+ creature_ptr->icky_wield[i] = TRUE;
+ creature_ptr->num_blow[i] /= 2;
+ if (creature_ptr->num_blow[i] < 1) creature_ptr->num_blow[i] = 1;
}
/* Maximum speed is (+99). (internally it's 110 + 99) */
creature_ptr->dis_to_d[default_hand] += MAX(bonus_to_d, 1);
}
- if (((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))) creature_ptr->ryoute = FALSE;
+ bool is_special_class = creature_ptr->pclass == CLASS_MONK;
+ is_special_class |= creature_ptr->pclass == CLASS_FORCETRAINER;
+ is_special_class |= creature_ptr->pclass == CLASS_BERSERKER;
+ if (is_special_class && (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)))
+ creature_ptr->ryoute = FALSE;
/* Affect Skill -- stealth (bonus one) */
creature_ptr->skill_stl += 1;
- if (IS_TIM_STEALTH()) creature_ptr->skill_stl += 99;
+ if (is_time_limit_stealth(creature_ptr)) creature_ptr->skill_stl += 99;
/* Affect Skill -- disarming (DEX and INT) */
creature_ptr->skill_dis += adj_dex_dis[creature_ptr->stat_ind[A_DEX]];
/* Affect Skill -- combat (throwing) (Level, by Class) */
creature_ptr->skill_tht += ((cp_ptr->x_thb * creature_ptr->lev / 10) + (ap_ptr->a_thb * creature_ptr->lev / 50));
-
if ((PRACE_IS_(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != SEIKAKU_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE))
{
creature_ptr->cursed &= ~(TRC_AGGRAVATE);
if (creature_ptr->immune_fire) creature_ptr->resist_fire = TRUE;
if (creature_ptr->immune_cold) creature_ptr->resist_cold = TRUE;
-
/* Hack -- handle "xtra" mode */
if (current_world_ptr->character_xtra) return;
msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
}
- /* Save it */
creature_ptr->old_heavy_shoot = creature_ptr->heavy_shoot;
}
- for (i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
/* Take note when "heavy weapon" changes */
if (creature_ptr->old_heavy_wield[i] != creature_ptr->heavy_wield[i])
msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
}
- /* Save it */
creature_ptr->old_heavy_wield[i] = creature_ptr->heavy_wield[i];
}
{
msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
}
- /* Save it */
+
creature_ptr->old_riding_wield[i] = creature_ptr->riding_wield[i];
}
/* Take note when "illegal weapon" changes */
- if (creature_ptr->old_icky_wield[i] != creature_ptr->icky_wield[i])
+ if (creature_ptr->old_icky_wield[i] == creature_ptr->icky_wield[i]) continue;
+
+ if (creature_ptr->icky_wield[i])
{
- if (creature_ptr->icky_wield[i])
- {
- msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
- if (current_world_ptr->is_loading_now)
- {
- chg_virtue(creature_ptr, V_FAITH, -1);
- }
- }
- else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
- {
- msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
- }
- else
+ msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
+ if (current_world_ptr->is_loading_now)
{
- msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
+ chg_virtue(creature_ptr, V_FAITH, -1);
}
-
- /* Save it */
- creature_ptr->old_icky_wield[i] = creature_ptr->icky_wield[i];
}
+ else if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
+ {
+ msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
+ }
+ else
+ {
+ msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
+ }
+
+ creature_ptr->old_icky_wield[i] = creature_ptr->icky_wield[i];
}
if (creature_ptr->riding && (creature_ptr->old_riding_ryoute != creature_ptr->riding_ryoute))
creature_ptr->monk_notify_aux = creature_ptr->monk_armour_aux;
}
- for (i = 0; i < INVEN_PACK; i++)
+ for (int i = 0; i < INVEN_PACK; i++)
{
-#if 0
- if ((creature_ptr->inventory_list[i].tval == TV_SORCERY_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_dd_s = TRUE;
- if ((creature_ptr->inventory_list[i].tval == TV_TRUMP_BOOK) && (creature_ptr->inventory_list[i].sval == 1)) have_dd_t = TRUE;
-#endif
if ((creature_ptr->inventory_list[i].tval == TV_NATURE_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_sw = TRUE;
if ((creature_ptr->inventory_list[i].tval == TV_CRAFT_BOOK) && (creature_ptr->inventory_list[i].sval == 2)) have_kabe = TRUE;
}
- for (this_o_idx = p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
+ for (this_o_idx = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
{
- o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
+ o_ptr = &floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
-#if 0
- if ((o_ptr->tval == TV_SORCERY_BOOK) && (o_ptr->sval == 3)) have_dd_s = TRUE;
- if ((o_ptr->tval == TV_TRUMP_BOOK) && (o_ptr->sval == 1)) have_dd_t = TRUE;
-#endif
if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
}
if (creature_ptr->pass_wall && !creature_ptr->kill_wall) creature_ptr->no_flowed = TRUE;
-#if 0
- if (have_dd_s && ((creature_ptr->realm1 == REALM_SORCERY) || (creature_ptr->realm2 == REALM_SORCERY) || (creature_ptr->pclass == CLASS_SORCERER)))
- {
- const magic_type *s_ptr = &mp_ptr->info[REALM_SORCERY - 1][SPELL_DD_S];
- if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
- }
- if (have_dd_t && ((creature_ptr->realm1 == REALM_TRUMP) || (creature_ptr->realm2 == REALM_TRUMP) || (creature_ptr->pclass == CLASS_SORCERER) || (creature_ptr->pclass == CLASS_RED_MAGE)))
- {
- const magic_type *s_ptr = &mp_ptr->info[REALM_TRUMP - 1][SPELL_DD_T];
- if (creature_ptr->lev >= s_ptr->slevel) creature_ptr->no_flowed = TRUE;
- }
-#endif
if (have_sw && ((creature_ptr->realm1 == REALM_NATURE) || (creature_ptr->realm2 == REALM_NATURE) || (creature_ptr->pclass == CLASS_SORCERER)))
{
const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE - 1][SPELL_SW];
static void calc_alignment(player_type *creature_ptr)
{
- MONSTER_IDX m_idx;
creature_ptr->align = 0;
- int i, j, neutral[2];
-
- for (m_idx = creature_ptr->current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ for (MONSTER_IDX m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--)
{
monster_type *m_ptr;
monster_race *r_ptr;
- m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
+ m_ptr = &floor_ptr->m_list[m_idx];
if (!monster_is_valid(m_ptr)) continue;
r_ptr = &r_info[m_ptr->r_idx];
- if (is_pet(m_ptr))
- {
- if (r_ptr->flags3 & RF3_GOOD) creature_ptr->align += r_ptr->level;
- if (r_ptr->flags3 & RF3_EVIL) creature_ptr->align -= r_ptr->level;
- }
+ if (!is_pet(m_ptr)) continue;
+
+ if (r_ptr->flags3 & RF3_GOOD) creature_ptr->align += r_ptr->level;
+ if (r_ptr->flags3 & RF3_EVIL) creature_ptr->align -= r_ptr->level;
}
if (creature_ptr->mimic_form)
}
}
- for (i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
- if (has_melee_weapon(creature_ptr, INVEN_RARM + i))
- {
- if (creature_ptr->inventory_list[INVEN_RARM + i].name1 == ART_IRON_BALL) creature_ptr->align -= 1000;
- }
+ if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) continue;
+ if (creature_ptr->inventory_list[INVEN_RARM + i].name1 != ART_IRON_BALL) continue;
+ creature_ptr->align -= 1000;
}
/* Determine player alignment */
- for (i = 0, j = 0; i < 8; i++)
+ int j = 0;
+ int neutral[2];
+ for (int i = 0; i < 8; i++)
{
switch (creature_ptr->vir_types[i])
{
}
}
- for (i = 0; i < j; i++)
+ for (int i = 0; i < j; i++)
{
if (creature_ptr->align > 0)
{
}
}
+
/*!
* @brief プレイヤーの最大HPを計算する /
* Calculate the players (maximal) hit points
*/
static void calc_hitpoints(player_type *creature_ptr)
{
- int bonus, mhp;
- byte tmp_hitdie;
-
/* Un-inflate "half-hitpoint bonus per level" value */
- bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
+ int bonus = ((int)(adj_con_mhp[creature_ptr->stat_ind[A_CON]]) - 128) * creature_ptr->lev / 4;
/* Calculate hitpoints */
- mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
+ int mhp = creature_ptr->player_hp[creature_ptr->lev - 1];
+ byte tmp_hitdie;
if (creature_ptr->mimic_form)
{
if (creature_ptr->pclass == CLASS_SORCERER)
if (creature_ptr->tsuyoshi) mhp += 50;
/* Factor in the hex spell settings */
- if (hex_spelling(HEX_XTRA_MIGHT)) mhp += 15;
- if (hex_spelling(HEX_BUILDING)) mhp += 60;
+ if (hex_spelling(creature_ptr, HEX_XTRA_MIGHT)) mhp += 15;
+ if (hex_spelling(creature_ptr, HEX_BUILDING)) mhp += 60;
/* New maximum hitpoints */
- if (creature_ptr->mhp != mhp)
+ if (creature_ptr->mhp == mhp) return;
+
+ /* Enforce maximum */
+ if (creature_ptr->chp >= mhp)
{
- /* Enforce maximum */
- if (creature_ptr->chp >= mhp)
- {
- creature_ptr->chp = mhp;
- creature_ptr->chp_frac = 0;
- }
+ creature_ptr->chp = mhp;
+ creature_ptr->chp_frac = 0;
+ }
#ifdef JP
- /* レベルアップの時は上昇量を表示する */
- if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp))
- {
- msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
- }
+ /* レベルアップの時は上昇量を表示する */
+ if (creature_ptr->level_up_message && (mhp > creature_ptr->mhp))
+ {
+ msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - creature_ptr->mhp));
+ }
#endif
- /* Save the new max-hitpoints */
- creature_ptr->mhp = mhp;
+ creature_ptr->mhp = mhp;
- /* Display hitpoints (later) */
- creature_ptr->redraw |= (PR_HP);
- creature_ptr->window |= (PW_PLAYER);
- }
+ creature_ptr->redraw |= PR_HP;
+ creature_ptr->window |= PW_PLAYER;
}
+
/*!
* @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius"
* @return なし
*/
static void calc_torch(player_type *creature_ptr)
{
- int i;
- POSITION rad;
- object_type *o_ptr;
- BIT_FLAGS flgs[TR_FLAG_SIZE];
-
- /* Assume no light */
creature_ptr->cur_lite = 0;
/* Loop through all wielded items */
- for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
+ object_type *o_ptr;
o_ptr = &creature_ptr->inventory_list[i];
/* Skip empty slots */
if (!o_ptr->k_idx) continue;
if ((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue;
}
}
- object_flags(o_ptr, flgs);
- /* calc the lite_radius */
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
+ object_flags(o_ptr, flgs);
- rad = 0;
+ POSITION rad = 0;
if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
if (creature_ptr->cur_lite > 14) creature_ptr->cur_lite = 14;
if (creature_ptr->cur_lite < 0) creature_ptr->cur_lite = 0;
- /* end experimental mods */
-
/* Notice changes in the "lite radius" */
- if (creature_ptr->old_lite != creature_ptr->cur_lite)
- {
- /* Hack -- PU_MON_LITE for monsters' darkness */
- creature_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS);
+ if (creature_ptr->old_lite == creature_ptr->cur_lite) return;
- /* Remember the old lite */
- creature_ptr->old_lite = creature_ptr->cur_lite;
+ /* Hack -- PU_MON_LITE for monsters' darkness */
+ creature_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS);
+
+ /* Remember the old lite */
+ creature_ptr->old_lite = creature_ptr->cur_lite;
+
+ if ((creature_ptr->cur_lite > 0) && (creature_ptr->special_defense & NINJA_S_STEALTH))
+ set_superstealth(creature_ptr, FALSE);
- if ((creature_ptr->cur_lite > 0) && (creature_ptr->special_defense & NINJA_S_STEALTH))
- set_superstealth(creature_ptr, FALSE);
- }
}
+
/*!
* @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
* Calculate number of spells player should have, and forget,
*/
static void calc_spells(player_type *creature_ptr)
{
- int i, j, k, levels;
- int num_allowed;
- int num_boukyaku = 0;
-
- const magic_type *s_ptr;
- REALM_IDX which;
- int bonus = 0;
-
- concptr p;
-
/* Hack -- must be literate */
if (!mp_ptr->spell_book) return;
return;
}
- p = spell_category_name(mp_ptr->spell_book);
+ concptr p = spell_category_name(mp_ptr->spell_book);
/* Determine the number of spells allowed */
- levels = creature_ptr->lev - mp_ptr->spell_first + 1;
+ int levels = creature_ptr->lev - mp_ptr->spell_first + 1;
/* Hack -- no negative spells */
if (levels < 0) levels = 0;
/* Extract total allowed spells */
- num_allowed = (adj_mag_study[creature_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
+ int num_allowed = (adj_mag_study[creature_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
+ int bonus = 0;
if ((creature_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK))
{
bonus = 4;
}
+
if (creature_ptr->pclass == CLASS_SAMURAI)
{
num_allowed = 32;
}
/* Count the number of spells we know */
- for (j = 0; j < 64; j++)
+ int num_boukyaku = 0;
+ for (int j = 0; j < 64; j++)
{
/* Count known spells */
if ((j < 32) ?
creature_ptr->new_spells = num_allowed + creature_ptr->add_spells + num_boukyaku - creature_ptr->learned_spells;
/* Forget spells which are too hard */
- for (i = 63; i >= 0; i--)
+ for (int i = 63; i >= 0; i--)
{
/* Efficiency -- all done */
if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
/* Access the spell */
- j = creature_ptr->spell_order[i];
+ int j = creature_ptr->spell_order[i];
/* Skip non-spells */
if (j >= 99) continue;
-
/* Get the spell */
+ const magic_type *s_ptr;
if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
{
if (j < 32)
if (s_ptr->slevel <= creature_ptr->lev) continue;
/* Is it known? */
- if ((j < 32) ?
+ bool is_spell_learned = (j < 32) ?
(creature_ptr->spell_learned1 & (1L << j)) :
- (creature_ptr->spell_learned2 & (1L << (j - 32))))
+ (creature_ptr->spell_learned2 & (1L << (j - 32)));
+ if (!is_spell_learned) continue;
+
+ /* Mark as forgotten */
+ REALM_IDX which;
+ if (j < 32)
{
- /* Mark as forgotten */
- if (j < 32)
- {
- creature_ptr->spell_forgotten1 |= (1L << j);
- which = creature_ptr->realm1;
- }
- else
- {
- creature_ptr->spell_forgotten2 |= (1L << (j - 32));
- which = creature_ptr->realm2;
- }
+ creature_ptr->spell_forgotten1 |= (1L << j);
+ which = creature_ptr->realm1;
+ }
+ else
+ {
+ creature_ptr->spell_forgotten2 |= (1L << (j - 32));
+ which = creature_ptr->realm2;
+ }
- /* No longer known */
- if (j < 32)
- {
- creature_ptr->spell_learned1 &= ~(1L << j);
- which = creature_ptr->realm1;
- }
- else
- {
- creature_ptr->spell_learned2 &= ~(1L << (j - 32));
- which = creature_ptr->realm2;
- }
+ /* No longer known */
+ if (j < 32)
+ {
+ creature_ptr->spell_learned1 &= ~(1L << j);
+ which = creature_ptr->realm1;
+ }
+ else
+ {
+ creature_ptr->spell_learned2 &= ~(1L << (j - 32));
+ which = creature_ptr->realm2;
+ }
#ifdef JP
- msg_format("%sの%sを忘れてしまった。", exe_spell(p_ptr, which, j % 32, SPELL_NAME), p);
+ msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
#else
- msg_format("You have forgotten the %s of %s.", p, exe_spell(p_ptr, which, j % 32, SPELL_NAME));
+ msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
#endif
-
-
- /* One more can be learned */
- creature_ptr->new_spells++;
- }
+ creature_ptr->new_spells++;
}
-
/* Forget spells if we know too many spells */
- for (i = 63; i >= 0; i--)
+ for (int i = 63; i >= 0; i--)
{
/* Stop when possible */
if (creature_ptr->new_spells >= 0) break;
if (!creature_ptr->spell_learned1 && !creature_ptr->spell_learned2) break;
/* Get the (i+1)th spell learned */
- j = creature_ptr->spell_order[i];
+ int j = creature_ptr->spell_order[i];
/* Skip unknown spells */
if (j >= 99) continue;
- /* Forget it (if learned) */
- if ((j < 32) ?
+ bool is_spell_learned = (j < 32) ?
(creature_ptr->spell_learned1 & (1L << j)) :
- (creature_ptr->spell_learned2 & (1L << (j - 32))))
+ (creature_ptr->spell_learned2 & (1L << (j - 32)));
+ if (!is_spell_learned) continue;
+
+ /* Mark as forgotten */
+ REALM_IDX which;
+ if (j < 32)
{
- /* Mark as forgotten */
- if (j < 32)
- {
- creature_ptr->spell_forgotten1 |= (1L << j);
- which = creature_ptr->realm1;
- }
- else
- {
- creature_ptr->spell_forgotten2 |= (1L << (j - 32));
- which = creature_ptr->realm2;
- }
+ creature_ptr->spell_forgotten1 |= (1L << j);
+ which = creature_ptr->realm1;
+ }
+ else
+ {
+ creature_ptr->spell_forgotten2 |= (1L << (j - 32));
+ which = creature_ptr->realm2;
+ }
- /* No longer known */
- if (j < 32)
- {
- creature_ptr->spell_learned1 &= ~(1L << j);
- which = creature_ptr->realm1;
- }
- else
- {
- creature_ptr->spell_learned2 &= ~(1L << (j - 32));
- which = creature_ptr->realm2;
- }
+ /* No longer known */
+ if (j < 32)
+ {
+ creature_ptr->spell_learned1 &= ~(1L << j);
+ which = creature_ptr->realm1;
+ }
+ else
+ {
+ creature_ptr->spell_learned2 &= ~(1L << (j - 32));
+ which = creature_ptr->realm2;
+ }
#ifdef JP
- msg_format("%sの%sを忘れてしまった。", exe_spell(p_ptr, which, j % 32, SPELL_NAME), p);
+ msg_format("%sの%sを忘れてしまった。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
#else
- msg_format("You have forgotten the %s of %s.", p, exe_spell(p_ptr, which, j % 32, SPELL_NAME));
+ msg_format("You have forgotten the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
#endif
-
-
- /* One more can be learned */
- creature_ptr->new_spells++;
- }
+ creature_ptr->new_spells++;
}
-
/* Check for spells to remember */
- for (i = 0; i < 64; i++)
+ for (int i = 0; i < 64; i++)
{
/* None left to remember */
if (creature_ptr->new_spells <= 0) break;
if (!creature_ptr->spell_forgotten1 && !creature_ptr->spell_forgotten2) break;
/* Get the next spell we learned */
- j = creature_ptr->spell_order[i];
+ int j = creature_ptr->spell_order[i];
/* Skip unknown spells */
if (j >= 99) break;
/* Access the spell */
+ const magic_type *s_ptr;
if (!is_magic((j < 32) ? creature_ptr->realm1 : creature_ptr->realm2))
{
if (j < 32)
/* Skip spells we cannot remember */
if (s_ptr->slevel > creature_ptr->lev) continue;
- /* First set of spells */
- if ((j < 32) ?
+ bool is_spell_learned = (j < 32) ?
(creature_ptr->spell_forgotten1 & (1L << j)) :
- (creature_ptr->spell_forgotten2 & (1L << (j - 32))))
+ (creature_ptr->spell_forgotten2 & (1L << (j - 32)));
+ if (!is_spell_learned) continue;
+
+ /* No longer forgotten */
+ REALM_IDX which;
+ if (j < 32)
{
- /* No longer forgotten */
- if (j < 32)
- {
- creature_ptr->spell_forgotten1 &= ~(1L << j);
- which = creature_ptr->realm1;
- }
- else
- {
- creature_ptr->spell_forgotten2 &= ~(1L << (j - 32));
- which = creature_ptr->realm2;
- }
+ creature_ptr->spell_forgotten1 &= ~(1L << j);
+ which = creature_ptr->realm1;
+ }
+ else
+ {
+ creature_ptr->spell_forgotten2 &= ~(1L << (j - 32));
+ which = creature_ptr->realm2;
+ }
- /* Known once more */
- if (j < 32)
- {
- creature_ptr->spell_learned1 |= (1L << j);
- which = creature_ptr->realm1;
- }
- else
- {
- creature_ptr->spell_learned2 |= (1L << (j - 32));
- which = creature_ptr->realm2;
- }
+ /* Known once more */
+ if (j < 32)
+ {
+ creature_ptr->spell_learned1 |= (1L << j);
+ which = creature_ptr->realm1;
+ }
+ else
+ {
+ creature_ptr->spell_learned2 |= (1L << (j - 32));
+ which = creature_ptr->realm2;
+ }
#ifdef JP
- msg_format("%sの%sを思い出した。", exe_spell(p_ptr, which, j % 32, SPELL_NAME), p);
+ msg_format("%sの%sを思い出した。", exe_spell(creature_ptr, which, j % 32, SPELL_NAME), p);
#else
- msg_format("You have remembered the %s of %s.", p, exe_spell(p_ptr, which, j % 32, SPELL_NAME));
+ msg_format("You have remembered the %s of %s.", p, exe_spell(creature_ptr, which, j % 32, SPELL_NAME));
#endif
-
-
- /* One less can be learned */
- creature_ptr->new_spells--;
- }
+ creature_ptr->new_spells--;
}
- k = 0;
-
if (creature_ptr->realm2 == REALM_NONE)
{
/* Count spells that can be learned */
- for (j = 0; j < 32; j++)
+ int k = 0;
+ for (int j = 0; j < 32; j++)
{
+ const magic_type *s_ptr;
if (!is_magic(creature_ptr->realm1)) s_ptr = &technic_info[creature_ptr->realm1 - MIN_TECHNIC][j];
else s_ptr = &mp_ptr->info[creature_ptr->realm1 - 1][j];
/* Count it */
k++;
}
+
if (k > 32) k = 32;
if ((creature_ptr->new_spells > k) &&
((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK)))
if (creature_ptr->new_spells < 0) creature_ptr->new_spells = 0;
/* Spell count changed */
- if (creature_ptr->old_spells != creature_ptr->new_spells)
+ if (creature_ptr->old_spells == creature_ptr->new_spells) return;
+
+ /* Message if needed */
+ if (creature_ptr->new_spells)
{
- /* Message if needed */
- if (creature_ptr->new_spells)
- {
#ifdef JP
- if (creature_ptr->new_spells < 10) {
- msg_format("あと %d つの%sを学べる。", creature_ptr->new_spells, p);
- }
- else {
- msg_format("あと %d 個の%sを学べる。", creature_ptr->new_spells, p);
- }
+ if (creature_ptr->new_spells < 10) {
+ msg_format("あと %d つの%sを学べる。", creature_ptr->new_spells, p);
+ }
+ else {
+ msg_format("あと %d 個の%sを学べる。", creature_ptr->new_spells, p);
+ }
#else
- msg_format("You can learn %d more %s%s.",
- creature_ptr->new_spells, p,
- (creature_ptr->new_spells != 1) ? "s" : "");
+ msg_format("You can learn %d more %s%s.",
+ creature_ptr->new_spells, p,
+ (creature_ptr->new_spells != 1) ? "s" : "");
#endif
-
- }
-
- /* Save the new_spells value */
- creature_ptr->old_spells = creature_ptr->new_spells;
-
- /* Redraw Study Status */
- creature_ptr->redraw |= (PR_STUDY);
-
- /* Redraw object recall */
- creature_ptr->window |= (PW_OBJECT);
}
+
+ creature_ptr->old_spells = creature_ptr->new_spells;
+ creature_ptr->redraw |= PR_STUDY;
+ creature_ptr->window |= PW_OBJECT;
}
+
/*!
* @brief プレイヤーの最大MPを計算する /
* Calculate maximum mana. You do not need to know any spells.
*/
static void calc_mana(player_type *creature_ptr)
{
- int msp, levels, cur_wgt, max_wgt;
-
- object_type *o_ptr;
-
-
/* Hack -- Must be literate */
if (!mp_ptr->spell_book) return;
+ int levels;
if ((creature_ptr->pclass == CLASS_MINDCRAFTER) ||
(creature_ptr->pclass == CLASS_MIRROR_MASTER) ||
(creature_ptr->pclass == CLASS_BLUE_MAGE))
levels = (creature_ptr->lev - mp_ptr->spell_first) + 1;
}
+ int msp;
if (creature_ptr->pclass == CLASS_SAMURAI)
{
msp = (adj_mag_mana[creature_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
creature_ptr->cumber_glove = FALSE;
/* Get the gloves */
+ object_type *o_ptr;
o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
/* Examine the gloves */
}
}
-
/* Assume player not encumbered by armor */
creature_ptr->cumber_armor = FALSE;
/* Weigh the armor */
- cur_wgt = 0;
+ int cur_wgt = 0;
if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
}
/* Determine the weight allowance */
- max_wgt = mp_ptr->spell_weight;
+ int max_wgt = mp_ptr->spell_weight;
/* Heavy armor penalizes mana by a percentage. -LM- */
if ((cur_wgt - max_wgt) > 0)
/* Mana can never be negative */
if (msp < 0) msp = 0;
-
/* Maximum mana has changed */
if (creature_ptr->msp != msp)
{
creature_ptr->window |= (PW_PLAYER | PW_SPELL);
}
-
/* Hack -- handle "xtra" mode */
if (current_world_ptr->character_xtra) return;
msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
}
- /* Save it */
creature_ptr->old_cumber_glove = creature_ptr->cumber_glove;
}
-
/* Take note when "armor state" changes */
- if (creature_ptr->old_cumber_armor != creature_ptr->cumber_armor)
- {
- if (creature_ptr->cumber_armor)
- {
- msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
- }
- else
- {
- msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
- }
+ if (creature_ptr->old_cumber_armor == creature_ptr->cumber_armor) return;
- /* Save it */
- creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
+ if (creature_ptr->cumber_armor)
+ {
+ msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
+ }
+ else
+ {
+ msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
}
+
+ creature_ptr->old_cumber_armor = creature_ptr->cumber_armor;
}
+
/*!
* @brief 装備中の射撃武器の威力倍率を返す /
* calcurate the fire rate of target object
*/
s16b calc_num_fire(player_type *creature_ptr, object_type *o_ptr)
{
+ /* Scan the usable creature_ptr->inventory_list */
int extra_shots = 0;
- int i;
- int num = 0;
- OBJECT_TYPE_VALUE tval_ammo = bow_tval_ammo(o_ptr);
- object_type *q_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
-
- /* Scan the usable creature_ptr->inventory_list */
- for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+ for (int i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
+ object_type *q_ptr;
q_ptr = &creature_ptr->inventory_list[i];
if (!q_ptr->k_idx) continue;
object_flags(o_ptr, flgs);
if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
- if (o_ptr->k_idx && !is_heavy_shoot(creature_ptr, o_ptr))
- {
- num = 100;
- /* Extra shots */
- num += (extra_shots * 100);
+ int num = 0;
+ if (o_ptr->k_idx == 0 || is_heavy_shoot(creature_ptr, o_ptr))
+ return (s16b)num;
- /* Hack -- Rangers love Bows */
- if ((creature_ptr->pclass == CLASS_RANGER) &&
- (tval_ammo == TV_ARROW))
- {
- num += (creature_ptr->lev * 4);
- }
+ num = 100;
+ /* Extra shots */
+ num += (extra_shots * 100);
- if ((creature_ptr->pclass == CLASS_CAVALRY) &&
- (tval_ammo == TV_ARROW))
- {
- num += (creature_ptr->lev * 3);
- }
+ /* Hack -- Rangers love Bows */
+ OBJECT_TYPE_VALUE tval_ammo = bow_tval_ammo(o_ptr);
+ if ((creature_ptr->pclass == CLASS_RANGER) &&
+ (tval_ammo == TV_ARROW))
+ {
+ num += (creature_ptr->lev * 4);
+ }
- if (creature_ptr->pclass == CLASS_ARCHER)
- {
- if (tval_ammo == TV_ARROW)
- num += ((creature_ptr->lev * 5) + 50);
- else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
- num += (creature_ptr->lev * 4);
- }
+ if ((creature_ptr->pclass == CLASS_CAVALRY) &&
+ (tval_ammo == TV_ARROW))
+ {
+ num += (creature_ptr->lev * 3);
+ }
- /*
- * Addendum -- also "Reward" high level warriors,
- * with _any_ missile weapon -- TY
- */
- if (creature_ptr->pclass == CLASS_WARRIOR &&
- (tval_ammo <= TV_BOLT) &&
- (tval_ammo >= TV_SHOT))
- {
- num += (creature_ptr->lev * 2);
- }
- if ((creature_ptr->pclass == CLASS_ROGUE) &&
- (tval_ammo == TV_SHOT))
- {
+ if (creature_ptr->pclass == CLASS_ARCHER)
+ {
+ if (tval_ammo == TV_ARROW)
+ num += ((creature_ptr->lev * 5) + 50);
+ else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
num += (creature_ptr->lev * 4);
- }
}
+
+ /*
+ * Addendum -- also "Reward" high level warriors,
+ * with _any_ missile weapon -- TY
+ */
+ if (creature_ptr->pclass == CLASS_WARRIOR &&
+ (tval_ammo <= TV_BOLT) &&
+ (tval_ammo >= TV_SHOT))
+ {
+ num += (creature_ptr->lev * 2);
+ }
+ if ((creature_ptr->pclass == CLASS_ROGUE) &&
+ (tval_ammo == TV_SHOT))
+ {
+ num += (creature_ptr->lev * 4);
+ }
+
return (s16b)num;
}
+
/*!
* @brief プレイヤーの所持重量制限を計算する /
* Computes current weight limit.
*/
WEIGHT weight_limit(player_type *creature_ptr)
{
- WEIGHT i;
-
/* Weight limit based only on strength */
- i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
+ WEIGHT i = (WEIGHT)adj_str_wgt[creature_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
if (creature_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
/* Return the result */
return i;
}
+
/*!
* @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
* @param i 判定する手のID(右手:0 左手:1)
return ((creature_ptr->inventory_list[i].k_idx && object_is_melee_weapon(&creature_ptr->inventory_list[i])) ? TRUE : FALSE);
}
+
/*!
* @brief プレイヤーの現在開いている手の状態を返す
* @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
BIT_FLAGS16 empty_hands(player_type *creature_ptr, bool riding_control)
{
BIT_FLAGS16 status = EMPTY_HAND_NONE;
-
if (!creature_ptr->inventory_list[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
if (!creature_ptr->inventory_list[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
- if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_RYOUTE))
+ if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_TWO_HANDS))
{
if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM);
else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM);
*/
bool heavy_armor(player_type *creature_ptr)
{
- WEIGHT monk_arm_wgt = 0;
-
if ((creature_ptr->pclass != CLASS_MONK) && (creature_ptr->pclass != CLASS_FORCETRAINER) && (creature_ptr->pclass != CLASS_NINJA)) return FALSE;
/* Weight the armor */
+ WEIGHT monk_arm_wgt = 0;
if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
}
+
/*!
* @brief update のフラグに応じた更新をまとめて行う / Handle "update"
* @return なし
if (creature_ptr->update & (PU_LITE))
{
creature_ptr->update &= ~(PU_LITE);
- update_lite(creature_ptr, floor_ptr);
+ update_lite(creature_ptr);
}
if (creature_ptr->update & (PU_FLOW))
{
creature_ptr->update &= ~(PU_DISTANCE);
- /* Still need to call update_monsters(FALSE) after update_mon_lite() */
- /* creature_ptr->update &= ~(PU_MONSTERS); */
-
- update_monsters(TRUE);
+ update_monsters(creature_ptr, TRUE);
}
if (creature_ptr->update & (PU_MON_LITE))
{
creature_ptr->update &= ~(PU_MON_LITE);
- update_mon_lite(creature_ptr, floor_ptr);
+ update_mon_lite(creature_ptr);
}
/*
if (creature_ptr->update & (PU_DELAY_VIS))
{
creature_ptr->update &= ~(PU_DELAY_VIS);
- delayed_visual_update(floor_ptr);
+ delayed_visual_update(creature_ptr);
}
if (creature_ptr->update & (PU_MONSTERS))
{
creature_ptr->update &= ~(PU_MONSTERS);
- update_monsters(FALSE);
+ update_monsters(creature_ptr, FALSE);
}
}
*/
bool player_has_no_spellbooks(player_type *creature_ptr)
{
- int i;
object_type *o_ptr;
-
- for (i = 0; i < INVEN_PACK; i++)
+ for (int i = 0; i < INVEN_PACK; i++)
{
o_ptr = &creature_ptr->inventory_list[i];
- if (o_ptr->k_idx && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
+ if (o_ptr->k_idx && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval)) return FALSE;
}
- for (i = p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ for (int i = floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].o_idx; i; i = o_ptr->next_o_idx)
{
- o_ptr = &p_ptr->current_floor_ptr->o_list[i];
- if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(o_ptr->tval, o_ptr->sval)) return FALSE;
+ o_ptr = &floor_ptr->o_list[i];
+ if (o_ptr->k_idx && (o_ptr->marked & OM_FOUND) && check_book_realm(creature_ptr, o_ptr->tval, o_ptr->sval)) return FALSE;
}
return TRUE;
}
+
void take_turn(player_type *creature_ptr, PERCENTAGE need_cost)
{
creature_ptr->energy_use = (ENERGY)need_cost;
}
+
void free_turn(player_type *creature_ptr)
{
creature_ptr->energy_use = 0;
}
+
/*!
* @brief プレイヤーを指定座標に配置する / Place the player in the dungeon XXX XXX
* @param x 配置先X座標
*/
bool player_place(player_type *creature_ptr, POSITION y, POSITION x)
{
- /* Paranoia XXX XXX */
if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx != 0) return FALSE;
/* Save player location */
creature_ptr->y = y;
creature_ptr->x = x;
-
- /* Success */
return TRUE;
}
+
/*!
* @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
* @return なし
*/
void wreck_the_pattern(player_type *creature_ptr)
{
- int to_ruin = 0;
- POSITION r_y, r_x;
- int pattern_type = f_info[p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
-
- if (pattern_type == PATTERN_TILE_WRECKED)
- {
- /* Ruined already */
- return;
- }
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ int pattern_type = f_info[floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat].subtype;
+ if (pattern_type == PATTERN_TILE_WRECKED) return;
msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
- if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
- to_ruin = randint1(45) + 35;
+ if (!IS_INVULN(creature_ptr))
+ take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
+ int to_ruin = randint1(45) + 35;
while (to_ruin--)
{
- scatter(p_ptr->current_floor_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0);
+ POSITION r_y, r_x;
+ scatter(creature_ptr, &r_y, &r_x, creature_ptr->y, creature_ptr->x, 4, 0);
if (pattern_tile(r_y, r_x) &&
- (f_info[p_ptr->current_floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
+ (f_info[floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
{
- cave_set_feat(p_ptr->current_floor_ptr, r_y, r_x, feat_pattern_corrupted);
+ cave_set_feat(creature_ptr, r_y, r_x, feat_pattern_corrupted);
}
}
- cave_set_feat(p_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_corrupted);
+ cave_set_feat(creature_ptr, creature_ptr->y, creature_ptr->x, feat_pattern_corrupted);
}
*/
void sanity_blast(player_type *creature_ptr, monster_type *m_ptr, bool necro)
{
- int power = 100;
-
if (creature_ptr->phase_out || !current_world_ptr->character_dungeon) return;
+ int power = 100;
if (!necro && m_ptr)
{
GAME_TEXT m_name[MAX_NLEN];
power = r_ptr->level / 2;
- monster_desc(m_name, m_ptr, 0);
+ monster_desc(creature_ptr, m_name, m_ptr, 0);
if (!(r_ptr->flags1 & RF1_UNIQUE))
{
GAME_TEXT m_name[MAX_NLEN];
concptr desc;
- get_mon_num_prep(get_nightmare, NULL);
+ get_mon_num_prep(creature_ptr, get_nightmare, NULL);
- r_ptr = &r_info[get_mon_num(MAX_DEPTH)];
+ r_ptr = &r_info[get_mon_num(creature_ptr, MAX_DEPTH)];
power = r_ptr->level + 10;
desc = r_name + r_ptr->name;
- get_mon_num_prep(NULL, NULL);
+ get_mon_num_prep(creature_ptr, NULL, NULL);
+
+#ifdef JP
+#else
-#ifndef JP
if (!(r_ptr->flags1 & RF1_UNIQUE))
sprintf(m_name, "%s %s", (is_a_vowel(desc[0]) ? "an" : "a"), desc);
else
do {
(void)do_dec_stat(creature_ptr, A_WIS);
} while (randint0(100) > creature_ptr->skill_sav && one_in_(2));
+
break;
case 16:
case 17:
handle_stuff(creature_ptr);
}
+
/*!
* @brief プレイヤーの経験値について整合性のためのチェックと調整を行う /
* Advance experience levels and print experience
*/
void check_experience(player_type *creature_ptr)
{
- bool level_reward = FALSE;
- bool level_mutation = FALSE;
- bool level_inc_stat = FALSE;
- bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
- PLAYER_LEVEL old_lev = creature_ptr->lev;
-
/* Hack -- lower limit */
if (creature_ptr->exp < 0) creature_ptr->exp = 0;
if (creature_ptr->max_exp < 0) creature_ptr->max_exp = 0;
creature_ptr->redraw |= (PR_EXP);
handle_stuff(creature_ptr);
-
/* Lose levels while possible */
+ bool android = (creature_ptr->prace == RACE_ANDROID ? TRUE : FALSE);
+ PLAYER_LEVEL old_lev = creature_ptr->lev;
while ((creature_ptr->lev > 1) &&
(creature_ptr->exp < ((android ? player_exp_a : player_exp)[creature_ptr->lev - 2] * creature_ptr->expfact / 100L)))
{
handle_stuff(creature_ptr);
}
-
/* Gain levels while possible */
+ bool level_reward = FALSE;
+ bool level_mutation = FALSE;
+ bool level_inc_stat = FALSE;
while ((creature_ptr->lev < PY_MAX_LEVEL) &&
(creature_ptr->exp >= ((android ? player_exp_a : player_exp)[creature_ptr->lev - 1] * creature_ptr->expfact / 100L)))
{
}
level_inc_stat = TRUE;
- exe_write_diary(p_ptr, NIKKI_LEVELUP, creature_ptr->lev, NULL);
+ exe_write_diary(creature_ptr, DIARY_LEVELUP, creature_ptr->lev, NULL);
}
sound(SOUND_LEVEL);
if (old_lev != creature_ptr->lev) autopick_load_pref(creature_ptr, FALSE);
}
+
/*!
* @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
* @param val 能力値
*/
void cnv_stat(int val, char *out_val)
{
- /* Above 18 */
- if (val > 18)
+ if (val <= 18)
{
- int bonus = (val - 18);
-
- if (bonus >= 220)
- {
- sprintf(out_val, "18/%3s", "***");
- }
- else if (bonus >= 100)
- {
- sprintf(out_val, "18/%03d", bonus);
- }
- else
- {
- sprintf(out_val, " 18/%02d", bonus);
- }
+ sprintf(out_val, " %2d", val);
+ return;
}
- /* From 3 to 18 */
+ int bonus = (val - 18);
+ if (bonus >= 220)
+ {
+ sprintf(out_val, "18/%3s", "***");
+ }
+ else if (bonus >= 100)
+ {
+ sprintf(out_val, "18/%03d", bonus);
+ }
else
{
- sprintf(out_val, " %2d", val);
+ sprintf(out_val, " 18/%02d", bonus);
}
}
+
/*!
* @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
* Modify a stat value by a "modifier", return new value
*/
s16b modify_stat_value(int value, int amount)
{
- int i;
-
/* Reward */
if (amount > 0)
{
/* Apply each point */
- for (i = 0; i < amount; i++)
+ for (int i = 0; i < amount; i++)
{
/* One point at a time */
if (value < 18) value++;
else if (amount < 0)
{
/* Apply each point */
- for (i = 0; i < (0 - amount); i++)
+ for (int i = 0; i < (0 - amount); i++)
{
/* Ten points at a time */
if (value >= 18 + 10) value -= 10;
}
/* Return new value */
- return (s16b)(value);
+ return (s16b)value;
}
*/
long calc_score(player_type *creature_ptr)
{
- int i, mult = 100;
- DEPTH max_dl = 0;
- u32b point, point_h, point_l;
int arena_win = MIN(creature_ptr->arena_number, MAX_ARENA_MONS);
+ int mult = 100;
if (!preserve_mode) mult += 10;
if (!autoroller) mult += 10;
if (!smart_learn) mult -= 20;
if (mult < 5) mult = 5;
- for (i = 0; i < current_world_ptr->max_d_idx; i++)
+ DEPTH max_dl = 0;
+ for (int i = 0; i < current_world_ptr->max_d_idx; i++)
if (max_dlv[i] > max_dl)
max_dl = max_dlv[i];
- point_l = (creature_ptr->max_max_exp + (100 * max_dl));
- point_h = point_l / 0x10000L;
+ u32b point_l = (creature_ptr->max_max_exp + (100 * max_dl));
+ u32b point_h = point_l / 0x10000L;
point_l = point_l % 0x10000L;
point_h *= mult;
point_l *= mult;
point_h /= 100;
point_l /= 100;
- point = (point_h << 16) + (point_l);
+ u32b point = (point_h << 16) + (point_l);
if (creature_ptr->arena_number >= 0)
point += (arena_win * arena_win * (arena_win > 29 ? 1000 : 100));
point = 1;
if (current_world_ptr->total_winner) point = 2;
}
+
if (easy_band) point = (0 - point);
return point;
/* Hack -- Prevent starvation */
(void)set_food(creature_ptr, PY_FOOD_MAX - 1);
- p_ptr->current_floor_ptr->dun_level = 0;
- creature_ptr->current_floor_ptr->inside_arena = FALSE;
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ floor_ptr->dun_level = 0;
+ floor_ptr->inside_arena = FALSE;
creature_ptr->phase_out = FALSE;
leaving_quest = 0;
- creature_ptr->current_floor_ptr->inside_quest = 0;
+ floor_ptr->inside_quest = 0;
if (creature_ptr->dungeon_idx) creature_ptr->recall_dungeon = creature_ptr->dungeon_idx;
creature_ptr->dungeon_idx = 0;
if (lite_town || vanilla_town)
creature_ptr->oldpy = 33;
creature_ptr->oldpx = 131;
}
+
creature_ptr->wild_mode = FALSE;
creature_ptr->leaving = TRUE;
- exe_write_diary(p_ptr, NIKKI_BUNSHOU, 1,
+ exe_write_diary(creature_ptr, DIARY_DESCRIPTION, 1,
_(" しかし、生き返った。",
" but revived."));
/* Prepare next floor */
leave_floor(creature_ptr);
- wipe_m_list();
+ wipe_monsters_list(creature_ptr);
+}
+
+/*!
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return 祝福状態ならばTRUE
+ */
+bool is_blessed(player_type *creature_ptr)
+{
+ return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(creature_ptr, HEX_BLESS);
+}
+
+
+bool is_oppose_acid(player_type *creature_ptr)
+{
+ return creature_ptr->oppose_acid || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
+}
+
+
+bool is_oppose_elec(player_type *creature_ptr)
+{
+ return creature_ptr->oppose_elec || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
+}
+
+
+bool is_oppose_fire(player_type *creature_ptr)
+{
+ return creature_ptr->oppose_fire || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
+}
+
+
+bool is_oppose_cold(player_type *creature_ptr)
+{
+ return creature_ptr->oppose_cold || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
+}
+
+
+bool is_oppose_pois(player_type *creature_ptr)
+{
+ return creature_ptr->oppose_pois || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
+}
+
+
+bool is_tim_esp(player_type *creature_ptr)
+{
+ return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
+}
+
+
+bool is_tim_stealth(player_type *creature_ptr)
+{
+ return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
+}
+
+
+bool is_time_limit_esp(player_type *creature_ptr)
+{
+ return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
+}
+
+
+bool is_time_limit_stealth(player_type *creature_ptr)
+{
+ return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
+}
+
+
+bool can_two_hands_wielding(player_type *creature_ptr)
+{
+ return !creature_ptr->riding || (creature_ptr->pet_extra_flags & PF_TWO_HANDS);
}