hp is set at start of round, not start of group
This commit is contained in:
parent
4d2f5a43dc
commit
402e3768e5
10
game/game.go
10
game/game.go
@ -28,8 +28,9 @@ func NewGame() *Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) StartRound() {
|
func (g *Game) StartRound() {
|
||||||
g.PP[0].StartRound()
|
g.HP = int8(g.RNG.Intn(3) + 2)
|
||||||
g.PP[1].StartRound()
|
g.PP[0].StartRound(g.HP)
|
||||||
|
g.PP[1].StartRound(g.HP)
|
||||||
g.Round++
|
g.Round++
|
||||||
g.Group = 0
|
g.Group = 0
|
||||||
g.StartGroup()
|
g.StartGroup()
|
||||||
@ -37,9 +38,8 @@ func (g *Game) StartRound() {
|
|||||||
|
|
||||||
func (g *Game) StartGroup() {
|
func (g *Game) StartGroup() {
|
||||||
items := g.RNG.Intn(4) + 1
|
items := g.RNG.Intn(4) + 1
|
||||||
g.HP = int8(g.RNG.Intn(3) + 2)
|
g.PP[0].StartGroup(&g.RNG, items)
|
||||||
g.PP[0].StartGroup(&g.RNG, g.HP, items)
|
g.PP[1].StartGroup(&g.RNG, items)
|
||||||
g.PP[1].StartGroup(&g.RNG, g.HP, items)
|
|
||||||
shells := g.RNG.Intn(6) + 2
|
shells := g.RNG.Intn(6) + 2
|
||||||
for i := 0; i < shells/2; i++ {
|
for i := 0; i < shells/2; i++ {
|
||||||
g.ShellArray[i] = true
|
g.ShellArray[i] = true
|
||||||
|
@ -13,12 +13,12 @@ type Player struct {
|
|||||||
Cuffs CuffState
|
Cuffs CuffState
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) StartRound() {
|
func (p *Player) StartRound(hp int8) {
|
||||||
|
p.HP = hp
|
||||||
clear(p.Items[:])
|
clear(p.Items[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) StartGroup(rng *RNG, hp int8, items int) {
|
func (p *Player) StartGroup(rng *RNG, items int) {
|
||||||
p.HP = hp
|
|
||||||
for i := 0; i < items; i++ {
|
for i := 0; i < items; i++ {
|
||||||
k := slices.Index(p.Items[:], ItemNone)
|
k := slices.Index(p.Items[:], ItemNone)
|
||||||
if k < 0 {
|
if k < 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user