aboutsummaryrefslogtreecommitdiff
path: root/go/game/permanent.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-08-15 21:36:14 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:38 +0200
commitd1d2243527ff2fb7fcbf67f96622e9bd5c279d89 (patch)
tree09aff37ad9ec06e8bfe132cea519bfc54778e9ce /go/game/permanent.go
parent5d0b3ee308cd4ef93eeacc90da215cffa856d9e8 (diff)
downloadmuhqs-game-d1d2243527ff2fb7fcbf67f96622e9bd5c279d89.tar.gz
muhqs-game-d1d2243527ff2fb7fcbf67f96622e9bd5c279d89.zip
fix armor parsing and effective XEffect calculation
Diffstat (limited to 'go/game/permanent.go')
-rw-r--r--go/game/permanent.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/go/game/permanent.go b/go/game/permanent.go
index 54404b77..051e0f74 100644
--- a/go/game/permanent.go
+++ b/go/game/permanent.go
@@ -171,27 +171,31 @@ func (p *permanentBase) HasEffect(effect string) bool {
}
func (p *permanentBase) XEffect(effect string) (int, error) {
+ found := false
x := 0
xE, err := p.card.getXEffect(effect)
- if err != nil {
- return 0, err
+ if err == nil {
+ x = xE.x
+ found = true
}
- x = xE.x
if x < 0 {
log.Panic("initial negativ x effect")
}
for _, e := range p.tmpEffects {
+ log.Println(effect, e)
if !strings.Contains(e, effect) {
continue
}
tmpX, err := parseXEffect(e)
if err != nil {
- return 0, err
+ continue
}
+ found = true
+
// TODO: implement layers
if tmpX.set {
x = tmpX.x
@@ -200,7 +204,11 @@ func (p *permanentBase) XEffect(effect string) (int, error) {
}
}
- return x, err
+ if found {
+ return x, nil
+ } else {
+ return 0, err
+ }
}
func (p *permanentBase) Marks(mark PermanentMark) int {