Readable attacker style checker

This commit is contained in:
Tooze 2026-05-29 19:06:20 -04:00
parent b72df6c1f7
commit 175e141970

View file

@ -23,6 +23,10 @@ import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.combat.ImpactHandler
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.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.entity.player.info.LogType
@ -361,17 +365,17 @@ object BACombatValidation {
fun resolveAttackerStyle( attacker: Player, state: BattleState ): AttackerStyle? {
return when (state.style) {
CombatStyle.MELEE -> when (attacker.properties.attackStyle.style) {
2 -> AttackerStyle.STYLE_1 // Controlled
0 -> AttackerStyle.STYLE_2 // Accurate
1 -> AttackerStyle.STYLE_3 // Aggressive
3 -> AttackerStyle.STYLE_4 // Defensive
STYLE_CONTROLLED -> AttackerStyle.STYLE_1
STYLE_ACCURATE -> AttackerStyle.STYLE_2
STYLE_AGGRESSIVE -> AttackerStyle.STYLE_3
STYLE_DEFENSIVE -> AttackerStyle.STYLE_4
else -> null
}
CombatStyle.RANGE -> when (state.ammunition.itemId) {
882 -> AttackerStyle.STYLE_1 // bronze
884 -> AttackerStyle.STYLE_2 // iron
886 -> AttackerStyle.STYLE_3 // steel
888 -> AttackerStyle.STYLE_4 // mithril
Items.BRONZE_ARROW_882 -> AttackerStyle.STYLE_1
Items.IRON_ARROW_884 -> AttackerStyle.STYLE_2
Items.STEEL_ARROW_886 -> AttackerStyle.STYLE_3
Items.MITHRIL_ARROW_888 -> AttackerStyle.STYLE_4
else -> null
}
CombatStyle.MAGIC -> when (state.spell.spellId) {