summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoraK-FDF <horak-fdf@web.de>2024-06-01 09:18:49 +0200
committerHoraK-FDF <horak-fdf@web.de>2024-06-01 09:18:49 +0200
commit1e136bfb3ebb18c90ee8fe3b75a0f58e58703a64 (patch)
treedc89caae0eaad4134048386425811f07f68ec812
parent11d75ebaae614e082055aaf7e6075e7c27bf9368 (diff)
downloadtmwa-master.tar.gz
tmwa-master.tar.bz2
tmwa-master.tar.xz
tmwa-master.zip
KeepAfterUse + DontUseAmmoHEADmaster
-rw-r--r--src/map/battle.cpp21
-rw-r--r--src/map/pc.cpp8
-rw-r--r--src/mmo/enums.hpp2
3 files changed, 20 insertions, 11 deletions
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index b745e05..16481a9 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -2060,18 +2060,21 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
// 攻撃対象となりうるので攻撃 | Attack because it can be attacked
if (sd && sd->status.weapon == ItemLook::W_BOW)
{
- IOff0 aidx = sd->equip_index_maybe[EQUIP::ARROW];
- if (aidx.ok())
+ IOff0 widx = sd->equip_index_maybe[EQUIP::WEAPON];
+ if (!bool(itemdb_search(sd->status.inventory[widx].nameid)->mode & ItemMode::DONT_USE_AMMO))
{
- if (battle_config.arrow_decrement)
- pc_delitem(sd, aidx, 1, 0);
- }
- else
- {
- clif_arrow_fail(sd, 0);
- return ATK::ZERO;
+ IOff0 aidx = sd->equip_index_maybe[EQUIP::ARROW];
+ if (aidx.ok())
+ if (battle_config.arrow_decrement)
+ pc_delitem(sd, aidx, 1, 0);
+ else
+ {
+ clif_arrow_fail(sd, 0);
+ return ATK::ZERO;
+ }
}
}
+
wd = battle_calc_weapon_attack(src, target, SkillID::ZERO, 0, 0);
// significantly increase injuries for hasted characters
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 12af48f..9105d05 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -2404,8 +2404,12 @@ int pc_useitem(dumb_ptr<map_session_data> sd, IOff0 n)
}
P<const ScriptBuffer> script = borrow(*sdidn->use_script);
- clif_useitemack(sd, n, amount - 1, 1);
- pc_delitem(sd, n, 1, 1);
+
+ if (!bool(itemdb_search(sd->status.inventory[n].nameid)->mode & ItemMode::KEEP_AFTER_USE))
+ {
+ clif_useitemack(sd, n, amount - 1, 1);
+ pc_delitem(sd, n, 1, 1);
+ }
// activity
if (sd)
diff --git a/src/mmo/enums.hpp b/src/mmo/enums.hpp
index c4a1b17..377f7d7 100644
--- a/src/mmo/enums.hpp
+++ b/src/mmo/enums.hpp
@@ -135,6 +135,8 @@ enum class ItemMode : uint8_t
NO_TRADE = 2,
NO_SELL_TO_NPC = 4,
NO_STORAGE = 8,
+ KEEP_AFTER_USE = 16,
+ DONT_USE_AMMO = 32,
};
ENUM_BITWISE_OPERATORS(ItemMode)
}