Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
43 lines
1.3 KiB
GDScript
43 lines
1.3 KiB
GDScript
class_name VesselGasBomberComponent
|
|
extends "res://vessels/VesselCooldownFillComponent.gd"
|
|
|
|
var capability_id := "gas_bomber"
|
|
|
|
const READY_COLOR := Color(1.0, 0.25, 0.78)
|
|
const COOLING_COLOR := Color(0.38, 0.16, 0.32)
|
|
|
|
|
|
func _init() -> void:
|
|
cooldown_duration = 5.0
|
|
|
|
|
|
const BOMB_EFFECT = preload("res://vfx/GasBombEffect.gd")
|
|
const GAS_PER_SHOT: int = 5
|
|
const MAX_RANGE: float = 950.0
|
|
# #201: doubled. The bomb is the fleet's only area weapon and one slow,
|
|
# expensive throw was worth less than a couple of seconds of ordinary fire.
|
|
const BLAST_DAMAGE: int = 6
|
|
const SHOT_COOLDOWN: float = 5.0
|
|
|
|
|
|
func ability_range() -> float: return MAX_RANGE
|
|
func ability_ammo_resource() -> String: return GameState.RESOURCE_GAS
|
|
func ability_ammo_cost() -> int: return GAS_PER_SHOT
|
|
func ability_cooldown() -> float: return SHOT_COOLDOWN
|
|
|
|
|
|
func fire_ability(world: Node, origin: Vector2, at: Vector2) -> bool:
|
|
if not consume_shot(SHOT_COOLDOWN):
|
|
return false
|
|
# Unlike the beam, the bomb goes to the POINT it was aimed at, and it has
|
|
# to travel there - which is what makes it dodgeable.
|
|
BOMB_EFFECT.launch(world, origin, at, BLAST_DAMAGE)
|
|
return true
|
|
|
|
|
|
func consume_shot(duration: float) -> bool:
|
|
return _begin_cooldown(duration)
|
|
|
|
|
|
func _ready_color() -> Color: return READY_COLOR
|
|
func _cooling_color() -> Color: return COOLING_COLOR
|