*/
#include "flavor/flavor-describer.h"
-#include "cmd-item/cmd-smith.h"
#include "combat/shoot.h"
#include "flavor/flag-inscriptions-table.h"
#include "flavor/flavor-util.h"
#include "object-enchant/special-object-flags.h"
#include "object-enchant/tr-types.h"
#include "object-enchant/trg-types.h"
-#include "object-hook/hook-checker.h"
-#include "object-hook/hook-enchant.h"
#include "object-hook/hook-quest.h"
#include "object/object-flags.h"
#include "object/object-kind.h"
#include "perception/object-perception.h"
+#include "player-base/player-class.h"
#include "player/player-status-table.h"
#include "player/player-status.h"
+#include "smith/object-smith.h"
+#include "smith/smith-types.h"
#include "specific-object/bow.h"
#include "sv-definition/sv-lite-types.h"
#include "sv-definition/sv-weapon-types.h"
static void describe_chest_trap(flavor_type *flavor_ptr)
{
- switch (chest_traps[flavor_ptr->o_ptr->pval]) {
- case 0:
+ auto trap_kinds = chest_traps[flavor_ptr->o_ptr->pval];
+ if (trap_kinds.count() >= 2) {
+ flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(マルチ・トラップ)", " (Multiple Traps)"));
+ return;
+ }
+
+ auto trap_kind = trap_kinds.first();
+ if (!trap_kind.has_value()) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(施錠)", " (Locked)"));
- break;
- case CHEST_LOSE_STR:
+ return;
+ }
+
+ switch (trap_kind.value()) {
+ case ChestTrapType::LOSE_STR:
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(毒針)", " (Poison Needle)"));
break;
- case CHEST_LOSE_CON:
+ case ChestTrapType::LOSE_CON:
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(毒針)", " (Poison Needle)"));
break;
- case CHEST_POISON:
+ case ChestTrapType::POISON:
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(ガス・トラップ)", " (Gas Trap)"));
break;
- case CHEST_PARALYZE:
+ case ChestTrapType::PARALYZE:
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(ガス・トラップ)", " (Gas Trap)"));
break;
- case CHEST_EXPLODE:
- flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(爆発装置)", " (Explosion Device)"));
+ case ChestTrapType::EXPLODE:
+ flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(爆発装置)", " (Explosive Device)"));
break;
- case CHEST_SUMMON:
- case CHEST_BIRD_STORM:
- case CHEST_E_SUMMON:
- case CHEST_H_SUMMON:
+ case ChestTrapType::SUMMON:
+ case ChestTrapType::BIRD_STORM:
+ case ChestTrapType::E_SUMMON:
+ case ChestTrapType::H_SUMMON:
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(召喚のルーン)", " (Summoning Runes)"));
break;
- case CHEST_RUNES_OF_EVIL:
+ case ChestTrapType::RUNES_OF_EVIL:
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(邪悪なルーン)", " (Gleaming Black Runes)"));
break;
- case CHEST_ALARM:
+ case ChestTrapType::ALARM:
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(警報装置)", " (Alarm)"));
break;
- default:
- flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(ã\83\9eã\83«ã\83\81ã\83»ã\83\88ã\83©ã\83\83ã\83\97)", " (Multiple Traps)"));
+ case ChestTrapType::SCATTER:
+ flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(ã\82¢ã\82¤ã\83\86ã\83 æ\95£ä¹±)", " (Scatter)"));
break;
+ case ChestTrapType::MAX:
+ throw("Invalid chest trap type is specified!");
}
}
static void describe_chest(flavor_type *flavor_ptr)
{
- if (flavor_ptr->o_ptr->tval != TV_CHEST)
+ if (flavor_ptr->o_ptr->tval != ItemKindType::CHEST) {
return;
+ }
- if (!flavor_ptr->known)
+ if (!flavor_ptr->known) {
return;
+ }
if (!flavor_ptr->o_ptr->pval) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(空)", " (empty)"));
}
if (flavor_ptr->o_ptr->pval < 0) {
- if (chest_traps[0 - flavor_ptr->o_ptr->pval])
+ if (chest_traps[0 - flavor_ptr->o_ptr->pval].any()) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(解除済)", " (disarmed)"));
- else
+ } else {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(非施錠)", " (unlocked)"));
+ }
return;
}
static void decide_tval_show(flavor_type *flavor_ptr)
{
- if (has_flag(flavor_ptr->tr_flags, TR_SHOW_MODS))
+ if (flavor_ptr->tr_flags.has(TR_SHOW_MODS)) {
flavor_ptr->show_weapon = true;
+ }
- if (flavor_ptr->o_ptr->is_smith() && (flavor_ptr->o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE))
+ if (flavor_ptr->o_ptr->is_smith() && (Smith::object_effect(flavor_ptr->o_ptr) == SmithEffectType::SLAY_GLOVE)) {
flavor_ptr->show_weapon = true;
+ }
- if (flavor_ptr->o_ptr->to_h && flavor_ptr->o_ptr->to_d)
+ if (flavor_ptr->o_ptr->to_h && flavor_ptr->o_ptr->to_d) {
flavor_ptr->show_weapon = true;
+ }
- if (flavor_ptr->o_ptr->ac)
+ if (flavor_ptr->o_ptr->ac) {
flavor_ptr->show_armour = true;
+ }
}
-static void describe_weapon_dice(player_type *player_ptr, flavor_type *flavor_ptr)
+static void describe_weapon_dice(PlayerType *player_ptr, flavor_type *flavor_ptr)
{
- if (!flavor_ptr->known && object_is_quest_target(player_ptr->current_floor_ptr->inside_quest, flavor_ptr->o_ptr))
+ if (!flavor_ptr->known && object_is_quest_target(player_ptr->current_floor_ptr->quest_number, flavor_ptr->o_ptr)) {
return;
+ }
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p1);
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p2);
}
-static void describe_bow(player_type *player_ptr, flavor_type *flavor_ptr)
+static void describe_bow(PlayerType *player_ptr, flavor_type *flavor_ptr)
{
flavor_ptr->power = bow_tmul(flavor_ptr->o_ptr->sval);
- if (has_flag(flavor_ptr->tr_flags, TR_XTRA_MIGHT))
+ if (flavor_ptr->tr_flags.has(TR_XTRA_MIGHT)) {
flavor_ptr->power++;
+ }
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p1);
if (!(flavor_ptr->mode & OD_DEBUG)) {
num_fire = calc_num_fire(player_ptr, flavor_ptr->o_ptr);
} else {
- TrFlags flgs;
- object_flags(flavor_ptr->o_ptr, flgs);
- if (has_flag(flgs, TR_XTRA_SHOTS))
+ auto flgs = object_flags(flavor_ptr->o_ptr);
+ if (flgs.has(TR_XTRA_SHOTS)) {
num_fire += 100;
+ }
}
- if ((num_fire == 0) || (flavor_ptr->power <= 0) || !flavor_ptr->known)
+ if ((num_fire == 0) || (flavor_ptr->power <= 0) || !flavor_ptr->known) {
return;
+ }
flavor_ptr->fire_rate = bow_energy(flavor_ptr->o_ptr->sval) / num_fire;
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p2);
}
-static void describe_tval(player_type *player_ptr, flavor_type *flavor_ptr)
+static void describe_tval(PlayerType *player_ptr, flavor_type *flavor_ptr)
{
switch (flavor_ptr->o_ptr->tval) {
- case TV_SHOT:
- case TV_BOLT:
- case TV_ARROW:
- case TV_HAFTED:
- case TV_POLEARM:
- case TV_SWORD:
- case TV_DIGGING:
+ case ItemKindType::SHOT:
+ case ItemKindType::BOLT:
+ case ItemKindType::ARROW:
+ case ItemKindType::HAFTED:
+ case ItemKindType::POLEARM:
+ case ItemKindType::SWORD:
+ case ItemKindType::DIGGING:
describe_weapon_dice(player_ptr, flavor_ptr);
break;
- case TV_BOW:
+ case ItemKindType::BOW:
describe_bow(player_ptr, flavor_ptr);
break;
static void describe_named_item_tval(flavor_type *flavor_ptr)
{
- if (!flavor_ptr->known)
+ if (!flavor_ptr->known) {
return;
+ }
if (flavor_ptr->show_weapon) {
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
}
}
-static void describe_fire_energy(player_type *player_ptr, flavor_type *flavor_ptr)
+static void describe_fire_energy(PlayerType *player_ptr, flavor_type *flavor_ptr)
{
ENERGY energy_fire = bow_energy(flavor_ptr->bow_ptr->sval);
if (player_ptr->num_fire == 0) {
flavor_ptr->avgdam /= energy_fire;
flavor_ptr->t = object_desc_num(flavor_ptr->t, flavor_ptr->avgdam);
flavor_ptr->t = object_desc_str(flavor_ptr->t, show_ammo_detail ? "/turn" : "");
- if (!show_ammo_crit_ratio)
+ if (!show_ammo_crit_ratio) {
return;
+ }
int percent = calc_crit_ratio_shot(player_ptr, flavor_ptr->known ? flavor_ptr->o_ptr->to_h : 0, flavor_ptr->known ? flavor_ptr->bow_ptr->to_h : 0);
flavor_ptr->t = object_desc_chr(flavor_ptr->t, '/');
flavor_ptr->t = object_desc_num(flavor_ptr->t, percent / 100);
flavor_ptr->t = object_desc_chr(flavor_ptr->t, '.');
- if (percent % 100 < 10)
+ if (percent % 100 < 10) {
flavor_ptr->t = object_desc_chr(flavor_ptr->t, '0');
+ }
flavor_ptr->t = object_desc_num(flavor_ptr->t, percent % 100);
flavor_ptr->t = object_desc_str(flavor_ptr->t, show_ammo_detail ? "% crit" : "%");
}
-static void describe_bow_power(player_type *player_ptr, flavor_type *flavor_ptr)
+static void describe_bow_power(PlayerType *player_ptr, flavor_type *flavor_ptr)
{
flavor_ptr->avgdam = flavor_ptr->o_ptr->dd * (flavor_ptr->o_ptr->ds + 1) * 10 / 2;
int tmul = bow_tmul(flavor_ptr->bow_ptr->sval);
- if (flavor_ptr->bow_ptr->is_known())
+ if (flavor_ptr->bow_ptr->is_known()) {
flavor_ptr->avgdam += (flavor_ptr->bow_ptr->to_d * 10);
+ }
- if (flavor_ptr->known)
+ if (flavor_ptr->known) {
flavor_ptr->avgdam += (flavor_ptr->o_ptr->to_d * 10);
+ }
- if (player_ptr->xtra_might)
+ if (player_ptr->xtra_might) {
tmul++;
+ }
tmul = tmul * (100 + (int)(adj_str_td[player_ptr->stat_index[A_STR]]) - 128);
flavor_ptr->avgdam *= tmul;
flavor_ptr->avgdam /= (100 * 10);
- if (player_ptr->concent)
- flavor_ptr->avgdam = boost_concentration_damage(player_ptr, flavor_ptr->avgdam);
+ flavor_ptr->avgdam = boost_concentration_damage(player_ptr, flavor_ptr->avgdam);
- if (flavor_ptr->avgdam < 0)
+ if (flavor_ptr->avgdam < 0) {
flavor_ptr->avgdam = 0;
+ }
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p1);
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p2);
}
-static void describe_spike_power(player_type *player_ptr, flavor_type *flavor_ptr)
+static void describe_spike_power(PlayerType *player_ptr, flavor_type *flavor_ptr)
{
int avgdam = player_ptr->mighty_throw ? (1 + 3) : 1;
int16_t energy_fire = 100 - player_ptr->lev;
return;
}
- if (flavor_ptr->o_ptr->to_a == 0)
+ if (flavor_ptr->o_ptr->to_a == 0) {
return;
+ }
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->b1);
return;
}
- if (!flavor_ptr->show_armour)
+ if (!flavor_ptr->show_armour) {
return;
+ }
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->b1);
{
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p1);
- if ((flavor_ptr->o_ptr->tval == TV_STAFF) && (flavor_ptr->o_ptr->number > 1)) {
+ if ((flavor_ptr->o_ptr->tval == ItemKindType::STAFF) && (flavor_ptr->o_ptr->number > 1)) {
flavor_ptr->t = object_desc_num(flavor_ptr->t, flavor_ptr->o_ptr->number);
flavor_ptr->t = object_desc_str(flavor_ptr->t, "x ");
}
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("回分", " charge"));
#ifdef JP
#else
- if (flavor_ptr->o_ptr->pval != 1)
+ if (flavor_ptr->o_ptr->pval != 1) {
flavor_ptr->t = object_desc_chr(flavor_ptr->t, 's');
+ }
#endif
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p2);
static void describe_charges_rod(flavor_type *flavor_ptr)
{
- if (flavor_ptr->o_ptr->timeout == 0)
+ if (flavor_ptr->o_ptr->timeout == 0) {
return;
+ }
if (flavor_ptr->o_ptr->number <= 1) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(充填中)", " (charging)"));
return;
}
- if (flavor_ptr->k_ptr->pval == 0)
+ if (flavor_ptr->k_ptr->pval == 0) {
flavor_ptr->k_ptr->pval = 1;
+ }
flavor_ptr->power = (flavor_ptr->o_ptr->timeout + (flavor_ptr->k_ptr->pval - 1)) / flavor_ptr->k_ptr->pval;
- if (flavor_ptr->power > flavor_ptr->o_ptr->number)
+ if (flavor_ptr->power > flavor_ptr->o_ptr->number) {
flavor_ptr->power = flavor_ptr->o_ptr->number;
+ }
flavor_ptr->t = object_desc_str(flavor_ptr->t, " (");
flavor_ptr->t = object_desc_num(flavor_ptr->t, flavor_ptr->power);
static void describe_specific_pval(flavor_type *flavor_ptr)
{
- if (has_flag(flavor_ptr->tr_flags, TR_SPEED)) {
+ if (flavor_ptr->tr_flags.has(TR_SPEED)) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("加速", " to speed"));
return;
}
- if (has_flag(flavor_ptr->tr_flags, TR_BLOWS)) {
+ if (flavor_ptr->tr_flags.has(TR_BLOWS)) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("攻撃", " attack"));
#ifdef JP
#else
- if (ABS(flavor_ptr->o_ptr->pval) != 1)
+ if (std::abs(flavor_ptr->o_ptr->pval) != 1) {
flavor_ptr->t = object_desc_chr(flavor_ptr->t, 's');
+ }
#endif
return;
}
- if (has_flag(flavor_ptr->tr_flags, TR_STEALTH)) {
+ if (flavor_ptr->tr_flags.has(TR_STEALTH)) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("隠密", " to stealth"));
return;
}
- if (has_flag(flavor_ptr->tr_flags, TR_SEARCH)) {
+ if (flavor_ptr->tr_flags.has(TR_SEARCH)) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("探索", " to searching"));
return;
}
- if (has_flag(flavor_ptr->tr_flags, TR_INFRA))
+ if (flavor_ptr->tr_flags.has(TR_INFRA)) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("赤外線視力", " to infravision"));
+ }
}
static void describe_pval(flavor_type *flavor_ptr)
{
- if (!has_pval_flags(flavor_ptr->tr_flags))
+ if (flavor_ptr->tr_flags.has_none_of(TR_PVAL_FLAG_MASK)) {
return;
+ }
flavor_ptr->t = object_desc_chr(flavor_ptr->t, ' ');
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p1);
flavor_ptr->t = object_desc_int(flavor_ptr->t, flavor_ptr->o_ptr->pval);
- if (has_flag(flavor_ptr->tr_flags, TR_HIDE_TYPE)) {
+ if (flavor_ptr->tr_flags.has(TR_HIDE_TYPE)) {
flavor_ptr->t = object_desc_chr(flavor_ptr->t, flavor_ptr->p2);
return;
}
static void describe_lamp_life(flavor_type *flavor_ptr)
{
- if ((flavor_ptr->o_ptr->tval != TV_LITE) || (flavor_ptr->o_ptr->is_fixed_artifact() || (flavor_ptr->o_ptr->sval == SV_LITE_FEANOR)))
+ if ((flavor_ptr->o_ptr->tval != ItemKindType::LITE) || (flavor_ptr->o_ptr->is_fixed_artifact() || (flavor_ptr->o_ptr->sval == SV_LITE_FEANOR))) {
return;
+ }
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(", " (with "));
- if (flavor_ptr->o_ptr->name2 == EGO_LITE_LONG)
- flavor_ptr->t = object_desc_num(flavor_ptr->t, flavor_ptr->o_ptr->xtra4 * 2);
- else
- flavor_ptr->t = object_desc_num(flavor_ptr->t, flavor_ptr->o_ptr->xtra4);
-
+ auto fuel_magnification = flavor_ptr->o_ptr->ego_idx == EgoType::LITE_LONG ? 2 : 1;
+ flavor_ptr->t = object_desc_num(flavor_ptr->t, fuel_magnification * flavor_ptr->o_ptr->fuel);
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("ターンの寿命)", " turns of light)"));
}
*/
static void describe_remaining(flavor_type *flavor_ptr)
{
- if (!flavor_ptr->known)
+ if (!flavor_ptr->known) {
return;
+ }
- if (((flavor_ptr->o_ptr->tval == TV_STAFF) || (flavor_ptr->o_ptr->tval == TV_WAND)))
+ if (((flavor_ptr->o_ptr->tval == ItemKindType::STAFF) || (flavor_ptr->o_ptr->tval == ItemKindType::WAND))) {
describe_charges_staff_wand(flavor_ptr);
- else if (flavor_ptr->o_ptr->tval == TV_ROD)
+ } else if (flavor_ptr->o_ptr->tval == ItemKindType::ROD) {
describe_charges_rod(flavor_ptr);
+ }
describe_pval(flavor_ptr);
describe_lamp_life(flavor_ptr);
- if (flavor_ptr->o_ptr->timeout && (flavor_ptr->o_ptr->tval != TV_ROD))
+ if (flavor_ptr->o_ptr->timeout && (flavor_ptr->o_ptr->tval != ItemKindType::ROD)) {
flavor_ptr->t = object_desc_str(flavor_ptr->t, _("(充填中)", " (charging)"));
+ }
}
static void decide_item_feeling(flavor_type *flavor_ptr)
return;
}
- if (((flavor_ptr->o_ptr->tval == TV_RING) || (flavor_ptr->o_ptr->tval == TV_AMULET) || (flavor_ptr->o_ptr->tval == TV_LITE)
- || (flavor_ptr->o_ptr->tval == TV_FIGURINE))
- && flavor_ptr->aware && !flavor_ptr->known && !(flavor_ptr->o_ptr->ident & IDENT_SENSE)) {
+ if (((flavor_ptr->o_ptr->tval == ItemKindType::RING) || (flavor_ptr->o_ptr->tval == ItemKindType::AMULET) || (flavor_ptr->o_ptr->tval == ItemKindType::LITE) || (flavor_ptr->o_ptr->tval == ItemKindType::FIGURINE)) && flavor_ptr->aware && !flavor_ptr->known && !(flavor_ptr->o_ptr->ident & IDENT_SENSE)) {
strcpy(flavor_ptr->fake_insc_buf, _("未鑑定", "unidentified"));
return;
}
return;
}
- if (!flavor_ptr->aware && flavor_ptr->o_ptr->is_tried())
+ if (!flavor_ptr->aware && flavor_ptr->o_ptr->is_tried()) {
strcpy(flavor_ptr->fake_insc_buf, _("未判明", "tried"));
+ }
}
/*!
* @brief オブジェクトの各表記を返すメイン関数 / Creates a description of the item "o_ptr", and stores it in "out_val".
- * @param player_ptr ã\83\97ã\83¬ã\83¼ヤーへの参照ポインタ
+ * @param player_ptr ã\83\97ã\83¬ã\82¤ヤーへの参照ポインタ
* @param buf 表記を返すための文字列参照ポインタ
* @param o_ptr 特性短縮表記を得たいオブジェクト構造体の参照ポインタ
* @param mode 表記に関するオプション指定
* @return 現在クエスト達成目的のアイテムならばTRUEを返す
*/
-void describe_flavor(player_type *player_ptr, char *buf, object_type *o_ptr, BIT_FLAGS mode)
+void describe_flavor(PlayerType *player_ptr, char *buf, ObjectType *o_ptr, BIT_FLAGS mode)
{
flavor_type tmp_flavor;
flavor_type *flavor_ptr = initialize_flavor_type(&tmp_flavor, buf, o_ptr, mode);
describe_named_item_tval(flavor_ptr);
if (!(mode & OD_DEBUG)) {
flavor_ptr->bow_ptr = &player_ptr->inventory_list[INVEN_BOW];
- if ((flavor_ptr->bow_ptr->k_idx != 0) && (flavor_ptr->o_ptr->tval == bow_tval_ammo(flavor_ptr->bow_ptr)))
+ if ((flavor_ptr->bow_ptr->k_idx != 0) && (flavor_ptr->o_ptr->tval == bow_tval_ammo(flavor_ptr->bow_ptr))) {
describe_bow_power(player_ptr, flavor_ptr);
- else if ((player_ptr->pclass == CLASS_NINJA) && (flavor_ptr->o_ptr->tval == TV_SPIKE))
+ } else if (PlayerClass(player_ptr).equals(PlayerClassType::NINJA) && (flavor_ptr->o_ptr->tval == ItemKindType::SPIKE)) {
describe_spike_power(player_ptr, flavor_ptr);
+ }
}
describe_ac(flavor_ptr);