package combat import "math/rand" func AttackRoll(attackLevel int, styleBonus int, equipBonus int) int { return (attackLevel + styleBonus + 8) * (equipBonus + 64) } func DefenseRoll(defenseLevel int, styleBonus int, equipBonus int) int { return (defenseLevel + styleBonus + 8) * (equipBonus + 64) } func HitCheck(attackRoll, defenseRoll int) bool { if attackRoll > defenseRoll { return true } if attackRoll < defenseRoll { return false } return rand.Intn(2) == 1 } func MaxHit(strengthLevel int, styleBonus int, equipBonus int) int { effective := (strengthLevel + styleBonus + 8) * (equipBonus + 64) hit := effective / 512 if hit < 1 { hit = 1 } return hit } func RollDamage(maxHit int) int { if maxHit <= 0 { return 0 } return 1 + rand.Intn(maxHit) } func AttackStyleBonus(style string) (attack, strength, defense int) { switch style { case "accurate": return 3, 0, 0 case "aggressive": return 0, 3, 0 case "defensive": return 0, 0, 3 case "balanced": return 1, 1, 1 default: return 0, 0, 0 } }