BaBots now attack Penance Fighters/rangers.

babot max count is 25.
babots names apear normal in CurrentTeamIFace
This commit is contained in:
Tooze 2026-02-26 16:31:35 -05:00
parent 08b96c3ce2
commit 23bb37728d
7 changed files with 39 additions and 22 deletions

View file

@ -18,6 +18,8 @@ import org.rs09.consts.Scenery
@Initializable
class BarbassDevHelper : CommandSet(Privilege.ADMIN) {
var babotcount = 0
override fun defineCommands() {
define ("maxbarbpts") { player,_ ->
player.addBarbPoints(BarbAssaultPoints(500, 500, 500,500))
@ -40,7 +42,13 @@ class BarbassDevHelper : CommandSet(Privilege.ADMIN) {
}
define("babot"){ player,_->
if (babotcount >= 25) {
sendMessage(player, "25 is max amount of BA bots allowed")
return@define
}
BarbassBot(BarbassaultLobby.MAIN_LOBBY.randomWalkableLoc)
babotcount++
}
define("hch"){ player,args->

View file

@ -17,7 +17,7 @@ import core.game.node.entity.player.Player
import org.rs09.consts.NPCs
val PENANCE_FIGHTER_IDS = listOf(
NPCs.PENANCE_FIGHTER_5040,
//NPCs.PENANCE_FIGHTER_5040, //tutorial
NPCs.PENANCE_FIGHTER_5044,
NPCs.PENANCE_FIGHTER_5045,
NPCs.PENANCE_FIGHTER_5213,
@ -31,6 +31,7 @@ val PENANCE_FIGHTER_IDS = listOf(
class PenanceFighterNPC : NPCBehavior(*PENANCE_FIGHTER_IDS.toIntArray()) {
override fun canBeAttackedBy(self: NPC, attacker: Entity, style: CombatStyle, shouldSendMessage: Boolean): Boolean {
if (attacker is Player && getItemFromEquipment(attacker, EquipmentSlot.CAPE)?.id != 10556) {
//todo make list of not allowed weapons to attack IE: Crystal bow, Karils Crossbow
sendMessage(attacker,"These Penance are immune to your attacks.")
return false
}
@ -41,7 +42,7 @@ class PenanceFighterNPC : NPCBehavior(*PENANCE_FIGHTER_IDS.toIntArray()) {
}
override fun beforeDamageReceived( self: NPC, attacker: Entity, state: BattleState) {
attacker as Player
state.estimatedHit = BarbAssaultCombat.applyAttackValidation( self, attacker, state )
if(!attacker.isArtificial) {state.estimatedHit = BarbAssaultCombat.applyAttackValidation( self, attacker, state )}
}
override fun onCreation (self: NPC) {

View file

@ -38,7 +38,7 @@ class PenanceRangerNPC : NPCBehavior(*PENANCE_RANGER_IDS.toIntArray()) {
}
override fun beforeDamageReceived( self: NPC, attacker: Entity, state: BattleState) {
attacker as Player
state.estimatedHit = BarbAssaultCombat.applyAttackValidation( self, attacker, state )
if(!attacker.isArtificial) {state.estimatedHit = BarbAssaultCombat.applyAttackValidation( self, attacker, state )}
}
override fun getXpMultiplier(self: NPC, attacker: Entity): Double {

View file

@ -22,7 +22,7 @@ class BACombatState(val bot: BarbassBot) {
fun fightNPCs() {
bot.customState = "Fight NPCs"
bot.AttackNpcsInRadius(8)
bot.AttackNpcsInRadius(25)
}
fun randomWalkTo(loc: Location, radius: Int) {

View file

@ -1,5 +1,6 @@
package content.minigame.barbassault.bots
import content.minigame.barbassault.BarbRole
import content.minigame.barbassault.arena.BarbassaultState
import content.minigame.barbassault.lobby.BarbassLobbyActivity.Companion.addToQueue
import content.minigame.barbassault.lobby.BarbassaultLobby
@ -25,7 +26,7 @@ class BarbassBot(l: Location) : PvMBots(legitimizeLocation(l)){
CombatBotAssembler().gearPCiMeleeBot(this)
val icape: Item = this.equipment.get(1)
EquipHandler.unequip(this,1,icape.id)
isArtificial
//isArtificial
}
var tick = 0
@ -75,6 +76,9 @@ class BarbassBot(l: Location) : PvMBots(legitimizeLocation(l)){
}
private fun doRoleTask() {
val myRole = this.baSession?.team?.getRoleForPlayer(this)
if (myRole == BarbRole.ATTACKER) {
combathandler.fightNPCs()
}
//do task based on myRole
}

View file

@ -87,17 +87,17 @@ open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, tr
private fun createQuickTeam(players: List<WaitingPlayer>) {
// if(player == null) {removeQuickQue(player);return}
players.forEach { removeQuickQue(it.player)}
var teamLeader: Player? = null
for (wp in players) {
// if(player.isArtificial) {return}
// if(wp.player.isArtificial) continue //only players can lead a party.
if (giveScroll(wp.player)) {
teamLeader = wp.player
break
}
}
//IF BY CHANCE no one had free inventory space KICK THEM ALL FROM QuickLobby!
// I should just return them to the que, at the end XD
//orr maybe allow them one game. and party disbands upon finshing the wave.
if (teamLeader == null) {
players.forEach {
sendMessage(it.player, "You could not hold a Scroll and have been removed from queue")
@ -106,23 +106,27 @@ open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, tr
return
}
createTeam(teamLeader)
val session = teamLeader.baSession
val team = session?.team ?: return
if (createTeam(teamLeader)){
players.forEach { removeQuickQue(it.player) }
players.forEachIndexed { index, wrapper ->
wrapper?.let { playerWrapper ->
if (index != 0) {
playerWrapper.player.baSession = session
team.addPlayer(playerWrapper.player)
}
playerWrapper.role?.let { role ->
team.setRoleForPlayer(playerWrapper.player, role)
val session = teamLeader.baSession
val team = session?.team ?: return
players.forEachIndexed { index, wrapper ->
wrapper?.let { playerWrapper ->
if (index != 0) {
playerWrapper.player.baSession = session
team.addPlayer(playerWrapper.player)
}
playerWrapper.role?.let { role ->
team.setRoleForPlayer(playerWrapper.player, role)
}
}
}
session.beginStartingPhase(true)
}
session.beginStartingPhase(true)
}
override fun configure() {
GameWorld.Pulser.submit(
@ -139,7 +143,7 @@ open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, tr
override fun death(e: Entity?, killer: Entity?): Boolean {
val ename = e?.name
log(this.javaClass, Log.FINE,"$ename has died in Barbass Lobby, HOW? killer:$killer")
log(this.javaClass, Log.FINE,"$ename has died in Barbass Lobby, HOW? killer:${killer?.name}")
e!!.getProperties().setTeleportLocation(null)
return true
}

View file

@ -44,7 +44,7 @@ fun updateCurrentTeam(player: Player) {
val slotPlayer = partySlot?.player
val slotRole = partySlot?.role
val nameText = slotPlayer?.name?.capitalizeWords() ?: CurrentTeam.defaultText
val nameText = slotPlayer?.username?.capitalizeWords() ?: CurrentTeam.defaultText
val model = slotRole?.let { ROLE_MODEL_MAP[it] } ?: -1
setInterfaceText(player, nameText, CurrentTeam.ID, uiSlot.name)
setInterfaceModel(player, model, CurrentTeam.ID, uiSlot.role, modelZoom)