diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-04 18:51:31 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:46:40 +0200 |
| commit | 8c3456f5a120a00f8a4e89065d7d50f2c1b4ad0d (patch) | |
| tree | 6e201152c264184bcd5aad784386654e921c8634 /go/game/permanent.go | |
| parent | 083ec284a9ef286729e544df9340a12760f03ab7 (diff) | |
| download | muhqs-game-8c3456f5a120a00f8a4e89065d7d50f2c1b4ad0d.tar.gz muhqs-game-8c3456f5a120a00f8a4e89065d7d50f2c1b4ad0d.zip | |
improve permanent pile support
* Fix alot of bugs caused by permanents without tiles
* Implement a permanent choice to select the permanents in a pile
* Fix how pile hooks are called
Diffstat (limited to 'go/game/permanent.go')
| -rw-r--r-- | go/game/permanent.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/go/game/permanent.go b/go/game/permanent.go index 91aa0cda..67c39e0b 100644 --- a/go/game/permanent.go +++ b/go/game/permanent.go @@ -85,8 +85,12 @@ func (p *PermanentBase) Owner() *Player { } func (p *PermanentBase) String() string { - return fmt.Sprintf("%s's %s@%s", - p.Controller().Name, p.Card().Name, p.Tile().Position.String()) + if p.Tile() != nil { + return fmt.Sprintf("%s's %s@%v", + p.Controller().Name, p.Card().Name, p.Tile().Position) + } + + return fmt.Sprintf("%s's %s", p.Controller().Name, p.Card().Name) } func DealDamage(src, dest Permanent, damage int) { @@ -157,14 +161,17 @@ func (p *PermanentBase) RemovePermanentFromPile(rm Permanent) { return } } -func (b *PermanentBase) onPile(p Permanent) { p.Card().Impl.onPile(p) } -func (b *PermanentBase) onUnpile(p Permanent) { p.Card().Impl.onUnpile(p) } -func (b *PermanentBase) onDrop(p Permanent) { p.Card().Impl.onDrop(p) } +func (b *PermanentBase) onPile(p Permanent) { b.Card().Impl.onPile(p) } +func (b *PermanentBase) onUnpile(p Permanent) { b.Card().Impl.onUnpile(p) } +func (b *PermanentBase) onDrop(p Permanent) { + b.onUnpile(p) + b.Card().Impl.onDrop(p) +} func AddPermanentToPile(containing, p Permanent) { p.SetContainingPerm(containing) containing.AddPermanentToPile(p) - p.onPile(p) + p.onPile(containing) } func RemovePermanentFromPile(containing, rm Permanent) { |
