summaryrefslogtreecommitdiff
path: root/src/map/script-fun.cpp
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-05-01 20:29:52 -0400
committermekolat <mekolat@users.noreply.github.com>2016-05-01 20:29:52 -0400
commit9661c46ab0c9bcb1cc582396b4816e057cec570d (patch)
treeaa02f8afca054f6ee3ab0ff122a4ba74643178ea /src/map/script-fun.cpp
parent103fba002ce4d5ec0b9f130681d6636ed52f0219 (diff)
parentfbd6802fa5d14e5aae0b602f6ed33fc7350f703b (diff)
downloadtmwa-9661c46ab0c9bcb1cc582396b4816e057cec570d.tar.gz
tmwa-9661c46ab0c9bcb1cc582396b4816e057cec570d.tar.bz2
tmwa-9661c46ab0c9bcb1cc582396b4816e057cec570d.tar.xz
tmwa-9661c46ab0c9bcb1cc582396b4816e057cec570d.zip
Merge pull request #217 from mekolat/override
override modifications
Diffstat (limited to 'src/map/script-fun.cpp')
-rw-r--r--src/map/script-fun.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 64ce156..898eec0 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -2233,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);
+ }
}
/*==========================================
@@ -4739,7 +4749,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'),