``` docs(changelog): 更新变更日志记录 由于未提供具体的代码差异信息,此提交用于占位和记录变更日志的更新。 ``` 注意:由于您提供的code differences信息为空,无法生成具体的功能性commit message。请提供实际的代码差异内容以便生成准确的提交信息。
94 lines
2.0 KiB
Go
94 lines
2.0 KiB
Go
package model
|
||
|
||
import (
|
||
"blazing/common/data/xmlres"
|
||
"blazing/common/utils"
|
||
)
|
||
|
||
// 实现获取等级范围内可学习的技能
|
||
func (p *PetInfo) GetLevelRangeCanLearningSkills(from, to uint32) []uint32 {
|
||
|
||
var skills []uint32
|
||
|
||
for _, skillIDs := range xmlres.PetMAP[int(p.ID)].LearnableMoves.Moves {
|
||
|
||
if skillIDs.LearningLv >= from && skillIDs.LearningLv <= to {
|
||
skills = append(skills, skillIDs.ID)
|
||
}
|
||
}
|
||
return skills
|
||
}
|
||
|
||
// 计算HP面板值(无性格修正)
|
||
func (c *PetInfo) calculatePetHPPanelSize(base, dv, level, ev uint32) uint32 {
|
||
|
||
return uint32((float64(base)*2+float64(ev)/4.0+float64(dv))*(float64(level)/100.0) + float64(level) + 10)
|
||
}
|
||
|
||
// 计算其他属性面板值(带性格修正)
|
||
func (c *PetInfo) calculatePetPanelSize(base, ev uint32, level uint32, natureCorrect float64) uint32 {
|
||
|
||
base1 := float64((float64(base)*2+float64(ev)/4.0+float64(c.Dv))*(float64(level)/100.0) + 5)
|
||
return uint32(float64(base1) * natureCorrect)
|
||
}
|
||
|
||
// 计算生成面板,只允许第一次生成超过100,比如boss,不允许额外超过
|
||
func (p *PetInfo) CalculatePetPane(limit uint32) {
|
||
|
||
naxml := xmlres.NatureRootMap[int(p.Nature)]
|
||
petxml := xmlres.PetMAP[int(p.ID)]
|
||
// 计算各项属性
|
||
level := p.Level
|
||
if limit > 0 {
|
||
level = utils.Min(p.Level, 100)
|
||
}
|
||
p.MaxHp = p.calculatePetHPPanelSize(
|
||
uint32(petxml.HP),
|
||
p.Dv,
|
||
level,
|
||
p.Ev[0],
|
||
)
|
||
p.Hp = p.MaxHp
|
||
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
|
||
p.Prop[0] = p.calculatePetPanelSize(
|
||
uint32(petxml.Atk),
|
||
|
||
p.Ev[1],
|
||
level,
|
||
naxml.AttackCorrect,
|
||
)
|
||
|
||
p.Prop[1] = p.calculatePetPanelSize(
|
||
uint32(petxml.Def),
|
||
|
||
p.Ev[2],
|
||
level,
|
||
naxml.DefenseCorrect,
|
||
)
|
||
|
||
p.Prop[2] = p.calculatePetPanelSize(
|
||
uint32(petxml.SpAtk),
|
||
|
||
p.Ev[3],
|
||
level,
|
||
naxml.SaCorrect,
|
||
)
|
||
|
||
p.Prop[3] = p.calculatePetPanelSize(
|
||
uint32(petxml.SpDef),
|
||
|
||
p.Ev[4],
|
||
level,
|
||
naxml.SdCorrect,
|
||
)
|
||
|
||
p.Prop[4] = p.calculatePetPanelSize(
|
||
uint32(petxml.Spd),
|
||
|
||
p.Ev[5],
|
||
level,
|
||
naxml.SpeedCorrect,
|
||
)
|
||
|
||
}
|