common

package
v0.0.0-...-a4756ed Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SK_EFF_TYP_CREATE_PROJECTILE = iota + 1
	SK_EFF_TYP_CREATE_TRAP
	SK_EFF_TYP_CREATE_UNIT
	SK_EFF_TYP_ADD_BUFF
	SK_EFF_TYP_CHANGE_POS
	SK_EFF_TYP_CHANGE_AREA
)

技能效果类型

View Source
const (
	TRAP_CONDITION_IMME   = 0
	TRAP_CONDITION_DETECT = 1
)

陷阱触发条件

View Source
const (
	VALUE_TYPE_FIX          = 0
	VALUE_TYPE_ATK_PERC     = 1
	VALUE_TYPE_MAX_HP_PERC  = 3
	VALUE_TYPE_CURR_HP_PERC = 4
)

数值类型

View Source
const (
	SKILL_PROCESS_TYPE_DIRECT = iota
	SKILL_PROCESS_TYPE_CREATE_PROJECTILE
	SKILL_PROCESS_TYPE_CREATE_TRAP
	SKILL_PROCESS_TYPE_CREATE_SERVANT
)

技能处理过程

View Source
const (
	FLYER_PROCESS_TYPE_DIRECT = iota
	FLYER_PROCESS_TYPE_CREATE_TRAP
)

飞行体处理过程

View Source
const (
	POS_TYPE_SELF_POS  = 0
	POS_TYPE_DIRECTION = 1
	POS_TYPE_CIRCLE    = 2
)

位置类型

View Source
const (
	BUFF_COND_ANY      = iota // 无条件
	BUFF_COND_HP_LEAST        // 最少HP
	BUFF_COND_ALL             // 全体
	BUFF_COND_RANDOM          // 随机
)

buff条件

View Source
const (
	COMMON_ATTACK = 1 //普攻
	CAST_SKILL    = 2 //释放技能
	KILL_FOE      = 3 //杀敌
)

角色行为类型

View Source
const (
	TRAP_TRACK_UNMOVABLE = iota
	TRAP_TRACK_FOLLOW_UNIT
	TRAP_TRACK_FOLLOW_TARGET
	TRAP_TRACK_MOVE_FORWARD
)

陷阱轨迹类型

View Source
const (
	CMD_OBJ_PUSH         = 1
	CMD_ROUTE_PUSH       = 2
	CMD_ENTER_MAP_PUSH   = 6
	CMD_DROP_PUSH        = 9
	CMD_DROP_REMOVE_PUSH = 10
)

proto cmd

Variables

This section is empty.

Functions

func Arrive

func Arrive(pos, targetPos *geom.Vector2d, deceleration, decelerationWeaker float64, maxSpeed float64, dt int64, stopDist float64) *geom.Vector2d

func BuffFilter

func BuffFilter(buffs []facade.Buff, filter func(facade.Buff) bool) []facade.Buff

func CalAttackInterval

func CalAttackInterval(asp int) int

计算攻击间隔

func CheckCharmState

func CheckCharmState(srcUnit facade.BattleUnit) int32

func EnsureBuffValue

func EnsureBuffValue(buff facade.Buff, target facade.BattleUnit, isDamage bool) int

func FindAllEnemyHeros

func FindAllEnemyHeros(src facade.BattleUnit, includeDead bool) []facade.BattleUnit

func FindEnemyHeros

func FindEnemyHeros(src facade.BattleUnit, radius float64, count uint) []facade.BattleUnit

func FindNearestEnemy

func FindNearestEnemy(src facade.BattleUnit, units []facade.BattleUnit) facade.BattleUnit

func FindUnits

func FindUnits(ctx facade.Battle, pos *geom.Vector2d, radius float64, count uint, filter func(facade.BattleUnit) bool) []facade.BattleUnit

func FixedPos

func FixedPos(pos *geom.Vector2d, unit facade.BattleUnit, ctx facade.Battle) *geom.Vector2d

func Move

func Move(pos, targetPos *geom.Vector2d, speed float64, dt int64) *geom.Vector2d

func MoveAhead

func MoveAhead(pos, heading *geom.Vector2d, speed float64, dt int64) *geom.Vector2d

func MoveNoCross

func MoveNoCross(pos, targetPos *geom.Vector2d, speed float64, dt int64, stopDist float64) (*geom.Vector2d, int64)

不可越过终点

func OnDead

func OnDead(ctx facade.Battle, obj facade.GameObject, remove bool)

func RandInRange

func RandInRange(min float64, max float64) float64

func TrimToInside

func TrimToInside(point *geom.Vector2d, r *geom.Rect) *geom.Vector2d

func TrimToOutside

func TrimToOutside(point *geom.Vector2d, r *geom.Rect) *geom.Vector2d

func UpdateSkillMove

func UpdateSkillMove(mover facade.SkillMover, dt int64)

Types

type BasePosChooser

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

========================================================================== 基类 ==========================================================================

func (*BasePosChooser) Choose

func (c *BasePosChooser) Choose(ctx facade.Battle, chooser facade.GameObject, caster facade.GameObject, params []int, target ...facade.GameObject)

type CircleRangePosChooser

type CircleRangePosChooser struct {
	*BasePosChooser
}

========================================================================== 圆内范围 ==========================================================================

type DirectionPosChooser

type DirectionPosChooser struct {
	*BasePosChooser
}

========================================================================== 固定方向 ==========================================================================

type FollowTargetTrapMoveHandler

type FollowTargetTrapMoveHandler struct {
}

跟随目标

func (*FollowTargetTrapMoveHandler) HandleTrapMove

func (h *FollowTargetTrapMoveHandler) HandleTrapMove(trap facade.Trap, ctx facade.Battle, dt int64)

type FollowUnitTrapMoveHandler

type FollowUnitTrapMoveHandler struct {
}

跟随英雄

func (*FollowUnitTrapMoveHandler) HandleTrapMove

func (h *FollowUnitTrapMoveHandler) HandleTrapMove(trap facade.Trap, ctx facade.Battle, dt int64)

type MoveForwardTrapMoveHandler

type MoveForwardTrapMoveHandler struct {
}

向前移动

func (*MoveForwardTrapMoveHandler) HandleTrapMove

func (h *MoveForwardTrapMoveHandler) HandleTrapMove(trap facade.Trap, ctx facade.Battle, dt int64)

type PosChooseTemplate

type PosChooseTemplate interface {
	// contains filtered or unexported methods
}

type PosChooser

type PosChooser interface {
	Choose(ctx facade.Battle, chooser facade.GameObject, caster facade.GameObject, params []int, target ...facade.GameObject)
}

func GetPosChooser

func GetPosChooser(t int) PosChooser

type SelfPosChooser

type SelfPosChooser struct {
	*BasePosChooser
}

========================================================================== 自身中心点 ==========================================================================

type TrapMoveHandler

type TrapMoveHandler interface {
	HandleTrapMove(trap facade.Trap, ctx facade.Battle, dt int64)
}

func GetTrapMoveHandler

func GetTrapMoveHandler(id int) (TrapMoveHandler, bool)

type UnmovableTrapMoveHandler

type UnmovableTrapMoveHandler struct {
}

不移动

func (*UnmovableTrapMoveHandler) HandleTrapMove

func (h *UnmovableTrapMoveHandler) HandleTrapMove(trap facade.Trap, ctx facade.Battle, dt int64)

Jump to

Keyboard shortcuts

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