From b770e11f539de8b86a6e042d357e248fc25845b2 Mon Sep 17 00:00:00 2001 From: asuratva Date: Wed, 15 May 2024 10:49:57 +0530 Subject: Add function to check for summoned creature in scripts --- src/map/script-fun.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 13b4bc8..8d5bf94 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -3726,6 +3726,23 @@ void builtin_aggravate(ScriptState *st) } } +/*========================================== + * Check for summoned creature + *------------------------------------------ + */ +static +void builtin_issummon(ScriptState *st) +{ + dumb_ptr md = map_id_is_mob(wrap(conv_num(st, &AARG(0)))); + int val = 0; + if (md && md->name.contains_seq("Summon"_s)) + { + val = 1; + } + + push_int(st->stack, val); +} + /*========================================== * エリア指定ユーザー数所得 * Area Designated User Income @@ -5757,6 +5774,7 @@ BuiltinFunction builtin_functions[] = BUILTIN(shop, "s"_s, '\0'), BUILTIN(isdead, ""_s, 'i'), BUILTIN(aggravate, "i?"_s, '\0'), + BUILTIN(issummon, "i?"_s, 'i'), BUILTIN(fakenpcname, "ssi"_s, '\0'), BUILTIN(puppet, "mxysi??"_s, 'i'), BUILTIN(destroy, "?"_s, '\0'), -- cgit v1.2.3-70-g09d2