Comply to formatting guidelines for golint

This commit is contained in:
mollusk 2018-07-06 04:37:30 -07:00
parent 9b973356a8
commit 38f4dc7ada
3 changed files with 9 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import (
"time"
)
//Battle allow two character types to battle each other
func Battle(hero, enemy Character) {
speed := time.Second * 1
@ -19,9 +20,9 @@ func Battle(hero, enemy Character) {
if heroInitiative == enemyInitiative {
if flipCoin() == "heads" {
heroInitiative -= 1
heroInitiative-- //does the same as -= 1
} else {
enemyInitiative -= 1
enemyInitiative--
}
}
printCombatantStats(&hero, &enemy, heroInitiative, enemyInitiative)
@ -71,9 +72,9 @@ func Battle(hero, enemy Character) {
func flipCoin() string {
if rand.Intn(10) < 5 {
return "heads"
} else {
return "tails"
}
} //no need for 'else', this format is the Go style
return "tails"
}
func printCombatantStats(hero, enemy *Character, heroInitiative, enemyInitiative int) {

View File

@ -1,5 +1,6 @@
package main
//Character define general type for characters
type Character struct {
Name string
Health int
@ -10,6 +11,7 @@ type Character struct {
Gear PaperDoll
}
//PaperDoll define type for creating basic paper doll feature
type PaperDoll struct {
Weapon Weapon
}

View File

@ -1,5 +1,6 @@
package main
//Room define general type for a basic room
type Room struct {
reward bool
doors string