-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
61 lines (45 loc) · 1.41 KB
/
main.go
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
51
52
53
54
55
56
57
58
59
60
61
package main
import (
"fmt"
//"io/ioutil"
"os"
"github.com/swwu/battlemap-server/entity"
"github.com/swwu/battlemap-server/logging"
"github.com/swwu/battlemap-server/ruleset"
"github.com/swwu/battlemap-server/server"
)
func main() {
logging.Init( /*ioutil.Discard*/ os.Stdout, os.Stdout, os.Stdout, os.Stderr)
fmt.Println("HELLO")
gamespaces := map[string]server.Gamespace{}
rulesets := map[string]ruleset.Ruleset{}
rulesets["test"] = ruleset.NewRulesetFromData("data/test_data")
gamespaces["testspace"] = server.NewGamespace(rulesets["test"])
rules := rulesets["test"]
ent := entity.NewEntity()
ent.AddEffect(rules.Effects()["baseEntityRules"])
//ent.AddEffect(rules.Effects()["fighterClass"])
ent.SetBaseValues(map[string]float64{
"str_base": 14,
"dex_base": 14,
"con_base": 14,
"int_base": 14,
"wis_base": 14,
"cha_base": 14,
})
ent.Recalculate()
vc := ent.VariableContext()
vals := []string{"str_base", "str_mod"}
/*
vals := []string{"str", "str_mod", "dex", "dex_mod", "fighter_lvl", "bab",
"melee_ab", "will_save", "will_save_insight_bonus",
"will_save_untyped_bonus", "fort_save", "ref_save", "ac_base",
"ac_abmod_bonus", "ac", "ac_touch", "ac_flatfooted", "cmb", "cmd",
"cmb_trip", "cmb_grapple", "hp"}
*/
for _, val := range vals {
fmt.Println(val, "-", vc.Variable(val).Value())
}
gamespaces["testspace"].SetEntity("test", ent)
server.Serve(gamespaces, rulesets)
}