corrected syntax formatting of all files
This commit is contained in:
parent
1094bfdeae
commit
f23ee96cac
11
battle.go
11
battle.go
@ -5,8 +5,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
|
||||
|
||||
func Battle(hero, enemy Character) {
|
||||
speed := time.Second * 1
|
||||
|
||||
@ -16,11 +14,10 @@ func Battle(hero, enemy Character) {
|
||||
heroInitiative := rand.Intn(7) + hero.Initiative
|
||||
enemyInitiative := rand.Intn(7) + enemy.Initiative
|
||||
|
||||
|
||||
if heroInitiative == enemyInitiative{
|
||||
if flipCoin() == "heads"{
|
||||
heroInitiative -=1
|
||||
}else{
|
||||
if heroInitiative == enemyInitiative {
|
||||
if flipCoin() == "heads" {
|
||||
heroInitiative -= 1
|
||||
} else {
|
||||
enemyInitiative -= 1
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,15 @@
|
||||
package main
|
||||
|
||||
|
||||
|
||||
type Character struct {
|
||||
Name string
|
||||
Health int
|
||||
Damage int
|
||||
Weapons (map[string] Weapon)
|
||||
Weapons (map[string]Weapon)
|
||||
Spell Spell
|
||||
Initiative int
|
||||
Gear PaperDoll
|
||||
}
|
||||
|
||||
|
||||
var (
|
||||
player = Character{
|
||||
|
||||
@ -20,7 +17,7 @@ var (
|
||||
Health: 100,
|
||||
Damage: 30,
|
||||
Spell: firearrow,
|
||||
Weapons: make(map[string] Weapon),
|
||||
Weapons: make(map[string]Weapon),
|
||||
Initiative: 4,
|
||||
Gear: PaperDoll{Weapon: Broadsword}}
|
||||
|
||||
@ -29,7 +26,7 @@ var (
|
||||
Name: "Goblin",
|
||||
Health: 100,
|
||||
Damage: 20,
|
||||
Weapons: make(map[string] Weapon),
|
||||
Weapons: make(map[string]Weapon),
|
||||
Initiative: 3,
|
||||
Gear: PaperDoll{Weapon: GoblinClaw}}
|
||||
)
|
||||
|
@ -8,10 +8,8 @@ type Weapon struct {
|
||||
|
||||
type PaperDoll struct {
|
||||
Weapon Weapon
|
||||
|
||||
}
|
||||
|
||||
|
||||
var (
|
||||
Broadsword = Weapon{
|
||||
Name: "Broadsword",
|
||||
|
Loading…
x
Reference in New Issue
Block a user