trinket/main.go

52 lines
695 B
Go
Raw Normal View History

2017-10-08 22:17:53 -07:00
package main
import (
"math/rand"
"os"
"os/exec"
"time"
)
2017-10-08 22:17:53 -07:00
//Characters
var (
player = Character{
2017-10-09 01:41:59 -07:00
Name: "Daniel",
Health: 100,
Damage: 30,
Spell: firearrow,
Weapons: [5]Weapon{Broadsword},
Initiative: 4}
2017-10-08 22:17:53 -07:00
goblin = Character{
2017-10-09 01:41:59 -07:00
Name: "Goblin",
Health: 100,
Damage: 20,
Weapons: [5]Weapon{GoblinClaw},
Initiative: 3}
2017-10-08 22:17:53 -07:00
firearrow = Spell{
2017-10-09 00:27:09 -07:00
Name: "Fire Arrow",
2017-10-08 22:17:53 -07:00
Damage: 50,
Cost: 10,
2017-10-09 00:27:09 -07:00
Level: 1,
2017-10-08 22:17:53 -07:00
Active: true}
)
2017-10-09 00:27:09 -07:00
func main() {
initGame()
Battle(player, goblin)
2017-10-09 00:27:09 -07:00
}
func initGame() {
rand.Seed(time.Now().Unix())
ClearScreen()
}
func ClearScreen() {
cmd := exec.Command("clear")
cmd.Stdout = os.Stdout
cmd.Run()
}