character

package
v0.0.0-...-84dbd67 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvatarAsc

func AvatarAsc(maxLvl int, data *model.AvatarData) int

func AvatarBaseStat

func AvatarBaseStat(char info.CharacterBase, data *model.AvatarData) ([]float64, error)

TODO: this code should eventually be refactor into attributes service

func WeaponBaseStat

func WeaponBaseStat(weap info.WeaponProfile, data *model.WeaponData) ([]float64, error)

Types

type AttackMod

type AttackMod struct {
	Amount AttackModFunc
	modifier.Base
}

type AttackModFunc

type AttackModFunc func(atk *combat.AttackEvent, t combat.Target) ([]float64, bool)

type Base

type Base interface {
	Data() *model.AvatarData
}

Base contains basic information for a character

type CharWrapper

type CharWrapper struct {
	Index int

	Character

	// base characteristics
	HasNightsoul bool
	Base         info.CharacterBase
	Weapon       info.WeaponProfile
	Talents      info.TalentProfile
	CharZone     info.ZoneType
	CharBody     info.BodyType
	NormalCon    int
	SkillCon     int
	BurstCon     int
	HasArkhe     bool

	Equip struct {
		Weapon info.Weapon
		Sets   map[keys.Set]info.Set
	}

	// current status
	ParticleDelay int // character custom particle delay
	Energy        float64
	EnergyMax     float64

	OnNightsoul       bool
	NightsoulPoint    float64
	NightsoulPointMax float64

	// needed so that start hp is not influenced by hp mods added during team initialization
	StartHP      int
	StartHPRatio int

	// normal attack counter
	NormalHitNum  int // how many hits in a normal combo
	NormalCounter int

	// tags
	Tags      map[string]int
	BaseStats [attributes.EndStatType]float64

	// dash cd: keeps track of remaining cd frames for off-field chars
	RemainingDashCD int
	DashLockout     bool
	// contains filtered or unexported fields
}

func New

func New(
	p info.CharacterProfile,
	f *int,
	debug bool,
	log glog.Logger,
	events event.Eventter,
	task task.Tasker,
) (*CharWrapper, error)

func (*CharWrapper) AddAttackMod

func (c *CharWrapper) AddAttackMod(mod AttackMod)

func (*CharWrapper) AddCooldownMod

func (c *CharWrapper) AddCooldownMod(mod CooldownMod)

func (*CharWrapper) AddDamageReductionMod

func (c *CharWrapper) AddDamageReductionMod(mod DamageReductionMod)

func (*CharWrapper) AddEnergy

func (c *CharWrapper) AddEnergy(src string, e float64)

func (*CharWrapper) AddHealBonusMod

func (c *CharWrapper) AddHealBonusMod(mod HealBonusMod)

func (*CharWrapper) AddNightsoul

func (c *CharWrapper) AddNightsoul(src string, amt float64)

func (*CharWrapper) AddReactBonusMod

func (c *CharWrapper) AddReactBonusMod(mod ReactBonusMod)

func (*CharWrapper) AddStatMod

func (c *CharWrapper) AddStatMod(mod StatMod)

func (*CharWrapper) AddStatus

func (c *CharWrapper) AddStatus(key string, dur int, hitlag bool)

func (*CharWrapper) ApplyAttackMods

func (c *CharWrapper) ApplyAttackMods(a *combat.AttackEvent, t combat.Target) []interface{}

func (*CharWrapper) ApplyHitlag

func (c *CharWrapper) ApplyHitlag(factor, dur float64)

ApplyHitlag adds hitlag to the character for specified duration

func (*CharWrapper) CDReduction

func (c *CharWrapper) CDReduction(a action.Action, dur int) int

func (*CharWrapper) ConsumeEnergy

func (c *CharWrapper) ConsumeEnergy(delay int)

func (*CharWrapper) ConsumeNightsoul

func (c *CharWrapper) ConsumeNightsoul(amt float64)

func (*CharWrapper) CooldownModIsActive

func (c *CharWrapper) CooldownModIsActive(key string) bool

func (*CharWrapper) DamageReduction

func (c *CharWrapper) DamageReduction(char int) float64

func (*CharWrapper) DamageReductionModIsActive

func (c *CharWrapper) DamageReductionModIsActive(key string) bool

func (*CharWrapper) DeleteAttackMod

func (c *CharWrapper) DeleteAttackMod(key string)

func (*CharWrapper) DeleteCooldownMod

func (c *CharWrapper) DeleteCooldownMod(key string)

func (*CharWrapper) DeleteDamageReductionMod

func (c *CharWrapper) DeleteDamageReductionMod(key string)

func (*CharWrapper) DeleteHealBonusMod

func (c *CharWrapper) DeleteHealBonusMod(key string)

func (*CharWrapper) DeleteReactBonusMod

func (c *CharWrapper) DeleteReactBonusMod(key string)

func (*CharWrapper) DeleteStatMod

func (c *CharWrapper) DeleteStatMod(key string)

func (*CharWrapper) DeleteStatus

func (c *CharWrapper) DeleteStatus(key string)

func (*CharWrapper) ExtendStatus

func (c *CharWrapper) ExtendStatus(key string, ext int) bool

func (*CharWrapper) FramePausedOnHitlag

func (c *CharWrapper) FramePausedOnHitlag() bool

func (*CharWrapper) HealBonus

func (c *CharWrapper) HealBonus() float64

func (*CharWrapper) HealBonusModIsActive

func (c *CharWrapper) HealBonusModIsActive(key string) bool

func (*CharWrapper) MaxHP

func (c *CharWrapper) MaxHP() float64

func (*CharWrapper) NonExtraStat

func (c *CharWrapper) NonExtraStat(s attributes.Stat) float64

func (*CharWrapper) QueueCharTask

func (c *CharWrapper) QueueCharTask(f func(), delay int)

func (*CharWrapper) ReactBonus

func (c *CharWrapper) ReactBonus(atk combat.AttackInfo) float64

TODO: consider merging this with just attack mods? reaction bonus should maybe just be it's own stat instead of being a separate mod really

func (*CharWrapper) ReactBonusModIsActive

func (c *CharWrapper) ReactBonusModIsActive(key string) bool

func (*CharWrapper) ReceiveParticle

func (c *CharWrapper) ReceiveParticle(p Particle, isActive bool, partyCount int)

func (*CharWrapper) RemoveTag

func (c *CharWrapper) RemoveTag(key string)

func (*CharWrapper) SetArtifactSet

func (c *CharWrapper) SetArtifactSet(key keys.Set, set info.Set)

func (*CharWrapper) SetIndex

func (c *CharWrapper) SetIndex(index int)

func (*CharWrapper) SetTag

func (c *CharWrapper) SetTag(key string, val int)

func (*CharWrapper) SetWeapon

func (c *CharWrapper) SetWeapon(w info.Weapon)

func (*CharWrapper) Stat

func (c *CharWrapper) Stat(s attributes.Stat) float64

func (*CharWrapper) StatModIsActive

func (c *CharWrapper) StatModIsActive(key string) bool

func (*CharWrapper) Stats

func (c *CharWrapper) Stats() ([attributes.EndStatType]float64, []interface{})

func (*CharWrapper) StatusDuration

func (c *CharWrapper) StatusDuration(key string) int

func (*CharWrapper) StatusExpiry

func (c *CharWrapper) StatusExpiry(key string) int

func (*CharWrapper) StatusIsActive

func (c *CharWrapper) StatusIsActive(key string) bool

func (*CharWrapper) Tag

func (c *CharWrapper) Tag(key string) int

func (*CharWrapper) TalentLvlAttack

func (c *CharWrapper) TalentLvlAttack() int

func (*CharWrapper) TalentLvlBurst

func (c *CharWrapper) TalentLvlBurst() int

func (*CharWrapper) TalentLvlSkill

func (c *CharWrapper) TalentLvlSkill() int

func (*CharWrapper) Tick

func (c *CharWrapper) Tick()

func (*CharWrapper) TotalAtk

func (c *CharWrapper) TotalAtk() float64

func (*CharWrapper) TotalDef

func (c *CharWrapper) TotalDef() float64

func (*CharWrapper) UpdateBaseStats

func (c *CharWrapper) UpdateBaseStats() error

type Character

type Character interface {
	Base
	HP

	Init() error // init function built into every char to setup any variables etc.

	Attack(p map[string]int) (action.Info, error)
	Aimed(p map[string]int) (action.Info, error)
	ChargeAttack(p map[string]int) (action.Info, error)
	HighPlungeAttack(p map[string]int) (action.Info, error)
	LowPlungeAttack(p map[string]int) (action.Info, error)
	Skill(p map[string]int) (action.Info, error)
	Burst(p map[string]int) (action.Info, error)
	Dash(p map[string]int) (action.Info, error)
	Walk(p map[string]int) (action.Info, error)
	Jump(p map[string]int) (action.Info, error)

	ActionStam(a action.Action, p map[string]int) float64

	ActionReady(a action.Action, p map[string]int) (bool, action.Failure)
	NextQueueItemIsValid(targetChar keys.Char, a action.Action, p map[string]int) error
	SetCD(a action.Action, dur int)
	Cooldown(a action.Action) int
	ResetActionCooldown(a action.Action)
	ReduceActionCooldown(a action.Action, v int)
	Charges(a action.Action) int

	Snapshot(a *combat.AttackInfo) combat.Snapshot

	AddEnergy(src string, amt float64)

	ApplyHitlag(factor, dur float64)
	AnimationStartDelay(model.AnimationDelayKey) int

	Condition([]string) (any, error)

	ResetNormalCounter()
	NextNormalCounter() int
}

type CooldownMod

type CooldownMod struct {
	Amount CooldownModFunc
	modifier.Base
}

type CooldownModFunc

type CooldownModFunc func(a action.Action) float64

type DamageReductionMod

type DamageReductionMod struct {
	Amount DamageReductionModFunc
	modifier.Base
}

type DamageReductionModFunc

type DamageReductionModFunc func() (float64, bool)

type HP

type HP interface {
	CurrentHPRatio() float64
	CurrentHP() float64
	CurrentHPDebt() float64

	SetHPByAmount(float64)
	SetHPByRatio(float64)
	ModifyHPByAmount(float64)
	ModifyHPByRatio(float64)

	ModifyHPDebtByAmount(float64)
	ModifyHPDebtByRatio(float64)

	Heal(*info.HealInfo) (float64, float64) // return actual hp healed and amount of hp debt cleared
	Drain(*info.DrainInfo) float64
}

HP contains info and helper for dealing with character hp

type HealBonusMod

type HealBonusMod struct {
	Amount HealBonusModFunc
	modifier.Base
}

type HealBonusModFunc

type HealBonusModFunc func() (float64, bool)

type Particle

type Particle struct {
	Source string
	Num    float64
	Ele    attributes.Element
}

type ReactBonusMod

type ReactBonusMod struct {
	Amount ReactBonusModFunc
	modifier.Base
}

type ReactBonusModFunc

type ReactBonusModFunc func(combat.AttackInfo) (float64, bool)

type StatMod

type StatMod struct {
	AffectedStat attributes.Stat
	Extra        bool
	Amount       StatModFunc
	modifier.Base
}

type StatModFunc

type StatModFunc func() ([]float64, bool)

type Status

type Status struct {
	modifier.Base
}

Status is basic mod for keeping track Status; usually affected by hitlag

Jump to

Keyboard shortcuts

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