battle2

package
v0.0.0-...-8af4b65 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropTypeHP    = 1 // 初始HP
	PropTypeDPS   = 2 // 初始dps
	PropTypeSpeed = 3 // 初始speed

	PropTypeCurHP    = 100 // 当前HP
	PropTypeCurDPS   = 101 // 当前dps
	PropTypeCurSpeed = 102 // 当前speed
)
View Source
const (
	UnitTypeUnknow     = 0
	UnitTypeHP         = 1
	UnitTypeDPS        = 2
	UnitTypeSpeed      = 3
	UnitTypeHPDPS      = 4
	UnitTypeHPSpeed    = 5
	UnitTypeDPSHP      = 6
	UnitTypeDPSSpeed   = 7
	UnitTypeHPSpeedHP  = 8
	UnitTypeHPSpeedDPS = 9
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BattleResult

type BattleResult struct {
	Units           []*Unit `json:"units"`           // 战斗单位,2个
	WinIndex        int     `json:"winIndex"`        // 胜利索引
	FirstIndex      int     `json:"firstIndex"`      // 先手索引
	ForceFirstIndex int     `json:"forceFirstIndex"` // 强制先手索引,只在速度相等时才有用,如果无意义为-1
}

func StartBattle

func StartBattle(src []*Unit, firstIndex int) *BattleResult

type BattlesStatsNode

type BattlesStatsNode struct {
	TotalNums int `json:"totalNums"`
	WinNums   int `json:"winNums"`
	LastHP    int `json:"lastHP"`
}

type Stats

type Stats struct {
	Title string       `json:"title"`
	Nodes []*StatsNode `json:"nodes"`
}

func Sim

func Sim(totalval int, minhp int, mindps int, minspeed int, title string, fn string) *Stats

给定初始属性,模拟全战斗

func (*Stats) Output

func (stats *Stats) Output(fn string) error

type StatsNode

type StatsNode struct {
	MainUnit      *Unit            `json:"mainUnit"`
	Total         BattlesStatsNode `json:"total"`
	ForceFirst    BattlesStatsNode `json:"forceFirst"`
	ForceNotFirst BattlesStatsNode `json:"forceNotFirst"`
}

func NewStatsNode

func NewStatsNode(unit *Unit) *StatsNode

func (*StatsNode) AddResult

func (node *StatsNode) AddResult(ret *BattleResult)

type Unit

type Unit struct {
	Props    map[int]int `json:"props"`
	UnitType int         `json:"unitType"`
}

func NewUnit

func NewUnit(hp int, dps int, speed int) *Unit

func (*Unit) Attack

func (unit *Unit) Attack(target *Unit)

func (*Unit) GetLastHPPer

func (unit *Unit) GetLastHPPer() int

func (*Unit) IsAlive

func (unit *Unit) IsAlive() bool

func (*Unit) Reset

func (unit *Unit) Reset()

func (*Unit) ResetAndClone

func (unit *Unit) ResetAndClone() *Unit

Jump to

Keyboard shortcuts

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