/* We have tried it */
const auto tval = bi_key.tval();
if (tval == ItemKindType::FOOD) {
- object_tried(o_ptr);
+ o_ptr->mark_as_tried();
}
/* The player is now aware of the object */
return;
}
- const auto &o_ref = this->copy_object(i_idx);
+ auto item = this->copy_object(i_idx);
vary_item(this->player_ptr, i_idx, -1);
sound(SOUND_QUAFF);
- auto ident = QuaffEffects(this->player_ptr).influence(o_ref);
+ auto ident = QuaffEffects(this->player_ptr).influence(item);
if (PlayerRace(this->player_ptr).equals(PlayerRaceType::SKELETON)) {
msg_print(_("液体の一部はあなたのアゴを素通りして落ちた!", "Some of the fluid falls through your jaws!"));
- (void)potion_smash_effect(this->player_ptr, 0, this->player_ptr->y, this->player_ptr->x, o_ref.bi_id);
+ (void)potion_smash_effect(this->player_ptr, 0, this->player_ptr->y, this->player_ptr->x, item.bi_id);
}
static constexpr auto flags_srf = {
};
auto &rfu = RedrawingFlagsUpdater::get_instance();
rfu.set_flags(flags_srf);
- this->change_virtue_as_quaff(o_ref);
- object_tried(&o_ref);
- if (ident && !o_ref.is_aware()) {
- object_aware(this->player_ptr, &o_ref);
- gain_exp(this->player_ptr, (o_ref.get_baseitem().level + (this->player_ptr->lev >> 1)) / this->player_ptr->lev);
+ this->change_virtue_as_quaff(item);
+ item.mark_as_tried();
+ if (ident && !item.is_aware()) {
+ object_aware(this->player_ptr, &item);
+ gain_exp(this->player_ptr, (item.get_baseitem().level + (this->player_ptr->lev >> 1)) / this->player_ptr->lev);
}
static constexpr auto flags = {
return;
}
- this->moisten(o_ref);
+ this->moisten(item);
}
bool ObjectQuaffEntity::can_influence()
rfu.reset_flags(flags_srf);
this->change_virtue_as_read(*o_ptr);
- object_tried(o_ptr);
+ o_ptr->mark_as_tried();
this->gain_exp_from_item_use(o_ptr, executor->is_identified());
static constexpr auto flags_swrf = {
SubWindowRedrawingFlag::INVENTORY,
}
rfu.reset_flags(flags_srf);
- object_tried(o_ptr);
+ o_ptr->mark_as_tried();
if (ident && !o_ptr->is_aware()) {
object_aware(this->player_ptr, o_ptr);
gain_exp(this->player_ptr, (lev + (this->player_ptr->lev >> 1)) / this->player_ptr->lev);
chg_virtue(this->player_ptr, Virtue::KNOWLEDGE, -1);
}
- object_tried(o_ptr);
+ o_ptr->mark_as_tried();
if ((ident != 0) && !o_ptr->is_aware()) {
object_aware(this->player_ptr, o_ptr);
gain_exp(this->player_ptr, (lev + (this->player_ptr->lev >> 1)) / this->player_ptr->lev);
chg_virtue(this->player_ptr, Virtue::KNOWLEDGE, -1);
}
- object_tried(o_ptr);
+ o_ptr->mark_as_tried();
if (ident && !o_ptr->is_aware()) {
object_aware(this->player_ptr, o_ptr);
gain_exp(this->player_ptr, (lev + (this->player_ptr->lev >> 1)) / this->player_ptr->lev);
const auto item_name = describe_flavor(player_ptr, q_ptr, OD_NAME_ONLY);
exe_write_diary(player_ptr, DiaryKind::FOUND, 0, item_name);
}
-
-/*!
- * @brief オブジェクトを試行済にする /
- * Something has been "sampled"
- * @param o_ptr 試行済にするオブジェクトの構造体参照ポインタ
- */
-void object_tried(const ItemEntity *o_ptr)
-{
- o_ptr->get_baseitem().tried = true;
-}
class ItemEntity;
class PlayerType;
void object_aware(PlayerType *player_ptr, const ItemEntity *o_ptr);
-void object_tried(const ItemEntity *o_ptr);
}
}
+/*!
+ * @brief オブジェクトを試行済にする
+ */
+void BaseitemInfo::mark_as_tried()
+{
+ this->tried = true;
+}
+
std::vector<BaseitemInfo> baseitems_info;
IDX flavor{}; /*!< 未鑑定名の何番目を当てるか(0は未鑑定名なし) / Special object flavor (or zero) */
bool aware{}; /*!< ベースアイテムが鑑定済かどうか / The player is "aware" of the item's effects */
bool tried{}; /*!< ベースアイテムを未鑑定のまま試したことがあるか / The player has "tried" one of the items */
+
+ void mark_as_tried();
};
extern std::vector<BaseitemInfo> baseitems_info;
}
/*!
+ * @brief オブジェクトを試行済にする
+ */
+void ItemEntity::mark_as_tried()
+{
+ this->get_baseitem().mark_as_tried();
+}
+
+/*!
* @brief エゴ光源のフラグを修正する
*
* 寿命のある光源で寿命が0ターンの時、光源エゴアイテムに起因するフラグは
TrFlags get_flags_known() const;
void mark_as_known();
+ void mark_as_tried();
private:
int get_baseitem_price() const;