summaryrefslogtreecommitdiff
path: root/world/map
diff options
context:
space:
mode:
authorHello TMW <hello@themanaworld.org>2024-09-09 18:39:54 +0000
committerLed Mitz <smoothshifter@tuta.io>2024-09-09 18:39:54 +0000
commit442f25eac02064d7e9e738b7a17d6e6bb7c99de2 (patch)
tree4264830abb97f5efdff45c3728dbe655da8c3e61 /world/map
parent2b9a9ea14967c7b09c250168b5bd2c430858f4b3 (diff)
downloadserverdata-442f25eac02064d7e9e738b7a17d6e6bb7c99de2.tar.gz
serverdata-442f25eac02064d7e9e738b7a17d6e6bb7c99de2.tar.bz2
serverdata-442f25eac02064d7e9e738b7a17d6e6bb7c99de2.tar.xz
serverdata-442f25eac02064d7e9e738b7a17d6e6bb7c99de2.zip
This brings "enhanced" miteyo. Release flavour.
Miteyo been meant to highlight "magic" NPCs on map, probably to make it easier to learn magic. This version, however, goes further. It scans map for poweful mages, who are focused on Astral Soul skill and acquired Lv 9 in that skill. Its very likely such mages are useful so its really cool idea. Changes vs prev commit: * Debug messages removed. * Skill iteration label renamed to make intent more clear. * Some fixups on code comments. Credits and kudos for idea going to Ledmitz.
Diffstat (limited to 'world/map')
-rw-r--r--world/map/npc/magic/level1-detect-magic.txt31
1 files changed, 31 insertions, 0 deletions
diff --git a/world/map/npc/magic/level1-detect-magic.txt b/world/map/npc/magic/level1-detect-magic.txt
index 33597d02..7936fa99 100644
--- a/world/map/npc/magic/level1-detect-magic.txt
+++ b/world/map/npc/magic/level1-detect-magic.txt
@@ -12,6 +12,9 @@
if (CASTS < 0) set CASTS, 1; // overflow
misceffect FX_MAGIC_DETECT_CAST, strcharinfo(0);
set .@range, (@spellpower/50)+1;
+ set .caster, getcharid(3);
+ foreach 0, getmap(), POS_X - .@range, POS_Y - .@range, POS_X + .@range, POS_Y + .@range,
+ strnpcinfo(0) + "::OnNearbyPlayer";
foreach 1, getmap(), POS_X - .@range, POS_Y - .@range, POS_X + .@range, POS_Y + .@range,
strnpcinfo(0) + "::OnNearbyNpc";
if (getmap() == "099-4")
@@ -21,6 +24,14 @@
callfunc "magic_exp";
end;
+OnNearbyPlayer:
+ if (@target_id == BL_ID) end; // Dont do lookups on caster.
+ if (sc_check(SC_HIDE, @target_id)) end; // Also skip hidden (anwiltyp) players.
+ if (attachrid(@target_id) < 1) end; // Switch context -> found player (to look up focused skills)
+ if (call("is_magician")) misceffect FX_MAGIC_DETECT_HIT, BL_ID; // BL_ID because now attached to target
+ if (attachrid(.caster) < 1) end; // Try to reattach back -> caster (is it needed?)
+ end;
+
OnNearbyNpc:
set .@e$, strnpcinfo(2,@target_id);
if(.@e$ == "#_M" || .@e$ == "#MAGIC" || get(.IS_MAGIC, @target_id))
@@ -35,3 +46,23 @@ OnInit:
set .exp_gain, 0;
end;
}
+
+// This function tests if current RID is a magician (Astral soul skill Lv 9).
+function|script|is_magician
+{
+ getactivatedpoolskilllist;
+ if (@skilllist_count != 0) goto L_iterate_focused; // Had some focused skills -> look further
+ goto L_focus_notfound; // No focused skills at all -> bail out.
+
+L_iterate_focused:
+ set @skilllist_count, @skilllist_count-1;
+ if ((@skilllist_id[@skilllist_count] == SKILL_ASTRAL_SOUL) && (getskilllv(SKILL_ASTRAL_SOUL) >= 2)) goto L_focus_found;
+ if (@skilllist_count == 0) goto L_focus_notfound;
+ goto L_iterate_focused; // iterate via array of focused skills.
+
+L_focus_found:
+ return 1;
+
+L_focus_notfound:
+ return 0;
+}