aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-01-20 11:14:43 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-27 16:43:44 +0100
commitcbed4f79f1f7f90f600ad9d1d711f82c6e09e8e5 (patch)
treed15c0cfacf1c3668e9e19dba197dfbf5fd8c2017
parent104300e058b2406e55367d6b05425428cda15115 (diff)
downloadmuhqs-game-cbed4f79f1f7f90f600ad9d1d711f82c6e09e8e5.tar.gz
muhqs-game-cbed4f79f1f7f90f600ad9d1d711f82c6e09e8e5.zip
reformat using gofmtp
-rw-r--r--go/client/main.go4
-rw-r--r--go/game/card.go1
-rw-r--r--go/game/permanent.go5
-rw-r--r--go/game/range_test.go32
-rw-r--r--go/game/tile.go3
-rw-r--r--go/game/unit.go3
-rw-r--r--go/ui/choice.go4
-rw-r--r--go/webtools/main.go2
8 files changed, 38 insertions, 16 deletions
diff --git a/go/client/main.go b/go/client/main.go
index ec8fff5e..13a07d0b 100644
--- a/go/client/main.go
+++ b/go/client/main.go
@@ -26,8 +26,7 @@ const (
HOVER_THRESHOLD = 60
)
-type HandLayer struct {
-}
+type HandLayer struct{}
func (l *HandLayer) Draw(screen *ebiten.Image) {
cardImg := assets.GetCard("base/archer", "en")
@@ -56,6 +55,7 @@ func (h *hoverDetector) update(x, y int) {
h.reset()
}
}
+
func (h *hoverDetector) reset() {
h.ticks = 0
if h.resetFunc != nil {
diff --git a/go/game/card.go b/go/game/card.go
index bfa476a9..9d71cc9c 100644
--- a/go/game/card.go
+++ b/go/game/card.go
@@ -150,7 +150,6 @@ func (card *Card) getEffects() []string {
return enEffects.([]string)
}
return effects.([]string)
-
}
func NewCard(cardPath string) *Card {
diff --git a/go/game/permanent.go b/go/game/permanent.go
index 7a9988e1..e90bd833 100644
--- a/go/game/permanent.go
+++ b/go/game/permanent.go
@@ -40,18 +40,23 @@ func NewPermanentBase(card *Card, tile *Tile, owner *Player) PermanentBase {
func (p *PermanentBase) GetCard() *Card {
return p.Card
}
+
func (p *PermanentBase) GetTile() *Tile {
return p.Tile
}
+
func (p *PermanentBase) GetDamage() int {
return p.Damage
}
+
func (p *PermanentBase) GetPile() []Permanent {
return p.Pile
}
+
func (p *PermanentBase) GetController() *Player {
return p.Controller
}
+
func (p *PermanentBase) GetOwner() *Player {
return p.Owner
}
diff --git a/go/game/range_test.go b/go/game/range_test.go
index afa164de..274b3b85 100644
--- a/go/game/range_test.go
+++ b/go/game/range_test.go
@@ -1,13 +1,14 @@
package game
import (
- "golang.org/x/exp/slices"
"testing"
+
+ "golang.org/x/exp/slices"
)
func TestPositionsInRange(t *testing.T) {
origin := Position{0, 0}
- positionsInRange1 := []Position{Position{0, 1}, Position{1, 0}, Position{1, 1}}
+ positionsInRange1 := []Position{{0, 1}, {1, 0}, {1, 1}}
calculatedPositions := PositionsInRange(origin, 1, false)
if len(positionsInRange1) != len(calculatedPositions) {
t.Fatalf("Unexpected number of calculated positions")
@@ -20,11 +21,28 @@ func TestPositionsInRange(t *testing.T) {
}
origin = Position{2, 2}
- positionsInRange2 := []Position{Position{0, 1}, Position{0, 2}, Position{0, 3},
- Position{1, 0}, Position{1, 1}, Position{1, 2}, Position{1, 3}, Position{1, 4},
- Position{2, 0}, Position{2, 1}, Position{2, 3}, Position{2, 4},
- Position{3, 0}, Position{3, 1}, Position{3, 2}, Position{3, 3}, Position{3, 4},
- Position{4, 1}, Position{4, 2}, Position{4, 3}}
+ positionsInRange2 := []Position{
+ {0, 1},
+ {0, 2},
+ {0, 3},
+ {1, 0},
+ {1, 1},
+ {1, 2},
+ {1, 3},
+ {1, 4},
+ {2, 0},
+ {2, 1},
+ {2, 3},
+ {2, 4},
+ {3, 0},
+ {3, 1},
+ {3, 2},
+ {3, 3},
+ {3, 4},
+ {4, 1},
+ {4, 2},
+ {4, 3},
+ }
calculatedPositions = PositionsInRange(origin, 2, false)
for _, p := range positionsInRange2 {
diff --git a/go/game/tile.go b/go/game/tile.go
index b8e8c83f..f66b4fb0 100644
--- a/go/game/tile.go
+++ b/go/game/tile.go
@@ -48,7 +48,8 @@ var TileTypes = struct {
House: house,
Farm: farm,
Street: street,
- Spawn: spawn}
+ Spawn: spawn,
+}
var TileNames = map[string]TileType{
"neutral": neutral,
diff --git a/go/game/unit.go b/go/game/unit.go
index b81ea8b3..028ff274 100644
--- a/go/game/unit.go
+++ b/go/game/unit.go
@@ -2,10 +2,11 @@ package game
import (
"fmt"
- "golang.org/x/exp/slices"
"log"
"strconv"
"strings"
+
+ "golang.org/x/exp/slices"
)
type UnitState int
diff --git a/go/ui/choice.go b/go/ui/choice.go
index 9e9b7b2f..2020ed0a 100644
--- a/go/ui/choice.go
+++ b/go/ui/choice.go
@@ -16,8 +16,8 @@ type Choice struct {
func choiceButtonOnClickDummy(b *SimpleButton) {}
func NewChoice(x, y int, width, choiceHeight int, choices []string,
- onClick func(*Choice, int, int)) *Choice {
-
+ onClick func(*Choice, int, int),
+) *Choice {
c := &Choice{x, y, width, choiceHeight, choices, onClick, []Button{}}
for i, choice := range c.choices {
diff --git a/go/webtools/main.go b/go/webtools/main.go
index 03fc9e37..4d03c770 100644
--- a/go/webtools/main.go
+++ b/go/webtools/main.go
@@ -6,8 +6,6 @@ import (
"muhq.space/muhqs-game/go/game"
)
-const ()
-
func jSRandomTileFromMap() js.Func {
jsonFunc := js.FuncOf(func(this js.Value, args []js.Value) any {
if len(args) != 2 {