Documentation ¶
Overview ¶
character package provides game character struct and other types for game characters.
Index ¶
- Constants
- Variables
- type Alignment
- type Attitude
- type Attributes
- func (a *Attributes) Apply(data res.AttributesData)
- func (a *Attributes) Damage() (int, int)
- func (a *Attributes) Data() res.AttributesData
- func (a *Attributes) Health() int
- func (a *Attributes) Lift() int
- func (a *Attributes) Mana() int
- func (a *Attributes) Sight() float64
- func (a *Attributes) String() string
- type Character
- func (c *Character) AddDialog(d *dialog.Dialog)
- func (c *Character) AddEffect(e *effect.Effect)
- func (c *Character) AddFlag(f flag.Flag)
- func (c *Character) AddKill(kill res.KillData)
- func (c *Character) AddOnModifierEvent(f func(m effect.Modifier))
- func (c *Character) AddSkill(s *skill.Skill)
- func (c *Character) AddTraining(t *training.TrainerTraining)
- func (c *Character) Agony() bool
- func (c *Character) Alignment() Alignment
- func (c *Character) Apply(data res.CharacterData)
- func (c *Character) AreaID() string
- func (c *Character) Attitude() Attitude
- func (c *Character) AttitudeFor(o serial.Serialer) Attitude
- func (c *Character) Attributes() *Attributes
- func (c *Character) BaseMoveCooldown() int64
- func (c *Character) Casted() useaction.Usable
- func (c *Character) ChapterID() string
- func (c *Character) ChargeReqs(reqs ...req.Requirement)
- func (c *Character) ChatLog() *objects.Log
- func (c *Character) Cooldown() int64
- func (c *Character) Crafting() *craft.Crafting
- func (c *Character) Damage() (int, int)
- func (c *Character) DamageType() objects.Element
- func (c *Character) Data() res.CharacterData
- func (c *Character) DefaultPosition() (float64, float64)
- func (c *Character) DestPoint() (float64, float64)
- func (c *Character) Dialog(char Character) (dial *dialog.Dialog)
- func (c *Character) Dialogs() (dls []*dialog.Dialog)
- func (c *Character) Effects() (effects []*effect.Effect)
- func (c *Character) Equipment() *Equipment
- func (c *Character) Experience() int
- func (c *Character) Fighting() bool
- func (c *Character) Flags() (flags []flag.Flag)
- func (c *Character) Gender() Gender
- func (c *Character) Guild() Guild
- func (c *Character) HasFlag(flag flag.Flag) bool
- func (c *Character) Health() int
- func (c *Character) HitEffects() []*effect.Effect
- func (c *Character) HitModifiers() []effect.Modifier
- func (c *Character) ID() string
- func (c *Character) Interrupt()
- func (c *Character) Inventory() *item.Inventory
- func (c *Character) Journal() *quest.Journal
- func (c *Character) Kills() []res.KillData
- func (c *Character) Level() int
- func (c *Character) Live() bool
- func (c *Character) Mana() int
- func (c *Character) MaxExperience() int
- func (c *Character) MaxHealth() int
- func (c *Character) MaxMana() int
- func (c *Character) MeetReqs(reqs ...req.Requirement) bool
- func (c *Character) MemorizeTarget(mem *TargetMemory)
- func (c *Character) Memory() (mem []*TargetMemory)
- func (c *Character) MoveCooldown() int64
- func (c *Character) Moving() bool
- func (c *Character) Position() (float64, float64)
- func (c *Character) Race() Race
- func (c *Character) RemoveEffect(e *effect.Effect)
- func (c *Character) RemoveFlag(f flag.Flag)
- func (c *Character) RemoveSkill(s *skill.Skill)
- func (c *Character) Respawn() int64
- func (c *Character) Serial() string
- func (c *Character) SetAlignment(ali Alignment)
- func (c *Character) SetAreaID(areaID string)
- func (c *Character) SetAttitude(att Attitude)
- func (c *Character) SetChapterID(chapterID string)
- func (c *Character) SetDefaultPosition(x, y float64)
- func (c *Character) SetDestPoint(x, y float64)
- func (c *Character) SetExperience(exp int)
- func (c *Character) SetGender(gender Gender)
- func (c *Character) SetGuild(guild Guild)
- func (c *Character) SetHealth(hp int)
- func (c *Character) SetMana(mana int)
- func (c *Character) SetMoveCooldown(cooldown int64)
- func (c *Character) SetPosition(x, y float64)
- func (c *Character) SetRespawn(respawn int64)
- func (c *Character) SetSerial(serial string)
- func (c *Character) SetTarget(t effect.Target)
- func (c *Character) SightRange() float64
- func (c *Character) Skills() (skills []*skill.Skill)
- func (c *Character) TakeEffect(e *effect.Effect)
- func (c *Character) TakeModifiers(source serial.Serialer, mods ...effect.Modifier)
- func (c *Character) Targets() (targets []effect.Target)
- func (c *Character) Trainings() []*training.TrainerTraining
- func (c *Character) Update(delta int64)
- func (c *Character) Use(ob useaction.Usable) error
- func (c *Character) UseAction() *useaction.UseAction
- type Equipment
- type EquipmentSlot
- type Gender
- type Guild
- type Race
- type TargetMemory
Constants ¶
const ( LawfulGood Alignment = Alignment("aliLawfulGood") NeutralGood = Alignment("aliNeutralGood") ChaoticGood = Alignment("aliChaoticGood") LawfulNeutral = Alignment("aliLawfulNeutral") TrueNeutral = Alignment("aliTrueNeutral") ChaoticNeutral = Alignment("aliChaoticNeutral") LawfulEvil = Alignment("aliLawfulEvil") NeutralEvil = Alignment("aliNeutralEvil") ChaoticEvil = Alignment("aliChaoticEvil") )
const ( Friendly Attitude = Attitude("attFriendly") Neutral = Attitude("attNeutral") Hostile = Attitude("attHostile") )
const ( BaseLift = 10 BaseSight = 300.0 BaseHealth = 50 BaseMana = 10 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
type Attributes struct {
Str, Con, Dex, Wis, Int int
}
Attributes struct represents game character attributes: strenght, constitution, dexterity, wisdom, intelligence.
func (*Attributes) Apply ¶
func (a *Attributes) Apply(data res.AttributesData)
Apply applies specified data on character attributes.
func (*Attributes) Damage ¶
func (a *Attributes) Damage() (int, int)
Damage returns min and max damage values based on attributes.
func (*Attributes) Data ¶
func (a *Attributes) Data() res.AttributesData
Data returns data resource for attributes.
func (*Attributes) Health ¶
func (a *Attributes) Health() int
Health returns maximal health based on attributes.
func (*Attributes) Lift ¶
func (a *Attributes) Lift() int
Lift returns maximal size of inventory based on attributes.
func (*Attributes) Mana ¶
func (a *Attributes) Mana() int
Mana returns maximal mana based on attributes.
func (*Attributes) Sight ¶
func (a *Attributes) Sight() float64
Sight returns maximal sight range based on attributes.
func (*Attributes) String ¶
func (a *Attributes) String() string
String returns attributes struct as string in format: [strengt], [constitution], [dexterity], [wisdom], [intelligence]
type Character ¶
type Character struct {
// contains filtered or unexported fields
}
Character struct represents game character.
func New ¶
func New(data res.CharacterData) *Character
New creates new character from specified data.
func (*Character) AddDialog ¶
AddDialog adds specified dialog to character and sets character as dialog owner.
func (*Character) AddOnModifierEvent ¶
AddOnModifierEvent adds specified function to be triggered after receiving a new modifier. The event function will be called for every recieved modifier after it was handled by the character.
func (*Character) AddTraining ¶
func (c *Character) AddTraining(t *training.TrainerTraining)
AddTrainings adds specified training to character trainings list.
func (*Character) Apply ¶
func (c *Character) Apply(data res.CharacterData)
Apply applies specified data on the character.
func (*Character) AttitudeFor ¶
AttitudeFor returns attitude for specified object. For dead objects returns neutral attitude. For memorized targets returns memorized attitude. For not memorized objects from the same guild returns friendly attitude. For not memorized hostile objects returns hostile attitude. For other cases returns character attitude.
func (*Character) Attributes ¶
func (c *Character) Attributes() *Attributes
Attributes returns character attributes.
func (*Character) BaseMoveCooldown ¶
BaseMoveCooldown returns character base movement cooldown in milliseconds.
func (*Character) ChargeReqs ¶
func (c *Character) ChargeReqs(reqs ...req.Requirement)
ChargeReqs takes from character all things that make the character meet specified requirements. All requirements that are not 'chargeable' will be ignored.
func (*Character) Damage ¶
Damage retruns min and max damage value, including weapons, active effects, etc.
func (*Character) DamageType ¶
DamgaeType returns type of damage caused by character.
func (*Character) Data ¶
func (c *Character) Data() res.CharacterData
Data creates data resource struct for character.
func (*Character) DefaultPosition ¶
DefaultPosition returns character default position.
func (*Character) Experience ¶
Experience returns current value of experience points.
func (*Character) HitEffects ¶
HitEffects returns character hit effects.
func (*Character) HitModifiers ¶
HitModifiers returns character hit modifiers.
func (*Character) Interrupt ¶
func (c *Character) Interrupt()
Interrupt stops any acction(like skill casting) performed by character.
func (*Character) MaxExperience ¶
MaxExperience returns maximal value of experience points.
func (*Character) MeetReqs ¶
func (c *Character) MeetReqs(reqs ...req.Requirement) bool
ReqsMeet checks whether all specified requirements are meet by character.
func (*Character) MemorizeTarget ¶
func (c *Character) MemorizeTarget(mem *TargetMemory)
MemorizeTarget saves specified target memory.
func (*Character) Memory ¶
func (c *Character) Memory() (mem []*TargetMemory)
Memory returns character tergets memory.
func (*Character) MoveCooldown ¶
MoveCooldown returns character movement cooldown in milliseconds.
func (*Character) RemoveEffect ¶
RemoveEffect removes effect from character.
func (*Character) RemoveFlag ¶
RemoveFlag removes specified flag.
func (*Character) RemoveSkill ¶
RemoveSkill removes specified skill.
func (*Character) SetAlignment ¶
SetAlignment sets character alignment.
func (*Character) SetAttitude ¶
SetAttitude sets character attitude.
func (*Character) SetChapterID ¶
SetChapterID sets specified chapter ID as character chapter ID.
func (*Character) SetDefaultPosition ¶
SetDefaultPosition sets specified XY position as default character position.
func (*Character) SetDestPoint ¶
SetDestPoint sets specified XY position as current destionation point of character.
func (*Character) SetExperience ¶
SetExperience sets specified value as current amount of experience points.
func (*Character) SetMoveCooldown ¶
SetMoveCooldown sets character movement cooldown to the specified value(in milliseconds).
func (*Character) SetPosition ¶
SetPosition sets specified XY position as current position.
func (*Character) SetRespawn ¶
SetRespawn sets character respawn time in milliseconds.
func (*Character) SightRange ¶
SightRange returns current sight range.
func (*Character) TakeEffect ¶
takeEffects adds specified effects
func (*Character) TakeModifiers ¶
TakeModifiers handles all specified modifiers. Source can be nil.
func (*Character) Trainings ¶
func (c *Character) Trainings() []*training.TrainerTraining
Trainings returns all trainings.
func (*Character) Use ¶
Use checks requirements and starts cast action for specified usable object. Returns an error if use requirements are not meet(REQS_NOT_MEET), if cooldown is active(NOT_READY_YET), if character is currently moving(IN_MOVE) or if character is dead or specified usable has no use action(CANT_USE).
type Equipment ¶
type Equipment struct {
// contains filtered or unexported fields
}
Struct for character equipment.
func (*Equipment) Apply ¶
func (eq *Equipment) Apply(data res.EquipmentData)
Apply applies specified data on the equipment.
func (*Equipment) Data ¶
func (eq *Equipment) Data() res.EquipmentData
Data creates data resource for equipment.
func (*Equipment) Slots ¶
func (eq *Equipment) Slots() []*EquipmentSlot
Slots retuns all equipment slots.
type EquipmentSlot ¶
type EquipmentSlot struct {
// contains filtered or unexported fields
}
Struct for equipment slots.
func (*EquipmentSlot) Item ¶
func (eqSlot *EquipmentSlot) Item() item.Equiper
Item returns slot item or nil if slot is empty.
func (*EquipmentSlot) SetItem ¶
func (eqSlot *EquipmentSlot) SetItem(it item.Equiper)
SetItem sets inserts specified item to slot.
type Guild ¶
type Guild struct {
// contains filtered or unexported fields
}
Guild struct represents chracter guild
type Race ¶
type Race struct {
// contains filtered or unexported fields
}
Struct for character race.
type TargetMemory ¶
Struct for saved data about target.