- 移除 NodeManager 相关代码,改为使用 input 包中的 Effect - 重构 FightC 结构,添加 GetRand 方法 - 新增 BaseAction 结构和 NewBaseAction 函数 - 更新 effect 包中的 Effect 结构和相关方法 - 调整 BattleSkillEntity 中的 AttackTime 方法,增加 Hit 字段 - 更新 AttackValue 结构,保留原有的 AttackTime 字段 - 重构战斗逻辑,包括回合开始前的处理、技能使用、伤害计算等
105 lines
2.8 KiB
Go
105 lines
2.8 KiB
Go
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) TakeHit(attacker, defender *input.Input, skill *info.BattleSkillEntity) uint32 {
|
|
|
|
return skill.Hit
|
|
}
|
|
|
|
func (this *EffectNode) UseSkill(attacker, defender *input.Input) bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
func (this *EffectNode) OnSkillPP() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
func (this *EffectNode) SkillUseEnd() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (this *EffectNode) BeforeMultiHit() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (this *EffectNode) BeforeHit() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (this *EffectNode) OnCritPreDamage() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (this *EffectNode) PreDamage() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (this *EffectNode) CalculateDamage(attacker, defender *input.Input, skill *info.BattleSkillEntity) {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (this *EffectNode) OnDamage() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (this *EffectNode) Shield() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
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 && skill.First {
|
|
CritRate = 16
|
|
}
|
|
//CritAtkSecond: 后出手时必定致命一击; 默认: 0
|
|
if skill.CritAtkSecond != 0 && !skill.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) OnHit() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (this *EffectNode) OnMiss() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (this *EffectNode) AfterAttacked() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|
|
|
|
func (this *EffectNode) OnDefeat() bool {
|
|
panic("not implemented") // TODO: Implement
|
|
}
|