载入中...
搜索中...
未找到
eve::tactics::BattleSystem类 参考final

Stateless systems over the tactics short-root ECS family. 更多...

#include <TacticsBattle.h>

静态 Public 成员函数

static Result< void > addSide (Battle &battle, ecs::EntityHandle side)
 Register a side during setup using a generation-checked handle.
 
static Result< void > addUnit (Battle &battle, ecs::EntityHandle unit, ecs::EntityHandle side, Cell cell)
 Register and place a unit during setup atomically.
 
static Result< void > start (Battle &battle, std::string policyId)
 Start a configured battle and emit battle.started.
 
static Result< BattlePhase > advance (Battle &battle, const SimulationStep &step)
 Advance exactly one observable automatic phase transition.
 
static Result< void > endTurn (Battle &battle, SubjectRef actor)
 End the currently acting unit's turn and enter TurnEnd.
 
static Result< MoveReceipt > moveUnit (Battle &battle, SubjectRef actor, Cell destination)
 Validate and atomically commit movement for the active unit.
 
static Result< MoveReceipt > moveUnit (Battle &battle, SubjectRef actor, Cell destination, SimulationTick commandTick)
 Commit movement at an explicit non-decreasing command tick (ActionRuntime adapter path).
 
static Result< void > faceUnit (Battle &battle, SubjectRef actor, int facing)
 Change the active unit's logical facing without consuming movement points.
 
static Result< void > faceUnit (Battle &battle, SubjectRef actor, int facing, SimulationTick commandTick)
 Commit facing at an explicit non-decreasing command tick.
 
static Result< void > previewFace (Battle &battle, SubjectRef actor, int facing)
 Preview a facing action with the exact validator used by commit.
 
static Result< void > waitUnit (Battle &battle, SubjectRef actor)
 Commit a wait action and enter TurnEnd for the active unit.
 
static Result< void > waitUnit (Battle &battle, SubjectRef actor, SimulationTick commandTick)
 Commit wait at an explicit non-decreasing command tick.
 
static Result< void > previewWait (Battle &battle, SubjectRef actor)
 Preview a wait action with the exact validator used by commit.
 
static Result< AbilityReceipt > useAbility (Battle &battle, SubjectRef actor, const LogicalId &action, Cell targetCell, SubjectRef targetUnit={}, std::string payload={})
 Declare an ability activation by the active unit.
 
static Result< AbilityReceipt > previewAbility (Battle &battle, SubjectRef actor, const LogicalId &action, Cell targetCell, SubjectRef targetUnit={}, std::string_view payload={})
 Preview an ability declaration with the exact validator used by commit.
 
static Result< MoveReceipt > previewMove (Battle &battle, SubjectRef actor, Cell destination)
 Preview movement with the exact validator used by commit, without mutation.
 
static Result< void > finish (Battle &battle)
 End a running battle and enter BattleEnd.
 
static Result< std::size_t > openReaction (Battle &battle, std::uint64_t triggerSequence, std::vector< ReactionCandidate > candidates)
 Open a sorted reaction window for an existing battle event sequence.
 
static Result< ReactionReceipt > acceptReaction (Battle &battle, SubjectRef reactor, const LogicalId &action)
 Accept one eligible reaction, consume one reaction point and close the top window.
 
static Result< void > declineReaction (Battle &battle)
 Decline and close the top reaction window without consuming resources.
 
static Result< void > addObjective (Battle &battle, ObjectiveSpec objective)
 Register a validated built-in objective during setup.
 
static Result< void > defeatUnit (Battle &battle, SubjectRef unit)
 Apply a tactical defeat outcome and evaluate affected objectives atomically.
 
static Result< std::uint64_t > roll (Battle &battle, const LogicalId &stream)
 Consume one value from a battle-owned named deterministic stream.
 

详细描述

Stateless systems over the tactics short-root ECS family.

Entity scope: Battle, TacticalSide and TacticalUnit roots linked to the supplied Battle. Read set: identities, membership, turn resources and board facts. Write set: Battle turn/events/board and TacticalUnit membership, position and acted flag. Structural mutation: none. Events are appended to Battle::Events. Services: none. Phase: owner simulation thread only. Determinism: bit-exact for equal setup, handles, SubjectRefs and steps.

在文件 TacticsBattle.h 第 49 行定义.

成员函数说明

◆ acceptReaction()

◆ addObjective()

◆ addSide()

Result< void > eve::tactics::BattleSystem::addSide ( Battle &  battle,
ecs::EntityHandle  side 
)
static

◆ addUnit()

Result< void > eve::tactics::BattleSystem::addUnit ( Battle &  battle,
ecs::EntityHandle  unit,
ecs::EntityHandle  side,
Cell  cell 
)
static

Register and place a unit during setup atomically.

返回
Applied, or failure with board/unit/battle state unchanged.

在文件 TacticsBattle.cpp 第 257 行定义.

引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::NotFound, placed, eve::PreconditionViolation, revision, eve::tactics::Setup, eve::StaleHandle, eve::Status::success(), eve::Result< T >::success() , 以及 unit.

被这些函数引用 eve::tactics::Tactics::newUnit().

◆ advance()

◆ declineReaction()

◆ defeatUnit()

◆ endTurn()

◆ faceUnit() [1/2]

Result< void > eve::tactics::BattleSystem::faceUnit ( Battle &  battle,
SubjectRef  actor,
int  facing 
)
static

Change the active unit's logical facing without consuming movement points.

在文件 TacticsBattle.cpp 第 627 行定义.

引用了 faceUnit() , 以及 facing.

被这些函数引用 faceUnit(), eve::tactics::Tactics::faceUnit() , 以及 eve::tactics::Tactics::submitGameplay().

◆ faceUnit() [2/2]

◆ finish()

◆ moveUnit() [1/2]

Result< MoveReceipt > eve::tactics::BattleSystem::moveUnit ( Battle &  battle,
SubjectRef  actor,
Cell  destination 
)
static

Validate and atomically commit movement for the active unit.

返回
Owning receipt; failure leaves board, position and resources unchanged.

在文件 TacticsBattle.cpp 第 585 行定义.

引用了 moveUnit().

被这些函数引用 moveUnit(), eve::tactics::Tactics::moveUnit() , 以及 eve::tactics::Tactics::submitGameplay().

◆ moveUnit() [2/2]

◆ openReaction()

◆ previewAbility()

Result< AbilityReceipt > eve::tactics::BattleSystem::previewAbility ( Battle &  battle,
SubjectRef  actor,
const LogicalId &  action,
Cell  targetCell,
SubjectRef  targetUnit = {},
std::string_view  payload = {} 
)
static

Preview an ability declaration with the exact validator used by commit.

返回
The receipt the commit would produce, computed without mutation: no action point is spent, no event is emitted and no command is recorded.
备注
Sharing one validator is what lets a UI show "this is legal and costs one point" and then commit it without a second, divergent rule set.

在文件 TacticsBattle.cpp 第 395 行定义.

引用了 action, payload , 以及 eve::tactics::validateAbility().

被这些函数引用 eve::tactics::Tactics::previewAbility().

◆ previewFace()

◆ previewMove()

◆ previewWait()

Result< void > eve::tactics::BattleSystem::previewWait ( Battle &  battle,
SubjectRef  actor 
)
static

◆ roll()

Result< std::uint64_t > eve::tactics::BattleSystem::roll ( Battle &  battle,
const LogicalId &  stream 
)
static

◆ start()

◆ useAbility()

Result< AbilityReceipt > eve::tactics::BattleSystem::useAbility ( Battle &  battle,
SubjectRef  actor,
const LogicalId &  action,
Cell  targetCell,
SubjectRef  targetUnit = {},
std::string  payload = {} 
)
static

Declare an ability activation by the active unit.

参数
actionAbility identity; it must be a valid logical id.
targetCellTarget cell; it must exist and share the actor's layer.
targetUnitOptional targeted unit; when valid it must be a living unit of this battle. It is kept independent of targetCell, because an ability may name a primary unit inside an area the caller centres elsewhere.
payloadOpaque caller-owned effect parameters, stored and replayed verbatim; it must not exceed kMaxAbilityPayloadBytes.
返回
Owning receipt, or a structured refusal that leaves resources, events and the command log unchanged.
备注
Tactics owns the activation opportunity, not the effect: it enforces the phase and the actor, spends one action point, emits action.declared and records the command for replay. Damage, status and hit resolution stay with the RPG or game adapter, which reports the tactical outcome back through defeatUnit. Ending the turn is the caller's decision, exactly as for a move. @ownership The returned receipt owns its values; nothing borrows from the battle.

在文件 TacticsBattle.cpp 第 401 行定义.

引用了 action, eve::tactics::BattleCommand::action, eve::tactics::BattleCommand::actor, eve::Applied, eve::tactics::BattleCommand::cell, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), eve::tactics::BattleCommand::kind, payload, eve::tactics::BattleCommand::payload, revision, eve::StaleHandle, eve::Status::success(), eve::Result< T >::success(), eve::tactics::BattleCommand::targetUnit, turn, unit, eve::tactics::UseAbility , 以及 eve::tactics::validateAbility().

被这些函数引用 eve::tactics::Tactics::submitGameplay() , 以及 eve::tactics::Tactics::useAbility().

◆ waitUnit() [1/2]

Result< void > eve::tactics::BattleSystem::waitUnit ( Battle &  battle,
SubjectRef  actor 
)
static

Commit a wait action and enter TurnEnd for the active unit.

在文件 TacticsBattle.cpp 第 678 行定义.

引用了 waitUnit().

被这些函数引用 eve::tactics::Tactics::submitGameplay(), waitUnit() , 以及 eve::tactics::Tactics::waitUnit().

◆ waitUnit() [2/2]


该类的文档由以下文件生成: