diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-01-20 11:14:43 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:44 +0100 |
| commit | cbed4f79f1f7f90f600ad9d1d711f82c6e09e8e5 (patch) | |
| tree | d15c0cfacf1c3668e9e19dba197dfbf5fd8c2017 /go/game | |
| parent | 104300e058b2406e55367d6b05425428cda15115 (diff) | |
| download | muhqs-game-cbed4f79f1f7f90f600ad9d1d711f82c6e09e8e5.tar.gz muhqs-game-cbed4f79f1f7f90f600ad9d1d711f82c6e09e8e5.zip | |
reformat using gofmtp
Diffstat (limited to 'go/game')
| -rw-r--r-- | go/game/card.go | 1 | ||||
| -rw-r--r-- | go/game/permanent.go | 5 | ||||
| -rw-r--r-- | go/game/range_test.go | 32 | ||||
| -rw-r--r-- | go/game/tile.go | 3 | ||||
| -rw-r--r-- | go/game/unit.go | 3 |
5 files changed, 34 insertions, 10 deletions
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 |
