Players now can't attack deep wilderness threats focused on other players
This commit is contained in:
@@ -5,6 +5,7 @@ import content.region.wilderness.handlers.revenants.RevenantNPC
|
|||||||
import content.region.wilderness.handlers.revenants.RevenantType
|
import content.region.wilderness.handlers.revenants.RevenantType
|
||||||
import core.api.*
|
import core.api.*
|
||||||
import core.game.node.entity.Entity
|
import core.game.node.entity.Entity
|
||||||
|
import core.game.node.entity.combat.CombatStyle
|
||||||
import core.game.node.entity.combat.DeathTask
|
import core.game.node.entity.combat.DeathTask
|
||||||
import core.game.node.entity.npc.NPC
|
import core.game.node.entity.npc.NPC
|
||||||
import core.game.node.entity.npc.NPCBehavior
|
import core.game.node.entity.npc.NPCBehavior
|
||||||
@@ -107,7 +108,6 @@ class RevGuardianBehavior : NPCBehavior() {
|
|||||||
if (WildernessZone.isInZone(target.properties.teleportLocation))
|
if (WildernessZone.isInZone(target.properties.teleportLocation))
|
||||||
self.properties.teleportLocation = target.properties.teleportLocation
|
self.properties.teleportLocation = target.properties.teleportLocation
|
||||||
}
|
}
|
||||||
sendChat(self, "ticking")
|
|
||||||
self.attack(target)
|
self.attack(target)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -117,6 +117,16 @@ class RevGuardianBehavior : NPCBehavior() {
|
|||||||
sendChat(self, chats.random())
|
sendChat(self, chats.random())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun canBeAttackedBy(self: NPC, attacker: Entity, style: CombatStyle, shouldSendMessage: Boolean): Boolean {
|
||||||
|
val target = getAttribute<Player?>(self, "dw-threat-target", null)
|
||||||
|
if (attacker != target) {
|
||||||
|
if (shouldSendMessage && attacker is Player)
|
||||||
|
sendMessage(attacker, "This revenant is focused on someone else.")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return super.canBeAttackedBy(self, attacker, style, shouldSendMessage)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDeathStarted(self: NPC, killer: Entity) {
|
override fun onDeathStarted(self: NPC, killer: Entity) {
|
||||||
val target = getAttribute<Player?>(self, "dw-threat-target", null) ?: return
|
val target = getAttribute<Player?>(self, "dw-threat-target", null) ?: return
|
||||||
sendChat(self, deathMessages.random())
|
sendChat(self, deathMessages.random())
|
||||||
@@ -126,6 +136,7 @@ class RevGuardianBehavior : NPCBehavior() {
|
|||||||
|
|
||||||
override fun onDropTableRolled(self: NPC, killer: Entity, drops: ArrayList<Item>) {
|
override fun onDropTableRolled(self: NPC, killer: Entity, drops: ArrayList<Item>) {
|
||||||
val target = getAttribute<Player?>(self, "dw-threat-target", null) ?: return
|
val target = getAttribute<Player?>(self, "dw-threat-target", null) ?: return
|
||||||
|
if (killer != target) drops.clear()
|
||||||
val timer = getOrStartTimer<DWThreatTimer>(target)
|
val timer = getOrStartTimer<DWThreatTimer>(target)
|
||||||
timer.ticksLeft = 0
|
timer.ticksLeft = 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user