refactor(fight): 重构战斗系统效果和技能逻辑
- 移除了未使用的 Effect0 基类效果 - 优化了技能施放和效果执行的逻辑 - 调整了命中和闪避的计算方式 -
This commit is contained in:
@@ -1,20 +1,18 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"blazing/common/utils"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
)
|
||||
|
||||
// 技能命中计算
|
||||
func (this *EffectNode) IsHit(attacker, defender *input.Input, skill *info.BattleSkillEntity) uint32 {
|
||||
return skill.AttackTime() //计算命中
|
||||
func (this *EffectNode) IsHit(attacker, defender *input.Input, skill *info.BattleSkillEntity) {
|
||||
|
||||
}
|
||||
|
||||
// 被命中计算,默认直接返回,重写这个来实现闪避率
|
||||
func (this *EffectNode) TakeHit(attacker, defender *input.Input, skill *info.BattleSkillEntity) uint32 {
|
||||
func (this *EffectNode) TakeHit(attacker, defender *input.Input, skill *info.BattleSkillEntity) {
|
||||
|
||||
return skill.Hit
|
||||
}
|
||||
|
||||
func (this *EffectNode) UseSkill(attacker, defender *input.Input) bool {
|
||||
@@ -59,32 +57,9 @@ func (this *EffectNode) PostDamage() bool {
|
||||
panic("not implemented") // TODO: Implement
|
||||
}
|
||||
|
||||
func (this *EffectNode) IsCrit(attacker, defender *input.Input, skill *info.BattleSkillEntity) uint32 {
|
||||
CritRate := utils.Max(skill.CritRate, 1)
|
||||
CritRateR := attacker.FightC.GetRand().Int31n(16)
|
||||
//CritAtkFirst: 先出手时必定致命一击; 默认: 0
|
||||
if skill.CritAtkFirst != 0 && attacker.First {
|
||||
CritRate = 16
|
||||
}
|
||||
//CritAtkSecond: 后出手时必定致命一击; 默认: 0
|
||||
if skill.CritAtkSecond != 0 && !attacker.First {
|
||||
CritRate = 16
|
||||
}
|
||||
// CritSelfHalfHp: 自身体力低于一半时必定致命一击; 默认: 0
|
||||
if skill.CritSelfHalfHp != 0 && (attacker.CurrentPet.HP < int(attacker.CurrentPet.Info.MaxHp)/2) {
|
||||
CritRate = 16
|
||||
}
|
||||
// CritFoeHalfHp: 对方体力低于一半时必定致命一击; 默认: 0
|
||||
if skill.CritSelfHalfHp != 0 && (defender.CurrentPet.HP < int(defender.CurrentPet.Info.MaxHp)/2) {
|
||||
CritRate = 16
|
||||
}
|
||||
|
||||
//todo 暴击伤害
|
||||
if CritRateR <= int32(CritRate) {
|
||||
return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
// 正常来说,什么都不做
|
||||
func (this *EffectNode) IsCrit(attacker, defender *input.Input, skill *info.BattleSkillEntity) {
|
||||
//return skill.Crit
|
||||
}
|
||||
|
||||
func (this *EffectNode) OnHit() bool {
|
||||
|
||||
Reference in New Issue
Block a user