summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--db/Changelog.txt3
-rw-r--r--db/mob_skill_db.txt95
-rw-r--r--src/map/battle.c38
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/mob.c9
-rw-r--r--src/map/mob.h1
7 files changed, 99 insertions, 50 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 0bbc4bea6..b1b9ad1d6 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/02/01
+ * Added support for mob skill target 'randomtarget', when specified, it
+ will pick a random enemy from within the skill's cast range. [Skotlex]
* Added string function strnlen [ultramage]
- This thing is useful for removing potential out-of-bounds crashes.
Had to #ifdef it because some systems implement it, some don't provide
diff --git a/db/Changelog.txt b/db/Changelog.txt
index d9e789f0c..6e6127a04 100644
--- a/db/Changelog.txt
+++ b/db/Changelog.txt
@@ -21,6 +21,9 @@
========================
02/01
+ * Updated the mob_db so that all skills from non-moving mobs that specified
+ 'target' as enemy will use 'randomtarget' instead.
+ * Amon Ra's meteors now use randomtarget instead of self.
* Corrected item 1459 (unused Partizan with no slots) being wlv3 instead of
2 (as the other two partizans)
* Changed the name of the four second versions of homunculi to not have a
diff --git a/db/mob_skill_db.txt b/db/mob_skill_db.txt
index 0f548371f..9e3983896 100644
--- a/db/mob_skill_db.txt
+++ b/db/mob_skill_db.txt
@@ -14,7 +14,8 @@
// target, without being attacked)
// anytarget (attack+angry+chase+follow)
//
-//target: The target of the skill can be: target (when a PC is targetted) / self / friend / master
+//target: The target of the skill can be: target (current target) / self / friend /
+// master / randomtarget (any enemy within skill's range)
// (the following are for ground-skills, a random target tile is selected from
// the specified area):
// around1 (3x3 area around self) / around2 (5x5 area around self) /
@@ -103,7 +104,7 @@
1019,PecoPeco@NPC_EMOTION,chase,197,1,2000,0,5000,yes,self,always,0,6,,,,,
1019,PecoPeco@NPC_FIREATTACK,attack,186,1,2000,0,5000,yes,target,always,0,,,,,,
1019,PecoPeco@NPC_PROVOCATION,chase,194,1,200,0,5000,yes,target,always,0,,,,,,19
-1020,Mandragora@NPC_GROUNDATTACK,attack,185,1,2000,0,5000,yes,target,always,0,,,,,,
+1020,Mandragora@NPC_GROUNDATTACK,attack,185,1,2000,0,5000,yes,randomtarget,always,0,,,,,,
1023,Orc Warrior@NPC_EMOTION,chase,197,1,200,0,5000,yes,self,always,0,19,0x81,,,,
1023,Orc Warrior@NPC_EMOTION,chase,197,1,2000,0,5000,yes,self,always,0,,,,,,
1023,Orc Warrior@NPC_GROUNDATTACK,attack,185,2,500,500,5000,no,target,always,0,,,,,,6
@@ -340,7 +341,7 @@
1067,Cornutus@NPC_WATERATTACK,attack,184,2,500,500,5000,no,target,always,0,,,,,,6
1067,Cornutus@CR_AUTOGUARD,attack,249,2,500,0,300000,yes,self,always,0,,,,,,
1067,Cornutus@CR_AUTOGUARD,chase,249,2,2000,0,300000,yes,self,longrangeattacked,,,,,,,
-1068,Hydra@NPC_WATERATTACK,attack,184,2,500,500,5000,no,target,always,0,,,,,,
+1068,Hydra@NPC_WATERATTACK,attack,184,2,500,500,5000,no,randomtarget,always,0,,,,,,
1069,Swordfish@NPC_WATERATTACK,attack,184,1,2000,0,5000,yes,target,always,0,,,,,,
1069,Swordfish@WZ_WATERBALL,attack,86,3,500,1500,5000,yes,target,always,0,,,,,,
1069,Swordfish@WZ_WATERBALL,chase,86,3,500,1500,5000,yes,target,always,0,,,,,,
@@ -566,10 +567,10 @@
1117,Evil Druid@NPC_UNDEADATTACK,chase,347,3,500,500,5000,no,target,always,0,,,,,,9
1117,Evil Druid@WZ_HEAVENDRIVE,attack,91,5,500,1200,5000,yes,target,always,0,,,,,,
1117,Evil Druid@WZ_HEAVENDRIVE,chase,91,5,500,1200,5000,yes,target,always,0,,,,,,
-1118,Flora@NPC_BLOODDRAIN,attack,199,1,500,0,5000,yes,target,always,0,,,,,,
+1118,Flora@NPC_BLOODDRAIN,attack,199,1,500,0,5000,yes,randomtarget,always,0,,,,,,
1118,Flora@NPC_REVENGE,idle,333,1,10000,0,0,yes,target,masterattacked,,,,,,,
1118,Flora@NPC_EMOTION,idle,197,1,2000,0,5000,yes,self,always,0,2,,,,,
-1118,Flora@NPC_GROUNDATTACK,attack,185,1,2000,0,5000,yes,target,always,0,,,,,,
+1118,Flora@NPC_GROUNDATTACK,attack,185,1,2000,0,5000,yes,randomtarget,always,0,,,,,,
1119,Frilldora@AS_CLOAKING,attack,135,1,2000,200,5000,yes,self,always,0,,,,,,
1119,Frilldora@AS_CLOAKING,idle,135,1,2000,200,5000,yes,self,always,0,,,,,,
1119,Frilldora@AS_CLOAKING,chase,135,1,2000,200,5000,yes,self,always,0,,,,,,
@@ -1249,11 +1250,11 @@
1276,Raydric Archer@NPC_DARKNESSATTACK,attack,190,3,500,500,5000,no,target,always,0,,,,,,9
1276,Raydric Archer@CR_AUTOGUARD,chase,249,2,2000,0,300000,yes,self,longrangeattacked,,,,,,,
1276,Raydric Archer@CR_AUTOGUARD,attack,249,2,500,0,300000,yes,self,always,0,,,,,,
-1277,Greatest General@NPC_BLINDATTACK,idle,177,3,10000,1500,5000,no,target,longrangeattacked,,,,,,,6
-1277,Greatest General@NPC_BLINDATTACK,idle,177,3,10000,1500,5000,no,target,casttargeted,,,,,,,6
-1277,Greatest General@NPC_FIREATTACK,attack,186,2,500,500,5000,no,target,always,0,,,,,,
-1277,Greatest General@WZ_EARTHSPIKE,idle,90,3,5000,1500,5000,no,target,longrangeattacked,,,,,,,6
-1277,Greatest General@WZ_EARTHSPIKE,idle,90,3,5000,1500,5000,no,target,casttargeted,,,,,,,6
+1277,Greatest General@NPC_BLINDATTACK,idle,177,3,10000,1500,5000,no,randomtarget,longrangeattacked,,,,,,,6
+1277,Greatest General@NPC_BLINDATTACK,idle,177,3,10000,1500,5000,no,randomtarget,casttargeted,,,,,,,6
+1277,Greatest General@NPC_FIREATTACK,attack,186,2,500,500,5000,no,randomtarget,always,0,,,,,,
+1277,Greatest General@WZ_EARTHSPIKE,idle,90,3,5000,1500,5000,no,randomtarget,longrangeattacked,,,,,,,6
+1277,Greatest General@WZ_EARTHSPIKE,idle,90,3,5000,1500,5000,no,randomtarget,casttargeted,,,,,,,6
1278,Stalactite Golem@NPC_STUNATTACK,attack,179,4,500,1500,5000,no,target,always,0,,,,,,6
1278,Stalactite Golem@SM_ENDURE,chase,8,1,5000,0,10000,yes,self,longrangeattacked,,,,,,,6
1278,Stalactite Golem@NPC_EMOTION_ON,attack,474,1,10000,0,30000,yes,self,always,0,6,0x3885,,,,
@@ -1570,7 +1571,7 @@
1367,Blazer@WZ_SIGHTRASHER,attack,81,5,500,1000,5000,no,target,always,0,,,,,,6
1368,Geographer@AL_HEAL,attack,28,9,10000,500,5000,yes,friend,friendhpltmaxrate,60,,,,,,
1368,Geographer@AL_HEAL,idle,28,9,10000,500,5000,yes,friend,friendhpltmaxrate,60,,,,,,
-1368,Geographer@NPC_SLEEPATTACK,attack,182,5,500,0,5000,yes,target,always,0,,,,,,
+1368,Geographer@NPC_SLEEPATTACK,attack,182,5,500,0,5000,yes,randomtarget,always,0,,,,,,
1369,Grand Peco@AS_SONICBLOW,attack,136,5,500,800,5000,no,target,always,0,,,,,,6
1369,Grand Peco@NPC_FIREATTACK,attack,186,3,500,500,5000,no,target,always,0,,,,,,6
1369,Grand Peco@NPC_EMOTION,chase,197,1,200,0,5000,yes,self,always,0,19,0x81,,,,
@@ -2439,20 +2440,20 @@
1510,Hylozoist@NPC_HALLUCINATION,chase,207,1,500,500,5000,yes,target,always,0,,,,,,9
1510,Hylozoist@NPC_HALLUCINATION,attack,207,1,500,500,5000,yes,target,always,0,,,,,,9
1510,Hylozoist@MO_BODYRELOCATION,chase,264,1,2000,500,5000,no,target,always,0,,,,,,
-1511,Amon Ra@NPC_BLOODDRAIN,idle,199,1,2000,0,5000,yes,target,always,0,,,,,,29
-1511,Amon Ra@NPC_BLOODDRAIN,idle,199,1,2000,0,5000,yes,target,always,0,,,,,,29
-1511,Amon Ra@NPC_BLOODDRAIN,attack,199,1,2000,0,5000,yes,target,always,0,,,,,,29
-1511,Amon Ra@NPC_BLOODDRAIN,attack,199,1,2000,0,5000,yes,target,always,0,,,,,,29
+1511,Amon Ra@NPC_BLOODDRAIN,idle,199,1,2000,0,5000,yes,randomtarget,always,0,,,,,,29
+1511,Amon Ra@NPC_BLOODDRAIN,idle,199,1,2000,0,5000,yes,randomtarget,always,0,,,,,,29
+1511,Amon Ra@NPC_BLOODDRAIN,attack,199,1,2000,0,5000,yes,randomtarget,always,0,,,,,,29
+1511,Amon Ra@NPC_BLOODDRAIN,attack,199,1,2000,0,5000,yes,randomtarget,always,0,,,,,,29
1511,Amon Ra@NPC_SUMMONMONSTER,idle,209,5,5000,0,10000,no,self,longrangeattacked,0,1474,1477,1438,,,9
1511,Amon Ra@NPC_SUMMONMONSTER,idle,209,5,5000,0,10000,no,self,casttargeted,0,1474,1477,1438,,,9
1511,Amon Ra@NPC_SUMMONMONSTER,attack,209,5,5000,0,10000,no,self,longrangeattacked,0,1474,1477,1438,,,9
1511,Amon Ra@NPC_SUMMONMONSTER,attack,209,5,5000,0,10000,no,self,casttargeted,0,1474,1477,1438,,,9
-1511,Amon Ra@WZ_METEOR,idle,83,11,10000,0,0,yes,self,longrangeattacked,,,,,,,9
-1511,Amon Ra@WZ_METEOR,idle,83,11,10000,0,0,yes,self,casttargeted,,,,,,,9
-1511,Amon Ra@WZ_METEOR,idle,83,11,10000,0,5000,yes,target,always,0,,,,,,9
+1511,Amon Ra@WZ_METEOR,idle,83,11,10000,0,0,yes,randomtarget,longrangeattacked,,,,,,,9
+1511,Amon Ra@WZ_METEOR,idle,83,11,10000,0,0,yes,randomtarget,casttargeted,,,,,,,9
+1511,Amon Ra@WZ_METEOR,idle,83,11,10000,0,5000,yes,randomtarget,always,0,,,,,,9
1511,Amon Ra@WZ_FIREPILLAR,idle,80,11,10000,0,2000,yes,around2,always,0,,,,,,
1511,Amon Ra@WZ_FIREPILLAR,idle,80,11,10000,0,2000,yes,around2,always,0,,,,,,
-1511,Amon Ra@NPC_DARKBLESSING,attack,203,1,5000,0,2000,no,target,always,0,,,,,,
+1511,Amon Ra@NPC_DARKBLESSING,attack,203,1,5000,0,2000,no,randomtarget,always,0,,,,,,
1511,Amon Ra@AL_TELEPORT,idle,26,1,10000,0,0,yes,self,rudeattacked,,,,,,,
1511,Amon Ra@AL_TELEPORT,walk,26,1,5000,0,5000,yes,self,rudeattacked,,,,,,,
1512,Hyegun@MO_BODYRELOCATION,chase,264,1,2000,500,5000,no,target,always,0,,,,,,
@@ -3220,18 +3221,18 @@
1663,Rawrel@NPC_EMOTION,idle,197,1,10000,0,5000,yes,self,skillused,28,15,,,,,
1663,Rawrel@NPC_EMOTION,attack,197,1,10000,0,5000,yes,self,skillused,28,15,,,,,
1663,Rawrel@NPC_EMOTION,chase,197,1,10000,0,5000,yes,self,skillused,28,15,,,,,
-1664,Photon Canon (Red)@NPC_WINDATTACK,attack,187,5,1000,1000,10000,yes,target,always,0,,,,,,
-1664,Photon Canon (Red)@NPC_WINDATTACK,attack,187,3,2000,500,5000,yes,target,always,0,,,,,,
-1664,Photon Canon (Red)@NPC_WINDATTACK,attack,187,1,10000,0,0,yes,target,always,0,,,,,,
-1665,Photon Canon (Yellow)@NPC_FIREATTACK,attack,186,5,1000,1000,10000,yes,target,always,0,,,,,,
-1665,Photon Canon (Yellow)@NPC_FIREATTACK,attack,186,3,2000,500,5000,yes,target,always,0,,,,,,
-1665,Photon Canon (Yellow)@NPC_FIREATTACK,attack,186,1,10000,0,0,yes,target,always,0,,,,,,
-1666,Photon Canon (Green)@NPC_WATERATTACK,attack,184,5,1000,1000,10000,yes,target,always,0,,,,,,
-1666,Photon Canon (Green)@NPC_WATERATTACK,attack,184,3,2000,500,5000,yes,target,always,0,,,,,,
-1666,Photon Canon (Green)@NPC_WATERATTACK,attack,184,1,10000,0,0,yes,target,always,0,,,,,,
-1667,Photon Canon (Blue)@NPC_GROUNDATTACK,attack,185,5,1000,1000,10000,yes,target,always,0,,,,,,
-1667,Photon Canon (Blue)@NPC_GROUNDATTACK,attack,185,3,2000,500,5000,yes,target,always,0,,,,,,
-1667,Photon Canon (Blue)@NPC_GROUNDATTACK,attack,185,1,10000,0,0,yes,target,always,0,,,,,,
+1664,Photon Canon (Red)@NPC_WINDATTACK,attack,187,5,1000,1000,10000,yes,randomtarget,always,0,,,,,,
+1664,Photon Canon (Red)@NPC_WINDATTACK,attack,187,3,2000,500,5000,yes,randomtarget,always,0,,,,,,
+1664,Photon Canon (Red)@NPC_WINDATTACK,attack,187,1,10000,0,0,yes,randomtarget,always,0,,,,,,
+1665,Photon Canon (Yellow)@NPC_FIREATTACK,attack,186,5,1000,1000,10000,yes,randomtarget,always,0,,,,,,
+1665,Photon Canon (Yellow)@NPC_FIREATTACK,attack,186,3,2000,500,5000,yes,randomtarget,always,0,,,,,,
+1665,Photon Canon (Yellow)@NPC_FIREATTACK,attack,186,1,10000,0,0,yes,randomtarget,always,0,,,,,,
+1666,Photon Canon (Green)@NPC_WATERATTACK,attack,184,5,1000,1000,10000,yes,randomtarget,always,0,,,,,,
+1666,Photon Canon (Green)@NPC_WATERATTACK,attack,184,3,2000,500,5000,yes,randomtarget,always,0,,,,,,
+1666,Photon Canon (Green)@NPC_WATERATTACK,attack,184,1,10000,0,0,yes,randomtarget,always,0,,,,,,
+1667,Photon Canon (Blue)@NPC_GROUNDATTACK,attack,185,5,1000,1000,10000,yes,randomtarget,always,0,,,,,,
+1667,Photon Canon (Blue)@NPC_GROUNDATTACK,attack,185,3,2000,500,5000,yes,randomtarget,always,0,,,,,,
+1667,Photon Canon (Blue)@NPC_GROUNDATTACK,attack,185,1,10000,0,0,yes,randomtarget,always,0,,,,,,
1668,Archdam@NPC_PIERCINGATT,attack,158,5,1000,0,5000,yes,target,always,0,,,,,,
1668,Archdam@NPC_GUIDEDATTACK,attack,172,2,500,1000,20000,no,target,always,0,,,,,,29
1668,Archdam@KN_SPEARSTAB,attack,58,5,500,800,5000,no,target,always,0,,,,,,
@@ -3268,9 +3269,9 @@
1673,Dimik (Fire)@NPC_COMBOATTACK,attack,171,4,500,700,5000,no,target,always,0,,,,,,
1673,Dimik (Fire)@NPC_COMBOATTACK,chase,171,4,500,700,5000,no,target,always,0,,,,,,
1673,Dimik (Fire)@NPC_FIREATTACK,attack,186,3,500,0,5000,yes,target,always,0,,,,,,
-1674,Monemus@NPC_FIREATTACK,attack,186,10,500,1000,30000,yes,target,always,0,,,,,,
-1674,Monemus@NPC_FIREATTACK,attack,186,3,1000,0,10000,yes,target,always,0,,,,,,
-1674,Monemus@NPC_FIREATTACK,attack,186,1,10000,0,0,yes,target,always,0,,,,,,
+1674,Monemus@NPC_FIREATTACK,attack,186,10,500,1000,30000,yes,randomtarget,always,0,,,,,,
+1674,Monemus@NPC_FIREATTACK,attack,186,3,1000,0,10000,yes,randomtarget,always,0,,,,,,
+1674,Monemus@NPC_FIREATTACK,attack,186,1,10000,0,0,yes,randomtarget,always,0,,,,,,
1675,Venatu (Fire)@NPC_SILENCEATTACK,attack,178,4,1000,700,5000,no,target,always,0,,,,,,
1675,Venatu (Fire)@NPC_AGIUP,attack,350,5,500,0,10000,yes,self,always,0,,,,,,18
1675,Venatu (Fire)@NPC_GUIDEDATTACK,attack,172,3,500,1000,20000,no,target,always,0,,,,,,6
@@ -3340,11 +3341,11 @@
1688,Lady Tany@AM_POTIONPITCHER,attack,231,4,2000,0,0,yes,friend,friendhpltmaxrate,90,,,,,,2
1688,Lady Tany@AL_TELEPORT,idle,26,1,1000,0,30000,yes,self,always,0,,,,,,
1688,Lady Tany@AL_TELEPORT,attack,26,1,1000,0,30000,yes,self,always,0,,,,,,
-1688,Lady Tany@AC_CHARGEARROW,attack,148,1,2000,0,5000,yes,target,always,0,,,,,,6
-1688,Lady Tany@NPC_COMBOATTACK,attack,171,1,1000,0,5000,no,target,always,0,,,,,,
-1688,Lady Tany@NPC_CRITICALSLASH,attack,170,1,500,500,5000,no,target,always,0,,,,,,6
-1688,Lady Tany@NPC_GUIDEDATTACK,attack,172,5,500,0,20000,no,target,always,0,,,,,,
-1688,Lady Tany@NPC_STUNATTACK,attack,179,5,500,0,5000,no,target,always,0,,,,,,
+1688,Lady Tany@AC_CHARGEARROW,attack,148,1,2000,0,5000,yes,randomtarget,always,0,,,,,,6
+1688,Lady Tany@NPC_COMBOATTACK,attack,171,1,1000,0,5000,no,randomtarget,always,0,,,,,,
+1688,Lady Tany@NPC_CRITICALSLASH,attack,170,1,500,500,5000,no,randomtarget,always,0,,,,,,6
+1688,Lady Tany@NPC_GUIDEDATTACK,attack,172,5,500,0,20000,no,randomtarget,always,0,,,,,,
+1688,Lady Tany@NPC_STUNATTACK,attack,179,5,500,0,5000,no,randomtarget,always,0,,,,,,
1688,Lady Tany@NPC_DEFENDER,attack,205,1,500,0,30000,yes,self,longrangeattacked,,,,,,,29
1688,Lady Tany@NPC_POWERUP,attack,349,5,10000,0,30000,yes,self,myhpltmaxrate,30,,,,,,6
1688,Lady Tany@NPC_SUMMONSLAVE,attack,196,5,10000,2000,5000,no,self,slavele,2,1691,,,,,
@@ -4038,19 +4039,19 @@
1779,Ktullanux@NPC_SUMMONSLAVE,idle,196,6,10000,0,0,no,self,onspawn,0,1777,,,,,
1779,Ktullanux@NPC_CALLSLAVE,attack,352,1,10000,0,30000,yes,target,always,0,,,,,,
1779,Ktullanux@NPC_CALLSLAVE,chase,352,1,10000,0,30000,yes,target,always,0,,,,,,
-1780,Muscipular@NPC_BLOODDRAIN,attack,199,1,1000,0,5000,yes,target,always,0,,,,,,
-1780,Muscipular@KN_SPEARSTAB,attack,58,5,1000,0,5000,no,target,always,0,,,,,,
-1780,Muscipular@NPC_GROUNDATTACK,attack,185,3,2000,0,5000,yes,target,always,0,,,,,,
-1780,Muscipular@MG_STONECURSE,attack,16,5,1000,0,5000,yes,target,always,0,,,,,,
+1780,Muscipular@NPC_BLOODDRAIN,attack,199,1,1000,0,5000,yes,randomtarget,always,0,,,,,,
+1780,Muscipular@KN_SPEARSTAB,attack,58,5,1000,0,5000,no,randomtarget,always,0,,,,,,
+1780,Muscipular@NPC_GROUNDATTACK,attack,185,3,2000,0,5000,yes,randomtarget,always,0,,,,,,
+1780,Muscipular@MG_STONECURSE,attack,16,5,1000,0,5000,yes,randomtarget,always,0,,,,,,
1780,Muscipular@AL_HEAL,attack,28,9,10000,0,5000,yes,friend,friendhpltmaxrate,60,,,,,,
1780,Muscipular@AL_HEAL,attack,28,9,10000,0,5000,yes,self,myhpltmaxrate,30,,,,,,
1780,Muscipular@AL_HEAL,idle,28,9,10000,0,5000,yes,friend,friendhpltmaxrate,60,,,,,,
1780,Muscipular@AL_HEAL,idle,28,9,10000,0,5000,yes,self,myhpltmaxrate,30,,,,,,
1781,Drosera@KN_PIERCE,attack,56,5,1000,0,5000,yes,target,always,0,,,,,,
-1781,Drosera@NPC_BLOODDRAIN,attack,199,1,1000,0,5000,yes,target,always,0,,,,,,
-1781,Drosera@NPC_GROUNDATTACK,attack,185,3,2000,0,5000,yes,target,always,0,,,,,,
-1781,Drosera@NPC_GUIDEDATTACK,attack,172,3,1000,0,5000,no,target,always,0,,,,,,
-1781,Drosera@NPC_SLEEPATTACK,attack,182,3,1000,0,5000,yes,target,always,0,,,,,,
+1781,Drosera@NPC_BLOODDRAIN,attack,199,1,1000,0,5000,yes,randomtarget,always,0,,,,,,
+1781,Drosera@NPC_GROUNDATTACK,attack,185,3,2000,0,5000,yes,randomtarget,always,0,,,,,,
+1781,Drosera@NPC_GUIDEDATTACK,attack,172,3,1000,0,5000,no,randomtarget,always,0,,,,,,
+1781,Drosera@NPC_SLEEPATTACK,attack,182,3,1000,0,5000,yes,randomtarget,always,0,,,,,,
1782,Roween@NPC_EMOTION,idle,197,1,2000,0,5000,yes,self,always,0,22,,,,,
1782,Roween@NPC_COMBOATTACK,attack,171,4,1000,0,5000,yes,target,always,0,,,,,,
1782,Roween@NPC_COMBOATTACK,chase,171,4,1000,0,5000,yes,target,always,0,,,,,,
diff --git a/src/map/battle.c b/src/map/battle.c
index 8b67ce885..bf79ff9b5 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -53,9 +53,6 @@ static int battle_gettargeted_sub(struct block_list *bl, va_list ap)
int target_id;
int *c;
- nullpo_retr(0, bl);
- nullpo_retr(0, ap);
-
bl_list = va_arg(ap, struct block_list **);
c = va_arg(ap, int *);
target_id = va_arg(ap, int);
@@ -105,6 +102,41 @@ int battle_gettarget(struct block_list *bl)
}
return 0;
}
+
+static int battle_getenemy_sub(struct block_list *bl, va_list ap)
+{
+ struct block_list **bl_list;
+ struct block_list *target;
+ int *c;
+
+ bl_list = va_arg(ap, struct block_list **);
+ c = va_arg(ap, int *);
+ target = va_arg(ap, struct block_list *);
+
+ if (bl->id == target->id)
+ return 0;
+ if (*c >= 24)
+ return 0;
+
+ if (battle_check_target(target, bl, BCT_ENEMY) > 0) {
+ bl_list[(*c)++] = bl;
+ return 1;
+ }
+ return 0;
+}
+
+// Picks a random enemy of the given type (BL_PC, BL_CHAR, etc) within the range given. [Skotlex]
+struct block_list* battle_getenemy(struct block_list *target, int type, int range)
+{
+ struct block_list *bl_list[24];
+ int c = 0;
+ memset(bl_list, 0, sizeof(bl_list));
+ map_foreachinrange(battle_getenemy_sub, target, range, type, bl_list, &c, target);
+ if (c == 0 || c > 24)
+ return NULL;
+ return bl_list[rand()%c];
+}
+
// _??[W̒x
struct delay_damage {
struct block_list *src;
diff --git a/src/map/battle.h b/src/map/battle.h
index 00be1fe42..6d2d8a7db 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -57,6 +57,7 @@ int battle_weapon_attack( struct block_list *bl,struct block_list *target,
// ep[^𓾂
struct block_list* battle_get_master(struct block_list *src);
struct block_list* battle_gettargeted(struct block_list *target);
+struct block_list* battle_getenemy(struct block_list *target, int type, int range);
int battle_gettarget(struct block_list *bl);
int battle_getcurrentskill(struct block_list *bl);
diff --git a/src/map/mob.c b/src/map/mob.c
index b47dfcbb8..f32acc85f 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2757,6 +2757,10 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
short x = 0, y = 0;
if (ms[i].target <= MST_AROUND) {
switch (ms[i].target) {
+ case MST_RANDOM: //Pick a random enemy within skill range.
+ bl = battle_getenemy(&md->bl, md->special_state.ai?BL_CHAR:BL_PC|BL_HOM,
+ skill_get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv));
+ break;
case MST_TARGET:
case MST_AROUND5:
case MST_AROUND6:
@@ -2805,6 +2809,10 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
if (ms[i].target <= MST_MASTER) {
struct block_list *bl;
switch (ms[i].target) {
+ case MST_RANDOM: //Pick a random enemy within skill range.
+ bl = battle_getenemy(&md->bl, md->special_state.ai?BL_CHAR:BL_PC|BL_HOM,
+ skill_get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv));
+ break;
case MST_TARGET:
bl = map_id2bl(md->target_id);
break;
@@ -3657,6 +3665,7 @@ static int mob_readskilldb(void)
{ "anytarget",MSS_ANYTARGET }, //Berserk+Angry+Rush+Follow
}, target[] = {
{ "target", MST_TARGET },
+ { "randomtarget", MST_RANDOM },
{ "self", MST_SELF },
{ "friend", MST_FRIEND },
{ "master", MST_MASTER },
diff --git a/src/map/mob.h b/src/map/mob.h
index f4895c7e0..0828629bd 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -73,6 +73,7 @@ struct mob_db {
enum {
MST_TARGET = 0,
+ MST_RANDOM, //Random Target!
MST_SELF,
MST_FRIEND,
MST_MASTER,