Documentation
¶
Index ¶
- type AmmoCount
- type BattleResult
- type CombineResult
- type DebugDoorInfo
- type DebugEnemyInfo
- type DebugEngineState
- type DebugEventInfo
- type DebugItemInfo
- type DebugPlayerInfo
- type DebugResult
- type DebugRoomInfo
- type DebugTriggerInfo
- type DefaultRng
- type DoorInfo
- type DoorInspection
- type Engine
- func (e *Engine) Battle(weaponName string) (*BattleResult, error)
- func (e *Engine) Combine(inputItemAName string, inputItemBName string) (*CombineResult, error)
- func (e *Engine) Debug() (*DebugResult, error)
- func (e *Engine) DisableValidation()
- func (e *Engine) EnableValidation()
- func (e *Engine) Heal(name string) (*HealResult, error)
- func (e *Engine) Inspect(name string) (*InspectResult, error)
- func (e *Engine) Inventory() (*InventoryResult, error)
- func (e *Engine) Minimap() (*MinimapResult, error)
- func (e *Engine) Observe() (*ObserveResult, error)
- func (e *Engine) Search(name string) (*SearchResult, error)
- func (e *Engine) Take(name string) (*TakeResult, error)
- func (e *Engine) Traverse(destination string) (*TraverseResult, error)
- func (e *Engine) Uncover(name string) (*UncoverResult, error)
- func (e *Engine) Unlock(keyNameOrCode string, targetName string) (*UnlockResult, error)
- func (e *Engine) Use(itemName string, targetName string) (*UseResult, error)
- type EngineStateChangeNotification
- type EngineStateInfo
- type FakeRng
- type FloorInfo
- type HealResult
- type InspectResult
- type InventoryResult
- type ItemInfo
- type ItemInspection
- type LevelCompletionState
- type MinimapDoorInfo
- type MinimapResult
- type MinimapRoomInfo
- type Mode
- type ObserveResult
- type Rng
- type SearchResult
- type TakeResult
- type TraverseResult
- type UncoverResult
- type UnlockResult
- type UseResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BattleResult ¶
type BattleResult struct {
EngineStateInfo EngineStateInfo
Result battleResultInternal
}
type CombineResult ¶
type CombineResult struct {
EngineStateInfo EngineStateInfo
Result combineResultInternal
}
type DebugDoorInfo ¶
type DebugDoorInfo struct {
Name string
Location string
RoomA string
RoomB string
HasKeyLock bool
HasCodeLock bool
IsLocked bool
KeyName string
Code string
}
DebugDoorInfo contains complete debug information about a door.
type DebugEnemyInfo ¶
DebugEnemyInfo contains complete debug information about an enemy.
type DebugEngineState ¶
type DebugEngineState struct {
LevelCompletionState string
Mode string
FightingEnemy *DebugEnemyInfo
CurrentRoom string
}
DebugEngineState contains complete debug information about the engine state.
type DebugEventInfo ¶
DebugEventInfo contains debug information about an event.
type DebugItemInfo ¶
type DebugItemInfo struct {
Name string
Description string
Location string
Detail string
IsPortable bool
IsContainer bool
IsConcealer bool
IsKey bool
IsAmmoBox bool
IsWeapon bool
IsHealthItem bool
// Container-specific fields
HasKeyLock bool
HasCodeLock bool
IsLocked bool
IsSearched bool
Contains *DebugItemInfo // Nested item info if container has contents
// Weapon-specific fields
WeaponDamage float64
UsesAmmo bool
AmmoQuantity int
// AmmoBox-specific fields
WeaponName string
AmmoCount int
// HealthItem-specific fields
HealthEffect string
// Concealer-specific fields
IsUncovered bool
HiddenItem *DebugItemInfo // Nested item info if concealer has hidden item
}
DebugItemInfo contains complete debug information about an item.
type DebugPlayerInfo ¶
type DebugPlayerInfo struct {
Health string
IsAlive bool
Inventory []DebugItemInfo
Ammo map[string]int
}
DebugPlayerInfo contains complete debug information about the player.
type DebugResult ¶
type DebugResult struct {
EngineStateInfo EngineStateInfo
EngineState DebugEngineState
Player DebugPlayerInfo
Rooms []DebugRoomInfo
Enemies []DebugEnemyInfo
Triggers []DebugTriggerInfo
WinCondition *DebugEventInfo
}
DebugResult contains the complete debug information for the engine.
func (*DebugResult) PrettyPrint ¶
func (d *DebugResult) PrettyPrint() string
PrettyPrint formats the debug result in a readable way.
type DebugRoomInfo ¶
type DebugRoomInfo struct {
Name string
Description string
Items []DebugItemInfo
Doors []DebugDoorInfo
IsCurrent bool
}
DebugRoomInfo contains complete debug information about a room.
type DebugTriggerInfo ¶
type DebugTriggerInfo struct {
EventType string
EventName string
EffectType string
EnemyName string
}
DebugTriggerInfo contains debug information about a trigger.
type DefaultRng ¶
type DefaultRng struct{}
func (*DefaultRng) Float64 ¶
func (g *DefaultRng) Float64() float64
type DoorInspection ¶
type DoorInspection struct {
DoorInfo
}
DoorInspection contains the details of an inspected door.
type Engine ¶
type Engine struct {
Level *world.Level
Player *world.Player
CurrentFloor *world.Floor
CurrentRoom *world.Room
FightingEnemy *world.Enemy
Rng Rng
LevelCompletionState LevelCompletionState
Mode Mode
ValidationDisabled bool
MinimapData map[string]*MinimapDoorInfo // door name -> minimap info
}
Engine contains all live game state and logic for a single level.
func (*Engine) Battle ¶
func (e *Engine) Battle(weaponName string) (*BattleResult, error)
Battle battles an enemy. Handles the event, possibly triggering a state change. Returns a BattleResult and engine state info with state change notification, if applicable.
func (*Engine) Combine ¶
func (e *Engine) Combine(inputItemAName string, inputItemBName string) (*CombineResult, error)
Combine crafts a new item by combining two input items. Returns a CombineResult and engine state info.
func (*Engine) Debug ¶
func (e *Engine) Debug() (*DebugResult, error)
Debug returns complete debug information about the engine state.
func (*Engine) DisableValidation ¶
func (e *Engine) DisableValidation()
func (*Engine) EnableValidation ¶
func (e *Engine) EnableValidation()
func (*Engine) Heal ¶
func (e *Engine) Heal(name string) (*HealResult, error)
Heal heals the player by name. Returns a HealResult and engine state info.
func (*Engine) Inspect ¶
func (e *Engine) Inspect(name string) (*InspectResult, error)
Inspect inspects an item or door by name. Returns an InspectResult and engine state info.
func (*Engine) Inventory ¶
func (e *Engine) Inventory() (*InventoryResult, error)
Inventory returns the player's inventory. Returns an InventoryResult and engine state info.
func (*Engine) Minimap ¶
func (e *Engine) Minimap() (*MinimapResult, error)
Minimap returns minimap data for the current floor. Returns a MinimapResult with engine state info.
func (*Engine) Observe ¶
func (e *Engine) Observe() (*ObserveResult, error)
Observe observes the current room. Returns an ObserveResult and engine state info.
func (*Engine) Search ¶
func (e *Engine) Search(name string) (*SearchResult, error)
Search searches a container by name. Returns a SearchResult and engine state info.
func (*Engine) Take ¶
func (e *Engine) Take(name string) (*TakeResult, error)
Take takes an item by name. Handles the event, possibly triggering a state change. Returns a TakeResult and engine state info with state change notification, if applicable.
func (*Engine) Traverse ¶
func (e *Engine) Traverse(destination string) (*TraverseResult, error)
Traverse traverses to a destination room. Handles the event, possibly triggering a state change. Returns a TraverseResult and engine state info with state change notification, if applicable.
func (*Engine) Uncover ¶
func (e *Engine) Uncover(name string) (*UncoverResult, error)
Uncover uncovers an item by name. Returns an UncoverResult and engine state info.
type EngineStateChangeNotification ¶
type EngineStateChangeNotification string
EngineStateChangeNotification indicates a state change in the engine.
const ( EngineStateChangeLevelComplete EngineStateChangeNotification = "level_complete" EngineStateChangeLevelFailed EngineStateChangeNotification = "level_failed" EngineStateChangeEnterCombat EngineStateChangeNotification = "enter_combat" EngineStateChangeExitCombat EngineStateChangeNotification = "exit_combat" )
type EngineStateInfo ¶
type EngineStateInfo struct {
LevelCompletionState LevelCompletionState
CurrentLevel *world.Level
CurrentFloor *world.Floor
CurrentRoom *world.Room
Mode Mode
PlayerHealth world.HealthState
EngineStateChangeNotification *EngineStateChangeNotification
FightingEnemy *world.Enemy
OutroNarrative string
}
EngineStateInfo contains general engine state info.
type HealResult ¶
type HealResult struct {
EngineStateInfo EngineStateInfo
Result healResultInternal
}
type InspectResult ¶
type InspectResult struct {
EngineStateInfo EngineStateInfo
Result inspectResultInternal
}
type InventoryResult ¶
type InventoryResult struct {
EngineStateInfo EngineStateInfo
Result inventoryResultInternal
}
type ItemInfo ¶
type ItemInfo struct {
Name string
Description string
Location string
IsPortable bool
IsContainer bool
IsConcealer bool
IsKey bool
IsAmmoBox bool
IsWeapon bool
IsHealthItem bool
IsFixture bool
// Container-specific fields
HasKeyLock bool
HasCodeLock bool
IsLocked bool
IsSearched bool
Contains string
// Concealer-specific fields
IsUncovered bool
}
ItemInfo contains the basic information about an item, excluding detail.
type ItemInspection ¶
ItemInspection contains the details of an inspected item.
type LevelCompletionState ¶
type LevelCompletionState string
LevelCompletionState indicates the completion state of the current level.
const ( LevelCompletionStateInProgress LevelCompletionState = "in_progress" LevelCompletionStateComplete LevelCompletionState = "complete" LevelCompletionStateFailed LevelCompletionState = "failed" )
type MinimapDoorInfo ¶
type MinimapDoorInfo struct {
Name string // door name
Locked *bool // nil if unknown, true/false if known
Hidden bool // true if the door should be hidden on minimap
}
MinimapDoorInfo contains minimap information about a door
type MinimapResult ¶
type MinimapResult struct {
EngineStateInfo EngineStateInfo
Result minimapResultInternal
}
type MinimapRoomInfo ¶
MinimapRoomInfo contains minimap information about a room
type Mode ¶
type Mode string
Current "mode" of the game. Investigation is the default mode. Certain events (e.g. entering a room) may trigger a switch to Combat.
type ObserveResult ¶
type ObserveResult struct {
EngineStateInfo EngineStateInfo
Result observeResultInternal
}
type SearchResult ¶
type SearchResult struct {
EngineStateInfo EngineStateInfo
Result searchResultInternal
}
type TakeResult ¶
type TakeResult struct {
EngineStateInfo EngineStateInfo
Result takeResultInternal
}
type TraverseResult ¶
type TraverseResult struct {
EngineStateInfo EngineStateInfo
Result traverseResultInternal
}
type UncoverResult ¶
type UncoverResult struct {
EngineStateInfo EngineStateInfo
Result uncoverResultInternal
}
type UnlockResult ¶
type UnlockResult struct {
EngineStateInfo EngineStateInfo
Result unlockResultInternal
}
type UseResult ¶
type UseResult struct {
EngineStateInfo EngineStateInfo
Result useResultInternal
}