step

package
v0.0.0-...-d2732b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package step implements a single step of resolving an attack.

Index

Constants

This section is empty.

Variables

View Source
var All = map[string]interfaces.Step{
	"__START__": &Step{
		name: "__START__",
		next: "Declare Target",
	},
	"Declare Target": &Step{
		name: "Declare Target",
		mods: []interfaces.Modification{modification.All["Declare Target"]()},
		next: "Roll Attack Dice",
	},
	"Roll Attack Dice": &Step{
		name: "Roll Attack Dice",
		mods: []interfaces.Modification{modification.All["Roll Attack Dice"]()},
		next: "Modify Attack Dice",
	},
	"Modify Attack Dice": &Step{
		name: "Modify Attack Dice",
		next: "Roll Defense Dice",
	},
	"Roll Defense Dice": &Step{
		name: "Roll Defense Dice",
		mods: []interfaces.Modification{modification.All["Roll Defense Dice"]()},
		next: "Modify Defense Dice",
	},
	"Modify Defense Dice": &Step{
		name: "Modify Defense Dice",
		next: "Compare Results",
	},
	"Compare Results": &Step{
		name: "Compare Results",
		mods: []interfaces.Modification{modification.All["Compare Results"]()},
		next: "Deal Damage",
	},
	"Deal Damage": &Step{
		name: "Deal Damage",
		mods: []interfaces.Modification{modification.All["Deal Damage"]()},
		next: "After Attacking/Defending",
	},
	"After Attacking/Defending": &Step{
		name: "After Attacking/Defending",
		next: "Perform Attack Twice",
	},
	"Perform Attack Twice": &Step{
		name: "Perform Attack Twice",
		mods: []interfaces.Modification{modification.All["Perform Attack Twice"]()},
		next: "Perform Additional Attack",
	},
	"Perform Additional Attack": &Step{
		name: "Perform Additional Attack",
	},
}

Functions

This section is empty.

Types

type Step

type Step struct {
	// contains filtered or unexported fields
}

func (Step) Mods

func (step Step) Mods() []interfaces.Modification

func (Step) Name

func (step Step) Name() string

func (Step) Next

func (step Step) Next() string

Next returns the default next step to perform. This is used by the attack runner to figure out what step to perform next if one isn't provided to the GameState by a modification.

func (Step) Run

func (step Step) Run(in <-chan interfaces.StepRequest, out chan<- interfaces.StepRequest, done chan<- bool)

Run loops forever and reads a StepRequest from the input channel, runs the modifications appropriate to this step, and sends a new StepRequest to the output channel.

When the in channel is closed and no more StepRequests are waiting, true is sent on the done channel.

func (*Step) SetName

func (step *Step) SetName(name string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL