skill

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PriorityProtect  = 100 // 守卫技能
	PriorityKill     = 200 // 狼人杀人
	PriorityAntidote = 300 // 女巫救人
	PriorityPoison   = 400 // 女巫毒人
	PriorityCheck    = 500 // 预言家查验
	PriorityHunter   = 600 // 猎人技能(被动)

	PriorityLastWords = 100 // 遗言
	PrioritySpeak     = 200 // 普通发言

	PriorityVote = 100 // 投票
)

技能优先级常量

Variables

This section is empty.

Functions

This section is empty.

Types

type Antidote

type Antidote struct {
	*BaseSkill
	Used bool // 是否已使用(全局只能用一次)
}

Antidote 女巫解药技能

func NewAntidote

func NewAntidote() *Antidote

NewAntidote 创建女巫解药技能

func (*Antidote) IsUsed

func (a *Antidote) IsUsed() bool

IsUsed 检查解药是否已使用

func (*Antidote) MarkUsed

func (a *Antidote) MarkUsed()

MarkUsed 标记解药已使用

type BaseSkill

type BaseSkill struct {
	Name        werewolf.SkillType
	Phase       werewolf.PhaseType
	Priority    int
	MultipleUse bool
	NeedsTarget bool
}

BaseSkill 基础技能实现

func (*BaseSkill) CanUseMultipleTimes

func (s *BaseSkill) CanUseMultipleTimes() bool

CanUseMultipleTimes 技能是否可以多次使用

func (*BaseSkill) GetName

func (s *BaseSkill) GetName() werewolf.SkillType

GetName 获取技能名称

func (*BaseSkill) GetPhase

func (s *BaseSkill) GetPhase() werewolf.PhaseType

GetPhase 获取技能使用阶段

func (*BaseSkill) GetPriority

func (s *BaseSkill) GetPriority() int

GetPriority 获取技能优先级

func (*BaseSkill) RequiresTarget

func (s *BaseSkill) RequiresTarget() bool

RequiresTarget 技能是否需要目标

type Check

type Check struct {
	*BaseSkill
}

Check 预言家查验技能

func NewCheck

func NewCheck() *Check

NewCheck 创建预言家查验技能

type Factory

type Factory struct{}

Factory 技能工厂

func NewFactory

func NewFactory() *Factory

NewFactory 创建技能工厂

func (*Factory) Create

func (f *Factory) Create(skillType werewolf.SkillType) (Skill, error)

Create 根据技能类型创建技能

func (*Factory) CreateSkillsForRole

func (f *Factory) CreateSkillsForRole(roleType werewolf.RoleType) []Skill

CreateSkillsForRole 为指定角色创建技能列表

type Kill

type Kill struct {
	*BaseSkill
}

Kill 狼人杀人技能

func NewKill

func NewKill() *Kill

NewKill 创建狼人杀人技能

type Poison

type Poison struct {
	*BaseSkill
	Used bool // 是否已使用(全局只能用一次)
}

Poison 女巫毒药技能

func NewPoison

func NewPoison() *Poison

NewPoison 创建女巫毒药技能

func (*Poison) IsUsed

func (p *Poison) IsUsed() bool

IsUsed 检查毒药是否已使用

func (*Poison) MarkUsed

func (p *Poison) MarkUsed()

MarkUsed 标记毒药已使用

type Protect

type Protect struct {
	*BaseSkill
}

Protect 守卫守护技能

func NewProtect

func NewProtect() *Protect

NewProtect 创建守卫守护技能

type Skill

type Skill interface {
	// GetName 获取技能名称
	GetName() werewolf.SkillType

	// GetPhase 获取技能使用阶段
	GetPhase() werewolf.PhaseType

	// GetPriority 获取技能优先级
	GetPriority() int

	// CanUseMultipleTimes 技能是否可以多次使用
	CanUseMultipleTimes() bool

	// RequiresTarget 技能是否需要目标
	RequiresTarget() bool
}

Skill 技能接口(简化版,无 Player 依赖) 只提供技能的元数据信息,实际执行逻辑在 Phase 中

type Speak

type Speak struct {
	*BaseSkill
}

Speak 发言技能(所有角色都有)

func NewSpeak

func NewSpeak() *Speak

NewSpeak 创建发言技能

type Vote

type Vote struct {
	*BaseSkill
}

Vote 投票技能(所有角色都有)

func NewVote

func NewVote() *Vote

NewVote 创建投票技能

Jump to

Keyboard shortcuts

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