Skip to content

Commit

Permalink
Fix more bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
bobtfish committed Dec 24, 2022
1 parent 3d22888 commit e46ef45
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 0 additions & 4 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
Bug / missing feature list:

Bugs
- second game has player 3+ and never finishes player selection
- When we have multiple players (8) then some are killed select spell screen allows selections for dead players

Visual / animation:
Press number to flash characters of one player
Flash characters of one player at start of move turn
Expand Down
4 changes: 4 additions & 0 deletions game/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func (gw *Window) GetPlayers() []*player.Player {
return gw.Players
}

func (gw *Window) ResetPlayers() {
gw.Players = make([]*player.Player, 0)
}

func (gw *Window) GetGrid() *grid.GameGrid {
return gw.Grid
}
Expand Down
10 changes: 6 additions & 4 deletions screen/turnmenu.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,20 @@ func (screen *TurnMenuScreen) Step(ctx screeniface.GameCtx) screeniface.GameScre
win := ctx.GetWindow()
c := captureNumKey(win)
players := ctx.(*game.Window).GetPlayers()
player := players[screen.PlayerIdx]
if c == 1 {
return &ExamineSpellsScreen{
SpellListScreen: SpellListScreen{
MainMenu: screen,
Player: players[screen.PlayerIdx],
Player: player,
},
}
}
if c == 2 {
return &SelectSpellScreen{
SpellListScreen: SpellListScreen{
MainMenu: screen,
Player: players[screen.PlayerIdx],
Player: player,
},
}
}
Expand All @@ -233,11 +234,12 @@ func (screen *TurnMenuScreen) Step(ctx screeniface.GameCtx) screeniface.GameScre
}
}
if c == 4 {
if len(players) == screen.PlayerIdx+1 {
nextIdx := NextPlayerIdx(screen.PlayerIdx, players)
if len(players) == nextIdx {
return &DisplaySpellCastScreen{}
}
return &TurnMenuScreen{
PlayerIdx: screen.PlayerIdx + 1,
PlayerIdx: nextIdx,
}
}
return screen
Expand Down
2 changes: 2 additions & 0 deletions screen/winner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"strings"

"github.com/bobtfish/mayhem/game"
"github.com/bobtfish/mayhem/logical"
"github.com/bobtfish/mayhem/player"
screeniface "github.com/bobtfish/mayhem/screen/iface"
Expand Down Expand Up @@ -34,6 +35,7 @@ func (screen *WinnerScreen) Enter(ctx screeniface.GameCtx) {
func (screen *WinnerScreen) Step(ctx screeniface.GameCtx) screeniface.GameScreen {
win := ctx.GetWindow()
if win.Typed() != "" {
ctx.(*game.Window).ResetPlayers()
return &InitialScreen{}
}
return screen
Expand Down

0 comments on commit e46ef45

Please sign in to comment.