refactor(logic): 优化战斗状态效果持续时间计算及清理冗余代码
This commit is contained in:
@@ -39,14 +39,14 @@ func (h Controller) AddTaskBuf(data *task.AddTaskBufInboundInfo, c *player.Playe
|
||||
// if data.Head.CMD != 2204 { //判断是每日任务
|
||||
// isdaliy = true
|
||||
// }
|
||||
result = &task.AddTaskBufOutboundInfo{}
|
||||
|
||||
|
||||
c.Service.Task(data.TaskId, func(te *model.TaskEX) bool {
|
||||
te.Data = data.TaskList
|
||||
return true
|
||||
})
|
||||
|
||||
return &task.AddTaskBufOutboundInfo{}, 0
|
||||
return result, 0
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -565,11 +565,11 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) {
|
||||
t := f.First.GetEffect(input.EffectType.Status, i)
|
||||
|
||||
if t != nil { //状态都是叠层类的
|
||||
ret.FAttack.Status[i] = int8(t.Duration())
|
||||
ret.FAttack.Status[i] = int8(t.Duration()) + 1
|
||||
}
|
||||
t = f.Second.GetEffect(input.EffectType.Status, i)
|
||||
if t != nil {
|
||||
ret.SAttack.Status[i] = int8(t.Duration())
|
||||
ret.SAttack.Status[i] = int8(t.Duration()) + 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ func (i *Input) CalculatePower(deftype *Input, skill *info.SkillEntity) decimal.
|
||||
Add(decimal.NewFromInt(2))
|
||||
|
||||
var typeRate decimal.Decimal
|
||||
fmt.Println(skill.Type().ID, deftype.CurrentPet.Type().ID)
|
||||
//fmt.Println(skill.Type().ID, deftype.CurrentPet.Type().ID)
|
||||
t, _ := element.NewElementCalculator().GetOffensiveMultiplier(skill.Type().ID, deftype.CurrentPet.Type().ID)
|
||||
|
||||
typeRate = decimal.NewFromFloat(t)
|
||||
|
||||
@@ -56,6 +56,7 @@ func (i *Input) GetPetInfo() *info.BattlePetEntity {
|
||||
}
|
||||
func (i *Input) ResetAttackValue() {
|
||||
i.AttackValue.SkillID = 0
|
||||
i.AttackValue.IsCritical = 0
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
|
||||
|
||||
_ "blazing/contrib/drivers/pgsql"
|
||||
"blazing/modules/base/service"
|
||||
|
||||
_ "blazing/contrib/files/local"
|
||||
|
||||
@@ -27,11 +22,10 @@ import (
|
||||
"blazing/login/internal/cmd"
|
||||
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
service.TestSendVerificationCode()
|
||||
//service.TestSendVerificationCode()
|
||||
cmd.Main.Run(gctx.New())
|
||||
}
|
||||
|
||||
@@ -47,23 +41,3 @@ func kick(id int) {
|
||||
// fmt.Println(err)
|
||||
// }()
|
||||
}
|
||||
|
||||
type ssss struct {
|
||||
ttt int `cmd:"111|222"`
|
||||
}
|
||||
|
||||
func Test_kick() {
|
||||
value := reflect.ValueOf(ssss{})
|
||||
|
||||
// 获取类型
|
||||
typ := value.Type()
|
||||
// 遍历结构体字段
|
||||
// fmt.Printf("结构体 %s 的字段信息:\n", t.Name())
|
||||
for i := 0; i < typ.NumField(); i++ {
|
||||
field := typ.Field(i)
|
||||
t := field.Tag.Get("cmd")
|
||||
//t1 := strings.Split(t, "|")
|
||||
t2 := gconv.SliceUint32(strings.Split(t, "|"))
|
||||
fmt.Println(t2)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user