summaryrefslogtreecommitdiff
path: root/src/map/magic-stmt.cpp
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-06-16 13:31:13 -0400
committermekolat <mekolat@users.noreply.github.com>2015-06-16 13:31:13 -0400
commitb2db882ac857b7dbba43009c3ddf89711c46cb14 (patch)
tree5220f80bd702502e4519693585e7ccad3dfbbc47 /src/map/magic-stmt.cpp
parent801d8e88c8236d09b436b50bd345532034a8be2f (diff)
downloadtmwa-b2db882ac857b7dbba43009c3ddf89711c46cb14.tar.gz
tmwa-b2db882ac857b7dbba43009c3ddf89711c46cb14.tar.bz2
tmwa-b2db882ac857b7dbba43009c3ddf89711c46cb14.tar.xz
tmwa-b2db882ac857b7dbba43009c3ddf89711c46cb14.zip
do not allow to attack PC with magic when on channel 0
Diffstat (limited to 'src/map/magic-stmt.cpp')
-rw-r--r--src/map/magic-stmt.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp
index 4d8330a..1a8085b 100644
--- a/src/map/magic-stmt.cpp
+++ b/src/map/magic-stmt.cpp
@@ -771,10 +771,12 @@ int op_injure(dumb_ptr<env_t> env, Slice<val_t> args)
int target_hp = battle_get_hp(target);
int mdef = battle_get_mdef(target);
- if (target->bl_type == BL::PC
- && !target->bl_m->flag.get(MapFlag::PVP)
- && (caster->bl_type == BL::PC)
- && ((caster->is_player()->state.pvpchannel > 1) && (target->is_player()->state.pvpchannel != caster->is_player()->state.pvpchannel)))
+ if (target->bl_type == BL::PC // target is player
+ && !target->bl_m->flag.get(MapFlag::PVP) // there is no pvpon flag
+ && (caster->bl_type == BL::PC) // caster is player
+ && ((target->is_player()->state.pvpchannel == 0)
+ || ((caster->is_player()->state.pvpchannel > 0)
+ && (target->is_player()->state.pvpchannel != caster->is_player()->state.pvpchannel))))
return 0; /* Cannot damage other players outside of pvp */
if (target != caster)