corrected syntax formatting of all files

This commit is contained in:
mollusk 2017-10-15 11:10:52 -07:00
parent 1094bfdeae
commit f23ee96cac
3 changed files with 10 additions and 18 deletions

View File

@ -5,8 +5,6 @@ import (
"time" "time"
) )
func Battle(hero, enemy Character) { func Battle(hero, enemy Character) {
speed := time.Second * 1 speed := time.Second * 1
@ -16,11 +14,10 @@ func Battle(hero, enemy Character) {
heroInitiative := rand.Intn(7) + hero.Initiative heroInitiative := rand.Intn(7) + hero.Initiative
enemyInitiative := rand.Intn(7) + enemy.Initiative enemyInitiative := rand.Intn(7) + enemy.Initiative
if heroInitiative == enemyInitiative {
if heroInitiative == enemyInitiative{ if flipCoin() == "heads" {
if flipCoin() == "heads"{ heroInitiative -= 1
heroInitiative -=1 } else {
}else{
enemyInitiative -= 1 enemyInitiative -= 1
} }
} }

View File

@ -1,18 +1,15 @@
package main package main
type Character struct { type Character struct {
Name string Name string
Health int Health int
Damage int Damage int
Weapons (map[string] Weapon) Weapons (map[string]Weapon)
Spell Spell Spell Spell
Initiative int Initiative int
Gear PaperDoll Gear PaperDoll
} }
var ( var (
player = Character{ player = Character{
@ -20,16 +17,16 @@ var (
Health: 100, Health: 100,
Damage: 30, Damage: 30,
Spell: firearrow, Spell: firearrow,
Weapons: make(map[string] Weapon), Weapons: make(map[string]Weapon),
Initiative: 4, Initiative: 4,
Gear: PaperDoll{Weapon: Broadsword}} Gear: PaperDoll{Weapon: Broadsword}}
goblin = Character{ goblin = Character{
Name: "Goblin", Name: "Goblin",
Health: 100, Health: 100,
Damage: 20, Damage: 20,
Weapons: make(map[string] Weapon), Weapons: make(map[string]Weapon),
Initiative: 3, Initiative: 3,
Gear: PaperDoll{Weapon: GoblinClaw}} Gear: PaperDoll{Weapon: GoblinClaw}}
) )

View File

@ -8,10 +8,8 @@ type Weapon struct {
type PaperDoll struct { type PaperDoll struct {
Weapon Weapon Weapon Weapon
} }
var ( var (
Broadsword = Weapon{ Broadsword = Weapon{
Name: "Broadsword", Name: "Broadsword",