2022-12-25 14:18:48 +08:00
package battle
2022-12-25 20:17:22 +08:00
// TODO: Replace all "int32", "int64", "uint32" and "uint64" with just "int" for better performance in JavaScript! Reference https://github.com/gopherjs/gopherjs#performance-tips
2022-12-25 14:18:48 +08:00
type Vec2D struct {
X float64
Y float64
}
type Polygon2D struct {
Anchor * Vec2D
Points [ ] * Vec2D
}
type PlayerDownsync struct {
Id int32
VirtualGridX int32
VirtualGridY int32
DirX int32
DirY int32
VelX int32
VelY int32
Speed int32
BattleState int32
JoinIndex int32
2023-01-01 20:18:35 +08:00
ColliderRadius int32
2022-12-25 14:18:48 +08:00
Removed bool
Score int32
LastMoveGmtMillis int32
FramesToRecover int32
2022-12-31 15:47:45 +08:00
FramesInChState int32
2022-12-25 14:18:48 +08:00
Hp int32
MaxHp int32
CharacterState int32
InAir bool
2023-01-11 18:09:18 +08:00
OnWall bool
2023-01-13 11:25:20 +08:00
OnWallNormX int32
OnWallNormY int32
2023-01-01 20:18:35 +08:00
ActiveSkillId int32
ActiveSkillHit int32
2023-01-04 23:48:00 +08:00
2023-01-05 10:20:01 +08:00
FramesInvinsible int32
2023-01-08 20:34:29 +08:00
BulletTeamId int32
ChCollisionTeamId int32 // not the same as "BulletTeamId", because even in the same team, we should allow inter-character collisions
2022-12-25 14:18:48 +08:00
}
type InputFrameDecoded struct {
Dx int32
Dy int32
BtnALevel int32
BtnBLevel int32
}
type InputFrameUpsync struct {
InputFrameId int32
Encoded uint64
}
type Barrier struct {
Boundary * Polygon2D
}
2023-01-13 11:25:20 +08:00
type BulletConfig struct {
2023-01-10 12:08:15 +08:00
BulletLocalId int32 // for referencing cached nodes in frontend rendering
2022-12-25 14:18:48 +08:00
// for offender
2023-01-01 15:43:25 +08:00
OriginatedRenderFrameId int32 // Copied from the first bullet for all subsequent bullets
OffenderJoinIndex int32 // Copied to favor collision handling of the dispatched bullet
StartupFrames int32 // from "OriginatedRenderFrameId"
CancellableStFrame int32 // from "OriginatedRenderFrameId"
CancellableEdFrame int32 // from "OriginatedRenderFrameId"
2022-12-25 14:18:48 +08:00
ActiveFrames int32
2022-12-31 15:47:45 +08:00
2022-12-25 14:18:48 +08:00
// for defender
2023-01-01 15:43:25 +08:00
HitStunFrames int32
BlockStunFrames int32
2023-01-01 20:18:35 +08:00
PushbackVelX int32
PushbackVelY int32
2023-01-01 15:43:25 +08:00
Damage int32
2023-01-05 10:20:01 +08:00
SelfLockVelX int32
SelfLockVelY int32
2023-01-01 15:43:25 +08:00
HitboxOffsetX int32
HitboxOffsetY int32
HitboxSizeX int32
HitboxSizeY int32
BlowUp bool
2023-01-01 22:51:46 +08:00
CancelTransit map [ int ] int
2023-01-08 20:34:29 +08:00
TeamId int32
2022-12-25 14:18:48 +08:00
}
2022-12-28 18:06:05 +08:00
type MeleeBullet struct {
2023-01-13 11:25:20 +08:00
Bullet * BulletConfig
2022-12-28 18:06:05 +08:00
}
type FireballBullet struct {
VirtualGridX int32
VirtualGridY int32
DirX int32
DirY int32
VelX int32
VelY int32
Speed int32
2023-01-11 18:09:18 +08:00
SpeciesId int32
2023-01-13 11:25:20 +08:00
Bullet * BulletConfig
2022-12-28 18:06:05 +08:00
}
2022-12-31 15:47:45 +08:00
type Skill struct {
2023-01-01 15:43:25 +08:00
BattleLocalId int32
RecoveryFrames int32
RecoveryFramesOnBlock int32
RecoveryFramesOnHit int32
2023-01-01 22:51:46 +08:00
ReleaseTriggerType int32 // 1: rising-edge, 2: falling-edge
BoundChState int32
2023-01-01 15:43:25 +08:00
Hits [ ] interface { } // Hits within a "Skill" are automatically triggered
2022-12-31 15:47:45 +08:00
}
2022-12-25 14:18:48 +08:00
type RoomDownsyncFrame struct {
2023-01-10 12:08:15 +08:00
Id int32
PlayersArr [ ] * PlayerDownsync
CountdownNanos int64
MeleeBullets [ ] * MeleeBullet
FireballBullets [ ] * FireballBullet
BackendUnconfirmedMask uint64
ShouldForceResync bool
BulletLocalIdCounter int32
2022-12-25 14:18:48 +08:00
}
2022-12-28 18:06:05 +08:00
type InputFrameDownsync struct {
InputFrameId int32
InputList [ ] uint64
ConfirmedList uint64
}
2023-01-08 20:34:29 +08:00
type NpcPatrolCue struct {
FlAct uint64 // Encoded input when collided with this cue & facing left
FrAct uint64 // Encoded input when collided with this cue & facing right
X float64
Y float64
}