45 lines
593 B
Go
45 lines
593 B
Go
package main
|
|
|
|
import (
|
|
"math/rand"
|
|
"os"
|
|
"os/exec"
|
|
"time"
|
|
)
|
|
|
|
//Characters
|
|
var (
|
|
player = Character{
|
|
|
|
Name: "Daniel",
|
|
Health: 100,
|
|
Damage: 30,
|
|
Spell: firearrow,
|
|
Weapons: [5]Weapon{Broadsword},
|
|
Initiative: 4}
|
|
|
|
goblin = Character{
|
|
|
|
Name: "Goblin",
|
|
Health: 100,
|
|
Damage: 20,
|
|
Weapons: [5]Weapon{GoblinClaw},
|
|
Initiative: 3}
|
|
)
|
|
|
|
func main() {
|
|
initGame()
|
|
Battle(player, goblin)
|
|
}
|
|
|
|
func initGame() {
|
|
rand.Seed(time.Now().Unix())
|
|
ClearScreen()
|
|
}
|
|
|
|
func ClearScreen() {
|
|
cmd := exec.Command("clear")
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Run()
|
|
}
|