Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
L2j Server Datapack
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
L2j
L2j Server Datapack
Commits
fc7f68dd
Commit
fc7f68dd
authored
4 years ago
by
Maneco2
Browse files
Options
Downloads
Patches
Plain Diff
Add Bloody Karinness AI
parent
6ca556d2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/com/l2jserver/datapack/ai/individual/BloodyKarinness.java
+165
-0
165 additions, 0 deletions
...com/l2jserver/datapack/ai/individual/BloodyKarinness.java
src/main/resources/data/scripts.cfg
+1
-0
1 addition, 0 deletions
src/main/resources/data/scripts.cfg
with
166 additions
and
0 deletions
src/main/java/com/l2jserver/datapack/ai/individual/BloodyKarinness.java
0 → 100644
+
165
−
0
View file @
fc7f68dd
/*
* Copyright (C) 2004-2020 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J DataPack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
com.l2jserver.datapack.ai.individual
;
import
com.l2jserver.datapack.ai.npc.AbstractNpcAI
;
import
com.l2jserver.gameserver.GeoData
;
import
com.l2jserver.gameserver.datatables.SpawnTable
;
import
com.l2jserver.gameserver.model.L2Spawn
;
import
com.l2jserver.gameserver.model.Location
;
import
com.l2jserver.gameserver.model.actor.L2Attackable
;
import
com.l2jserver.gameserver.model.actor.L2Npc
;
import
com.l2jserver.gameserver.model.actor.instance.L2PcInstance
;
/**
* Bloody Karinness AI.
* @author Maneco2
* @version 2.6.2.0
*/
public
class
BloodyKarinness
extends
AbstractNpcAI
{
// NPCs
private
static
final
int
BLOODY_KARINNESS
=
22856
;
private
static
final
int
[]
BLOODY_FAMILY
=
{
22854
,
// Bloody Karik
22855
,
// Bloody Berserker
22856
,
// Bloody Karinness
};
public
BloodyKarinness
()
{
super
(
BloodyKarinness
.
class
.
getSimpleName
(),
"ai/individual"
);
addKillId
(
BLOODY_KARINNESS
);
addAttackId
(
BLOODY_KARINNESS
);
addTeleportId
(
BLOODY_KARINNESS
);
addMoveFinishedId
(
BLOODY_KARINNESS
);
}
@Override
public
String
onAdvEvent
(
String
event
,
L2Npc
npc
,
L2PcInstance
player
)
{
switch
(
event
)
{
case
"CORE_AI"
:
{
if
(
npc
!=
null
)
{
((
L2Attackable
)
npc
).
clearAggroList
();
npc
.
disableCoreAI
(
false
);
startQuestTimer
(
"RETURN_SPAWN"
,
300000
,
npc
,
null
);
}
break
;
}
case
"RETURN_SPAWN"
:
{
if
(
npc
!=
null
)
{
((
L2Attackable
)
npc
).
setCanReturnToSpawnPoint
(
true
);
}
break
;
}
}
return
super
.
onAdvEvent
(
event
,
npc
,
player
);
}
@Override
public
String
onAttack
(
L2Npc
npc
,
L2PcInstance
attacker
,
int
damage
,
boolean
isSummon
)
{
switch
(
npc
.
getId
())
{
case
BLOODY_KARINNESS:
{
final
double
DistSpawn
=
npc
.
calculateDistance
(
npc
.
getSpawn
().
getLocation
(),
false
,
false
);
if
(
DistSpawn
>
3000
)
{
npc
.
disableCoreAI
(
true
);
npc
.
teleToLocation
(
npc
.
getSpawn
().
getLocation
());
}
else
{
if
((
DistSpawn
>
500
)
&&
(
getRandom
(
100
)
<
1
)
&&
(
npc
.
isInCombat
())
&&
(!
npc
.
isCastingNow
()))
{
for
(
int
object
:
BLOODY_FAMILY
)
{
for
(
L2Spawn
spawn
:
SpawnTable
.
getInstance
().
getSpawns
(
object
))
{
final
L2Npc
obj
=
spawn
.
getLastSpawn
();
if
((
obj
!=
null
)
&&
!
obj
.
isDead
()
&&
(
Math
.
abs
(
npc
.
getZ
()
-
obj
.
getZ
())
<
150
))
{
if
(
npc
.
calculateDistance
(
obj
,
false
,
false
)
>
obj
.
getTemplate
().
getClanHelpRange
())
{
if
((
npc
.
calculateDistance
(
obj
,
false
,
false
)
<
3000
)
&&
GeoData
.
getInstance
().
canSeeTarget
(
npc
,
obj
))
{
npc
.
disableCoreAI
(
true
);
((
L2Attackable
)
npc
).
setCanReturnToSpawnPoint
(
false
);
addMoveToDesire
(
npc
,
new
Location
(
obj
.
getX
()
+
getRandom
(-
100
,
100
),
obj
.
getY
()
+
getRandom
(-
100
,
100
),
obj
.
getZ
()
+
20
,
0
),
0
);
}
}
}
}
}
}
}
break
;
}
}
return
super
.
onAttack
(
npc
,
attacker
,
damage
,
isSummon
);
}
@Override
public
String
onKill
(
L2Npc
npc
,
L2PcInstance
killer
,
boolean
isSummon
)
{
switch
(
npc
.
getId
())
{
case
BLOODY_KARINNESS:
{
if
(
getRandom
(
100
)
<
5
)
{
final
int
newZ
=
npc
.
getZ
()
+
20
;
addAttackDesire
(
addSpawn
(
npc
.
getId
(),
npc
.
getX
(),
npc
.
getY
(),
newZ
,
npc
.
getHeading
(),
false
,
0
),
killer
);
addAttackDesire
(
addSpawn
(
npc
.
getId
(),
npc
.
getX
(),
npc
.
getY
()
-
10
,
newZ
,
npc
.
getHeading
(),
false
,
0
),
killer
);
addAttackDesire
(
addSpawn
(
npc
.
getId
(),
npc
.
getX
(),
npc
.
getY
()
-
20
,
newZ
,
npc
.
getHeading
(),
false
,
0
),
killer
);
addAttackDesire
(
addSpawn
(
npc
.
getId
(),
npc
.
getX
(),
npc
.
getY
()
+
10
,
newZ
,
npc
.
getHeading
(),
false
,
0
),
killer
);
addAttackDesire
(
addSpawn
(
npc
.
getId
(),
npc
.
getX
(),
npc
.
getY
()
+
20
,
newZ
,
npc
.
getHeading
(),
false
,
0
),
killer
);
}
break
;
}
}
return
super
.
onKill
(
npc
,
killer
,
isSummon
);
}
@Override
protected
void
onTeleport
(
L2Npc
npc
)
{
startQuestTimer
(
"CORE_AI"
,
100
,
npc
,
null
);
}
@Override
public
void
onMoveFinished
(
L2Npc
npc
)
{
startQuestTimer
(
"CORE_AI"
,
100
,
npc
,
null
);
}
public
static
void
main
(
String
[]
args
)
{
new
BloodyKarinness
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/data/scripts.cfg
+
1
−
0
View file @
fc7f68dd
...
...
@@ -150,6 +150,7 @@ com/l2jserver/datapack/ai/individual/Beleth.java
com/l2jserver/datapack/ai/individual/BlackdaggerWing.java
com/l2jserver/datapack/ai/individual/BleedingFly.java
com/l2jserver/datapack/ai/individual/BloodyBerserker.java
com/l2jserver/datapack/ai/individual/BloodyKarinness.java
com/l2jserver/datapack/ai/individual/CrimsonHatuOtis.java
com/l2jserver/datapack/ai/individual/Core.java
com/l2jserver/datapack/ai/individual/DarkWaterDragon.java
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment