aboutsummaryrefslogtreecommitdiff
path: root/go/game/permanent.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/game/permanent.go')
-rw-r--r--go/game/permanent.go19
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) {