ADHD brain GO!

This commit is contained in:
Tooze 2026-04-13 10:26:26 -04:00
parent f3b07b66cb
commit b4b6a52458
7 changed files with 84 additions and 26 deletions

View file

@ -198,4 +198,16 @@ fun Player.increaseBarbRoleLevel(role: BarbRole) {
*/
fun Player.getBarbWave(): Int? {
return this.getAttribute("barbass:wave", 1)
}
/**
* Sets the player's current Barbarian Assault wave.
*
* This stores the wave value under the `"/save:barbass:wave"` attribute,
* allowing it to persist.
*
* @param wave The wave number to assign to the player.
*/
fun Player.setBarbWave(wave: Int){
this.setAttribute("/save:barbass:wave", wave)
}

View file

@ -186,7 +186,9 @@ class BarbassaultGameArea : InteractionListener, MapArea {
}
return@on true
}
//todo use vial on player
//"The player's hitpoints are full." //Error message if target player hp is full
//sendamount heal for conversion to points at end.
on(Scenery.HEALER_SPRING_20150, IntType.SCENERY, "Take-from") { player, _ ->
val healLevel = player.getBarbLevels().heal
//emote 5400
@ -256,17 +258,6 @@ class BarbassaultGameArea : InteractionListener, MapArea {
}
}
fun removeAll(player: Player, items: List<Int>, container: Container = Container.INVENTORY): Boolean {
var removedAny = false
items.forEach { id ->
if (removeAll(player, id, container)) {
removedAny = true
}
}
return removedAny
}
fun playerChangeScenery(player: Player,anim: Int ,node: Node, newSceneryId: Int, pulseDelay: Int = 3, message: String = "") {
player.animate(Animation(anim))
@ -378,6 +369,25 @@ object BarbAssaultCombat {
}
}
object BAGraphics {
const val GREEN_LARGE_EXPLOSION_867 = 867
const val RED_LARGE_EXPLOSION_868 = 868
const val BLUE_LARGE_EXPLOSION_869 = 869
const val GREEN_EGG_BREAK_873 = 873
const val RED_EGG_BREAK_874 = 874
const val BLUE_EGG_BREAK_875 = 875
const val PENANCE_HEALER_BAD_BREATH_863 = 863
const val PENANCE_HEALER_GOOD_BREATH_864 = 864
const val GREEN_LARGE_EXPLOSION2_876 = 876
}

View file

@ -11,6 +11,7 @@ import content.minigame.barbassault.getBarbWave
import content.minigame.barbassault.lobby.*
import core.api.*
import core.game.node.entity.Entity
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.impl.PulseManager
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
@ -23,6 +24,7 @@ import core.game.world.map.Direction
import core.game.world.map.Location
import core.game.world.map.build.DynamicRegion
import core.game.world.map.zone.*
import core.game.world.update.flag.context.Graphics
import core.tools.Log
import core.tools.secondsToTicks
import core.tools.ticksToSeconds
@ -48,6 +50,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
val eventBus = BarbAssEventBus()
val npcCaps = SpawnCaps(4,4,2,2)//wave 1
private val countDoown = if(GameWorld.settings?.isDevMode == true) 4 else 60
private var countdownPulse: Pulse? = null
fun beginStartingPhase(quickStart: Boolean = false) {
@ -56,7 +59,13 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
createArena()
startCountdown(quickStart)
}
fun cancleStartingPhase(){
if (state != BarbassaultState.STARTING) return
state = BarbassaultState.PARTY_CREATION
countdownPulse?.stop()
countdownPulse = null
broadcast("-- Next wave no longer starting")
}
private fun enterArena() {
state = BarbassaultState.IN_ARENA
region.setMusicId(ASSAULT_AND_BATTERY_604)
@ -99,9 +108,10 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
private fun startCountdown(quickStart: Boolean) {
var ticks = secondsToTicks(countDoown)//60
if(!quickStart){ team.allPlayers().forEach { openOverlay(it, 494);setInterfaceText(it, "60", 494, 0) } }
GameWorld.Pulser.submit(object : Pulse(1) {
countdownPulse = object : Pulse(1) {
override fun pulse(): Boolean {
if (state != BarbassaultState.STARTING) return true
ticks--
if (ticks <= 0) {
@ -117,7 +127,9 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
return false
}
})
}
Pulser.submit(countdownPulse!!)
}
private fun InitEvents(){
@ -301,9 +313,15 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
return npc
}
fun spawnEggCannons() {
sessionNPCSpawn( NPCs.EGG_LAUNCHER_5026, base.transform(21, 34, 0), Direction.NORTH )
val eggCannonNpcWest = sessionNPCSpawn( NPCs.EGG_LAUNCHER_5026, base.transform(21, 34, 0), Direction.NORTH )
eggCannonNpcWest?.isWalks = false
eggCannonNpcWest?.isNeverWalks = true
eggCannonNpcWest?.definition?.combatDistance = 14
eggCannonNpcWest?.properties?.combatPulse?.style = CombatStyle.RANGE
//eggCannonNpcWest?.
eggCannonNpcWest?.definition?.combatGraphics[1] = Graphics(866, 25, 0)
if (currentWave == 10) return
sessionNPCSpawn( NPCs.EGG_LAUNCHER_5026, base.transform(40, 34, 0), Direction.NORTH )
val eggCannonNpcEast = sessionNPCSpawn( NPCs.EGG_LAUNCHER_5026, base.transform(40, 34, 0), Direction.NORTH )
}

View file

@ -27,7 +27,7 @@ class WaveCompleteInterface {
https://youtu.be/OjkLXOQVWEQ?t=113
https://www.youtube.com/watch?v=gpSmUZcaMwY
//error message if button level up, "Sorry, you don't have enough points to level up

View file

@ -89,6 +89,7 @@ class EggCannon : ComponentPlugin() {
return this
}
///stun(entity: Entity, ticks: Int)
// stunned monster cant take damage here?
///isStunned(entity: Entity)
//applyPoison (entity: Entity, source: Entity, severity: Int)
//isPoisoned (entity: Entity) : Boolean
@ -203,7 +204,6 @@ class EggCannon : ComponentPlugin() {
if (role != BarbRole.COLLECTOR) {sendMessage(player,"You need to be a Collector to load eggs.");return}
ALL_EGGS.forEach { loadHopperEggs(player, it) }
//Load hopper emote, Same as place table??
sendMessage(player,"Loading hopper")
}
fun loadHopperEggs(player: Player?,itemId: Int ){
player ?: return
@ -211,8 +211,14 @@ class EggCannon : ComponentPlugin() {
val result = player.baSession?.eggHopper?.addEgg(itemId,invCount)
val color = player.baSession?.eggHopper?.eggColorMap?.get(itemId)
val added = result?.get(color) ?: 0
removeItem(player, Item(itemId, added))
//load from collector bag too
if(invCount > 0){
val result = player.baSession?.eggHopper?.addEgg(itemId,invCount)
val color = player.baSession?.eggHopper?.eggColorMap?.get(itemId)
val added = result?.get(color) ?: 0
sendMessage(player,"You load the hopper.")
removeItem(player, Item(itemId, added))
}
}
fun showEggHopperCount(player: Player?){
player ?: return
@ -259,6 +265,9 @@ entity.interfaceManager.restoreTabs()
shoot option when no eggs in hoper =
MEssage chatbox-> There are no egs in the hopper.
Dialog message if no monsters in range
"there are no targetable Penance Runners within firing range.
Look-in ->
The hopper contains
0 poison egs, 0 explosive eggs
@ -271,4 +280,9 @@ poison eggs
You load the hopper.
You cant load any more /Egg_type/s.
Picking up wrong egg, "The egg exploded" / 5 damage
"You put the egg in the bag"
*/

View file

@ -184,6 +184,7 @@ object BarbTeamManager {
player.baSession = null
updateCurrentTeam(player)
updateTeam(team)
//session.cancleStartingPhase()
}
fun updateTeam(team: BarbTeam) {

View file

@ -3,10 +3,12 @@ package content.minigame.barbassault.lobby
import content.minigame.barbassault.BarbRole
import content.minigame.barbassault.arena.BarbassaultState
import content.minigame.barbassault.baSession
import content.minigame.barbassault.getBarbWave
import content.minigame.barbassault.lobby.BarbTeamManager.abandonTeam
import content.minigame.barbassault.lobby.BarbTeamManager.createTeam
import content.minigame.barbassault.lobby.BarbTeamManager.disbandTeam
import content.minigame.barbassault.lobby.BarbassQuickWaveActivity.Companion.addToQueue
import content.minigame.barbassault.setBarbWave
import core.api.*
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
@ -91,7 +93,6 @@ class BarbassaultLobby : InteractionListener, MapArea {
val team = session?.team
if (team == null) {
//todo remove or correct message
leader.sendMessage("No active session found.")
return@onUseWithPlayer false
}
@ -164,14 +165,15 @@ class BarbassaultLobby : InteractionListener, MapArea {
return@on true
}
on(Scenery.DOOR_20209, IntType.SCENERY, "Pass") { player, node ->
if (capeCheck(player)) { return@on false }
if (!capeCheck(player)) { return@on false }
//todo Not allowed to enter QuickStart with Scroll
if (!QUICK_START.insideBorder(player.location)){
player.setAttribute("/save:barbass:wave", 1)
player.setBarbWave(1)
handlePlayerOptionDoor(player) { role ->
//player.sendMessage("You are a ${role.name.lowercase().replaceFirstChar { it.uppercase() }}.")
handleWaveDoor(player, node, 489)
addToQueue(player, role)
}
}else {
handleWaveDoor(player, node, 489)
@ -300,7 +302,7 @@ class BarbassaultLobby : InteractionListener, MapArea {
fun handleWaveDoor(player: Player, node: Node,iface: Int){
val doorLoc = node.location
val playerLoc = player.location
var wave = player.getAttribute("barbass:wave", 1)
var wave = player.getBarbWave()
if (wave == BARBWAVEDOOR[node.id]) {
val insideRoom = playerLoc.y <= doorLoc.y
val moveY = if (insideRoom) 1 else -1
@ -309,9 +311,10 @@ class BarbassaultLobby : InteractionListener, MapArea {
forceMove(player, playerLoc, playerLoc.transform(0, moveY, 0), 25, 60, null, 819) {
if (insideRoom) {
//player.baSession = null
//player.baSession?.cancleStartingPhase()
abandonTeam(player)
closeOverlay(player)
if (node.id == 20209) { BarbassQuickWaveActivity.removeQuickQue(player) }
if (node.id == Scenery.DOOR_20209) { BarbassQuickWaveActivity.removeQuickQue(player) } // needs to happen sooner
} else {
openOverlay(player, iface)
// player.sendMessage("you enter wave ${BARBWAVEDOOR[node.id]}")