Add 3D dice roll animation for thrown rocks
Emit the individual rock-die faces (0/0/1/1/2/2) from the battle resolver so the client can render a real CSS 3D cube per die that tumbles and settles on the rolled face, replacing the flat random damage number. Falls back to the flying-rock cue for older battle logs without per-die data.
This commit is contained in:
@@ -91,6 +91,9 @@ type BattleEvent struct {
|
||||
// clash: per-seat damage totals / deaths after the exchange.
|
||||
Damage []int `json:"damage,omitempty"`
|
||||
Died []bool `json:"died,omitempty"`
|
||||
// rock: individual die faces rolled (each 0, 1, or 2), for the dice
|
||||
// animation; Roll is their sum.
|
||||
Dice []int `json:"dice,omitempty"`
|
||||
// rock: dice total rolled; rock/strip/steal: target pet's fate.
|
||||
Roll int `json:"roll"`
|
||||
DamageAfter int `json:"damageAfter"`
|
||||
@@ -368,13 +371,15 @@ func (g *Game) resolveBattle() {
|
||||
return false
|
||||
}
|
||||
roll := 0
|
||||
for range dice {
|
||||
roll += g.rollRockDie()
|
||||
faces := make([]int, dice)
|
||||
for i := range dice {
|
||||
faces[i] = g.rollRockDie()
|
||||
roll += faces[i]
|
||||
}
|
||||
dealt, blocked := hitUnit(target, roll)
|
||||
died := !tu.Alive()
|
||||
emit(BattleEvent{
|
||||
Type: "rock", Seat: from, Target: target, Roll: roll,
|
||||
Type: "rock", Seat: from, Target: target, Roll: roll, Dice: faces,
|
||||
DamageAfter: tu.Damage, TargetDied: died,
|
||||
})
|
||||
if blocked {
|
||||
|
||||
Reference in New Issue
Block a user