feat: 添加宠物训练加成效果
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -2,6 +2,7 @@ package effect
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"blazing/logic/service/fight/action"
|
"blazing/logic/service/fight/action"
|
||||||
|
"blazing/logic/service/fight/info"
|
||||||
"blazing/logic/service/fight/input"
|
"blazing/logic/service/fight/input"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -70,6 +71,29 @@ func (e *NewSel247) TurnEnd() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NewSel239 struct {
|
||||||
|
NewSel0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *NewSel239) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||||
|
if !e.IsOwner() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if e.Ctx().SkillEntity == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if len(e.Args()) == 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Ctx().SkillEntity.XML.Power += int(e.Args()[0].IntPart())
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
input.InitEffect(input.EffectType.NewSel, 239, &NewSel239{})
|
||||||
input.InitEffect(input.EffectType.NewSel, 247, &NewSel247{})
|
input.InitEffect(input.EffectType.NewSel, 247, &NewSel247{})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,6 +388,11 @@ const (
|
|||||||
maxHPUpEffectStatus byte = 8
|
maxHPUpEffectStatus byte = 8
|
||||||
maxHPUpEffectEID uint16 = 26
|
maxHPUpEffectEID uint16 = 26
|
||||||
maxHPUpEffectCap = 20
|
maxHPUpEffectCap = 20
|
||||||
|
trainingEffectStatus byte = 5
|
||||||
|
trainingAttrEffectIdx uint16 = 60001
|
||||||
|
trainingPowerEffectIdx uint16 = 60002
|
||||||
|
trainingAttrEffectEID uint16 = 247
|
||||||
|
trainingPowerEffectEID uint16 = 239
|
||||||
)
|
)
|
||||||
|
|
||||||
// 繁殖加成,体力提升加成 ,这里是防止和其他重复所以定义不同类别,但是实际上,能量珠那些事调用不同id的effect实现
|
// 繁殖加成,体力提升加成 ,这里是防止和其他重复所以定义不同类别,但是实际上,能量珠那些事调用不同id的effect实现
|
||||||
@@ -400,6 +405,56 @@ func (pet *PetInfo) GetEffect(ptype int) (int, *PetEffectInfo, bool) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (pet *PetInfo) getEffectByStatusAndEID(status byte, eid uint16) (int, *PetEffectInfo, bool) {
|
||||||
|
return utils.FindWithIndex(pet.EffectInfo, func(item PetEffectInfo) bool {
|
||||||
|
return item.Status == status && item.EID == eid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func ensureEffectArgsLen(args []int, size int) []int {
|
||||||
|
if len(args) >= size {
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
next := make([]int, size)
|
||||||
|
copy(next, args)
|
||||||
|
return next
|
||||||
|
}
|
||||||
|
|
||||||
|
func (pet *PetInfo) addTrainingEffectDelta(idx uint16, eid uint16, argsLen int, argIndex int, value int) bool {
|
||||||
|
if pet == nil || value <= 0 || argIndex < 0 || argIndex >= argsLen {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, eff, ok := pet.getEffectByStatusAndEID(trainingEffectStatus, eid); ok {
|
||||||
|
if eff.Idx == 0 {
|
||||||
|
eff.Idx = idx
|
||||||
|
}
|
||||||
|
eff.Status = trainingEffectStatus
|
||||||
|
eff.EID = eid
|
||||||
|
eff.Args = ensureEffectArgsLen(eff.Args, argsLen)
|
||||||
|
eff.Args[argIndex] += value
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
args := make([]int, argsLen)
|
||||||
|
args[argIndex] = value
|
||||||
|
pet.EffectInfo = append(pet.EffectInfo, PetEffectInfo{
|
||||||
|
Idx: idx,
|
||||||
|
Status: trainingEffectStatus,
|
||||||
|
EID: eid,
|
||||||
|
Args: args,
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (pet *PetInfo) AddTrainingAttrBonus(attr int, value int) bool {
|
||||||
|
return pet.addTrainingEffectDelta(trainingAttrEffectIdx, trainingAttrEffectEID, 6, attr, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (pet *PetInfo) AddTrainingPowerBonus(value int) bool {
|
||||||
|
return pet.addTrainingEffectDelta(trainingPowerEffectIdx, trainingPowerEffectEID, 2, 0, value)
|
||||||
|
}
|
||||||
|
|
||||||
func (pet *PetInfo) AddMaxHPUpEffect(itemID uint32, value int) bool {
|
func (pet *PetInfo) AddMaxHPUpEffect(itemID uint32, value int) bool {
|
||||||
if pet == nil || value <= 0 {
|
if pet == nil || value <= 0 {
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user