Fixed the animation issues with the Rock Golems
This commit is contained in:
@@ -72708,9 +72708,10 @@
|
||||
{
|
||||
"examine": "Rock with attitude.",
|
||||
"combat_style": "1",
|
||||
"range_animation": "0",
|
||||
"attack_speed": "4",
|
||||
"defence_animation": "8",
|
||||
"range_animation": "5347",
|
||||
"attack_speed": "6",
|
||||
"defence_animation": "154",
|
||||
"death_animation": "156",
|
||||
"name": "Rock Golem",
|
||||
"lifepoints": "25",
|
||||
"strength_level": "8",
|
||||
@@ -72718,14 +72719,16 @@
|
||||
"aggressive": "true",
|
||||
"bonuses": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
|
||||
"range_level": "15",
|
||||
"projectile": "968",
|
||||
"attack_level": "8"
|
||||
},
|
||||
{
|
||||
"examine": "Rock with attitude.",
|
||||
"combat_style": "1",
|
||||
"range_animation": "0",
|
||||
"attack_speed": "4",
|
||||
"defence_animation": "17",
|
||||
"range_animation": "5347",
|
||||
"attack_speed": "6",
|
||||
"defence_animation": "154",
|
||||
"death_animation": "156",
|
||||
"name": "Rock Golem",
|
||||
"lifepoints": "40",
|
||||
"strength_level": "17",
|
||||
@@ -72733,14 +72736,16 @@
|
||||
"aggressive": "true",
|
||||
"bonuses": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
|
||||
"range_level": "30",
|
||||
"projectile": "968",
|
||||
"attack_level": "17"
|
||||
},
|
||||
{
|
||||
"examine": "Rock with attitude.",
|
||||
"combat_style": "1",
|
||||
"range_animation": "0",
|
||||
"attack_speed": "4",
|
||||
"defence_animation": "36",
|
||||
"range_animation": "5347",
|
||||
"attack_speed": "6",
|
||||
"defence_animation": "154",
|
||||
"death_animation": "156",
|
||||
"name": "Rock Golem",
|
||||
"lifepoints": "60",
|
||||
"strength_level": "36",
|
||||
@@ -72748,14 +72753,16 @@
|
||||
"aggressive": "true",
|
||||
"bonuses": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
|
||||
"range_level": "40",
|
||||
"projectile": "968",
|
||||
"attack_level": "38"
|
||||
},
|
||||
{
|
||||
"examine": "Rock with attitude.",
|
||||
"combat_style": "1",
|
||||
"range_animation": "0",
|
||||
"attack_speed": "4",
|
||||
"defence_animation": "64",
|
||||
"range_animation": "5347",
|
||||
"attack_speed": "6",
|
||||
"defence_animation": "154",
|
||||
"death_animation": "156",
|
||||
"name": "Rock Golem",
|
||||
"lifepoints": "86",
|
||||
"strength_level": "64",
|
||||
@@ -72763,14 +72770,16 @@
|
||||
"aggressive": "true",
|
||||
"bonuses": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
|
||||
"range_level": "60",
|
||||
"projectile": "968",
|
||||
"attack_level": "64"
|
||||
},
|
||||
{
|
||||
"examine": "Rock with attitude.",
|
||||
"combat_style": "1",
|
||||
"range_animation": "0",
|
||||
"attack_speed": "4",
|
||||
"defence_animation": "100",
|
||||
"range_animation": "5347",
|
||||
"attack_speed": "6",
|
||||
"defence_animation": "154",
|
||||
"death_animation": "156",
|
||||
"name": "Rock Golem",
|
||||
"lifepoints": "120",
|
||||
"strength_level": "100",
|
||||
@@ -72778,14 +72787,16 @@
|
||||
"aggressive": "true",
|
||||
"bonuses": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
|
||||
"range_level": "75",
|
||||
"projectile": "968",
|
||||
"attack_level": "100"
|
||||
},
|
||||
{
|
||||
"examine": "Rock with attitude.",
|
||||
"combat_style": "1",
|
||||
"range_animation": "0",
|
||||
"attack_speed": "4",
|
||||
"defence_animation": "130",
|
||||
"range_animation": "5347",
|
||||
"attack_speed": "6",
|
||||
"defence_animation": "154",
|
||||
"death_animation": "156",
|
||||
"name": "Rock Golem",
|
||||
"lifepoints": "166",
|
||||
"strength_level": "130",
|
||||
@@ -72793,6 +72804,7 @@
|
||||
"aggressive": "true",
|
||||
"bonuses": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
|
||||
"range_level": "80",
|
||||
"projectile": "968",
|
||||
"attack_level": "130"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,25 +1,86 @@
|
||||
package content.global.ame.events.rockgolem
|
||||
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.combat.BattleState
|
||||
import core.game.node.entity.combat.CombatStyle
|
||||
import core.game.node.entity.combat.CombatSwingHandler
|
||||
import core.game.node.entity.combat.MultiSwingHandler
|
||||
import core.game.node.entity.combat.equipment.SwitchAttack
|
||||
import core.game.node.entity.combat.InteractionType
|
||||
import core.game.node.entity.impl.Projectile
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.npc.NPCBehavior
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import org.rs09.consts.NPCs
|
||||
|
||||
class RockGolemBehavior() : NPCBehavior(
|
||||
NPCs.ROCK_GOLEM_413, NPCs.ROCK_GOLEM_414, NPCs.ROCK_GOLEM_415, NPCs.ROCK_GOLEM_416, NPCs.ROCK_GOLEM_417, NPCs.ROCK_GOLEM_418
|
||||
) {
|
||||
val rangeHandler = SwitchAttack(CombatStyle.RANGE)
|
||||
val meleeHandler = SwitchAttack(CombatStyle.MELEE)
|
||||
val combatHandler = MultiSwingHandler(rangeHandler, meleeHandler)
|
||||
class RockGolemBehavior() : NPCBehavior(NPCs.ROCK_GOLEM_413, NPCs.ROCK_GOLEM_414, NPCs.ROCK_GOLEM_415, NPCs.ROCK_GOLEM_416, NPCs.ROCK_GOLEM_417, NPCs.ROCK_GOLEM_418) {
|
||||
private val swingHandler = RockGolemSwingHandler()
|
||||
|
||||
override fun getSwingHandlerOverride(self: NPC, original: CombatSwingHandler): CombatSwingHandler {
|
||||
return combatHandler
|
||||
return swingHandler
|
||||
}
|
||||
|
||||
override fun getXpMultiplier(self: NPC, attacker: Entity): Double {
|
||||
return super.getXpMultiplier(self, attacker) / 16.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class RockGolemSwingHandler : CombatSwingHandler(CombatStyle.RANGE) {
|
||||
override fun canSwing(entity: Entity, victim: Entity): InteractionType? {
|
||||
return type?.swingHandler?.canSwing(entity, victim)
|
||||
}
|
||||
|
||||
override fun swing(entity: Entity?, victim: Entity?, state: BattleState?): Int {
|
||||
if (entity == null || victim == null) return -1
|
||||
|
||||
val prayingRange = victim.hasProtectionPrayer(CombatStyle.RANGE)
|
||||
|
||||
type = if (prayingRange) {
|
||||
CombatStyle.MELEE
|
||||
} else {
|
||||
CombatStyle.RANGE
|
||||
}
|
||||
|
||||
if (type == CombatStyle.MELEE && entity.location.getDistance(victim.location) > 1) return -1
|
||||
|
||||
return type?.swingHandler?.swing(entity, victim, state) ?: 0
|
||||
}
|
||||
|
||||
override fun impact(entity: Entity?, victim: Entity?, state: BattleState?) {
|
||||
type?.swingHandler?.impact(entity, victim, state)
|
||||
}
|
||||
|
||||
override fun visualizeImpact(entity: Entity?, victim: Entity?, state: BattleState?) {
|
||||
type?.swingHandler?.visualizeImpact(entity, victim, state)
|
||||
}
|
||||
|
||||
override fun visualize(entity: Entity, victim: Entity?, state: BattleState?) {
|
||||
when (type) {
|
||||
CombatStyle.MELEE -> {
|
||||
entity.animate(Animation(153))
|
||||
}
|
||||
|
||||
CombatStyle.RANGE -> {
|
||||
val speed = (100 + (Projectile.getLocation(entity).getDistance(victim!!.getLocation()) * 5)).toInt()
|
||||
Projectile.create(entity, victim, 968, 48, 36, 80, speed, 5, entity.size() shl 5).send()
|
||||
entity.animate(Animation(5347))
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
override fun calculateAccuracy(entity: Entity?): Int {
|
||||
return type?.swingHandler?.calculateAccuracy(entity) ?: 0
|
||||
}
|
||||
|
||||
override fun calculateHit(entity: Entity?, victim: Entity?, modifier: Double): Int {
|
||||
return type?.swingHandler?.calculateHit(entity, victim, modifier) ?: 0
|
||||
}
|
||||
|
||||
override fun calculateDefence(victim: Entity?, attacker: Entity?): Int {
|
||||
return type?.swingHandler?.calculateDefence(victim, attacker) ?: 0
|
||||
}
|
||||
|
||||
override fun getSetMultiplier(e: Entity?, skillId: Int): Double {
|
||||
return type?.swingHandler?.getSetMultiplier(e, skillId) ?: 0.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ open class MultiSwingHandler(meleeDistance: Boolean, vararg attacks: SwitchAttac
|
||||
protected var current: SwitchAttack
|
||||
|
||||
/**
|
||||
* The current attack.
|
||||
* The next attack.
|
||||
*/
|
||||
protected var next: SwitchAttack
|
||||
|
||||
|
||||
Reference in New Issue
Block a user