载入中...
搜索中...
未找到
MeleeHit.cpp
浏览该文件的文档.
59bool spheresOverlap(MeleePoint3 a, double ra, MeleePoint3 b, double rb, MeleePoint3& contact, MeleePoint3& normal) {
69bool capsuleSphereOverlap(const CapsuleWorld& capsule, MeleePoint3 center, double radius, MeleePoint3& contact,
75bool capsuleCapsuleOverlap(const CapsuleWorld& a, const CapsuleWorld& b, MeleePoint3& contact, MeleePoint3& normal) {
76 // Sample closest approach via discrete segment samples; deterministic and adequate for arena scale.
95bool shapesOverlap(const MeleeShape& attackShape, const MeleePose& attackPose, MeleePoint3 attackOffset,
104 return capsuleSphereOverlap(capsuleAt(attackShape, attackPose, attackOffset), hurtPose.position,
130 Diagnostic::error(DiagnosticCode::InvalidArgument, "melee capsule halfHeight is invalid", "halfHeight"));
157 Diagnostic::error(DiagnosticCode::InvalidArgument, "hitbox local offset is invalid", "localOffset"));
159 Diagnostic::error(DiagnosticCode::InvalidArgument, "hitbox health damage is invalid", "healthDamage"));
161 Diagnostic::error(DiagnosticCode::InvalidArgument, "hitbox poise damage is invalid", "poiseDamage"));
163 Diagnostic::error(DiagnosticCode::InvalidArgument, "hitbox damage type is empty", "damageType"));
166 Diagnostic::error(DiagnosticCode::InvalidArgument, "hitbox knockback speed is invalid", "knockbackSpeed"));
169 Diagnostic::error(DiagnosticCode::InvalidArgument, "hitbox knockback lift is invalid", "knockbackLift"));
203Result<void> MeleeHitRuntime::setHurtboxPose(SubjectRef subject, std::string_view hurtboxId, MeleePose pose) {
208 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "hurtbox was not found", "hurtboxId"));
221 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "hitbox catalog entry missing",
260 Diagnostic::error(DiagnosticCode::InvalidArgument, "melee tick must be non-decreasing", "tick"));
326 Diagnostic::error(DiagnosticCode::NotFound, "damage target was not found", hit.target.format()));
Deterministic bone-agnostic melee hitbox/hurtbox sweep.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
bool isValid() const noexcept
Return whether this reference is valid and non-nil.
Definition SubjectRef.h:38
Result< DamageOutcome > apply(CombatState &target, const DamageRequest &request) const
Resolve and atomically commit one damage request.
Definition Damage.cpp:200
virtual Result< MeleePose > pose(SubjectRef subject, std::string_view hitboxId) const =0
Resolve the current world pose for one subject's active hitbox.
Result< void > registerHitbox(MeleeHitboxDefinition definition)
Register or replace one hitbox catalog entry after full validation.
Definition MeleeHit.cpp:173
Result< std::vector< DamageOutcome > > applyHits(DamageRuntime &damage, std::map< std::string, CombatState, std::less<> > &states, const std::vector< MeleeHitEvent > &hits, const std::map< std::string, double, std::less<> > &bodyPartMultipliers={}) const
Apply owning hit events through DamageRuntime using a mutable state map.
Definition MeleeHit.cpp:316
Result< void > setHurtboxPose(SubjectRef subject, std::string_view hurtboxId, MeleePose pose)
Update the current world pose of one registered hurtbox.
Definition MeleeHit.cpp:203
Result< void > armHitbox(SubjectRef subject, std::string_view hitboxId, action::ActionExecutionId execution)
Arm one hitbox while a Montage window owns it.
Definition MeleeHit.cpp:214
Result< MeleeHitFrame > advance(SimulationTick tick)
Sample poses for armed hitboxes, sweep against hurtboxes and emit unique hits.
Definition MeleeHit.cpp:257
Result< void > clearHurtboxes(SubjectRef subject)
Remove every hurtbox owned by a subject.
Definition MeleeHit.cpp:190
Result< void > disarmHitbox(SubjectRef subject, std::string_view hitboxId, action::ActionExecutionId execution)
Disarm one hitbox window and forget its per-target hit memory.
Definition MeleeHit.cpp:242
Result< void > registerHurtbox(MeleeHurtboxDefinition definition)
Register or replace one hurtbox after full validation.
Definition MeleeHit.cpp:180
constexpr std::uint64_t value() const noexcept
Returns the underlying value at an explicit protocol boundary.
Definition StrongUint64.h:26
Definition ActionDamageSink.cpp:9
@ Capsule
@ InvalidArgument
@ NotFound
@ NoOp
@ Applied
Mutable combat state owned by the gameplay domain for one subject.
Definition Damage.h:37
Catalog entry that maps a timeline hitbox resource id onto geometry.
Definition MeleeHit.h:67
double knockbackLift
Upward impulse added on hit; independent of the contact normal.
Definition MeleeHit.h:78
MeleePoint3 localOffset
Local offset from the pose provided by the pose source.
Definition MeleeHit.h:71
double knockbackSpeed
Horizontal impulse magnitude along the contact normal (attacker → target).
Definition MeleeHit.h:76
Body-part tag used for multipliers and debugging.
Definition MeleeHit.h:56
double yawRadians
Yaw radians around world +Y; pitch/roll are unused for v1 capsules.
Definition MeleeHit.h:49
Result< void > validate() const
Reject non-finite or non-positive dimensions.
Definition MeleeHit.cpp:125