summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-08-12 14:34:34 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-08-12 14:34:34 +0200
commit8912fec468336600b32fc9ba7c2532b8c78e640f (patch)
treee936bd90f926e9263027b040a4c4c8b966141b97
parent14a6aa4c488bcd2d49103cbee1424b2769d77ce0 (diff)
wip
-rw-r--r--attr_string.go6
-rw-r--r--newguy.go25
-rw-r--r--newguy_test.go4
-rw-r--r--queue.go16
-rw-r--r--type_string.go16
5 files changed, 59 insertions, 8 deletions
diff --git a/attr_string.go b/attr_string.go
index 1cfbaa6..ceb150b 100644
--- a/attr_string.go
+++ b/attr_string.go
@@ -1,12 +1,12 @@
-// Code generated by "stringer -type=Attr"; DO NOT EDIT
+// generated by stringer -type=Attr; DO NOT EDIT
package main
import "fmt"
-const _Attr_name = "CHACONDEXHPMaxINTMPMaxSTRWIS"
+const _Attr_name = "CHACONDEXHPMaxINTMPMaxSTRWISNattr"
-var _Attr_index = [...]uint8{0, 3, 6, 9, 14, 17, 22, 25, 28}
+var _Attr_index = [...]uint8{0, 3, 6, 9, 14, 17, 22, 25, 28, 33}
func (i Attr) String() string {
if i < 0 || i >= Attr(len(_Attr_index)-1) {
diff --git a/newguy.go b/newguy.go
index 38847bf..cf85404 100644
--- a/newguy.go
+++ b/newguy.go
@@ -37,17 +37,22 @@ type Guy struct {
Name, Race, Klass string
Level int
Attr map[Attr]int
+ Inventory map[string]int
+ queue chan Queue
+ Spells []string
}
func NewGuy() *Guy {
r := Races.Pick()
k := Klasses.Pick()
g := Guy{
- Name: GenerateName(),
- Race: r.Name,
- Klass: k.Name,
- Level: 1,
- Attr: make(map[Attr]int),
+ Name: GenerateName(),
+ Race: r.Name,
+ Klass: k.Name,
+ Level: 1,
+ Attr: make(map[Attr]int),
+ Inventory: make(map[string]int),
+ queue: make(chan Queue, 10),
}
for i := Attr(0); i < Nattr; i++ {
g.Attr[i] = Roll()
@@ -58,5 +63,15 @@ func NewGuy() *Guy {
for _, v := range k.Attr {
g.Attr[v] += 1
}
+ g.Inventory["Gold"] = 0
+ g.queue <- Queue{Task, 10, "Experiencing an enigmatic and foreboding night vision"}
+ g.queue <- Queue{Task, 6, "Much is revealed about that wise old bastard you'd underestimated"}
+ g.queue <- Queue{Task, 6, "A shocking series of events leaves you alone and bewildered, but resolute"}
+ g.queue <- Queue{Task, 4, "Drawing upon an unrealized reserve of determination, you set out on a long and dangerous journey"}
+ g.queue <- Queue{Plot, 2, "Loading"}
+
+ // DEBUG
+ close(g.queue)
+
return &g
}
diff --git a/newguy_test.go b/newguy_test.go
index 585f7a0..055ea82 100644
--- a/newguy_test.go
+++ b/newguy_test.go
@@ -10,4 +10,8 @@ func TestGenerateName(t *testing.T) {
func TestNewGuy(t *testing.T) {
g := NewGuy()
t.Logf("%+v", g)
+
+ for q := range g.queue {
+ t.Log(q)
+ }
}
diff --git a/queue.go b/queue.go
new file mode 100644
index 0000000..11b9aa8
--- /dev/null
+++ b/queue.go
@@ -0,0 +1,16 @@
+package main
+
+//go:generate stringer -type=Type
+
+type Type int
+
+const (
+ Task Type = iota
+ Plot
+)
+
+type Queue struct {
+ Type Type
+ Duration int
+ Title string
+}
diff --git a/type_string.go b/type_string.go
new file mode 100644
index 0000000..ed5418f
--- /dev/null
+++ b/type_string.go
@@ -0,0 +1,16 @@
+// generated by stringer -type=Type; DO NOT EDIT
+
+package main
+
+import "fmt"
+
+const _Type_name = "TaksPlot"
+
+var _Type_index = [...]uint8{0, 4, 8}
+
+func (i Type) String() string {
+ if i < 0 || i >= Type(len(_Type_index)-1) {
+ return fmt.Sprintf("Type(%d)", i)
+ }
+ return _Type_name[_Type_index[i]:_Type_index[i+1]]
+}