```
fix(fight): 修复效果持续时间设置错误和命中计算参数类型问题 - 修正Effect461中Duration参数从-1改为1,解决持续时间异常问题 - 删除Effect486文件,移除废弃的效果实现 - 修正processSkillAttack中AttackTimeC参数类型,从int转为正确类型 - 在copySkill中添加Accuracy属性复制,解决技能命中丢失问题 - 修正CalculateRealValue函数stat参数类型从int改为int8 - 修正AttackTimeC和GetAccuracy函数level参数类型从int改为int8 - 优化Get
This commit is contained in:
@@ -27,7 +27,7 @@ func (e *Effect461) Skill_Use() bool {
|
||||
}
|
||||
func (e *Effect461) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.EffectNode.Duration(-1) // 持续n回合
|
||||
e.EffectNode.Duration(1) // 持续n回合
|
||||
}
|
||||
func (e *Effect461) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
if !e.can {
|
||||
|
||||
@@ -8,14 +8,29 @@ import (
|
||||
// 486 - 下n回合若自身选择使用技能则无视对手能力提升状态
|
||||
type Effect486 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect486) OnSkill() bool {
|
||||
// 设置标志,接下来n回合内无视对手能力提升
|
||||
e.Ctx().Our.IgnoreOpponentPositiveBuffsForNDuration(int(e.Args()[0].IntPart()))
|
||||
func (e *Effect486) Skill_Use() bool {
|
||||
e.can = true
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect486) CalculatePre() bool {
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Opp.Prop = [6]int8{}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect486) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 486, &Effect486{})
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
// processSkillAttack 处理技能攻击逻辑
|
||||
func (f *FightC) processSkillAttack(attacker, defender *input.Input, skill *info.SkillEntity) {
|
||||
skill.AttackTimeC(int(attacker.Prop[5])) //计算命中
|
||||
skill.AttackTimeC(attacker.Prop[5]) //计算命中
|
||||
|
||||
defender.Exec(func(effect input.Effect) bool { //计算闪避,然后修改对方命中),同时相当于计算属性无效这种
|
||||
effect.Ctx().SkillEntity = skill
|
||||
@@ -112,8 +112,9 @@ func (f *FightC) copySkill(action *action.SelectSkillAction) *info.SkillEntity {
|
||||
return nil
|
||||
}
|
||||
|
||||
originalSkill, _ := deepcopy.Anything(action.SkillEntity) //备份技能
|
||||
originalSkill.(*info.SkillEntity).Rand = f.rand //拷贝后随机数丢失
|
||||
originalSkill, _ := deepcopy.Anything(action.SkillEntity) //备份技能
|
||||
originalSkill.(*info.SkillEntity).Rand = f.rand //拷贝后随机数丢失
|
||||
originalSkill.(*info.SkillEntity).Accuracy = action.SkillEntity.Accuracy //拷贝后命中丢失
|
||||
return originalSkill.(*info.SkillEntity)
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ func CreateBattlePetEntity(info model.PetInfo, rand *rand.Rand) *BattlePetEntity
|
||||
// value 基础属性值
|
||||
// stat 状态变化值(可正可负)
|
||||
// 返回// 返回计算后的实际属性值,确保结果至少为1
|
||||
func CalculateRealValue(value alpacadecimal.Decimal, stat1 int) alpacadecimal.Decimal {
|
||||
func CalculateRealValue(value alpacadecimal.Decimal, stat1 int8) alpacadecimal.Decimal {
|
||||
if stat1 == 0 {
|
||||
|
||||
return value
|
||||
|
||||
@@ -77,6 +77,7 @@ func CreateSkill(skill *model.SkillInfo, rand *rand.Rand, pet *BattlePetEntity)
|
||||
ret.XML = move
|
||||
}
|
||||
ret.Accuracy = alpacadecimal.NewFromInt(int64(move.Accuracy))
|
||||
println(ret.Accuracy.IntPart())
|
||||
ret.Info = skill
|
||||
|
||||
return &ret
|
||||
@@ -170,7 +171,7 @@ func getSkillName(move *SkillEntity) string {
|
||||
// }
|
||||
|
||||
// 计算是否命中
|
||||
func (s *SkillEntity) AttackTimeC(level int) uint32 {
|
||||
func (s *SkillEntity) AttackTimeC(level int8) uint32 {
|
||||
s.AttackTime = 0 //先重置上一次的
|
||||
|
||||
if s.XML.MustHit != 0 {
|
||||
@@ -230,10 +231,11 @@ func (s *SkillEntity) Criticalrandom() alpacadecimal.Decimal {
|
||||
}
|
||||
|
||||
// Accuracy 优化版命中率计算(用绝对值和正负判断处理等级)
|
||||
func (a *SkillEntity) GetAccuracy(level int) alpacadecimal.Decimal {
|
||||
func (a *SkillEntity) GetAccuracy(level int8) alpacadecimal.Decimal {
|
||||
// 基础参数校验
|
||||
|
||||
if level >= 0 { //强化等级
|
||||
// println(a.Accuracy.IntPart(), "命中")
|
||||
return CalculateRealValue((a.Accuracy), level)
|
||||
}
|
||||
var temp float64
|
||||
|
||||
@@ -93,11 +93,9 @@ func (our *Input) InitEffect(etype EnumEffectType, id int, a ...int) Effect {
|
||||
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
|
||||
// 是否需要真实提升
|
||||
func (our *Input) GetProp(id int) int {
|
||||
// 获取基础属性值
|
||||
baseValue := int(our.AttackValue.Prop[id])
|
||||
|
||||
// 计算实际值(这里可以插入后续优化的函数调用)
|
||||
realValue := info.CalculateRealValue(alpacadecimal.NewFromInt(int64(our.CurrentPet.Info.Prop[id])), baseValue)
|
||||
realValue := info.CalculateRealValue(alpacadecimal.NewFromInt(int64(our.CurrentPet.Info.Prop[id])), our.AttackValue.Prop[id])
|
||||
|
||||
// todo: 插入获取后处理函数,例如:
|
||||
// realValue = postProcessValue(realValue, id, c)
|
||||
|
||||
Reference in New Issue
Block a user