fix(fight): 战斗修改
This commit is contained in:
@@ -2,6 +2,7 @@ package input
|
||||
|
||||
import (
|
||||
"blazing/common/data/xmlres"
|
||||
|
||||
"blazing/logic/service/common"
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
@@ -15,8 +16,8 @@ type Input struct {
|
||||
CurrentPet *info.BattlePetEntity //当前精灵
|
||||
AllPet []*info.BattlePetEntity
|
||||
Player common.PlayerI
|
||||
|
||||
Finished bool //是否加载完成
|
||||
Opp *Input
|
||||
Finished bool //是否加载完成
|
||||
*info.AttackValue
|
||||
FightC common.FightI
|
||||
// info.BattleActionI
|
||||
@@ -52,30 +53,35 @@ func NewInput(c common.FightI, p common.PlayerI) *Input {
|
||||
return ret
|
||||
|
||||
}
|
||||
func (i *Input) GetPetInfo() *info.BattlePetEntity {
|
||||
func (our *Input) GetPetInfo() *info.BattlePetEntity {
|
||||
|
||||
return i.CurrentPet
|
||||
return our.CurrentPet
|
||||
|
||||
}
|
||||
func (input *Input) GenSataus() {
|
||||
func (our *Input) SetOPP(t *Input) {
|
||||
|
||||
our.Opp = t
|
||||
|
||||
}
|
||||
func (our *Input) GenSataus() {
|
||||
|
||||
for i := 0; i < 20; i++ { //堆叠状态剩余回合
|
||||
|
||||
t := input.GetEffect(EffectType.Status, i)
|
||||
t := our.GetEffect(EffectType.Status, i)
|
||||
|
||||
if t != nil && t.Alive() { //状态都是叠层类的
|
||||
|
||||
input.Status[i] = int8(t.Duration())
|
||||
our.Status[i] = int8(t.Duration())
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
func (input *Input) GenInfo() {
|
||||
func (our *Input) GenInfo() {
|
||||
|
||||
input.RemainHp = int32(input.CurrentPet.Info.Hp)
|
||||
input.SkillList = input.CurrentPet.Info.SkillList
|
||||
our.RemainHp = int32(our.CurrentPet.Info.Hp)
|
||||
our.SkillList = our.CurrentPet.Info.SkillList
|
||||
|
||||
// f.Second.SkillList = f.Second.CurrentPet.Info.SkillList
|
||||
// f.Second.RemainHp = int32(f.Second.CurrentPet.Info.Hp)
|
||||
@@ -83,24 +89,24 @@ func (input *Input) GenInfo() {
|
||||
// ret.SAttack = *f.Second.AttackValue
|
||||
|
||||
}
|
||||
func (i *Input) ResetAttackValue() {
|
||||
i.AttackValue.SkillID = 0
|
||||
i.AttackValue.IsCritical = 0
|
||||
i.AttackValue.GainHp = 0
|
||||
i.AttackValue.LostHp = 0
|
||||
func (our *Input) ResetAttackValue() {
|
||||
our.AttackValue.SkillID = 0
|
||||
our.AttackValue.IsCritical = 0
|
||||
our.AttackValue.GainHp = 0
|
||||
our.AttackValue.LostHp = 0
|
||||
|
||||
}
|
||||
|
||||
// 这个每回合都会调用
|
||||
func (i *Input) InitAttackValue() {
|
||||
i.AttackValue = info.NewAttackValue(i.Player.GetInfo().UserID)
|
||||
func (our *Input) InitAttackValue() {
|
||||
our.AttackValue = info.NewAttackValue(our.Player.GetInfo().UserID)
|
||||
|
||||
}
|
||||
func (i *Input) GetPet(id uint32) (ii *info.BattlePetEntity, Reason info.ChangePetInfo) {
|
||||
for _, v := range i.AllPet {
|
||||
func (our *Input) GetPet(id uint32) (ii *info.BattlePetEntity, Reason info.ChangePetInfo) {
|
||||
for _, v := range our.AllPet {
|
||||
if v.Info.CatchTime == uint32(id) {
|
||||
copier.Copy(&Reason, &v.Info)
|
||||
Reason.UserId = i.Player.GetInfo().UserID
|
||||
Reason.UserId = our.Player.GetInfo().UserID
|
||||
|
||||
ii = v
|
||||
}
|
||||
@@ -112,7 +118,7 @@ func (i *Input) GetPet(id uint32) (ii *info.BattlePetEntity, Reason info.ChangeP
|
||||
|
||||
// GetStatusBonus 获取最高的状态倍率
|
||||
// 遍历状态数组,返回存在的状态中最高的倍率(无状态则返回1.0)
|
||||
func (i *Input) GetStatusBonus() float64 {
|
||||
func (our *Input) GetStatusBonus() float64 {
|
||||
// 异常状态倍率映射表(状态索引 -> 倍率)
|
||||
var statusBonuses = map[info.EnumBattleStatus]float64{
|
||||
info.PetStatus.Paralysis: 1.5,
|
||||
@@ -136,15 +142,15 @@ func (i *Input) GetStatusBonus() float64 {
|
||||
return maxBonus
|
||||
}
|
||||
|
||||
func (i *Input) initeffectcache() {
|
||||
i.EffectCache = make([]Effect, 0) //先把上一回合数据清空,但是应该把本身延续类效果集成过来
|
||||
func (our *Input) initeffectcache() {
|
||||
our.EffectCache = make([]Effect, 0) //先把上一回合数据清空,但是应该把本身延续类效果集成过来
|
||||
|
||||
for _, v := range i.Effects {
|
||||
for _, v := range our.Effects {
|
||||
|
||||
if v.Alive() { //说明存活效果而且是延续类效果,将之添加到初始化列表中
|
||||
|
||||
//这里添加的效果是已经生效的效果对effect的复制,相当于技能施的效果的前置比如改命中的效果等
|
||||
i.EffectCache = append(i.EffectCache, v)
|
||||
our.EffectCache = append(our.EffectCache, v)
|
||||
|
||||
}
|
||||
|
||||
@@ -153,8 +159,8 @@ func (i *Input) initeffectcache() {
|
||||
}
|
||||
|
||||
// 解析并 施加effect
|
||||
func (i *Input) Parseskill(defender *Input, skill *action.SelectSkillAction) {
|
||||
i.initeffectcache() //这里说明是延续的效果,每次复制出来一个新的就好了
|
||||
func (our *Input) Parseskill(defender *Input, skill *action.SelectSkillAction) {
|
||||
our.initeffectcache() //这里说明是延续的效果,每次复制出来一个新的就好了
|
||||
//i.NewEffects = make([]Effect, 0) //这里说明是新增的效果
|
||||
temparg := skill.SideEffectArgS
|
||||
|
||||
@@ -165,7 +171,7 @@ func (i *Input) Parseskill(defender *Input, skill *action.SelectSkillAction) {
|
||||
args := xmlres.EffectArgs[v]
|
||||
//这里是给双方添加buff
|
||||
if t != nil {
|
||||
t.SetArgs(i, temparg[:args]...) //设置入参,施加方永远是我方
|
||||
t.SetArgs(our, temparg[:args]...) //设置入参,施加方永远是我方
|
||||
|
||||
// if t.Owner() { //如果取反,说明是给对方添加的回合效果
|
||||
// //实际上,owner永远为反,说明是对方给我添加的
|
||||
@@ -178,7 +184,7 @@ func (i *Input) Parseskill(defender *Input, skill *action.SelectSkillAction) {
|
||||
// }
|
||||
//这里是临时缓存buff,后面确认命中后修改HIT状态
|
||||
// t.Alive() //先让效果保持存活
|
||||
i.EffectCache = append(i.EffectCache, t)
|
||||
our.EffectCache = append(our.EffectCache, t)
|
||||
// i.NewEffects = append(i.NewEffects, t)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user