diff options
Diffstat (limited to 'go/game/artifact.go')
| -rw-r--r-- | go/game/artifact.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/go/game/artifact.go b/go/game/artifact.go new file mode 100644 index 00000000..452d5a6a --- /dev/null +++ b/go/game/artifact.go @@ -0,0 +1,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{} +} |
