if (o_ptr->is_ammo()) {
ADD_FLG(FLG_MISSILES);
- } else if (o_ptr->tval == ItemKindType::SCROLL || o_ptr->tval == ItemKindType::STAFF || o_ptr->is_wand_rod()) {
+ } else if (o_ptr->tval == ItemKindType::SCROLL || o_ptr->is_wand_staff() || o_ptr->is_wand_rod()) {
ADD_FLG(FLG_DEVICES);
} else if (o_ptr->tval == ItemKindType::LITE) {
ADD_FLG(FLG_LIGHTS);
*/
bool exe_eat_charge_of_magic_device(PlayerType *player_ptr, ItemEntity *o_ptr, INVENTORY_IDX item)
{
- if (o_ptr->tval != ItemKindType::STAFF && o_ptr->tval != ItemKindType::WAND) {
+ if (!o_ptr->is_wand_staff()) {
return false;
}
return;
}
- if (((flavor_ptr->o_ptr->tval == ItemKindType::STAFF) || (flavor_ptr->o_ptr->tval == ItemKindType::WAND))) {
+ if (flavor_ptr->o_ptr->is_wand_staff()) {
describe_charges_staff_wand(flavor_ptr);
} else if (flavor_ptr->o_ptr->tval == ItemKindType::ROD) {
describe_charges_rod(flavor_ptr);
void floor_item_charges(FloorType *floor_ptr, INVENTORY_IDX item)
{
auto *o_ptr = &floor_ptr->o_list[item];
- if ((o_ptr->tval != ItemKindType::STAFF) && (o_ptr->tval != ItemKindType::WAND)) {
- return;
- }
- if (!o_ptr->is_known()) {
+ if (!o_ptr->is_wand_staff() || !o_ptr->is_known()) {
return;
}
msg_format(_("魔力が逆流した!%sは完全に魔力を失った。", "The recharging backfires - %s is completely drained!"), o_name);
if (o_ptr->tval == ItemKindType::ROD) {
o_ptr->timeout = k_ptr->pval * o_ptr->number;
- } else if ((o_ptr->tval == ItemKindType::WAND) || (o_ptr->tval == ItemKindType::STAFF)) {
+ } else if (o_ptr->is_wand_staff()) {
o_ptr->pval = 0;
}
*/
bool process_un_power(PlayerType *player_ptr, MonsterAttackPlayer *monap_ptr)
{
- if (((monap_ptr->o_ptr->tval != ItemKindType::STAFF) && (monap_ptr->o_ptr->tval != ItemKindType::WAND)) || (monap_ptr->o_ptr->pval == 0)) {
+ if (!monap_ptr->o_ptr->is_wand_staff() || (monap_ptr->o_ptr->pval == 0)) {
return false;
}
auto food_type = PlayerRace(player_ptr).food();
if (food_type == PlayerRaceFoodType::MANA) {
- if (o_ptr->tval == ItemKindType::STAFF || o_ptr->tval == ItemKindType::WAND) {
+ if (o_ptr->is_wand_staff()) {
return true;
}
} else if (food_type == PlayerRaceFoodType::CORPSE) {
msg_format(_("魔力が逆流した!%sは完全に魔力を失った。", "The recharging backfires - %s is completely drained!"), o_name);
if ((o_ptr->tval == ItemKindType::ROD) && (o_ptr->timeout < 10000)) {
o_ptr->timeout = (o_ptr->timeout + 100) * 2;
- } else if ((o_ptr->tval == ItemKindType::WAND) || (o_ptr->tval == ItemKindType::STAFF)) {
+ } else if (o_ptr->is_wand_staff()) {
o_ptr->pval = 0;
}
return update_player(player_ptr);
auto list = std::vector<PARAMETER_VALUE>();
for (INVENTORY_IDX i = 0; i < st_ptr->stock_num; i++) {
auto *o_ptr = &st_ptr->stock[i];
- if (o_ptr == j_ptr) {
- continue;
- }
- if (o_ptr->bi_id != j_ptr->bi_id) {
- continue;
- }
- if (o_ptr->tval != ItemKindType::STAFF && o_ptr->tval != ItemKindType::WAND) {
+ if ((o_ptr == j_ptr) || (o_ptr->bi_id != j_ptr->bi_id) || !o_ptr->is_wand_staff()) {
continue;
}
+
list.push_back(o_ptr->pval);
}
+
return list;
}
}
}
+bool BaseitemKey::is_wand_staff() const
+{
+ switch (this->type_value) {
+ case ItemKindType::WAND:
+ case ItemKindType::STAFF:
+ return true;
+ default:
+ return false;
+ }
+}
+
bool BaseitemKey::is_mushrooms() const
{
if (!this->subtype_value.has_value()) {
bool has_unidentified_name() const;
bool can_recharge() const;
bool is_wand_rod() const;
+ bool is_wand_staff() const;
private:
ItemKindType type_value;
{
return BaseitemKey(this->tval).is_wand_rod();
}
+
+bool ItemEntity::is_wand_staff() const
+{
+ return BaseitemKey(this->tval).is_wand_staff();
+}
bool has_unidentified_name() const;
ItemKindType get_arrow_kind() const;
bool is_wand_rod() const;
+ bool is_wand_staff() const;
private:
int get_baseitem_price() const;
*/
void inven_item_charges(const ItemEntity &item)
{
- const auto tval = item.tval;
- if ((tval != ItemKindType::STAFF) && (tval != ItemKindType::WAND)) {
- return;
- }
-
- if (!item.is_known()) {
+ if (!item.is_wand_staff() || !item.is_known()) {
return;
}