`` refactor(fight): 重构状态效果处理逻辑,统一使用Skill_Hit_Pre方法并修复回合开始触发时机``
待实现寄生种子
This commit is contained in:
@@ -18,7 +18,8 @@ type StatusNotSkill struct {
|
||||
EffectStatus
|
||||
}
|
||||
|
||||
func (e *StatusNotSkill) CanSkill(opp *input.Input) bool {
|
||||
// 不能出手
|
||||
func (e *StatusNotSkill) Skill_Hit_Pre(input.Ctx) bool {
|
||||
return false
|
||||
|
||||
}
|
||||
@@ -28,19 +29,16 @@ type DrainHP struct {
|
||||
EffectStatus
|
||||
}
|
||||
|
||||
func (e *DrainHP) OnTurnStart(opp *input.Input) {
|
||||
func (e *DrainHP) Skill_Hit_Pre(input input.Ctx) bool {
|
||||
input.DamageZone = &info.DamageZone{
|
||||
|
||||
e.Input.Damage(input.Ctx{
|
||||
|
||||
Input: opp,
|
||||
DamageZone: &info.DamageZone{
|
||||
|
||||
Type: info.DamageType.Red,
|
||||
Damage: decimal.NewFromUint64(uint64(opp.CurrentPet.Info.MaxHp)).
|
||||
Div(decimal.NewFromInt(8)),
|
||||
},
|
||||
})
|
||||
Type: info.DamageType.True, //状态类扣除无法被减伤
|
||||
Damage: decimal.NewFromUint64(uint64(e.Input.CurrentPet.Info.MaxHp)).
|
||||
Div(decimal.NewFromInt(8)),
|
||||
}
|
||||
e.Input.Damage(input)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 被寄生种子 扣血类
|
||||
@@ -48,10 +46,13 @@ type StatusDrainedHP struct {
|
||||
DrainHP
|
||||
}
|
||||
|
||||
func (e *StatusDrainedHP) OnTurnStart(opp *input.Input) {
|
||||
e.DrainHP.OnTurnStart(opp)
|
||||
func (e *StatusDrainedHP) Skill_Hit_Pre(input input.Ctx) bool {
|
||||
e.DrainHP.Skill_Hit_Pre(input) //先调用父类扣血
|
||||
//TODO 寄生种子 给对面回血,待实现回血buff
|
||||
|
||||
opp.CurrentPet.Info.Hp = -e.Input.CurrentPet.Info.MaxHp / 8
|
||||
// input.CurrentPet.Info.Hp = -e.Input.CurrentPet.Info.MaxHp / 8
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
func init() {
|
||||
|
||||
@@ -390,7 +390,7 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *action.S
|
||||
attacker.Exec(func(t input.Effect) bool { //计算命中 miss改命中
|
||||
|
||||
t.Skill_Hit_Pre(input.Ctx{ //调基础命中
|
||||
Input: attacker,
|
||||
Input: defender,
|
||||
SkillEntity: a.Skill,
|
||||
}) //相当于先调整基础命中,不光调整命中,这里还能调整技能属性,暴击率
|
||||
|
||||
@@ -552,6 +552,18 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) {
|
||||
}
|
||||
|
||||
var attacker, defender *input.Input
|
||||
f.First.Exec(func(t input.Effect) bool { //回合开始前
|
||||
|
||||
//结算状态
|
||||
t.Turn_Start(input.Ctx{Input: f.First})
|
||||
return true
|
||||
})
|
||||
f.Second.Exec(func(t input.Effect) bool { //回合开始前
|
||||
|
||||
//结算状态
|
||||
t.Turn_Start(input.Ctx{Input: f.Second})
|
||||
return true
|
||||
})
|
||||
//开始回合操作
|
||||
for i := 0; i < 2; i++ {
|
||||
var oldskill interface{}
|
||||
@@ -564,13 +576,6 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) {
|
||||
oldskill, _ = deepcopy.Anything(sattack.Skill) //备份技能
|
||||
}
|
||||
|
||||
attacker.Exec(func(t input.Effect) bool { //回合开始前
|
||||
|
||||
//结算状态
|
||||
t.Turn_Start(input.Ctx{Input: attacker})
|
||||
return true
|
||||
})
|
||||
|
||||
canuseskill := true
|
||||
// 实际上攻击方 还有系统选择放弃出手的
|
||||
if IsNil(oldskill) || attacker.CurrentPet.Info.Hp <= 0 {
|
||||
|
||||
Reference in New Issue
Block a user