Skip to content

Commit

Permalink
Added trample and hasten
Browse files Browse the repository at this point in the history
  • Loading branch information
nlsui committed Feb 26, 2022
1 parent 5ae946e commit 5333e12
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 1 deletion.
2 changes: 1 addition & 1 deletion keywordedSchema.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions keywords/ability.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type ability struct {
Pay *pay `json:",omitempty"`
Periodic *periodic `json:",omitempty"`
Tribute *tribute `json:",omitempty"`
Trample *trample `json:",omitempty"`
}

func (a ability) ValidateType(r jsonschema.RootElement) error {
Expand Down
1 change: 1 addition & 0 deletions keywords/effect.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type effect struct {
Grind *grind `json:",omitempty"`
Grow *grow `json:",omitempty"`
Harm *harm `json:",omitempty"`
Hasten *hasten `json:",omitempty"`
Heal *heal `json:",omitempty"`
Kill *kill `json:",omitempty"`
Insight *insight `json:",omitempty"`
Expand Down
26 changes: 26 additions & 0 deletions keywords/hasten.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package keywords

import (
"github.com/DecentralCardGame/cardobject/cardobject"
"github.com/DecentralCardGame/cardobject/jsonschema"
)

type hasten struct {
Target cardobject.CardMode
}

func (h hasten) ValidateType(r jsonschema.RootElement) error {
return jsonschema.ValidateStruct(h, r)
}

func (h hasten) InteractionText() string {
return "Hasten §Target"
}

func (h hasten) Description() string {
return "Allow a friendly Entity's to attack the turn it is played."
}

func (h hasten) Classes() []jsonschema.Class {
return []jsonschema.Class{cardobject.MYSTICISM, cardobject.CULTURE}
}
13 changes: 13 additions & 0 deletions keywords/hasten_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package keywords

import (
"testing"
)

func TestHasten(t *testing.T) {
hasten := hasten{"ALL"}
err := hasten.ValidateType(allClassesTestCard())
if err != nil {
t.Error(err)
}
}
24 changes: 24 additions & 0 deletions keywords/trample.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package keywords

import (
"github.com/DecentralCardGame/cardobject/cardobject"
"github.com/DecentralCardGame/cardobject/jsonschema"
)

type trample struct{}

func (t trample) ValidateType(r jsonschema.RootElement) error {
return jsonschema.ValidateStruct(t, r)
}

func (t trample) InteractionText() string {
return "Trample."
}

func (t trample) Description() string {
return "Deals excess damage to enemy places/HQ."
}

func (t trample) Classes() []jsonschema.Class {
return []jsonschema.Class{cardobject.TECHNOLOGY, cardobject.NATURE}
}
13 changes: 13 additions & 0 deletions keywords/trample_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package keywords

import (
"testing"
)

func TestTrample(t *testing.T) {
trample := trample{}
err := trample.ValidateType(allClassesTestCard())
if err != nil {
t.Error(err)
}
}

0 comments on commit 5333e12

Please sign in to comment.