diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-22 11:09:44 -0400 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-07-22 12:54:28 -0400 |
| commit | 7f4ba6774db54e8bb427024dca05c7c16efa7039 (patch) | |
| tree | 81db9aae21b6d410f32ff8947800593afd4fd38c /go/game/permanent.go | |
| parent | eb2fc0af7db8614024f6d73093ccb0825c8a1cc0 (diff) | |
| download | muhqs-game-7f4ba6774db54e8bb427024dca05c7c16efa7039.tar.gz muhqs-game-7f4ba6774db54e8bb427024dca05c7c16efa7039.zip | |
implement house tile effect
Diffstat (limited to 'go/game/permanent.go')
| -rw-r--r-- | go/game/permanent.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/go/game/permanent.go b/go/game/permanent.go index 76f2325d..19d65bb6 100644 --- a/go/game/permanent.go +++ b/go/game/permanent.go @@ -27,13 +27,17 @@ type Permanent interface { adjustMarks(PermanentMark, int) IsDestroyed() bool - Attackable() bool String() string CurrentlyAvailActions() []Action AvailActions() []Action IsAvailableTile(*Tile) bool + // Attackable reports if a permanent is attackable. + Attackable() bool + // RangeProtected reports if a permanent is attackable in ranged combat. + RangeProtected() bool + fight(p Permanent) adjustDamage(damage int) addTmpEffect(tmpEffect string) @@ -193,6 +197,19 @@ func (p *permanentBase) IsAvailableTile(tile *Tile) bool { return tile.IsAvailableForCard(p.card) } +// Attackable reports if a permanent is attackable. +// Only permanents represented on the map are attackable. +func (p *permanentBase) Attackable() bool { + return p.Tile() != nil +} + +// RangeProtected reports if the permanent is attackable in range combat. +// If the permanent has no Tile then it is not represented on the map and is not attackable at all. +// House tiles protect from ranged combat. +func (p *permanentBase) RangeProtected() bool { + return !p.Attackable() || p.Tile().Type == TileTypes.House +} + func (p *permanentBase) setContainingPerm(containing Permanent) { p.containingPerm = containing } func (p *permanentBase) addPermanentToPile(a Permanent) { p.pile = append(p.pile, a) } func (p *permanentBase) clearPile() { p.pile = nil } |
