blob: 452d5a6a61536913cd153f8d2c07dd7dc233a3f0 (
plain)
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
|
package game
import (
"log"
"strconv"
"strings"
)
type Artifact struct {
PermanentBase
Solid int
}
func NewArtifact(cardPath string, tile *Tile, owner *Player) *Artifact {
card := NewCard(cardPath)
a := &Artifact{NewPermanentBase(card, tile, owner), 0}
tile.Permanent = a
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) GetAvailActionPrototypes() []ActionPrototype {
return []ActionPrototype{}
}
|