mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-21 18:35:11 -06:00
WaveDefinitions
This commit is contained in:
parent
9b3042b849
commit
ab0c3c81b2
9 changed files with 164 additions and 29 deletions
|
|
@ -1,6 +1,5 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import content.minigame.barbassault.lobby.BarbTeam
|
||||
import core.game.node.entity.player.Player
|
||||
//https://www.youtube.com/watch?v=OJ2BDEM03Dw
|
||||
|
||||
|
|
@ -48,18 +47,7 @@ data class ScoreTracker(var attackerStats: AttackerStats = AttackerStats(), var
|
|||
}
|
||||
fun toScoreboard(caps: SpawnCaps): RoleScore = BarbAssaultScoreBuilder.build(this, caps)
|
||||
}
|
||||
val waveCaps = listOf( //i should put this somewhere else
|
||||
SpawnCaps(4,4,2,2), //wave1
|
||||
SpawnCaps(4,5,3,3),
|
||||
SpawnCaps(6,5,4,3),
|
||||
SpawnCaps(6,6,4,4),
|
||||
SpawnCaps(6,6,5,5),
|
||||
SpawnCaps(7,6,6,6),
|
||||
SpawnCaps(7,7,6,7),
|
||||
SpawnCaps(8,7,7,7),
|
||||
SpawnCaps(8,8,9,8) // wave 9
|
||||
)
|
||||
data class SpawnCaps(val rangers: Int, val fighters: Int, val runners: Int, val healers: Int)
|
||||
|
||||
data class RoleScore(val rangersKilled: Int, val fightersKilled: Int, val incorrectStylePenalty: Int,
|
||||
val eggsScore: Int,
|
||||
val runnersKilledScore: Int, val runnersPastPenalty: Int,
|
||||
|
|
|
|||
|
|
@ -304,6 +304,9 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
player.fullRestore()
|
||||
|
||||
destroyArena()
|
||||
}
|
||||
fun getMonstersForWave(){
|
||||
|
||||
}
|
||||
fun sessionNPCSpawn(id: Int, location: Location, direction: Direction, vararg objects: Any): NPC? {
|
||||
val npc = NPC.create(id, location, direction, *objects)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import core.game.node.entity.Entity
|
|||
import core.game.node.entity.combat.CombatStyle
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.npc.NPCBehavior
|
||||
import core.game.world.map.RegionManager
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.game.world.update.flag.context.Graphics
|
||||
import org.rs09.consts.NPCs
|
||||
|
||||
|
|
@ -16,7 +16,8 @@ class EggCannon : NPCBehavior(NPCs.EGG_LAUNCHER_5026) {
|
|||
self.walkRadius = 0
|
||||
self.dropLocation
|
||||
self.definition.combatGraphics[1] = Graphics(866, 25, 0)
|
||||
|
||||
//5426 = attackanimation
|
||||
self.properties.rangeAnimation = Animation.create(5426)
|
||||
self.definition.combatDistance = 14
|
||||
self.properties.combatPulse.style = CombatStyle.RANGE
|
||||
|
||||
|
|
@ -30,7 +31,7 @@ class EggCannon : NPCBehavior(NPCs.EGG_LAUNCHER_5026) {
|
|||
|
||||
return true
|
||||
}
|
||||
fun FireEggAt(target:String,eggColor: String){
|
||||
fun fireEggAt(target:String,eggColor: String){
|
||||
// RegionManager.getSurroundingNPCs()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import core.game.node.entity.player.Player
|
|||
import org.rs09.consts.NPCs
|
||||
|
||||
val PENANCE_HEALER_IDS = listOf(
|
||||
NPCs.PENANCE_HEALER_5043,
|
||||
//NPCs.PENANCE_HEALER_5043,//tut
|
||||
NPCs.PENANCE_HEALER_5238,
|
||||
NPCs.PENANCE_HEALER_5239,
|
||||
NPCs.PENANCE_HEALER_5240,
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ import core.api.hasLineOfSight
|
|||
import core.api.produceGroundItem
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.GroundItemManager
|
||||
import core.game.node.item.Item
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.RegionManager
|
||||
import org.rs09.consts.Items
|
||||
|
||||
|
|
@ -85,3 +82,30 @@ fun findClosestTargetNPCFromNPC(targetNPC:NPC,npc: NPC,range:Int = 14): NPC? {
|
|||
}
|
||||
return closest
|
||||
}
|
||||
/**
|
||||
* Finds the closest NPC to the given player within a specified range
|
||||
* that matches the provided NPC ID.
|
||||
*
|
||||
* @param player The player used as the search origin.
|
||||
* @param npcId The ID of the NPC to search for.
|
||||
* @param range Maximum distance to search for NPCs.
|
||||
* @return The closest matching NPC, or null if none are found.
|
||||
*/
|
||||
fun findClosestNPCIDFromPlayer(player: Player, targetNPC: Int, range: Int = 14): NPC? {
|
||||
var closest: NPC? = null
|
||||
var bestDistance = Double.MAX_VALUE
|
||||
|
||||
for (npc in RegionManager.getLocalNpcs(player, range)) {
|
||||
if (npc.id != targetNPC) continue
|
||||
if (!hasLineOfSight(player, npc)) continue
|
||||
|
||||
val dist = player.location.getDistance(npc.location)
|
||||
if (dist < bestDistance) {
|
||||
bestDistance = dist
|
||||
closest = npc
|
||||
}
|
||||
}
|
||||
return closest
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import core.game.world.update.flag.context.Graphics
|
|||
import org.rs09.consts.NPCs
|
||||
//20730 = rangers cast
|
||||
val PENANCE_RANGER_IDS = listOf(
|
||||
NPCs.PENANCE_RANGER_5041,
|
||||
NPCs.PENANCE_RANGER_5041, // tut
|
||||
NPCs.PENANCE_RANGER_5229,
|
||||
NPCs.PENANCE_RANGER_5230,
|
||||
NPCs.PENANCE_RANGER_5231,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import core.game.node.item.GroundItem
|
|||
|
||||
|
||||
val PENANCE_RUNNER_IDS = listOf(
|
||||
NPCs.PENANCE_RUNNER_5042,
|
||||
//NPCs.PENANCE_RUNNER_5042,//tut
|
||||
NPCs.PENANCE_RUNNER_5220,
|
||||
NPCs.PENANCE_RUNNER_5221,
|
||||
NPCs.PENANCE_RUNNER_5222,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,107 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import org.rs09.consts.NPCs
|
||||
|
||||
|
||||
fun getWaveDefinition(index: Int): WaveDefinition {
|
||||
return when (index) {
|
||||
10 -> waves[7]
|
||||
else -> waves[index]
|
||||
}
|
||||
}
|
||||
|
||||
data class WaveDefinition( val caps: SpawnCaps, val npcIds: Map<PenanceType, Int> )
|
||||
enum class PenanceType { HEALER, RUNNER, FIGHTER, RANGER }
|
||||
data class SpawnCaps(val rangers: Int, val fighters: Int, val runners: Int, val healers: Int)
|
||||
val waves = listOf(
|
||||
WaveDefinition( //Wave tut
|
||||
SpawnCaps(rangers = 1, fighters = 1, runners = 1, healers = 1),
|
||||
mapOf(
|
||||
PenanceType.HEALER to NPCs.PENANCE_HEALER_5043,
|
||||
PenanceType.RUNNER to NPCs.PENANCE_RUNNER_5042,
|
||||
PenanceType.FIGHTER to NPCs.PENANCE_FIGHTER_5040,
|
||||
PenanceType.RANGER to NPCs.PENANCE_RANGER_5041
|
||||
)
|
||||
),
|
||||
WaveDefinition( //Wave 1
|
||||
SpawnCaps(rangers = 4, fighters = 4, runners = 2, healers = 2),
|
||||
mapOf(
|
||||
PenanceType.HEALER to NPCs.PENANCE_HEALER_5238,
|
||||
PenanceType.RUNNER to NPCs.PENANCE_RUNNER_5220,
|
||||
PenanceType.FIGHTER to NPCs.PENANCE_FIGHTER_5044,
|
||||
PenanceType.RANGER to NPCs.PENANCE_RANGER_5229 // missing death animation
|
||||
)
|
||||
),
|
||||
WaveDefinition( //Wave 2
|
||||
SpawnCaps(rangers = 4, fighters = 5, runners = 3, healers = 3),
|
||||
mapOf(
|
||||
PenanceType.HEALER to NPCs.PENANCE_HEALER_5239,
|
||||
PenanceType.RUNNER to NPCs.PENANCE_RUNNER_5221,
|
||||
PenanceType.FIGHTER to NPCs.PENANCE_FIGHTER_5045,
|
||||
PenanceType.RANGER to NPCs.PENANCE_RANGER_5230
|
||||
)
|
||||
),
|
||||
WaveDefinition( //Wave 3
|
||||
SpawnCaps(rangers = 6, fighters = 5, runners = 4, healers = 3),
|
||||
mapOf(
|
||||
PenanceType.HEALER to NPCs.PENANCE_HEALER_5240,
|
||||
PenanceType.RUNNER to NPCs.PENANCE_RUNNER_5222,
|
||||
PenanceType.FIGHTER to NPCs.PENANCE_FIGHTER_5213,
|
||||
PenanceType.RANGER to NPCs.PENANCE_RANGER_5231
|
||||
)
|
||||
),
|
||||
WaveDefinition( //Wave 4
|
||||
SpawnCaps(rangers = 6, fighters = 6, runners = 4, healers = 4),
|
||||
mapOf(
|
||||
PenanceType.HEALER to NPCs.PENANCE_HEALER_5241,
|
||||
PenanceType.RUNNER to NPCs.PENANCE_RUNNER_5223,
|
||||
PenanceType.FIGHTER to NPCs.PENANCE_FIGHTER_5214,
|
||||
PenanceType.RANGER to NPCs.PENANCE_RANGER_5232
|
||||
)
|
||||
),
|
||||
WaveDefinition( //Wave 5
|
||||
SpawnCaps(rangers = 6, fighters = 6, runners = 5, healers = 5),
|
||||
mapOf(
|
||||
PenanceType.HEALER to NPCs.PENANCE_HEALER_5242,
|
||||
PenanceType.RUNNER to NPCs.PENANCE_RUNNER_5224,
|
||||
PenanceType.FIGHTER to NPCs.PENANCE_FIGHTER_5215,
|
||||
PenanceType.RANGER to NPCs.PENANCE_RANGER_5233
|
||||
)
|
||||
),
|
||||
WaveDefinition( //Wave 6
|
||||
SpawnCaps(rangers = 7, fighters = 6, runners = 6, healers = 6),
|
||||
mapOf(
|
||||
PenanceType.HEALER to NPCs.PENANCE_HEALER_5243,
|
||||
PenanceType.RUNNER to NPCs.PENANCE_RUNNER_5225,
|
||||
PenanceType.FIGHTER to NPCs.PENANCE_FIGHTER_5216,
|
||||
PenanceType.RANGER to NPCs.PENANCE_RANGER_5234
|
||||
)
|
||||
),
|
||||
WaveDefinition( //Wave 7 //Also used in wave 10
|
||||
SpawnCaps(rangers = 7, fighters = 7, runners = 6, healers = 7),
|
||||
mapOf(
|
||||
PenanceType.HEALER to NPCs.PENANCE_HEALER_5244,
|
||||
PenanceType.RUNNER to NPCs.PENANCE_RUNNER_5226,
|
||||
PenanceType.FIGHTER to NPCs.PENANCE_FIGHTER_5217,
|
||||
PenanceType.RANGER to NPCs.PENANCE_RANGER_5235
|
||||
)
|
||||
),
|
||||
WaveDefinition( //Wave 8
|
||||
SpawnCaps(rangers = 8, fighters = 7, runners = 7, healers = 7),
|
||||
mapOf(
|
||||
PenanceType.HEALER to NPCs.PENANCE_HEALER_5245,
|
||||
PenanceType.RUNNER to NPCs.PENANCE_RUNNER_5227,
|
||||
PenanceType.FIGHTER to NPCs.PENANCE_FIGHTER_5218,
|
||||
PenanceType.RANGER to NPCs.PENANCE_RANGER_5236
|
||||
)
|
||||
),
|
||||
WaveDefinition( //Wave 9
|
||||
SpawnCaps(rangers = 8, fighters = 8, runners = 9, healers = 8),
|
||||
mapOf(
|
||||
PenanceType.HEALER to NPCs.PENANCE_HEALER_5246,
|
||||
PenanceType.RUNNER to NPCs.PENANCE_RUNNER_5228,
|
||||
PenanceType.FIGHTER to NPCs.PENANCE_FIGHTER_5219,
|
||||
PenanceType.RANGER to NPCs.PENANCE_RANGER_5237
|
||||
)
|
||||
),
|
||||
)
|
||||
|
|
@ -1,18 +1,21 @@
|
|||
package content.minigame.barbassault.arena.scenery
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import content.minigame.barbassault.arena.Npcs.findClosestNPCIDFromPlayer
|
||||
import content.minigame.barbassault.arena.Npcs.findClosestTargetNPCFromNPC
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.api.*
|
||||
import core.game.component.CloseEvent
|
||||
import core.game.component.Component
|
||||
import core.game.component.ComponentDefinition
|
||||
import core.game.component.ComponentPlugin
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.Item
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
|
||||
|
||||
//Egg hoppper scenrey item updates based on eggs in hopper
|
||||
|
|
@ -119,14 +122,18 @@ class EggHopper : ComponentPlugin() {
|
|||
}
|
||||
return true
|
||||
}
|
||||
val PENANCE_HEALER_IDS = listOf(
|
||||
NPCs.PENANCE_HEALER_5245,
|
||||
NPCs.PENANCE_HEALER_5246
|
||||
)
|
||||
fun shootNormalEggs(button: Int,player: Player?) {
|
||||
player ?: return
|
||||
val eggHopper = player.baSession?.eggHopper
|
||||
val penanceSets = listOf(
|
||||
"Penance Healer" to EggTurret.pHealerBtns,
|
||||
"Penance Runner" to EggTurret.pRunnerBtns,
|
||||
"Penance Fighter" to EggTurret.pFighterBtns,
|
||||
"Penance Ranger" to EggTurret.pRangerBtns
|
||||
"Penance Healer" to EggTurret.pHealerBtns, // PENANCE_HEALER_IDS
|
||||
"Penance Runner" to EggTurret.pRunnerBtns, // PENANCE_RUNNER_IDS
|
||||
"Penance Fighter" to EggTurret.pFighterBtns, // PENANCE_FIGHTER_IDS
|
||||
"Penance Ranger" to EggTurret.pRangerBtns // PENANCE_RANGER_IDS
|
||||
)
|
||||
for ((name, colors) in penanceSets) {
|
||||
when(button) {
|
||||
|
|
@ -136,6 +143,7 @@ class EggHopper : ComponentPlugin() {
|
|||
return
|
||||
}
|
||||
sendMessage(player, "Shoot poison at $name.");
|
||||
//fireEgg(player: Player,npc: NPC)
|
||||
return
|
||||
}
|
||||
colors.red -> {
|
||||
|
|
@ -232,8 +240,12 @@ class EggHopper : ComponentPlugin() {
|
|||
|
||||
}
|
||||
|
||||
fun fireEgg(int: Int,){
|
||||
|
||||
fun fireEgg(player: Player,npc: NPC){
|
||||
val session = player.baSession
|
||||
val eggCannon = findClosestNPCIDFromPlayer(player,NPCs.EGG_LAUNCHER_5026,2)
|
||||
val target = findClosestTargetNPCFromNPC(npc, eggCannon as NPC )
|
||||
//
|
||||
eggCannon.attack(target)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue