harvest/game/scripts/game_config.gd
2026-10-03 12:14:28 -04:00

52 lines
2.2 KiB
GDScript

class_name GameConfig
extends Resource
## Every tunable campaign setting, kept in one resource (see game/RULES.md for the rules these
## values feed). The defaults live in res://game/resources/game_config.tres; every number is a
## starting value to tune during balancing.
@export_group("Campaign")
## Nights the scarecrow must survive before the farmers return.
@export_range(1, 20) var campaign_nights: int = 5
@export_group("Phases")
## Seconds of game time per phase. The morning review is untimed: it waits for the player.
@export var day_length: float = 180.0
@export var dusk_length: float = 30.0
@export var night_length: float = 150.0
## After sunrise: enemies retreat and carriers can still be intercepted for this long.
@export var dawn_grace: float = 20.0
## D1: lets the player skip the rest of the day/dusk and start the night (off by default).
@export var allow_early_night: bool = false
@export_group("Scarecrow")
## HP carries over between nights (D7); 0 HP is an immediate Game Over.
@export_range(1, 100) var scarecrow_max_hp: int = 10
@export_group("Farm assets")
## Starting count per target category. A category with a count of 0 is not in play and is
## ignored by the "farm stripped" check (D2). Animals and supplies arrive in Step 8.
@export_range(0, 500) var start_crops: int = 30
@export_range(0, 100) var start_animals: int = 0
@export_range(0, 5000) var start_supplies: int = 0
@export_group("Theft rules")
## D5: fear makes carriers drop their loot, not only killing them.
@export var fear_drops_loot: bool = true
## D6: dropped loot still on the ground when the dawn grace ends returns home automatically.
@export var loot_returns_at_dawn: bool = true
## D6: animals that can follow the scarecrow back to the pen at once.
@export_range(1, 10) var max_following_animals: int = 3
## Length of a phase in seconds, or INF for the untimed morning review and terminal phases.
func phase_length(phase: CampaignController.Phase) -> float:
match phase:
CampaignController.Phase.DAY:
return day_length
CampaignController.Phase.DUSK:
return dusk_length
CampaignController.Phase.NIGHT:
return night_length
CampaignController.Phase.DAWN:
return dawn_grace
return INF