def

package
v0.0.0-...-911e024 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRecallIntervals = RecallIntervalLevel{
	5 * minute,
	30 * minute,
	12 * hour,
	1 * day,
	2 * day,
	4 * day,
	week,
	2 * week,
	4 * week,
	8 * week,
	quarter,
}

DefaultRecallIntervals 艾宾浩斯记忆曲线的默认复习间隔策略

Functions

This section is empty.

Types

type AttackResult

type AttackResult string

AttackResult 表示攻击结果的类型

const (
	// AttackDefeat 表示攻击失败
	AttackDefeat AttackResult = "defeat"
	// AttackMiss 表示攻击未命中
	AttackMiss AttackResult = "miss"
	// AttackHit 表示攻击命中
	AttackHit AttackResult = "hit"
	// AttackKill 表示攻击致命
	AttackKill AttackResult = "kill"
	// AttackComplete 表示攻击完成
	AttackComplete AttackResult = "complete"
)

func (AttackResult) DamageRate

func (ar AttackResult) DamageRate() utils.Percentage

DamageRate 返回攻击结果对应的伤害百分比

type DifficultyLevel

type DifficultyLevel uint8
const (
	NoviceNormal    DifficultyLevel = 0x01
	NoviceAdvanced  DifficultyLevel = 0x02
	NoviceChallenge DifficultyLevel = 0x03

	AmateurNormal    DifficultyLevel = 0x11
	AmateurAdvanced  DifficultyLevel = 0x12
	AmateurChallenge DifficultyLevel = 0x13

	ProfessionalNormal    DifficultyLevel = 0x21
	ProfessionalAdvanced  DifficultyLevel = 0x22
	ProfessionalChallenge DifficultyLevel = 0x23

	ExpertNormal    DifficultyLevel = 0x31
	ExpertAdvanced  DifficultyLevel = 0x32
	ExpertChallenge DifficultyLevel = 0x33

	MasterNormal    DifficultyLevel = 0x41
	MasterAdvanced  DifficultyLevel = 0x42
	MasterChallenge DifficultyLevel = 0x43
	MasterExtreme   DifficultyLevel = 0x44
)

func (DifficultyLevel) Factor

func (d DifficultyLevel) Factor() float64

func (DifficultyLevel) Normalize

func (d DifficultyLevel) Normalize() float64

Normalize returns a normalized value between 0 and 1

func (*DifficultyLevel) String

func (d *DifficultyLevel) String() string

func (*DifficultyLevel) UnmarshalJSON

func (d *DifficultyLevel) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal the enum from a json string or number

type DungeonType

type DungeonType uint8 // 0 ~ 255
const (
	DungeonTypeCampaign DungeonType = 0x1  // 战役地牢
	DungeonTypeEndless  DungeonType = 0x2  // 无尽地牢
	DungeonTypeInstance DungeonType = 0x21 // 即时副本 (随机地牢)
)

func (*DungeonType) String

func (dt *DungeonType) String() string

func (*DungeonType) UnmarshalJSON

func (dt *DungeonType) UnmarshalJSON(data []byte) error

UnmarshalJSON custom unmarshaller to handle both strings and numbers

func (*DungeonType) Valid

func (dt *DungeonType) Valid() bool

type ImportanceLevel

type ImportanceLevel uint8
const (
	DomainGeneral   ImportanceLevel = 0x01
	DomainKey       ImportanceLevel = 0x02
	DomainEssential ImportanceLevel = 0x03

	AreaGeneral     ImportanceLevel = 0x11
	AreaKey         ImportanceLevel = 0x12
	AreaEssential   ImportanceLevel = 0x13
	AreaMasterPiece ImportanceLevel = 0x14

	GlobalGeneral     ImportanceLevel = 0x21
	GlobalKey         ImportanceLevel = 0x22
	GlobalEssential   ImportanceLevel = 0x23
	GlobalMasterPiece ImportanceLevel = 0x24
)

func (ImportanceLevel) Normalize

func (i ImportanceLevel) Normalize() float64

Normalize returns a normalized value between 0 and 1

func (*ImportanceLevel) String

func (i *ImportanceLevel) String() string

func (*ImportanceLevel) UnmarshalJSON

func (i *ImportanceLevel) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal the enum from a json string or number

type PriorityMode

type PriorityMode []PriorityModeSetting

PriorityMode - 复习时的出场顺序

func (*PriorityMode) Scan

func (r *PriorityMode) Scan(value any) error

Scan 实现 sql.Scanner 接口

func (PriorityMode) Value

func (r PriorityMode) Value() (driver.Value, error)

Value 实现 driver.Valuer 接口

type PriorityModeSetting

type PriorityModeSetting string

PriorityModeSetting - 复习时的出场顺序

const (
	// PriorityModeFamiliarityASC - 熟练度: 生疏优先
	PriorityModeFamiliarityASC PriorityModeSetting = "familiarity_asc"
	// PriorityModeFamiliarityDESC - 熟练度: 熟悉优先
	PriorityModeFamiliarityDESC PriorityModeSetting = "familiarity_desc"

	// PriorityModeTimePassDESC - 近远期: 近期优先
	PriorityModeTimePassDESC PriorityModeSetting = "time_pass_desc"
	// PriorityModeTimePassASC - 近远期: 远期优先
	PriorityModeTimePassASC PriorityModeSetting = "time_pass_asc"

	// PriorityModeDifficultyASC - 难度: 简单优先
	PriorityModeDifficultyASC PriorityModeSetting = "difficulty_asc"
	// PriorityModeDifficultyDESC - 难度: 困难优先
	PriorityModeDifficultyDESC PriorityModeSetting = "difficulty_desc"

	// PriorityModeRelatedASC - 关联度: 关联度高的优先
	PriorityModeRelatedASC PriorityModeSetting = "related_asc"
	// PriorityModeImportanceASC - 重要度: 重要程度高的优先
	PriorityModeImportanceASC PriorityModeSetting = "importance_asc"
	// PriorityModeShuffle - 是否打乱, 不打乱就默认按 DB 顺序
	PriorityModeShuffle PriorityModeSetting = "shuffle"
)

type QuizMode

type QuizMode string

QuizMode 决定了如何处理 familiarity 为 0 的项

const (
	// QuizModeAlwaysNew - always_new: 优先学新 (总是先选 familiarity 为 0 的)
	QuizModeAlwaysNew QuizMode = "always_new" // 总是优先复习,但从熟练度低的开始
	// QuizModeAlwaysOld - always_old: 优先复习 (总是先选 familiarity 不为 0 的)
	QuizModeAlwaysOld QuizMode = "always_old" //
	// QuizModeBalance - balance: 平衡随机 (先选 familiarity 不为 0 的,但一定概率会选中 familiarity 为 0 的)
	QuizModeBalance QuizMode = "balance" //
	// QuizModeThreshold - threshold: 阀门 (根据 familiarity 不为 0 的数量决定,familiarity 不为 0 的项超过一定数量时,优先复习 familiarity 为 0 的项)
	QuizModeThreshold QuizMode = "threshold" //
	// QuizModeDynamic - dynamic: 动态调权 (根据当天加入 familiarity 为 0 的数量决定,保证至少学习一定数量的新项)
	QuizModeDynamic QuizMode = "dynamic" //

)

type RecallIntervalLevel

type RecallIntervalLevel []time.Duration

RecallIntervalLevel 定义了复习间隔的级别 @Description RecallIntervalLevel is a slice of durations in Go duration format (e.g., '1h30m')

func (RecallIntervalLevel) GetInterval

func (r RecallIntervalLevel) GetInterval(familiarity utils.Percentage) time.Duration

GetInterval 根据熟练度选择命中哪一个 interval 配置

func (RecallIntervalLevel) MarshalJSON

func (r RecallIntervalLevel) MarshalJSON() ([]byte, error)

MarshalJSON 实现 JSON 序列化

func (*RecallIntervalLevel) Scan

func (r *RecallIntervalLevel) Scan(value any) error

Scan 实现 sql.Scanner 接口

func (*RecallIntervalLevel) UnmarshalJSON

func (r *RecallIntervalLevel) UnmarshalJSON(data []byte) error

UnmarshalJSON 实现 JSON 反序列化

func (RecallIntervalLevel) Value

func (r RecallIntervalLevel) Value() (driver.Value, error)

Value 实现 driver.Valuer 接口

Jump to

Keyboard shortcuts

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