1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
package game
import (
"log"
"strconv"
"strings"
)
type Artifact struct {
PermanentBase
Solid int
}
func NewArtifactFromPath(cardPath string, tile *Tile, owner *Player) *Artifact {
card := NewCard(cardPath)
return NewArtifact(card, tile, owner)
}
func NewArtifact(card *Card, tile *Tile, owner *Player) *Artifact {
a := &Artifact{NewPermanentBase(card, tile, owner), 0}
effects := card.getEffects()
for _, e := range effects {
if strings.HasPrefix(e, "Solid") {
tokens := strings.Split(e, " ")
var err error
a.Solid, err = strconv.Atoi(tokens[1])
if err != nil {
log.Fatalf("Invalid Solid definition %s\n", e)
}
}
}
return a
}
func (a *Artifact) Fight(p Permanent) {
}
func (a *Artifact) IsDestroyed() bool {
return a.Damage() >= a.Solid
}
func (a *Artifact) Attackable() bool {
return a.Solid > 0
}
func (a *Artifact) AvailActions() []Action {
return []Action{}
}
|