object

package
v0.0.0-...-7b43bce Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LIFE_STRENGTH_PERM     = 15
	MANA_INTELLIGENCE_PERM = 10
	ATTACK_ATTR_PERM       = 2
	DEFENSE_AGILITY_PERM   = 2
)

Variables

This section is empty.

Functions

func CaculateAttack

func CaculateAttack(attrType int, baseAttack, strength, agility, intelligence int64) int64

func CaculateDefense

func CaculateDefense(baseDefense, agility int64) int64

func CaculateLife

func CaculateLife(baseLife, strength int64) int64

func CaculateMana

func CaculateMana(baseMana, intelligence int64) int64

Types

type BufferObject

type BufferObject struct {
	model.BufferState
	CurCnt      int   `json:"cur_cnt"`      //当前第几次伤害
	ElapsedTime int64 `json:"elapsed_time"` //已经过的时间
	TotalTime   int64 `json:"total_time"`   //总持续时间
}

func NewBufferObject

func NewBufferObject(data *model.BufferState) *BufferObject

type GameObject

type GameObject struct {
	Posx shape.Coord `json:"pos_x"`
	Posy shape.Coord `json:"pos_y"`
	Posz shape.Coord `json:"pos_z"`
	Uuid string      `json:"uuid"`
}

type HeroObject

type HeroObject struct {
	model.Hero
	GameObject
	Life  int64 `json:"life" db:"life" ` //
	Mana  int64 `json:"mana" db:"mana" ` //
	State constants.ActionState
}

func NewHeroObject

func NewHeroObject(data *model.Hero) *HeroObject

func (*HeroObject) IsAlive

func (h *HeroObject) IsAlive() bool

func (*HeroObject) UpdateProperty

func (h *HeroObject) UpdateProperty()

type MonsterObject

type MonsterObject struct {
	GameObject
	Data        model.Monster         `json:"-"` //这个不用传递给前端,节省数据
	Name        string                `json:"name"`
	Id          int64                 `json:"id"`
	Avatar      string                `json:"avatar" db:"avatar" `             //模型
	MonsterType int                   `json:"monster_type" db:"monster_type" ` //0-怪物, 1-npc
	Level       int                   `json:"level" db:"level" `               //
	Grade       int                   `json:"grade" db:"grade" `               //级别:0"普通怪",1"小头目",2"精英怪",3"大BOSS",            4"变态怪", 5 "变态怪"
	MaxLife     int64                 `json:"max_life" db:"max_life" `         //
	MaxMana     int64                 `json:"max_mana" db:"max_mana" `         //
	Life        int64                 `json:"life" db:"life" `                 //
	Mana        int64                 `json:"mana" db:"mana" `                 //
	Defense     int64                 `json:"defense" db:"defense" `           //
	Attack      int64                 `json:"attack" db:"attack" `             //
	Dir         int                   `json:"dir"`
	State       constants.ActionState `json:"state"`
}

func NewMonsterObject

func NewMonsterObject(data *model.Monster, offset int) *MonsterObject

func (*MonsterObject) GetAttack

func (m *MonsterObject) GetAttack() int64

附带了随机攻击力计算的函数

func (*MonsterObject) GetDefense

func (m *MonsterObject) GetDefense() int64

func (*MonsterObject) IsAlive

func (m *MonsterObject) IsAlive() bool

func (*MonsterObject) UpdateProperty

func (m *MonsterObject) UpdateProperty()

type SpellObject

type SpellObject struct {
	GameObject
	Data         model.Spell        `json:"-"`
	Id           int64              `json:"id"`
	SpellId      int                `json:"-"`
	Name         string             `json:"name" `          //
	Description  string             `json:"description" `   //
	FlyAnimation string             `json:"fly_animation" ` //
	FlyStepTime  int                `json:"fly_step_time" ` //飞行速度
	SpellType    int                `json:"spell_type" `    //飞行速度
	CdTime       int                `json:"cd_time" `       //cd间隔
	CurCdTime    int                `json:"cur_cd_time" `   //当前cd间隔
	Buf          *model.BufferState `json:"-"`
	TargetPos    shape.Vector3      `json:"target_pos"`
	CasterId     int64              `json:"caster_id"`
	CasterType   int                `json:"caster_type"`
	TargetId     int64              `json:"target_id"`
	TargetType   int                `json:"target_type"`
}

func NewSpellObject

func NewSpellObject(data *model.Spell, buf *model.BufferState) *SpellObject

func (*SpellObject) GenId

func (s *SpellObject) GenId()

func (*SpellObject) ResetCDTime

func (s *SpellObject) ResetCDTime()

func (*SpellObject) Update

func (s *SpellObject) Update(elapsedTime int64)

Jump to

Keyboard shortcuts

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