From 99938e1447c9743a7b6198dbfe6ea265da7b67ba Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 16 Nov 2021 16:42:37 -0500 Subject: [PATCH] update game string, fix ally,enemy.other effects --- game.go | 13 +++++++++++-- oracle.go | 14 +++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/game.go b/game.go index df469e1..9b18d37 100644 --- a/game.go +++ b/game.go @@ -52,7 +52,7 @@ func NewGame(sentDeck []int, scoDeck []int) *Game { } func (g *Game) String() string { - return fmt.Sprintf("Sen(%v): %v\n\n%v\n\nSco(%v): %v\nStatus:%v Draw:%v Turn:%v\n%v\n", g.SentinalPlayer.Life, g.SentinalPlayer.Hand, g.GameBoard, g.ScourgePlayer.Life, g.ScourgePlayer.Hand, g.Status, g.CanDraw, g.CurrentTurn, g.CardBuffer) + return fmt.Sprintf("Sen(%v): %v\n\n%v\n\nSco(%v): %v\nStatus:%v Draw:%v Turn:%v\nBuffers\nCardBuffer:%v\nSB:%v BB:%v\nEffectTarget:%v\nQueuedEffect:%v", g.SentinalPlayer.Life, g.SentinalPlayer.Hand, g.GameBoard, g.ScourgePlayer.Life, g.ScourgePlayer.Hand, g.Status, g.CanDraw, g.CurrentTurn, g.CardBuffer, g.ScryBuffer, g.CardBuffer, g.TargetReq, g.QueuedEffect) } func (g *Game) Parse(cmd *Command) *CommandResult { @@ -93,7 +93,9 @@ func (g *Game) Parse(cmd *Command) *CommandResult { debug_res = nil res_type = InvalidCmd } - g.StateChanges() + if g.Status == StatusPlaying { + g.StateChanges() + } return &CommandResult{ PlayerID: cmd.PlayerID, ResultType: res_type, @@ -202,6 +204,10 @@ func (g *Game) PlayerStateAct(id int, cmd string) *GameView { if id != g.CurrentTurn { return nil } + if g.CanDraw == true || g.QueuedEffect != nil { + log.Println("player tried to end turn while still actions available") + return nil + } g.CardBuffer = DeckFromCards([]*Card{}) for _, v := range g.GetBoard(id) { OracleEndstep(v, g) @@ -216,6 +222,9 @@ func (g *Game) PlayerStateAct(id int, cmd string) *GameView { } func (g *Game) PlayerAct(id int, cmd string) *Deck { + if g.Status != StatusLobby { + return nil + } if id != g.CurrentTurn { return nil } diff --git a/oracle.go b/oracle.go index cc8ad04..dc55daa 100644 --- a/oracle.go +++ b/oracle.go @@ -84,10 +84,10 @@ func OracleEnters(c *Card, g *Game) { } } case Ally: - g.QueuedEffect = &Effect{c.Id, uuid.Nil, 2, 1, true} + g.QueuedEffect = &Effect{c.Id, uuid.Nil, 1, 1, true} g.TargetReq = TargetOwn case Enemy: - g.QueuedEffect = &Effect{c.Id, uuid.Nil, 2, -1, true} + g.QueuedEffect = &Effect{c.Id, uuid.Nil, 1, -1, true} g.TargetReq = TargetOpp case Chupacabra: g.QueuedEffect = &Effect{c.Id, uuid.Nil, 4, 0, true} @@ -96,7 +96,7 @@ func OracleEnters(c *Card, g *Game) { g.QueuedEffect = &Effect{c.Id, uuid.Nil, 6, 1, true} g.TargetReq = TargetOwn case Vanguard: - g.QueuedEffect = &Effect{c.Id, uuid.Nil, 7, 1, true} + g.QueuedEffect = &Effect{c.Id, uuid.Nil, 5, 1, true} g.TargetReq = TargetOwn case Elephant: g.QueuedEffect = &Effect{c.Id, uuid.Nil, 9, 0, false} @@ -181,15 +181,15 @@ func OracleEndstep(c *Card, g *Game) { func OraclePower(c CardType, g *Game) int { //this is horrible switch c { - case Dud, Clog: + case Dud, Clog, Valk: return 0 case Speedster, HealthPotion, Tree, Goblin, GoblinSpawn, Chupacabra: return 1 - case Commander, Ally: + case Commander, Ally, Enemy: return 2 - case Paladin, Duelist: + case Paladin, Duelist, Bureaucrat: return 3 - case Scholar, Vanguard: + case Scholar, Vanguard, Student, Librarian: return 4 case Warrior, Elephant: return 5