<ClCompile Include="..\..\src\object-enchant\weapon\apply-magic-bow.cpp" />\r
<ClCompile Include="..\..\src\object-enchant\item-magic-applier.cpp" />\r
<ClCompile Include="..\..\src\player\eldritch-horror.cpp" />\r
- <ClCompile Include="..\..\src\specific-object\bow.cpp" />\r
<ClCompile Include="..\..\src\object\object-stack.cpp" />\r
<ClCompile Include="..\..\src\object\object-value-calc.cpp" />\r
<ClCompile Include="..\..\src\perception\object-perception.cpp" />\r
<ClInclude Include="..\..\src\object-enchant\item-magic-applier.h" />\r
<ClInclude Include="..\..\src\player\eldritch-horror.h" />\r
<ClInclude Include="..\..\src\realm\realm-types.h" />\r
- <ClInclude Include="..\..\src\specific-object\bow.h" />\r
<ClInclude Include="..\..\src\object\object-stack.h" />\r
<ClInclude Include="..\..\src\object\object-value-calc.h" />\r
<ClInclude Include="..\..\src\perception\object-perception.h" />\r
\
specific-object/blade-turner.cpp specific-object/blade-turner.h \
specific-object/bloody-moon.cpp specific-object/bloody-moon.h \
- specific-object/bow.cpp specific-object/bow.h \
specific-object/chest.cpp specific-object/chest.h \
specific-object/death-crimson.cpp specific-object/death-crimson.h \
specific-object/death-scythe.cpp specific-object/death-scythe.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"
#include "system/baseitem-info.h"
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->bi_id != 0) && (flavor_ptr->o_ptr->tval == bow_tval_ammo(flavor_ptr->bow_ptr))) {
+ const BaseitemKey key(flavor_ptr->bow_ptr->tval, flavor_ptr->bow_ptr->sval);
+ if ((flavor_ptr->bow_ptr->bi_id != 0) && (key.tval() == key.get_arrow_kind())) {
describe_bow_power(player_ptr, flavor_ptr);
- } else if (PlayerClass(player_ptr).equals(PlayerClassType::NINJA) && (flavor_ptr->o_ptr->tval == ItemKindType::SPIKE)) {
+ } else if (PlayerClass(player_ptr).equals(PlayerClassType::NINJA) && (key.tval() == ItemKindType::SPIKE)) {
describe_spike_power(player_ptr, flavor_ptr);
}
}
#include "realm/realm-hex-numbers.h"
#include "realm/realm-names-table.h"
#include "realm/realm-song-numbers.h"
-#include "specific-object/bow.h"
#include "specific-object/torch.h"
#include "spell-realm/spells-hex.h"
#include "spell-realm/spells-song.h"
update_ability_scores(player_ptr);
o_ptr = &player_ptr->inventory_list[INVEN_BOW];
if (o_ptr->bi_id) {
- player_ptr->tval_ammo = bow_tval_ammo(o_ptr);
+ const BaseitemKey key(o_ptr->tval, o_ptr->sval);
+ player_ptr->tval_ammo = key.get_arrow_kind();
player_ptr->num_fire = calc_num_fire(player_ptr, o_ptr);
}
return (int16_t)num;
}
- ItemKindType tval_ammo = bow_tval_ammo(o_ptr);
+ const BaseitemKey key(o_ptr->tval, o_ptr->sval);
+ const auto tval_ammo = key.get_arrow_kind();
PlayerClass pc(player_ptr);
if (pc.equals(PlayerClassType::RANGER) && (tval_ammo == ItemKindType::ARROW)) {
num += (player_ptr->lev * 4);
+++ /dev/null
-#include "specific-object/bow.h"
-#include "object/tval-types.h"
-#include "sv-definition/sv-bow-types.h"
-#include "system/item-entity.h"
-
-/*!
- * @brief 射撃武器に対応する矢/弾薬のベースアイテムIDを返す /
- * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
- * @return 対応する矢/弾薬のベースアイテムID
- */
-ItemKindType bow_tval_ammo(ItemEntity *o_ptr)
-{
- switch (o_ptr->sval) {
- case SV_SLING:
- return ItemKindType::SHOT;
- case SV_SHORT_BOW:
- case SV_LONG_BOW:
- case SV_NAMAKE_BOW:
- return ItemKindType::ARROW;
- case SV_LIGHT_XBOW:
- case SV_HEAVY_XBOW:
- return ItemKindType::BOLT;
- case SV_CRIMSON:
- case SV_HARP:
- return ItemKindType::NO_AMMO;
- }
-
- return ItemKindType::NONE;
-}
+++ /dev/null
-#pragma once
-
-enum class ItemKindType : short;
-class ItemEntity;
-ItemKindType bow_tval_ammo(ItemEntity *o_ptr);
#include "system/baseitem-info.h"
#include "object/tval-types.h"
+#include "sv-definition/sv-bow-types.h"
BaseitemKey::BaseitemKey(const ItemKindType type_value, const std::optional<int> &subtype_value)
: type_value(type_value)
return this->subtype_value;
}
+/*!
+ * @brief 射撃武器に対応する矢/弾薬のベースアイテムIDを返す
+ * @return 対応する矢/弾薬のベースアイテムID
+ */
+ItemKindType BaseitemKey::get_arrow_kind() const
+{
+ if (this->type_value != ItemKindType::BOW) {
+ return ItemKindType::NONE;
+ }
+
+ if (!this->subtype_value.has_value()) {
+ return ItemKindType::NONE;
+ }
+
+ switch (this->subtype_value.value()) {
+ case SV_SLING:
+ return ItemKindType::SHOT;
+ case SV_SHORT_BOW:
+ case SV_LONG_BOW:
+ case SV_NAMAKE_BOW:
+ return ItemKindType::ARROW;
+ case SV_LIGHT_XBOW:
+ case SV_HEAVY_XBOW:
+ return ItemKindType::BOLT;
+ case SV_CRIMSON:
+ case SV_HARP:
+ return ItemKindType::NO_AMMO;
+ default:
+ return ItemKindType::NONE;
+ }
+}
+
BaseitemInfo::BaseitemInfo()
: bi_key(ItemKindType::NONE)
{
ItemKindType tval() const;
std::optional<int> sval() const;
+ ItemKindType get_arrow_kind() const;
+
private:
ItemKindType type_value;
std::optional<int> subtype_value;