Documentation ¶
Overview ¶
Project OpenMonster Copyright (C) 2020 Kori
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/\>.
Project OpenMonster Copyright (C) 2020 Kori
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/\>.
Project OpenMonster Copyright (C) 2020 Kori
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/\>.
Project OpenMonster Copyright (C) 2020 Kori
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/\>.
Project OpenMonster Copyright (C) 2020 Kori
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/\>.
Project OpenMonster Copyright (C) 2020 Kori
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/\>.
Project OpenMonster Copyright (C) 2020 Kori
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/\>.
Project OpenMonster Copyright (C) 2020 Kori
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/\>.
Index ¶
- Constants
- Variables
- func AddTypeMatchup(attacker Type, defender Type, effectivity float64)
- func DefaultGeneticModifierRange() (AttributeStat, AttributeStat)
- func GetTypeEffectivity(attacker Type, defender ...Type) float64
- type AttributeStat
- type Attributes
- func (a Attributes) Abs() Attributes
- func (a Attributes) Add(b Attributes) Attributes
- func (a Attributes) AddF(b float64) Attributes
- func (a Attributes) AddI(b int) Attributes
- func (a Attributes) Div(b Attributes) Attributes
- func (a Attributes) Mult(b Attributes) Attributes
- func (a Attributes) MultF(b float64) Attributes
- func (a Attributes) MultI(b int) Attributes
- func (a Attributes) Pow(b Attributes) Attributes
- func (a Attributes) Sign() Attributes
- type Breeder
- type Condition
- type DamageModifier
- type EvolveRequirement
- type Exp
- type ExpCurve
- type Gender
- type GeneticModifierRangeSupplier
- type ID
- type IDSupplier
- type Level
- type LevelCondition
- type LevelRangeSupplier
- type Monster
- func (mon *Monster) ApplyStatus(name string, amount int) bool
- func (mon *Monster) Attributes() Attributes
- func (mon *Monster) CurrentHPPercent() float64
- func (mon *Monster) CurrentStaminaPercent() float64
- func (mon *Monster) Damage(dmg int)
- func (mon *Monster) IsKO() bool
- func (mon Monster) MarshalJSON() ([]byte, error)
- func (mon *Monster) ReduceStamina(stamina int)
- func (mon *Monster) String() string
- func (mon *Monster) Types() []Type
- func (mon *Monster) UnmarshalJSON(data []byte) error
- type MonsterVolatile
- type Move
- type MoveArr
- type MoveBase
- type MoveBaseTemplate
- func (mb MoveBaseTemplate) Cooldown() int
- func (mb MoveBaseTemplate) Description() string
- func (mbt *MoveBaseTemplate) MarshalJSON() ([]byte, error)
- func (mb MoveBaseTemplate) Modifier() []MoveModifier
- func (mb MoveBaseTemplate) Name() string
- func (mb *MoveBaseTemplate) SetCooldown(c int)
- func (mb *MoveBaseTemplate) SetDescription(desc string)
- func (mb *MoveBaseTemplate) SetModifier(mod []MoveModifier)
- func (mb *MoveBaseTemplate) SetName(name string)
- func (mb *MoveBaseTemplate) SetStaminaUsage(su int)
- func (mb *MoveBaseTemplate) SetTarget(t MoveTarget)
- func (mb *MoveBaseTemplate) SetType(t Type)
- func (mb MoveBaseTemplate) StaminaUsage() int
- func (mb MoveBaseTemplate) String() string
- func (mb MoveBaseTemplate) Target() MoveTarget
- func (mb MoveBaseTemplate) Type() Type
- func (mbt *MoveBaseTemplate) UnmarshalJSON(msg []byte) error
- type MoveModifier
- type MoveRequirement
- type MoveTarget
- type Request
- type RequestStatus
- type Requirement
- type Species
- type StatusModifier
- type Trait
- type Type
- type Vector2D
Constants ¶
const ( ModifierType_Damage = "damage" ModifierType_Status = "status" )
const (
MoveAmount int = 4
)
TODO: Move to config file
Variables ¶
var ItemCache map[string]*item.Base
var MoveBaseCache map[string]MoveBase
var NilMoveBase = NewMoveBaseTemplate("Nil", "Placeholder for empty moves", "", 0, 90)
var SpeciesCache map[string]*Species
var TraitCache traitCache = make(traitCache)
Functions ¶
func AddTypeMatchup ¶
AddTypeMatchup adds the effectivity of an attacking type against a defending type. If a combination already exists, it will be replaced.
func DefaultGeneticModifierRange ¶ added in v0.3.0
func DefaultGeneticModifierRange() (AttributeStat, AttributeStat)
func GetTypeEffectivity ¶
GetTypeEffectivity returns the effectivity of an attack type against the defending types. If the combination is not listed, a neutral effectivity is assumed. In the case of a dual-type, the individual type combinations will be used to calculate the final effectivity.
Types ¶
type AttributeStat ¶
type AttributeStat int
const MaxGeneticModifier AttributeStat = 25
const MinGeneticModifier AttributeStat = 1
type Attributes ¶
type Attributes struct { Health AttributeStat `json:"health"` PhysAttack AttributeStat `json:"physAttack"` PhysDefense AttributeStat `json:"physDefense"` SpecAttack AttributeStat `json:"specAttack"` SpecDefense AttributeStat `json:"specDefense"` Initiative AttributeStat `json:"initiative"` Stamina AttributeStat `json:"stamina"` }
func (Attributes) Abs ¶ added in v0.2.0
func (a Attributes) Abs() Attributes
func (Attributes) Add ¶
func (a Attributes) Add(b Attributes) Attributes
func (Attributes) AddF ¶ added in v0.2.0
func (a Attributes) AddF(b float64) Attributes
func (Attributes) AddI ¶ added in v0.2.0
func (a Attributes) AddI(b int) Attributes
func (Attributes) Div ¶ added in v0.2.0
func (a Attributes) Div(b Attributes) Attributes
func (Attributes) Mult ¶ added in v0.2.0
func (a Attributes) Mult(b Attributes) Attributes
func (Attributes) MultF ¶ added in v0.2.0
func (a Attributes) MultF(b float64) Attributes
func (Attributes) MultI ¶ added in v0.2.0
func (a Attributes) MultI(b int) Attributes
func (Attributes) Pow ¶ added in v0.2.0
func (a Attributes) Pow(b Attributes) Attributes
func (Attributes) Sign ¶ added in v0.2.0
func (a Attributes) Sign() Attributes
type DamageModifier ¶
type DamageModifier struct { Power uint `json:"power"` AttackStat string `json:"attackStat"` DefenseStat string `json:"defenseStat"` }
func (DamageModifier) MarshalJSON ¶
func (d DamageModifier) MarshalJSON() ([]byte, error)
func (DamageModifier) ModifierType ¶
func (d DamageModifier) ModifierType() string
type EvolveRequirement ¶
type EvolveRequirement Requirement
type GeneticModifierRangeSupplier ¶ added in v0.3.0
type GeneticModifierRangeSupplier func() (from AttributeStat, to AttributeStat)
type IDSupplier ¶
type IDSupplier interface {
NextID() ID
}
type LevelCondition ¶
type LevelCondition struct {
Level Level `json:"level"`
}
func (LevelCondition) IsFulfilled ¶
func (l LevelCondition) IsFulfilled(m Monster) bool
func (LevelCondition) MarshalJSON ¶
func (lv LevelCondition) MarshalJSON() ([]byte, error)
func (LevelCondition) Type ¶
func (l LevelCondition) Type() string
type LevelRangeSupplier ¶
type Monster ¶
type Monster struct { ID ID `json:"id"` Nickname string Level Level Species *Species `json:"species"` TrainingModifier Attributes GeneticModifier Attributes NutritionalModifier Attributes Gender Gender Moves MoveArr Exp Exp OwnerID ID Status []status.Ailment Trait *Trait MonsterVolatile }
func CreateMonster ¶
func CreateMonster(species *Species, levelRange LevelRangeSupplier, gmRange GeneticModifierRangeSupplier) *Monster
func (*Monster) ApplyStatus ¶
ApplyStatus adds an amount of points to a status threshold. Returns true, if the threshold is reached and the ailment applied.
func (*Monster) Attributes ¶
func (mon *Monster) Attributes() Attributes
func (*Monster) CurrentHPPercent ¶
func (*Monster) CurrentStaminaPercent ¶
func (Monster) MarshalJSON ¶
func (*Monster) ReduceStamina ¶
func (*Monster) UnmarshalJSON ¶
type MonsterVolatile ¶
type MonsterVolatile struct { TempModifier Attributes CurrentHP int CurrentStamina int StatusThreshold map[string]int }
type Move ¶
type Move struct {
// contains filtered or unexported fields
}
func (*Move) IncreaseCooldown ¶
func (move *Move) IncreaseCooldown()
func (*Move) MarshalJSON ¶
func (*Move) ResetCooldown ¶
func (move *Move) ResetCooldown()
type MoveArr ¶
type MoveArr [MoveAmount]*Move
func NewMoveArr ¶
func NewMoveArr() MoveArr
func (MoveArr) Add ¶
* Add adds a move to the MoveArr if there is space left and the move is not already in the MoveArr Returns an error, if the move was not added
func (MoveArr) Contains ¶
* Contains checks, if there is a move with the given MoveBase in the MoveArr
func (MoveArr) MarshalJSON ¶
type MoveBaseTemplate ¶
type MoveBaseTemplate struct {
// contains filtered or unexported fields
}
* MoveBaseTemplate contains the shared information of a move. Everything in MoveBaseTemplate is constant and should not be changed
upgradePoints defines how many points will be added to the move points after an upgrade
func NewMoveBaseTemplate ¶
func NewMoveBaseTemplate(name, description string, moveType Type, staminaUsage int, power uint) *MoveBaseTemplate
func (MoveBaseTemplate) Cooldown ¶
func (mb MoveBaseTemplate) Cooldown() int
func (MoveBaseTemplate) Description ¶
func (mb MoveBaseTemplate) Description() string
func (*MoveBaseTemplate) MarshalJSON ¶
func (mbt *MoveBaseTemplate) MarshalJSON() ([]byte, error)
func (MoveBaseTemplate) Modifier ¶
func (mb MoveBaseTemplate) Modifier() []MoveModifier
func (MoveBaseTemplate) Name ¶
func (mb MoveBaseTemplate) Name() string
func (*MoveBaseTemplate) SetCooldown ¶
func (mb *MoveBaseTemplate) SetCooldown(c int)
func (*MoveBaseTemplate) SetDescription ¶
func (mb *MoveBaseTemplate) SetDescription(desc string)
func (*MoveBaseTemplate) SetModifier ¶
func (mb *MoveBaseTemplate) SetModifier(mod []MoveModifier)
func (*MoveBaseTemplate) SetName ¶
func (mb *MoveBaseTemplate) SetName(name string)
func (*MoveBaseTemplate) SetStaminaUsage ¶
func (mb *MoveBaseTemplate) SetStaminaUsage(su int)
func (*MoveBaseTemplate) SetTarget ¶
func (mb *MoveBaseTemplate) SetTarget(t MoveTarget)
func (*MoveBaseTemplate) SetType ¶
func (mb *MoveBaseTemplate) SetType(t Type)
func (MoveBaseTemplate) StaminaUsage ¶
func (mb MoveBaseTemplate) StaminaUsage() int
func (MoveBaseTemplate) String ¶
func (mb MoveBaseTemplate) String() string
func (MoveBaseTemplate) Target ¶
func (mb MoveBaseTemplate) Target() MoveTarget
func (MoveBaseTemplate) Type ¶
func (mb MoveBaseTemplate) Type() Type
func (*MoveBaseTemplate) UnmarshalJSON ¶
func (mbt *MoveBaseTemplate) UnmarshalJSON(msg []byte) error
type MoveModifier ¶
type MoveModifier interface {
ModifierType() string
}
type MoveRequirement ¶
type MoveRequirement Requirement
type MoveTarget ¶
type MoveTarget string
type RequestStatus ¶
type RequestStatus string
const ( ReqStatus_Pending RequestStatus = "pending" ReqStatus_Ok RequestStatus = "ok" ReqStatus_Declined RequestStatus = "declined" ReqStatus_Canceled RequestStatus = "canceled" )
type Requirement ¶
type Requirement struct { ID ID `json:"id"` Name string `json:"name"` Trigger string `json:"trigger"` Condition Condition `json:"condition"` }
func (Requirement) IsFulfilled ¶
func (r Requirement) IsFulfilled(m Monster) bool
func (*Requirement) UnmarshalJSON ¶
func (r *Requirement) UnmarshalJSON(data []byte) error
type Species ¶
type Species struct { Name string `json:"name"` Base Attributes `json:"attributeBase"` Types []Type `json:"types"` BaseExp Exp `json:"baseExp"` ExpCurve *ExpCurve `json:"expCurve"` MoveSet []Requirement `json:"moveSet"` Evolution []Requirement `json:"evolution"` // How many training modifier a monster gains, if it defeats a monster of this species TrainingModifier Attributes `json:"trainingModifier"` }
type StatusModifier ¶
func (StatusModifier) MarshalJSON ¶
func (d StatusModifier) MarshalJSON() ([]byte, error)
func (StatusModifier) ModifierType ¶
func (d StatusModifier) ModifierType() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Project OpenMonster Copyright (C) 2020 Kori This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
Project OpenMonster Copyright (C) 2020 Kori This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. |