summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoraK-FDF <horak-fdf@web.de>2024-08-07 23:40:36 +0200
committerHoraK-FDF <horak-fdf@web.de>2024-08-07 23:40:36 +0200
commitaafbf7708f6c5972b4d9c149eb149f38a3c29e26 (patch)
tree9c8b265ac18c45bf6e51745af32b471646422b26
parente1b3b711889d25c84c1aacd4f95b2808cd369a8f (diff)
downloadtmwa-aafbf7708f6c5972b4d9c149eb149f38a3c29e26.tar.gz
tmwa-aafbf7708f6c5972b4d9c149eb149f38a3c29e26.tar.bz2
tmwa-aafbf7708f6c5972b4d9c149eb149f38a3c29e26.tar.xz
tmwa-aafbf7708f6c5972b4d9c149eb149f38a3c29e26.zip
sc_phys_shield_item
-rw-r--r--src/map/battle.cpp4
-rw-r--r--src/map/pc.cpp4
-rw-r--r--src/map/script-fun.cpp1
-rw-r--r--src/map/skill.cpp6
-rw-r--r--src/mmo/skill.t.hpp4
5 files changed, 12 insertions, 7 deletions
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index ac8dcf2..d66308d 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -2091,10 +2091,10 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
}
if (wd.damage > 0
- && t_sc_data[StatusChange::SC_PHYS_SHIELD].timer
+ && (t_sc_data[StatusChange::SC_PHYS_SHIELD].timer || t_sc_data[StatusChange::SC_PHYS_SHIELD_ITEM].timer)
&& target->bl_type == BL::PC)
{
- int reduction = t_sc_data[StatusChange::SC_PHYS_SHIELD].val1;
+ int reduction = std::max(t_sc_data[StatusChange::SC_PHYS_SHIELD].val1, t_sc_data[StatusChange::SC_PHYS_SHIELD_ITEM].val1); // highest value is taken here but serverdata should make sure only one of those is active
if (reduction > wd.damage)
reduction = wd.damage;
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index df5423e..9ef70fe 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -1553,8 +1553,8 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
/* Slow down if protected */
- if (sd->sc_data[StatusChange::SC_PHYS_SHIELD].timer)
- aspd_rate += sd->sc_data[StatusChange::SC_PHYS_SHIELD].val1;
+ if (sd->sc_data[StatusChange::SC_PHYS_SHIELD].timer || sd->sc_data[StatusChange::SC_PHYS_SHIELD_ITEM].timer)
+ aspd_rate += std::max(sd->sc_data[StatusChange::SC_PHYS_SHIELD].val1, sd->sc_data[StatusChange::SC_PHYS_SHIELD_ITEM].val1); // highest value is taken here but serverdata should make sure only one of those is active
if (sd->sc_data[StatusChange::SC_SLOWMOVE].timer)
speed_rate += sd->sc_data[StatusChange::SC_SLOWMOVE].val1;
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 3bbd369..fee39d6 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -3920,6 +3920,7 @@ void builtin_sc_start(ScriptState *st)
// all those use ms so this checks for < 1s are not needed on those
// and it would break the cooldown symbol since many spells have cooldowns less than 1s
case StatusChange::SC_PHYS_SHIELD:
+ case StatusChange::SC_PHYS_SHIELD_ITEM:
case StatusChange::SC_MBARRIER:
case StatusChange::SC_COOLDOWN:
case StatusChange::SC_COOLDOWN_MG:
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 65df758..7454cc3 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -201,9 +201,9 @@ int skill_additional_effect(dumb_ptr<block_list> src, dumb_ptr<block_list> bl,
}
sc_def_phys_shield_spell = 0;
- if (battle_get_sc_data(bl)[StatusChange::SC_PHYS_SHIELD].timer)
+ if (battle_get_sc_data(bl)[StatusChange::SC_PHYS_SHIELD].timer || battle_get_sc_data(bl)[StatusChange::SC_PHYS_SHIELD_ITEM].timer)
sc_def_phys_shield_spell =
- battle_get_sc_data(bl)[StatusChange::SC_PHYS_SHIELD].val1;
+ std::max(battle_get_sc_data(bl)[StatusChange::SC_PHYS_SHIELD].val1, battle_get_sc_data(bl)[StatusChange::SC_PHYS_SHIELD_ITEM].val1); // highest value is taken here but serverdata should make sure only one of those is active
// 対象の耐性 | Target resistance
luk = battle_get_luk(bl);
@@ -753,6 +753,7 @@ void skill_status_change_end(dumb_ptr<block_list> bl, StatusChange type, TimerDa
case StatusChange::SC_ATKPOT: /* attack potion [Valaris] */
case StatusChange::SC_MATKPOT: /* magic attack potion [Valaris] */
case StatusChange::SC_PHYS_SHIELD:
+ case StatusChange::SC_PHYS_SHIELD_ITEM:
case StatusChange::SC_HASTE:
case StatusChange::SC_SLOWMOVE:
calc_flag = 1;
@@ -1033,6 +1034,7 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type,
case StatusChange::SC_HASTE:
case StatusChange::SC_PHYS_SHIELD:
+ case StatusChange::SC_PHYS_SHIELD_ITEM:
case StatusChange::SC_MBARRIER:
case StatusChange::SC_SLOWMOVE:
calc_flag = 1;
diff --git a/src/mmo/skill.t.hpp b/src/mmo/skill.t.hpp
index 25d7b3e..b0b6b8d 100644
--- a/src/mmo/skill.t.hpp
+++ b/src/mmo/skill.t.hpp
@@ -67,7 +67,9 @@ enum class StatusChange : uint16_t
SC_CANTMOVE = 134, // stops all movement
SC_ATKPOT = 185, // item script
- SC_MATKPOT = 186, // unused, but kept for parallel
+ SC_MATKPOT = 186, // `Matk' spell from items (val1 : power)
+
+ SC_PHYS_SHIELD_ITEM = 193, // `Protect' spell from items, reduce damage (val1: power) can't be chancelled with detsanc
// Added for Fate's spells
SC_HIDE = 194, // Hide from `detect' magic (PCs only)