summaryrefslogtreecommitdiff
path: root/src/map/pc.cpp
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-03-24 15:10:40 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-15 11:47:28 -0400
commit2a581450a6ff87c5a183be3855e68b3f2e1b53f3 (patch)
tree7caf4a3c16fa11b92d5cbaf5881d0829aa75b9dc /src/map/pc.cpp
parent6eb63903cd839b2c0dbf3acefceee4ba7b07b0f8 (diff)
downloadtmwa-2a581450a6ff87c5a183be3855e68b3f2e1b53f3.tar.gz
tmwa-2a581450a6ff87c5a183be3855e68b3f2e1b53f3.tar.bz2
tmwa-2a581450a6ff87c5a183be3855e68b3f2e1b53f3.tar.xz
tmwa-2a581450a6ff87c5a183be3855e68b3f2e1b53f3.zip
improvements, cleanup, bug fixes
Diffstat (limited to 'src/map/pc.cpp')
-rw-r--r--src/map/pc.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 929143c..db3b372 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -2731,7 +2731,8 @@ int pc_attack(dumb_ptr<map_session_data> sd, BlockId target_id, int type)
if (bl->bl_type == BL::NPC)
{ // monster npcs [Valaris]
- npc_click(sd, target_id);
+ if (battle_get_class(bl) != INVISIBLE_CLASS && !pc_isdead(sd))
+ npc_click(sd, target_id);
return 0;
}
@@ -3352,13 +3353,10 @@ int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd,
if (src && src->bl_type == BL::PC)
{
// [Fate] PK death, trigger scripts
- argrec_t arg[3] =
+ argrec_t arg[1] =
{
- {"@killerrid"_s, static_cast<int32_t>(unwrap<BlockId>(src->bl_id))},
{"@victimrid"_s, static_cast<int32_t>(unwrap<BlockId>(sd->bl_id))},
- {"@victimlvl"_s, sd->status.base_level},
};
- npc_event_doall_l(stringish<ScriptLabel>("OnPCKilledEvent"_s), sd->bl_id, arg);
npc_event_doall_l(stringish<ScriptLabel>("OnPCKillEvent"_s), src->bl_id, arg);
sd->state.pvp_rank = 0;
@@ -3487,7 +3485,10 @@ int pc_readparam(dumb_ptr<block_list> bl, SP type)
case SP::INT:
case SP::DEX:
case SP::LUK:
- val = battle_get_stat(type, bl);
+ if (bl && bl->bl_type == BL::PC)
+ val = bl->is_player()->status.attrs[sp_to_attr(type)];
+ else
+ val = battle_get_stat(type, bl);
break;
case SP::SPEED:
val = battle_get_speed(bl).count();
@@ -3531,6 +3532,12 @@ int pc_readparam(dumb_ptr<block_list> bl, SP type)
case SP::CHAR_ID:
val = sd ? unwrap<CharId>(sd->status_key.char_id) : 0;
break;
+ case SP::ELTLVL:
+ val = static_cast<int>(battle_get_element(sd).level);
+ break;
+ case SP::ELTTYPE:
+ val = static_cast<int>(battle_get_element(sd).element);
+ break;
}
return val;