2017-10-08 22:17:53 -07:00
|
|
|
package main
|
|
|
|
|
2017-10-09 00:41:51 -07:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"math/rand"
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
"time"
|
|
|
|
)
|
2017-10-08 22:17:53 -07:00
|
|
|
|
|
|
|
//Characters
|
|
|
|
var (
|
|
|
|
player = Character{
|
|
|
|
|
2017-10-09 00:27:09 -07:00
|
|
|
Name: "Daniel",
|
|
|
|
Health: 100,
|
|
|
|
Damage: 60,
|
|
|
|
Spell: firearrow,
|
|
|
|
Weapons: [5]Weapon{Broadsword}}
|
2017-10-08 22:17:53 -07:00
|
|
|
|
|
|
|
goblin = Character{
|
|
|
|
|
2017-10-09 00:27:09 -07:00
|
|
|
Name: "Goblin",
|
|
|
|
Health: 100,
|
|
|
|
Damage: 20,
|
|
|
|
Weapons: [5]Weapon{GoblinClaw}}
|
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() {
|
2017-10-09 00:41:51 -07:00
|
|
|
initGame()
|
|
|
|
Battle(player, goblin)
|
2017-10-09 00:27:09 -07:00
|
|
|
fmt.Println(goblin.Weapons[0].Damage)
|
|
|
|
}
|
2017-10-09 00:41:51 -07:00
|
|
|
|
|
|
|
func initGame() {
|
|
|
|
rand.Seed(time.Now().Unix())
|
|
|
|
ClearScreen()
|
|
|
|
}
|
|
|
|
|
|
|
|
func ClearScreen() {
|
|
|
|
cmd := exec.Command("clear")
|
|
|
|
cmd.Stdout = os.Stdout
|
|
|
|
cmd.Run()
|
|
|
|
}
|