mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-20 13:30:27 -07:00
Merge branch 'GFI-bugfix' into 'master'
Fixed a bug with guard-on-troll combat See merge request 2009scape/2009scape!156
This commit is contained in:
commit
17a27683bf
2 changed files with 40 additions and 39 deletions
|
|
@ -0,0 +1,40 @@
|
|||
package rs09.game.node.entity.npc.other
|
||||
|
||||
import api.ContentAPI
|
||||
import core.game.node.entity.npc.AbstractNPC
|
||||
import core.game.world.map.Location
|
||||
import core.plugin.Initializable
|
||||
import core.tools.RandomFunction
|
||||
import org.rs09.consts.NPCs
|
||||
|
||||
@Initializable
|
||||
class HonourGuardGFI : AbstractNPC {
|
||||
//Constructor spaghetti because Arios I guess
|
||||
constructor() : super(NPCs.HONOUR_GUARD_5514, null, true) {}
|
||||
private constructor(id: Int, location: Location) : super(id, location) {}
|
||||
|
||||
override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC {
|
||||
return HonourGuardGFI(id, location)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.HONOUR_GUARD_5514,NPCs.HONOUR_GUARD_5515,NPCs.HONOUR_GUARD_5516,NPCs.HONOUR_GUARD_5517)
|
||||
}
|
||||
|
||||
override fun tick() {
|
||||
if(isActive && !inCombat() && RandomFunction.roll(10)){
|
||||
val localTrolls = ContentAPI.findLocalNPCs(this, intArrayOf(NPCs.ICE_TROLL_FEMALE_5523, NPCs.ICE_TROLL_MALE_5522, NPCs.ICE_TROLL_RUNT_5521, NPCs.ICE_TROLL_GRUNT_5524))
|
||||
localTrolls.forEach{troll ->
|
||||
if(troll.location.withinDistance(location,6)) {
|
||||
attack(troll)
|
||||
return super.tick()
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isActive){
|
||||
properties.combatPulse.stop()
|
||||
}
|
||||
return super.tick()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
package rs09.game.node.entity.npc.other
|
||||
|
||||
import api.ContentAPI
|
||||
import core.game.node.entity.npc.AbstractNPC
|
||||
import core.game.world.map.Location
|
||||
import core.plugin.Initializable
|
||||
import core.tools.RandomFunction
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.system.SystemLogger
|
||||
|
||||
@Initializable
|
||||
class IceTrollGFI : AbstractNPC {
|
||||
//Constructor spaghetti because Arios I guess
|
||||
constructor() : super(NPCs.ICE_TROLL_MALE_5522, null, true) {}
|
||||
private constructor(id: Int, location: Location) : super(id, location) {}
|
||||
|
||||
override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC {
|
||||
return IceTrollGFI(id, location)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(NPCs.ICE_TROLL_FEMALE_5523, NPCs.ICE_TROLL_MALE_5522, NPCs.ICE_TROLL_RUNT_5521, NPCs.ICE_TROLL_GRUNT_5524)
|
||||
}
|
||||
|
||||
override fun tick() {
|
||||
if(isActive && !inCombat() && RandomFunction.roll(20)){
|
||||
val localGuards = ContentAPI.findLocalNPCs(this, intArrayOf(NPCs.HONOUR_GUARD_5514,NPCs.HONOUR_GUARD_5515,NPCs.HONOUR_GUARD_5516,NPCs.HONOUR_GUARD_5517))
|
||||
localGuards.forEach{guard ->
|
||||
SystemLogger.logInfo("Looping guards...")
|
||||
if(guard.location.withinDistance(location,6)) {
|
||||
attack(guard)
|
||||
return super.tick()
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.tick()
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue