diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/pc.cpp | 2 | ||||
-rw-r--r-- | src/map/script-fun.cpp | 48 |
2 files changed, 34 insertions, 16 deletions
diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 63b1497..6057278 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -3435,6 +3435,8 @@ int pc_readparam(dumb_ptr<block_list> bl, SP type) val = sd ? pc_nextjobexp(sd) : 0; break; case SP::HP: + if (sd && pc_isdead(sd)) + break; // val = 0 val = battle_get_hp(bl); break; case SP::MAXHP: diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 640bb20..0b1e7e6 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -584,6 +584,7 @@ void builtin_warp(ScriptState *st) MapName str = stringish<MapName>(ZString(conv_str(st, &AARG(0)))); x = conv_num(st, &AARG(1)); y = conv_num(st, &AARG(2)); + pc_setpos(sd, str, x, y, BeingRemoveWhy::GONE); } @@ -2232,21 +2233,31 @@ static void builtin_overrideattack(ScriptState *st) { dumb_ptr<map_session_data> sd = script_rid2sd(st); - int charges = conv_num(st, &AARG(0)); - interval_t attack_delay = static_cast<interval_t>(conv_num(st, &AARG(1))); - int attack_range = conv_num(st, &AARG(2)); - StatusChange icon = StatusChange(conv_num(st, &AARG(3))); - ItemNameId look = wrap<ItemNameId>(static_cast<uint16_t>(conv_num(st, &AARG(4)))); - ZString event_ = ZString(conv_str(st, &AARG(5))); + if (HARG(0)) + { + interval_t attack_delay = static_cast<interval_t>(conv_num(st, &AARG(0))); + int attack_range = conv_num(st, &AARG(1)); + StatusChange icon = StatusChange(conv_num(st, &AARG(2))); + ItemNameId look = wrap<ItemNameId>(static_cast<uint16_t>(conv_num(st, &AARG(3)))); + ZString event_ = ZString(conv_str(st, &AARG(4))); - NpcEvent event; - extract(event_, &event); + NpcEvent event; + extract(event_, &event); - sd->attack_spell_override = st->oid; - sd->attack_spell_charges = charges; - sd->magic_attack = event; - pc_set_weapon_icon(sd, charges, icon, look); - pc_set_attack_info(sd, attack_delay, attack_range); + sd->attack_spell_override = st->oid; + sd->attack_spell_charges = 1; + sd->magic_attack = event; + pc_set_weapon_icon(sd, 1, icon, look); + pc_set_attack_info(sd, attack_delay, attack_range); + } + else + { + // explicit discharge + sd->attack_spell_override = BlockId(); + pc_set_weapon_icon(sd, 0, StatusChange::ZERO, ItemNameId()); + pc_set_attack_info(sd, interval_t::zero(), 0); + pc_calcstatus(sd, 0); + } } /*========================================== @@ -4543,7 +4554,12 @@ void builtin_getdir(ScriptState *st) static void builtin_getmap(ScriptState *st) { - dumb_ptr<map_session_data> sd = script_rid2sd(st); + dumb_ptr<map_session_data> sd; + + if (HARG(0)) //指定したキャラを状態異常にする + sd = map_id_is_player(wrap<BlockId>(conv_num(st, &AARG(0)))); + else + sd = script_rid2sd(st); push_str<ScriptDataStr>(st->stack, sd->bl_m->name_); } @@ -4715,7 +4731,7 @@ BuiltinFunction builtin_functions[] = BUILTIN(skill, "ii?"_s, '\0'), BUILTIN(setskill, "ii"_s, '\0'), BUILTIN(getskilllv, "i"_s, 'i'), - BUILTIN(overrideattack, "iiiiiE"_s, '\0'), + BUILTIN(overrideattack, "?????"_s, '\0'), BUILTIN(getgmlevel, ""_s, 'i'), BUILTIN(end, ""_s, '\0'), BUILTIN(getopt2, ""_s, 'i'), @@ -4812,7 +4828,7 @@ BuiltinFunction builtin_functions[] = BUILTIN(getnpcx, "?"_s, 'i'), BUILTIN(getnpcy, "?"_s, 'i'), BUILTIN(strnpcinfo, "i?"_s, 's'), - BUILTIN(getmap, ""_s, 's'), + BUILTIN(getmap, "?"_s, 's'), BUILTIN(mapexit, ""_s, '\0'), BUILTIN(freeloop, "i"_s, '\0'), BUILTIN(if_then_else, "iii"_s, '.'), |