mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-21 09:02:07 -07:00
Nature Spirit Grotto Bridge Agility
This commit is contained in:
parent
c3fa00dc37
commit
ff81deb59e
1 changed files with 41 additions and 8 deletions
|
|
@ -1,10 +1,13 @@
|
|||
package rs09.game.interaction.region
|
||||
|
||||
import core.game.node.entity.impl.ForceMovement
|
||||
import core.game.world.map.Direction
|
||||
import api.ContentAPI
|
||||
import core.game.node.entity.skill.agility.AgilityHandler
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.game.world.update.flag.context.Graphics
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
* File to be used for anything Morytania related.
|
||||
|
|
@ -19,8 +22,12 @@ class MorytaniaListeners : InteractionListener() {
|
|||
val GROTTO_BRIDGE = 3522
|
||||
val outside = Location.create(3439, 3337, 0)
|
||||
val inside = Location.create(3442, 9734, 1)
|
||||
private val RUNNING_ANIM = Animation(1995)
|
||||
private val JUMP_ANIM = Animation(1603)
|
||||
|
||||
private val swimAnim = Animation(6988)
|
||||
private val jumpAnim = Animation(1603)
|
||||
private val failWater = Location(3439,3330)
|
||||
private val failMessage = "You nearly drown in the disgusting swamp."
|
||||
private val splashGFX = Graphics(68)
|
||||
|
||||
override fun defineListeners() {
|
||||
/* on(GROTTO_ENTRANCE,SCENERY,"enter"){ player, node ->
|
||||
|
|
@ -34,10 +41,36 @@ class MorytaniaListeners : InteractionListener() {
|
|||
}
|
||||
|
||||
on(GROTTO_BRIDGE,SCENERY,"jump"){ player, node ->
|
||||
if (player.location.y == 3328) {
|
||||
ForceMovement.run(player, node.location, node.location.transform(0, 3, 0), RUNNING_ANIM, JUMP_ANIM, Direction.NORTH, 15).endAnimation = Animation.RESET
|
||||
} else if (player.location.y == 3332){
|
||||
ForceMovement.run(player, node.location, node.location.transform(0, -3, 0), RUNNING_ANIM, JUMP_ANIM, Direction.SOUTH, 15).endAnimation = Animation.RESET
|
||||
val start = node.location
|
||||
var failLand = Location(3438,3331)
|
||||
var failAnim = Animation(770)
|
||||
var fromGrotto = false
|
||||
|
||||
ContentAPI.lock(player,10)
|
||||
|
||||
// Switch to south facing animations if jumping from Grotto
|
||||
if (start.y == 3331) {
|
||||
fromGrotto = true
|
||||
failAnim = Animation(771)
|
||||
failLand = Location(3438,3328)
|
||||
}
|
||||
if (AgilityHandler.hasFailed(player, 1, 0.1)) {
|
||||
val end = if (fromGrotto) failWater else start
|
||||
AgilityHandler.forceWalk(player, -1, start, end, failAnim, 15, 0.0, null,0).endAnimation = swimAnim
|
||||
AgilityHandler.forceWalk(player, -1, failWater, failLand, swimAnim, 15, 2.0, null,3)
|
||||
ContentAPI.submitIndividualPulse(player, object : Pulse(2){
|
||||
override fun pulse(): Boolean {
|
||||
ContentAPI.visualize(player,failAnim,splashGFX)
|
||||
ContentAPI.teleport(player,failWater)
|
||||
// Deal 1-6 damage but wait until the player is back on land
|
||||
AgilityHandler.fail(player,0,failLand,swimAnim,Random.nextInt(1,7),failMessage)
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
val end = if (fromGrotto) start.transform(0,-3,0) else start.transform(0,3,0)
|
||||
AgilityHandler.forceWalk(player, -1, start, end, jumpAnim, 15, 15.0, null,0)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue