mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-21 10:25:13 -06:00
Attacker bots use the Called Attack style, Right or wrong.
This commit is contained in:
parent
a6e6d5cfdf
commit
5aecc3f4a0
4 changed files with 35 additions and 21 deletions
|
|
@ -15,6 +15,11 @@ import content.minigame.barbassault.setBASession
|
|||
import core.api.*
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.STYLE_ACCURATE
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.STYLE_AGGRESSIVE
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.STYLE_CONTROLLED
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.STYLE_DEFENSIVE
|
||||
import core.game.node.entity.impl.PulseManager
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
|
|
@ -597,11 +602,11 @@ class BarbassaultSession( val activity: BAActivity ? = null) :LogoutListener, M
|
|||
|
||||
val roleCalls: MutableMap<BarbRole, RoleCall<*>> = mutableMapOf()
|
||||
interface HasUIText { val ui: String; val hornShout:String }
|
||||
enum class AttackerStyle(val top: String, val bottom: String, override val hornShout:String):HasUIText {
|
||||
STYLE_1("Controlled/","Bronze/Wind", "Attacker: Controlled/Bronze/Wind!"),
|
||||
STYLE_2("Accurate/","Iron/Water", "Attacker: Accurate/Iron/Water!"),
|
||||
STYLE_3("Aggressive/","Steel/Earth", "Attacker: Aggressive/Steel/Earth!"),
|
||||
STYLE_4("Defensive/","Mithril/Fire", "Attacker: Defensive/Mithril/Fire!");
|
||||
enum class AttackerStyle(val top: String, val bottom: String, override val hornShout:String,val attackStyle: Int):HasUIText {
|
||||
STYLE_1("Controlled/","Bronze/Wind", "Attacker: Controlled/Bronze/Wind!",STYLE_CONTROLLED),
|
||||
STYLE_2("Accurate/","Iron/Water", "Attacker: Accurate/Iron/Water!", STYLE_ACCURATE),
|
||||
STYLE_3("Aggressive/","Steel/Earth", "Attacker: Aggressive/Steel/Earth!",STYLE_AGGRESSIVE),
|
||||
STYLE_4("Defensive/","Mithril/Fire", "Attacker: Defensive/Mithril/Fire!",STYLE_DEFENSIVE);
|
||||
override val ui: String get() = top
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ class PenanceFighterNPC : NPCBehavior(*PENANCE_FIGHTER_IDS.toIntArray()) {
|
|||
|
||||
override fun beforeDamageReceived(self: NPC, attacker: Entity, state: BattleState) {
|
||||
val player = attacker as? Player ?: return
|
||||
if (!player.isArtificial) {
|
||||
//if (!player.isArtificial) {
|
||||
state.estimatedHit = BACombatValidation.applyAttackValidation(self, player, state)
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
override fun tick(self: NPC): Boolean {
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ class PenanceRangerNPC : NPCBehavior(*PENANCE_RANGER_IDS.toIntArray()) {
|
|||
}
|
||||
override fun beforeDamageReceived( self: NPC, attacker: Entity, state: BattleState) {
|
||||
attacker as Player
|
||||
if(!attacker.isArtificial) {
|
||||
// if(!attacker.isArtificial) {
|
||||
state.estimatedHit = BACombatValidation.applyAttackValidation( self, attacker, state )
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
override fun getXpMultiplier(self: NPC, attacker: Entity): Double {
|
||||
|
|
|
|||
|
|
@ -1,55 +1,65 @@
|
|||
package content.minigame.barbassault.bots
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import content.minigame.barbassault.arena.BarbassaultSession.AttackerStyle
|
||||
import content.minigame.barbassault.arena.BarbassaultSession.AttackerStyle.STYLE_1
|
||||
import content.minigame.barbassault.arena.BarbassaultSession.AttackerStyle.STYLE_2
|
||||
import content.minigame.barbassault.arena.BarbassaultSession.AttackerStyle.STYLE_3
|
||||
import content.minigame.barbassault.arena.BarbassaultSession.AttackerStyle.STYLE_4
|
||||
import content.minigame.barbassault.getBARoleForPlayer
|
||||
import content.minigame.barbassault.getBASession
|
||||
import core.api.sendChat
|
||||
import core.game.interaction.MovementPulse
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.AttackStyle
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.BONUS_SLASH
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.STYLE_ACCURATE
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.STYLE_AGGRESSIVE
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.STYLE_CONTROLLED
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface.STYLE_DEFENSIVE
|
||||
import core.game.world.GameWorld
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.path.Pathfinder
|
||||
import core.tools.RandomFunction
|
||||
import kotlin.random.Random
|
||||
|
||||
class BACombatState(private val bot: BABot) {
|
||||
|
||||
private val rng = Random.Default
|
||||
|
||||
//session.roleCalls[BarbRole.ATTACKER]?.toCall
|
||||
fun fightNPCs() {
|
||||
bot.customState = "Fight NPCs"
|
||||
bot.AttackNpcsInRadius(25)
|
||||
//use Called AttackStyle
|
||||
val baSession = getBASession(bot) ?: return
|
||||
val called = baSession.roleCalls[BarbRole.COLLECTOR]?.called as AttackerStyle
|
||||
bot.properties.attackStyle = AttackStyle(called.attackStyle, BONUS_SLASH)
|
||||
|
||||
}
|
||||
|
||||
fun handleDefender() {
|
||||
|
||||
bot.customState = "Lure Runners"
|
||||
|
||||
val session = getBASession(bot) ?: return
|
||||
|
||||
randomWalk(session.region.borders.randomWalkableLoc, 3)
|
||||
//used Called Lure
|
||||
}
|
||||
|
||||
fun handleCollector() {
|
||||
|
||||
bot.customState = "Collecting Eggs"
|
||||
|
||||
val session = getBASession(bot) ?: return
|
||||
|
||||
randomWalk(session.region.borders.randomWalkableLoc, 3)
|
||||
//only target Called Eggs
|
||||
}
|
||||
|
||||
fun handleHealer() {
|
||||
|
||||
bot.customState = "Healing"
|
||||
|
||||
val session = getBASession(bot) ?: return
|
||||
|
||||
randomWalk(session.region.borders.randomWalkableLoc, 2)
|
||||
//Only use Called poisonFood.
|
||||
}
|
||||
|
||||
fun chatter() {
|
||||
if (rng.nextInt(12) != 0) { return }
|
||||
val role = getBARoleForPlayer(bot)
|
||||
val messages = when (role) {
|
||||
BarbRole.ATTACKER -> listOf("Call pls","Wrong style?","Attacking!")
|
||||
|
|
@ -59,11 +69,10 @@ class BACombatState(private val bot: BABot) {
|
|||
else -> listOf("Lag...","Nice","Oops")
|
||||
}
|
||||
|
||||
bot.sendChat(messages.random(rng))
|
||||
bot.sendChat(messages.random())
|
||||
}
|
||||
|
||||
fun randomWalk(center: Location, radius: Int) {
|
||||
|
||||
if (bot.walkingQueue.isMoving) {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue