import { preloadImage } from "./preloader.js"

async function setStandardTurret(turret) {
  turret.spriteImg= await preloadImage("assets/img/turrets/turret_standard.webp")
  turret.bulletSprite = await preloadImage("assets/img/turrets/bullet_standard.webp")
  turret.firingRate = 150
  turret.lastShot = 0
  turret.spread = 100
  turret.damage = 5
  turret.percing = true
  turret.aoe = false
  turret.aoeSize = 20
  turret.bulletHealth = 3
  turret.isAnimated = true
  turret.removeAfterAnimation = false
  turret.animationRunning = false
  turret.frames = 8
  turret.heightX = 256
  turret.heightY = 256
}

async function setFastTurret(turret) {
  turret.spriteImg= await preloadImage("assets/img/turrets/turret_fast.webp")
  turret.bulletSprite = await preloadImage("assets/img/turrets/bullet_fast.webp")
  turret.firingRate = 20
  turret.lastShot = 0
  turret.spread = 200
  turret.damage = 5
  turret.aoe = false
  turret.percing = false
  turret.aoeSize = 10
  turret.bulletHealth = 1
  turret.isAnimated = true
  turret.removeAfterAnimation = false
  turret.animationRunning = false
  turret.frames = 8
  turret.heightX = 256
  turret.heightY = 256
}

async function setHeavyTurret(turret) {
  turret.spriteImg= await preloadImage("assets/img/turrets/turret_heavy.webp")
  turret.bulletSprite = await preloadImage("assets/img/turrets/bullet_heavy.webp")
  turret.firingRate = 400
  turret.lastShot = 0
  turret.spread = 50
  turret.damage = 10
  turret.aoe = true
  turret.percing = false
  turret.aoeSize = 50
  turret.bulletHealth = 1
  turret.isAnimated = true
  turret.removeAfterAnimation = false
  turret.animationRunning = false
  turret.frames = 16
  turret.heightX = 256
  turret.heightY = 256
}

async function setLaserTurret(turret) {
  turret.spriteImg= await preloadImage("assets/img/turrets/turret_laser.webp")
  turret.bulletSprite = await preloadImage("assets/img/turrets/bullet_laser.webp")
  turret.firingRate = 1000
  turret.lastShot = 0
  turret.spread = 10
  turret.damage = 100
  turret.aoe = true
  turret.percing = true
  turret.aoeSize = 20
  turret.bulletHealth = 10000
  turret.isAnimated = true
  turret.removeAfterAnimation = false
  turret.animationRunning = false
  turret.frames = 8
  turret.heightX = 256
  turret.heightY = 256
}

export { setStandardTurret, setFastTurret, setHeavyTurret, setLaserTurret }