Documentation ¶
Index ¶
- Constants
- Variables
- func NextLevel(level int) float64
- type ActionLabels
- type Actor
- func (a *Actor) AddAction(actionId string, specials []string)
- func (a *Actor) AddXP(xp float64) bool
- func (a *Actor) ApplyLevel(levelUp LevelUp)
- func (a Actor) CanUse(item world.Item) bool
- func (a Actor) CreateLevelUp() LevelUp
- func (a Actor) CreateStatLabelList() (statsLabels []string)
- func (a Actor) CreateStatNameList() (statsIDs []string)
- func (a *Actor) Equip(equipSlotId string, item world.Item)
- func (a Actor) GetEquipSlotIdByItemType(itemT world.ItemType) string
- func (a Actor) GetItemTypeBySlotPos(slot int) world.ItemType
- func (a Actor) IsKOed() bool
- func (a *Actor) IsPlayer() bool
- func (a *Actor) KO()
- func (a Actor) PredictStats(equipSlotId string, item world.Item) map[string]float64
- func (a Actor) ReadyToLevelUp() bool
- func (a *Actor) RenderEquipment(args ...interface{})
- func (a *Actor) UnEquip(equipSlotId string)
- func (a *Actor) UnlockMenuAction(actionId string)
- type ActorDef
- type ActorDropItem
- type ActorLabel
- type ActorSummary
- type ActorXPSummary
- type Drop
- type DropChanceItem
- type Equipment
- type LevelUp
- type OddmentTable
- type Party
- type WorldExtended
Constants ¶
View Source
const ( ActionAttack = "Attack" ActionItem = "Item" ActionMagic = "Magic" ActionSpecial = "Special" ActionFlee = "Flee" )
Variables ¶
View Source
var ActorLabels = ActorLabel{ EquipSlotLabels: []string{ `Weapon `, `Armor `, `Accessory 1 `, `Accessory 2 `, }, EquipSlotId: []string{ "Weapon", "Armor", "Accessory1", "Accessory2", }, EquipSlotTypes: map[world.ItemType]string{ world.Weapon: "Weapon", world.Armor: "Armor", world.Accessory: "Accessory", }, ActorStats: []string{ "Strength", "Speed", "Intelligence", }, ItemStats: []string{ "Attack", "Defense", "Magic", "Resist", }, ActorStatLabels: []string{ `Strength `, `Speed `, `Intelligence `, }, ItemStatLabels: []string{ `Attack `, `Defense `, `Magic `, `Resist `, }, ActionLabels: ActionLabels{ Attack: "Attack", Item: "Item", }, }
View Source
var DragonDef = ActorDef{ Id: "dragon", IsPlayer: false, Stats: world.BaseStats{ HpNow: 200, HpMax: 200, MpNow: 0, MpMax: 0, Strength: 35, Speed: 8, Intelligence: 20, Counter: 0.1, }, Name: "Green Dragon", Portrait: "../resources/avatar_hero.png", Actions: []string{ActionAttack}, Drop: Drop{ XP: 350, Gold: [2]int{250, 300}, Always: nil, Chance: []DropChanceItem{ {Oddment: 1, ItemId: -1}, {Oddment: 3, ItemId: 10}, }, }, StealItem: 11, }
View Source
var EnemyDefinitions = map[string]ActorDef{ "goblin": GoblinDef, "dragon": DragonDef, "ogre": OgreDef, }
View Source
var GoblinDef = ActorDef{ Id: "goblin", IsPlayer: false, Stats: world.BaseStats{ HpNow: 90, HpMax: 90, MpNow: 0, MpMax: 0, Strength: 15, Speed: 8, Intelligence: 2, }, Name: "Goblin", Portrait: "../resources/avatar_hero.png", Actions: []string{ActionAttack}, Drop: Drop{ XP: 150, Gold: [2]int{5, 15}, Always: nil, Chance: []DropChanceItem{ {Oddment: 1, ItemId: -1}, {Oddment: 3, ItemId: 11}, }, }, StealItem: 14, }
View Source
var HeroDef = ActorDef{ Id: "hero", IsPlayer: true, Stats: world.BaseStats{ HpNow: 40, HpMax: 40, MpNow: 8, MpMax: 8, Level: 0, Strength: 10, Speed: 12, Intelligence: 10, Counter: 0, }, StatGrowth: map[string]func() int{ "HpMax": dice.Create("2d25+25"), "MpMax": dice.Create("1d5+2"), "Strength": world.StatsGrowth.Fast, "Speed": world.StatsGrowth.Fast, "Intelligence": world.StatsGrowth.Med, }, ActionGrowth: map[int]map[string][]string{ 5: { ActionSpecial: []string{world.SpecialSlash}, }, }, Name: "Chandragupta", Portrait: "../resources/avatar_hero.png", Actions: []string{ActionAttack, ActionItem, ActionFlee}, Special: []string{world.SpecialSlash}, ActiveEquipSlots: []int{0, 1, 2, 3}, }
View Source
var MageDef = ActorDef{ Id: "mage", IsPlayer: true, Stats: world.BaseStats{ HpNow: 30, HpMax: 30, MpNow: 10, MpMax: 10, Level: 0, Strength: 8, Speed: 11, Intelligence: 20, }, StatGrowth: map[string]func() int{ "HpMax": dice.Create("2d25+18"), "MpMax": dice.Create("1d5+2"), "Strength": world.StatsGrowth.Med, "Speed": world.StatsGrowth.Med, "Intelligence": world.StatsGrowth.Fast, }, ActionGrowth: map[int]map[string][]string{ 1: { ActionMagic: []string{world.SpellBolt}, }, 2: { ActionMagic: []string{world.SpellFire, world.SpellIce}, }, 4: { ActionMagic: []string{world.SpellBurn}, }, }, Name: "Mrignayani", Portrait: "../resources/avatar_mage.png", Actions: []string{ActionAttack, ActionItem, ActionFlee}, Magic: []string{world.SpellFire, world.SpellBurn, world.SpellBolt}, ActiveEquipSlots: []int{0, 1, 2, 3}, }
View Source
var OgreDef = ActorDef{ Id: "ogre", IsPlayer: false, Stats: world.BaseStats{ HpNow: 150, HpMax: 150, MpNow: 0, MpMax: 0, Strength: 20, Speed: 8, Intelligence: 2, Counter: 0, }, Name: "Ogre", Portrait: "../resources/avatar_hero.png", Actions: []string{ActionAttack}, Drop: Drop{ XP: 250, Gold: [2]int{100, 200}, Always: nil, Chance: []DropChanceItem{ {Oddment: 1, ItemId: -1}, {Oddment: 3, ItemId: 10}, }, }, StealItem: 12, }
View Source
var PartyMembersDefinitions = map[string]ActorDef{ "hero": HeroDef, "mage": MageDef, "thief": ThiefDef, }
View Source
var ThiefDef = ActorDef{ Id: "thief", IsPlayer: true, Stats: world.BaseStats{ HpNow: 35, HpMax: 35, MpNow: 7, MpMax: 7, Level: 0, Strength: 10, Speed: 13, Intelligence: 10, }, StatGrowth: map[string]func() int{ "HpMax": dice.Create("2d25+20"), "MpMax": dice.Create("1d10+5"), "Strength": world.StatsGrowth.Med, "Speed": world.StatsGrowth.Med, "Intelligence": world.StatsGrowth.Med, }, ActionGrowth: map[int]map[string][]string{ 2: { world.SpecialSteal: []string{ActionSpecial}, }, }, Name: "Shashank", Portrait: "../resources/avatar_thief.png", Actions: []string{ActionAttack, ActionItem, ActionFlee}, Special: []string{world.SpecialSteal}, ActiveEquipSlots: []int{0, 1, 2, 3}, }
Functions ¶
Types ¶
type ActionLabels ¶
type ActionLabels struct {
Attack, Item string
}
type Actor ¶
type Actor struct {
Id, Name string
Stats world.Stats
StatGrowth map[string]func() int
PortraitTexture pixel.Picture
Portrait *pixel.Sprite
Level int
XP, NextLevelXP float64
Actions []string
Magic []string
Special []string
StealItem int //Item ID only for Enemy actors
ActiveEquipSlots []int
Equipped map[string]int //int is ItemsDB Id
Drop ActorDropItem
// contains filtered or unexported fields
}
Actor is any creature or character that participates in combat and therefore requires stats, equipment, etc
func (*Actor) ApplyLevel ¶
func (Actor) CreateLevelUp ¶
func (Actor) CreateStatLabelList ¶
func (Actor) CreateStatNameList ¶
func (Actor) GetEquipSlotIdByItemType ¶
GetEquipSlotIdByItemType takes in Item Type INT return Type string e.g. Weapon
func (Actor) PredictStats ¶
PredictStats compare Equipped Item Stats with given Item returns -> BaseStats after comparison
func (Actor) ReadyToLevelUp ¶
func (*Actor) RenderEquipment ¶
func (a *Actor) RenderEquipment(args ...interface{})
func (*Actor) UnlockMenuAction ¶
type ActorDef ¶
type ActorDef struct { Id string //must match entityDef Stats world.BaseStats StatGrowth map[string]func() int Level int ActionGrowth map[int]map[string][]string //Level -> {Action : [special, special]} Portrait string Name string Actions []string Magic []string Special []string StealItem int //Item ID only for Enemy actors ActiveEquipSlots []int IsPlayer bool Equipment Drop }
type ActorDropItem ¶
type ActorDropItem struct { XP float64 Gold float64 Always []int //ActionItem ids that are guaranteed to drop Chance *OddmentTable }
type ActorLabel ¶
type ActorSummary ¶
type ActorSummary struct {
X, Y, Width float64
Actor Actor
HPBar, MPBar gui.ProgressBarIMD
XPBar gui.ProgressBar
ShowXP bool
AvatarTextPadding,
LabelRightPadding,
LabelValuePadding,
VerticalPadding,
TextPaddingY float64
}
func ActorSummaryCreate ¶
func ActorSummaryCreate(actor Actor, showXP bool) ActorSummary
func (ActorSummary) GetCursorPosition ¶
func (s ActorSummary) GetCursorPosition() pixel.Vec
func (*ActorSummary) HideXP ¶
func (s *ActorSummary) HideXP()
func (*ActorSummary) Render ¶
func (s *ActorSummary) Render(renderer pixel.Target)
type ActorXPSummary ¶
type ActorXPSummary struct { Actor *Actor X, Y float64 Avatar *pixel.Sprite AvatarWidth, AvatarHeight float64 Layout gui.Layout LayoutId string XPBar gui.ProgressBarIMD PopUpList []*gui.XPPopUp PopUpDisplayTime float64 }
func ActorXPSummaryCreate ¶
func ActorXPSummaryCreate(actor *Actor, layout gui.Layout, layoutId string) *ActorXPSummary
func (*ActorXPSummary) AddPopUp ¶
func (a *ActorXPSummary) AddPopUp(text, hexColor string)
func (*ActorXPSummary) CancelPopUp ¶
func (a *ActorXPSummary) CancelPopUp()
func (ActorXPSummary) PopUpCount ¶
func (a ActorXPSummary) PopUpCount() int
func (*ActorXPSummary) Render ¶
func (a *ActorXPSummary) Render(renderer pixel.Target)
func (*ActorXPSummary) SetPosition ¶
func (a *ActorXPSummary) SetPosition(x, y float64)
func (*ActorXPSummary) Update ¶
func (a *ActorXPSummary) Update(dt float64)
type Drop ¶
type Drop struct { XP float64 Gold [2]int //range min, max Always []int //item ids that are guaranteed to drop Chance []DropChanceItem }
type DropChanceItem ¶
type Equipment ¶
type Equipment struct { Weapon, Armor, Access1, Access2 int //ItemsDB.Id }
Must match to ItemsDB ID
type OddmentTable ¶
type OddmentTable struct { Items []DropChanceItem Oddment float64 }
func OddmentTableCreate ¶
func OddmentTableCreate(items []DropChanceItem) *OddmentTable
func (OddmentTable) CalcOddment ¶
func (o OddmentTable) CalcOddment() (total float64)
func (OddmentTable) Pick ¶
func (o OddmentTable) Pick() world.ItemIndex
type Party ¶
type Party struct { Members map[string]*Actor World *WorldExtended }
func PartyCreate ¶
func PartyCreate(w *WorldExtended) *Party
type WorldExtended ¶
func WorldExtendedCreate ¶
func WorldExtendedCreate() *WorldExtended
Click to show internal directories.
Click to hide internal directories.