model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttackSkill

type AttackSkill interface {
	Skill
	Cost() Cost
	BaseDamage(targetCharacter, senderCharacter uint64, backgroundCharacters []uint64) *context.DamageContext
}

type BaseEntity

type BaseEntity interface {
	TypeID() uint64
	InjectTypeID(id uint64)
}

BaseEntity 实体的基本接口,包含被框架托管的必须方法

type Card

type Card interface {
	BaseEntity
	Type() enum.CardType
	Cost() map[enum.ElementType]uint
}

type Character

type Character interface {
	GetID() (id uint64)
	GetOwner() (owner uint64)
	GetAffiliation() (affiliation enum.Affiliation)
	GetVision() (element enum.ElementType)
	GetWeaponType() (weaponType enum.WeaponType)
	GetSkills() (skills []uint64)
	GetHP() (hp uint)
	GetMaxHP() (maxHP uint)
	GetMP() (mp uint)
	GetMaxMP() (maxMP uint)
	GetEquipment(equipmentType enum.EquipmentType) (equipped bool, equipment uint64)
	GetSatiety() (satiety bool)
	GetAttachedElements() (elements []enum.ElementType)
	GetStatus() (status enum.CharacterStatus)
	GetLocalModifiers(modifierType enum.ModifierType) (modifiers []uint64)
}

Character 供外部包调用的角色接口

type CooperativeSkill

type CooperativeSkill interface {
	Skill
	BaseDamage() *context.DamageContext
	EffectLeft() uint
	Effective() bool
}

type Cost

type Cost struct {
	// contains filtered or unexported fields
}

func NewCost

func NewCost() *Cost

NewCost 创建一个空Cost

func NewCostFromMap

func NewCostFromMap(m map[enum.ElementType]uint) *Cost

NewCostFromMap 从一个map创建Cost

func NewRandomCost

func NewRandomCost(elementAmount uint) *Cost

NewRandomCost 创建一个随机费用的Cost

func (*Cost) Add

func (c *Cost) Add(other Cost)

Add 想Cost中增加other中的所有元素骰子,不含等价判断

func (Cost) Contains

func (c Cost) Contains(other Cost) bool

Contains 判断Cost中是否包含other中的所有元素,含等价判断

func (Cost) Costs

func (c Cost) Costs() map[enum.ElementType]uint

func (Cost) Equals

func (c Cost) Equals(other Cost) bool

Equals 判断Cost中的元素是否和other中的元素完全等价

func (*Cost) Pay

func (c *Cost) Pay(other Cost)

Pay 从Cost中减去other中的元素骰子,不含等价判断

func (Cost) Total

func (c Cost) Total() uint

type EquipmentCard

type EquipmentCard interface {
	Card
	EquipmentType() enum.EquipmentType
	Modify() (event Event)
}

func ConvertToEquipmentCard

func ConvertToEquipmentCard(original Card) (success bool, result EquipmentCard)

type Event

type Event interface {
	BaseEntity
	TriggerAt() enum.TriggerType
	CanTriggered(context.CallbackContext) bool
	NeedClear() bool
	Callback(*context.CallbackContext)
}

type EventCard

type EventCard interface {
	Card
	Event() (event Event)
}

func ConvertToEventCard

func ConvertToEventCard(original Card) (success bool, result EventCard)

type GameOptions

type GameOptions struct {
	ReRollTimes uint                      // ReRollTimes 所有玩家的基础可重掷次数
	StaticCost  map[enum.ElementType]uint // StaticCost 所有玩家的基础固定持有骰子
	RollAmount  uint                      // RollAmount 所有玩家的投掷阶段生成元素骰子数量
	GetCards    uint                      // GetCards 所有玩家在回合开始时可以获得的卡牌数量
	SwitchCost  map[enum.ElementType]uint // SwitchCost 切换角色所需要的消费
}

type PassiveSkill

type PassiveSkill interface {
}

type Player

type Player interface {
	GetUID() (uid uint64)
	GetCost() (cost map[enum.ElementType]uint)
	GetCards() (cards []uint64)
	GetSummons() (summons []uint64)
	GetSupports() (supports []uint64)
	CardDeckRemain() (remain uint)
	GetActiveCharacter() (character uint64)
	GetBackgroundCharacters() (characters []uint64)
	GetCharacter(character uint64) (has bool, entity Character)
	GetStatus() (status enum.PlayerStatus)
	GetGlobalModifiers(modifierType enum.ModifierType) (modifiers []uint64)
	GetCooperativeSkills(trigger enum.TriggerType) (skills []uint64)
	GetEvents(trigger enum.TriggerType) (events []uint64)
}

Player 供外部包调用的玩家接口

type ReactionCalculator

type ReactionCalculator interface {
	// ReactionCalculate 计算当前角色身上附着的元素之间能否发生反应,返回反应类型和剩余元素
	ReactionCalculate([]enum.ElementType) (reaction enum.Reaction, elementRemains []enum.ElementType)

	// DamageCalculate 根据反应类型计算对应的伤害修正
	DamageCalculate(reaction enum.Reaction, targetCharacter Character, ctx *context.DamageContext)

	// EffectCalculate 根据反应类型计算对应的反应效果
	EffectCalculate(reaction enum.Reaction, targetPlayer Player) (ctx *context.CallbackContext)

	// Attach 尝试让新元素附着在现有元素集合内,此时不触发元素反应,返回尝试附着后的元素集合
	Attach(originalElements []enum.ElementType, newElement enum.ElementType) (resultElements []enum.ElementType)

	// Relative 判断某种反应是否是某元素的相关反应
	Relative(reaction enum.Reaction, relativeElement enum.ElementType) bool
}

type RuleSet

type RuleSet struct {
	ID                 uint64
	ReactionCalculator ReactionCalculator
	VictorCalculator   VictorCalculator
}

func (RuleSet) ImplementationCheck

func (r RuleSet) ImplementationCheck() bool

type Skill

type Skill interface {
	BaseEntity
	Type() enum.SkillType
}

type SupportCard

type SupportCard interface {
	Card
	Support() (event Event)
}

func ConvertToSupportCard

func ConvertToSupportCard(original Card) (success bool, result SupportCard)

type VictorCalculator

type VictorCalculator interface {
	// CalculateVictors 计算游戏的胜利者
	CalculateVictors(players []Player) (has bool, victors []Player)
}

type WeaponCard

type WeaponCard interface {
	EquipmentCard
	WeaponType() enum.WeaponType
}

Jump to

Keyboard shortcuts

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