fix(fight): 修复战斗命中判断逻辑并移除冗余命中检查

- 修复 NewSel32 中的命中判断,将 Side 字段改为 Hit 字段
- 移除 EffectAttackMiss 中的冗余命中判断逻辑
- 移除 EffectDefeatTrigger 中的重复命中检查
- 移除 EffectPhysicalAttackAddStatus 中的冗余命中判断
- 移除多个效果文件中的重复命中检查逻辑
- 修正 Effect136 中的命中处理逻辑,确保在技能命中时正确触发
- 移除其他多个效果中的重复命中检查代码
```
This commit is contained in:
2026-01-04 21:41:10 +08:00
parent 1bd6840e98
commit 0f524aab85
90 changed files with 117 additions and 331 deletions

View File

@@ -26,7 +26,7 @@ func (e *NewSel32) OnSkill() bool {
if e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if !e.Ctx().SkillEntity.Side {
if !e.Ctx().SkillEntity.Hit {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].Div(alpacadecimal.NewFromInt(10)).IntPart()), 100)

View File

@@ -46,10 +46,6 @@ func registerAttackMissEffects() {
// 核心逻辑技能命中时若为目标攻击类型则强制miss
// -----------------------------------------------------------
func (e *EffectAttackMiss) Skill_Hit_ex() bool {
// 命中判定失败,不触发
if !e.Hit() {
return true
}
// 技能为空时不处理
skill := e.Ctx().SkillEntity

View File

@@ -47,9 +47,7 @@ func registerDefeatTriggerEffects() {
// -----------------------------------------------------------
// OnSkill命中时标记当次攻击可触发效果
func (e *EffectDefeatTrigger) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true // 标记当次攻击有效
return true
}

View File

@@ -47,10 +47,6 @@ func registerPhysicalAttackAddStatusEffects() {
// 核心逻辑:受物理攻击时触发(覆盖父类方法)
// -----------------------------------------------------------
func (e *EffectPhysicalAttackAddStatus) Skill_Use_ex() bool {
// 1. 命中判定失败,不触发
if !e.Hit() {
return true
}
// 2. 技能为空或非物理攻击,不触发
skill := e.Ctx().SkillEntity

View File

@@ -25,9 +25,6 @@ func init() {
// 命中之后
func (e *Effect1) OnSkill() bool {
if !e.Hit() {
return true
}
e.Input.Heal(
e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(alpacadecimal.NewFromInt(2)),

View File

@@ -23,9 +23,6 @@ func init() {
// 命中之后
func (e *Effect101) OnSkill() bool {
if !e.Hit() {
return true
}
e.Input.Heal(
e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Mul(e.Args()[0].Div(alpacadecimal.NewFromInt(100))),

View File

@@ -51,9 +51,7 @@ func (e *Effect104) SetArgs(t *input.Input, a ...int) {
// 技能触发时调用
// -----------------------------------------------------------
func (e *Effect104) OnSkill() bool {
if !e.Hit() {
return true
}
if !e.can {
e.can = true
return true

View File

@@ -21,9 +21,6 @@ func init() {
// 命中之后
func (e *Effect105) OnSkill() bool {
if !e.Hit() {
return true
}
e.Input.Heal(
e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(e.Args()[0]),

View File

@@ -23,9 +23,6 @@ type Effect107 struct {
// 我方使用效果
func (e *Effect107) Skill_Useed() bool {
if !e.Hit() {
return true
}
d := e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[0])))
//说明伤害小于N

View File

@@ -19,9 +19,7 @@ func (e *Effect110) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect110) Skill_Use_ex() bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity != nil {
if e.Ctx().SkillEntity.AttackTime != 0 { //没有闪避掉
return true

View File

@@ -15,9 +15,6 @@ type Effect111 struct {
}
func (e *Effect111) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,

View File

@@ -24,9 +24,7 @@ func init() {
// 命中之后
func (e *Effect112) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,

View File

@@ -24,9 +24,7 @@ type Effect115 struct {
}
func (e *Effect115) OnSkill() bool {
if !e.Hit() {
return true
}
// 概率判定
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !ok {

View File

@@ -33,9 +33,6 @@ func (e *Effect116) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect116) Skill_Useed() bool {
if !e.Hit() {
return true
}
if e.Input.FightC.IsFirst(e.Input.Player) {
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(alpacadecimal.NewFromInt(5)))

View File

@@ -31,9 +31,6 @@ func (e *Effect117) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect117) OnSkill() bool {
if !e.Hit() {
return true
}
if e.Input.FightC.IsFirst(e.Input.Player) {
// 概率判定

View File

@@ -18,9 +18,7 @@ type Effect119 struct {
}
func (e *Effect119) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true
return true
}
@@ -67,9 +65,6 @@ type Effect120 struct {
}
func (e *Effect120) OnSkill() bool {
if !e.Hit() {
return true
}
// 50%概率
ok, _, _ := e.Input.Player.Roll(50, 100)
@@ -105,9 +100,6 @@ type Effect121 struct {
}
func (e *Effect121) OnSkill() bool {
if !e.Hit() {
return true
}
// 检查属性是否相同
if e.Ctx().Our.CurrentPet.PetInfo.Type == e.Ctx().Opp.CurrentPet.PetInfo.Type {
@@ -143,9 +135,7 @@ func (e *Effect122) Skill_Hit() bool {
}
func (e *Effect122) OnSkill() bool {
if !e.Hit() {
return true
}
if e.can {
propIndex := int(e.Args()[0].IntPart())
chance := int(e.Args()[1].IntPart())

View File

@@ -15,9 +15,6 @@ type Effect124 struct {
}
func (e *Effect124) OnSkill() bool {
if !e.Hit() {
return true
}
chance := int(e.Args()[0].IntPart())
changeAmount := int(e.Args()[1].IntPart())

View File

@@ -27,9 +27,7 @@ func (e *Effect125) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect125) DamageLock_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if t.Type != info.DamageType.Red {
return true
}
@@ -37,6 +35,6 @@ func (e *Effect125) DamageLock_ex(t *info.DamageZone) bool {
if t.Damage.Cmp(e.Args()[1]) == -1 {
return true
}
t.Damage=e.Args()[1]
t.Damage = e.Args()[1]
return true
}

View File

@@ -30,9 +30,7 @@ func (e *Effect128) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect128) DamageLock_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if t.Type != info.DamageType.Red {
return true
}

View File

@@ -26,9 +26,7 @@ func init() {
// 技能触发时调用
// -----------------------------------------------------------
func (e *Effect13) OnSkill() bool {
if !e.Hit() {
return true
}
if gconv.Int(e.Ctx().Opp.CurrentPet.PetInfo.Type) == int(element.ElementTypeGrass) {
return true
}

View File

@@ -17,9 +17,6 @@ type Effect130 struct {
// -----------------------------------------------------------
func (e *Effect130) OnSkill() bool {
// 1. 命中判定失败,不触发
if !e.Hit() {
return true
}
if e.Ctx().Opp.CurrentPet.PetInfo.Gender != int(e.Args()[0].IntPart()) {
return true

View File

@@ -28,10 +28,6 @@ type Effect131 struct {
// Damage_DIV_ex 受击前触发(核心伤害拦截节点)
// 该方法在伤害计算前执行,适合修改/清零伤害实现免疫效果
func (e *Effect131) DamageLock_ex(t *info.DamageZone) bool {
// 1. 检查效果是否命中(未命中则不生效)
if !e.Hit() {
return true
}
// 3. 获取配置的目标性别XArgs[0]存储X性别的数值
xGender := e.Args()[0].IntPart()

View File

@@ -20,9 +20,7 @@ type Effect134 struct {
}
func (e *Effect134) DamageFloor(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
// fmt.Println("Effect134_old", t.Damage.IntPart())
if t.Type == info.DamageType.Red {

View File

@@ -22,9 +22,7 @@ type Effect135 struct {
}
func (e *Effect135) DamageFloor(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
// fmt.Println("Effect135_old", t.Damage.IntPart())
if t.Type == info.DamageType.Red {

View File

@@ -21,11 +21,18 @@ func init() {
}
// 命中之后
func (e *Effect136) OnSkill() bool {
if !e.Hit() {
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
func (e *Effect136) Skill_Hit() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.AttackTime != 0 {
return true
}
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
return true
}

View File

@@ -20,10 +20,6 @@ func init() {
// 命中之后
func (e *Effect145) OnSkill() bool {
if !e.Hit() {
return true
}
if e.Ctx().Opp.StatEffect_Exist(info.PetStatus.Poisoned) {
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])

View File

@@ -15,9 +15,6 @@ type Effect147 struct {
}
func (e *Effect147) OnSkill() bool {
if !e.Hit() {
return true
}
if e.Ctx().Our.FightC.IsFirst(e.Ctx().Our.Player) {
return true
@@ -47,9 +44,7 @@ type Effect148 struct {
}
func (e *Effect148) OnSkill() bool {
if !e.Hit() {
return true
}
if e.Ctx().Our.FightC.IsFirst(e.Ctx().Our.Player) {
return true
}
@@ -77,9 +72,6 @@ type Effect159 struct {
}
func (e *Effect159) OnSkill() bool {
if !e.Hit() {
return true
}
// 检查自身体力是否小于最大值的1/{0}
maxHP := int64(e.Ctx().Our.CurrentPet.Info.MaxHp)

View File

@@ -19,10 +19,6 @@ func init() {
// 命中之后
func (e *Effect151) OnSkill() bool {
if !e.Hit() {
return true
}
if e.Ctx().Opp.StatEffect_Exist(info.PetStatus.Burned) {
chance := e.EffectNode.SideEffectArgs[0]

View File

@@ -23,9 +23,6 @@ func init() {
// 技能触发时调用
// -----------------------------------------------------------
func (e *Effect1605) OnSkill() bool {
if !e.Hit() {
return true
}
// n% 触发概率(默认 SideEffectArgs[0]
chance := e.SideEffectArgs[0]

View File

@@ -21,9 +21,7 @@ func init() {
// 命中之后
func (e *Effect180) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
return true
}

View File

@@ -22,9 +22,7 @@ func init() {
// 命中之后
func (e *Effect195) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
return true
}

View File

@@ -26,9 +26,7 @@ type Effect21 struct {
// 使用技能时不可被继承继承Miss和Hit就行
func (e *Effect21) OnSkill() bool {
if !e.Hit() {
return true
}
e.l.Do(func() { //保证技能使用后初始化一次就行
statIndex := e.SideEffectArgs[0]
@@ -45,10 +43,6 @@ func (e *Effect21) OnSkill() bool {
// 被攻击时候反弹
func (e *Effect21) Skill_Use_ex() bool {
//未命中
if !e.Hit() {
return true
}
//不是技能
if e.Ctx().SkillEntity == nil {
return true

View File

@@ -22,9 +22,6 @@ type Effect28 struct {
}
func (e *Effect28) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,

View File

@@ -24,9 +24,6 @@ type Effect29 struct {
}
func (e *Effect29) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{

View File

@@ -24,9 +24,6 @@ type Effect31 struct {
}
func (e *Effect31) Damage_Mul(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if t.Type == info.DamageType.Red {
n := int(e.Input.FightC.GetRand().Int31n(int32(e.SideEffectArgs[1]-e.SideEffectArgs[0]+1))) + e.SideEffectArgs[0]

View File

@@ -22,9 +22,7 @@ type Effect32 struct {
}
func (e *Effect32) Action_start(a, b *action.SelectSkillAction) bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}

View File

@@ -24,9 +24,7 @@ type Effect34 struct {
// 使用技能时不可被继承继承Miss和Hit就行
func (e *Effect34) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true
return true
}

View File

@@ -23,9 +23,7 @@ type Effect36 struct {
}
func (e *Effect36) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true
return true
}

View File

@@ -21,9 +21,7 @@ type Effect39 struct {
}
func (e *Effect39) OnSkill() bool {
if !e.Hit() {
return true
}
// 概率判定
ok, _, _ := e.Input.Player.Roll(e.SideEffectArgs[0], 100)
if !ok {

View File

@@ -36,9 +36,6 @@ func (e *Effect41) SetArgs(t *input.Input, a ...int) {
// 伤害落实前触发,限制最大伤害
func (e *Effect41) Damage_DIV_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}

View File

@@ -16,9 +16,7 @@ type Effect42 struct {
}
func (e *Effect42) Damage_Mul(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}

View File

@@ -22,9 +22,7 @@ type Effect43 struct {
}
func (e *Effect43) OnSkill() bool {
if !e.Hit() {
return true
}
tt := alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)).Div(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[0])))
//fmt.Println("恢复自身最大体量的1/n", tt.IntPart())
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, tt)

View File

@@ -16,9 +16,7 @@ type Effect44 struct {
}
func (e *Effect44) Damage_DIV_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}

View File

@@ -17,9 +17,7 @@ type Effect46 struct {
}
func (e *Effect46) Damage_DIV_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}

View File

@@ -21,9 +21,7 @@ type Effect466 struct {
}
func (e *Effect466) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[0])
return true
}

View File

@@ -23,17 +23,13 @@ func init() {
// 命中之后
func (e *Effect478) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true
return true
}
func (e *Effect478) Skill_Hit_ex() bool {
if !e.Hit() {
return true
}
if !e.can {
return true
}

View File

@@ -15,10 +15,6 @@ type Effect48 struct {
func (e *Effect48) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
if !e.Hit() {
return true
}
if in != e.Ctx().Opp {
return true
}

View File

@@ -13,9 +13,7 @@ type Effect49 struct {
}
func (e *Effect49) Damage_SUB_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}

View File

@@ -38,9 +38,6 @@ type EffectStat struct {
// 技能触发时调用
// -----------------------------------------------------------
func (e *EffectStat) OnSkill() bool {
if !e.Hit() {
return true
}
// 参数解构 (防止 SideEffectArgs 长度不足)
var (

View File

@@ -16,9 +16,7 @@ type Effect50 struct {
}
func (e *Effect50) Damage_DIV_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}

View File

@@ -22,9 +22,6 @@ type Effect90 struct {
}
func (e *Effect90) Damage_Mul(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if t.Type == info.DamageType.Red {

View File

@@ -14,9 +14,7 @@ type Effect54 struct {
}
func (e *Effect54) Damage_DIV_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}

View File

@@ -22,9 +22,7 @@ func init() {
// 命中之后
func (e *Effect566) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
return true
}

View File

@@ -28,9 +28,7 @@ func (e *Effect57) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect57) OnSkill() bool {
if !e.Hit() {
return true
}
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1])
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
return true

View File

@@ -22,18 +22,14 @@ type Effect58 struct {
}
func (e *Effect58) OnSkill() bool {
if !e.Hit() {
return true
}
e.Can = true
return true
}
func (e *Effect58) Action_start(a, b *action.SelectSkillAction) bool {
if !e.Hit() {
return true
}
if !e.Can {
return true
}

View File

@@ -31,9 +31,7 @@ func (e *Effect59) SetArgs(t *input.Input, a ...int) {
// 命中之后
func (e *Effect59) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,

View File

@@ -28,9 +28,7 @@ func (e *Effect60) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect60) OnSkill() bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}

View File

@@ -86,10 +86,6 @@ func init() {
// 魂印开局添加,然后切精灵不消失
func (e *Effect62) OnSkill() bool {
if !e.Hit() {
//e.Alive(false)
return true
}
//e.Duration(1) //必须保持到下一回合,这样才会被复制
// e.opp = ctx.Input

View File

@@ -14,9 +14,6 @@ type Effect65 struct {
}
func (e *Effect65) Skill_Hit() bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true

View File

@@ -16,9 +16,7 @@ type Effect68 struct {
}
func (e *Effect68) DamageLock_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}

View File

@@ -27,9 +27,7 @@ func init() {
}
func (e *Effect69) OnSkill() bool {
if !e.Hit() {
return true
}
t := &Effect69_sub{
EffectNode: node.EffectNode{},
}

View File

@@ -32,9 +32,7 @@ func (e *Effect7) Skill_Hit() bool {
return true
}
func (e *Effect7) DamageFloor(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
//fmt.Println("Effect7_old", t.Damage.IntPart())
if t.Type == info.DamageType.Red {
if e.Ctx().Our.CurrentPet.Info.Hp <= e.Ctx().Opp.CurrentPet.Info.Hp {
@@ -49,9 +47,7 @@ func (e *Effect7) DamageFloor(t *info.DamageZone) bool {
return true
}
func (e *Effect7) DamageLock(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
//fmt.Println("Effect7_old", t.Damage.IntPart())
if t.Type == info.DamageType.Red {
if t.Damage.Cmp(e.max) == 1 {

View File

@@ -35,9 +35,7 @@ func (e *Effect71) SetArgs(t *input.Input, a ...int) {
// 命中之后
func (e *Effect71) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,

View File

@@ -23,14 +23,21 @@ func init() {
}
// 命中之后
func (e *Effect72) OnSkill() bool {
if !e.Hit() {
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.True,
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.Hp)),
})
e.Ctx().Our.CurrentPet.NotAlive = true
func (e *Effect72) Skill_Hit() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.AttackTime != 0 {
return true
}
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.True,
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.Hp)),
})
e.Ctx().Our.CurrentPet.NotAlive = true
return true
}

View File

@@ -34,9 +34,6 @@ func (e *Effect73) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect73) Action_end_ex() bool {
if !e.Hit() {
return true
}
if !e.Input.FightC.IsFirst(e.Ctx().Our.Player) {
return true
}

View File

@@ -27,9 +27,6 @@ func newEffectRandomStatus(ranges []statusRange) *EffectRandomStatus {
// 通用逻辑:命中后按概率随机触发状态
func (e *EffectRandomStatus) OnSkill() bool {
if !e.Hit() {
return true
}
// 生成0-99的随机数100种可能
randVal := int(e.Input.FightC.GetRand().Int31n(100))

View File

@@ -24,9 +24,7 @@ type Effect76 struct {
}
func (e *Effect76) OnSkill() bool {
if !e.Hit() {
return true
}
// 概率判定
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !ok {

View File

@@ -28,9 +28,7 @@ func (e *Effect77) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect77) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[1])
return true
}

View File

@@ -13,9 +13,6 @@ type Effect776 struct {
}
func (e *Effect776) Damage_Mul(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if t.Type == info.DamageType.Red {

View File

@@ -24,9 +24,6 @@ func init() {
// 命中之后
// 特攻+2速度+1命中+1
func (e *Effect79) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Our.SetProp(e.Ctx().Our, 2, 2, info.AbilityOpType.ADD)
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1, info.AbilityOpType.ADD)

View File

@@ -34,9 +34,7 @@ func (e *Effect8) DamageFloor(t *info.DamageZone) bool {
return true
}
func (e *Effect8) DamageLock(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
//fmt.Println("Effect7_old", t.Damage.IntPart())
if t.Type == info.DamageType.Red {
if t.Damage.Cmp(e.max) == 1 {

View File

@@ -22,9 +22,6 @@ func init() {
}
func (e *Effect80) OnSkill() bool {
if !e.Hit() {
return true
}
att := e.Ctx().Our.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(2))
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{

View File

@@ -20,18 +20,14 @@ type Effect81 struct {
}
func (e *Effect81) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true
return true
}
func (e *Effect81) Action_start(a, b *action.SelectSkillAction) bool {
if !e.Hit() {
return true
}
if !e.can {
return true
}

View File

@@ -23,18 +23,14 @@ type Effect83 struct {
}
func (e *Effect83) OnSkill() bool {
if !e.Hit() {
return true
}
e.can = true
return true
}
func (e *Effect83) Compare_Pre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
if !e.Hit() {
return true
}
if !e.can {
return true
}
@@ -63,9 +59,7 @@ func (e *Effect83) Compare_Pre(fattack *action.SelectSkillAction, sattack *actio
// /自身雄性,下两回合必定先手;自身雌性,下两回合必定致命一击
func (e *Effect83) Action_start(a, b *action.SelectSkillAction) bool {
if !e.Hit() {
return true
}
if !e.can {
return true
}

View File

@@ -19,9 +19,6 @@ type Effect87 struct {
}
func (e *Effect87) OnSkill() bool {
if !e.Hit() {
return true
}
e.Ctx().Our.HealPP(-1)
return true

View File

@@ -22,9 +22,7 @@ type Effect88 struct {
}
func (e *Effect88) Damage_Mul(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
// 概率判定
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !ok {

View File

@@ -31,9 +31,6 @@ func (e *Effect89) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect89) Skill_Useed() bool {
if !e.Hit() {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(e.Args()[1]))

View File

@@ -24,9 +24,7 @@ type Effect93 struct {
}
func (e *Effect93) OnSkill() bool {
if !e.Hit() {
return true
}
// 概率判定
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !ok {

View File

@@ -21,9 +21,6 @@ type Effect95 struct {
}
func (e *Effect95) Action_start(a, b *action.SelectSkillAction) bool {
if !e.Hit() {
return true
}
//fmt.Println(e.Ctx().SkillEntity)
if e.Ctx().SkillEntity == nil {

View File

@@ -24,9 +24,6 @@ type Effect98 struct {
}
func (e *Effect98) Damage_Mul(t *info.DamageZone) bool {
if !e.Hit() {
return true
}
if e.Ctx().Opp.CurrentPet.Gender != 1 {
return true

View File

@@ -56,9 +56,6 @@ func registerConditionalAddDamageEffects() {
// -----------------------------------------------------------
func (e *EffectConditionalAddDamage) OnSkill() bool {
// 1. 命中判定失败,不触发
if !e.Hit() {
return true
}
// 2. 获取当前效果ID对应的条件函数
cond, ok := conditionMap[int(e.ID().Suffix())]

View File

@@ -90,9 +90,6 @@ func (e *EffectPropSyncReverse) SetArgs(t *input.Input, a ...int) {
}
func (e *EffectPropSyncReverse) OnSkill() bool {
if !e.Hit() {
return true
}
if e.opppet != nil {
return true
}

View File

@@ -18,9 +18,6 @@ type Effect3 struct {
// 执行时逻辑
// ----------------------
func (e *Effect3) OnSkill() bool {
if !e.Hit() {
return true
}
// 遍历六项能力值(攻击、防御、速度等)
for i := 0; i < 6; i++ {

View File

@@ -53,9 +53,6 @@ func registerStatusEffects() {
// 技能触发时调用
// -----------------------------------------------------------
func (e *Effect10) OnSkill() bool {
if !e.Hit() {
return true
}
// n% 触发概率(默认 SideEffectArgs[0]
chance := e.EffectNode.SideEffectArgs[0]

View File

@@ -60,16 +60,18 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, skill *info
attacker.SumDamage = attacker.SumDamage.Mul(alpacadecimal.NewFromInt(2))
}
if !skill.Side {
//这时候将被覆盖的效果全部装回来enterturn
for _, effect := range attacker.Effect_Lost {
if effect.Duration() > 0 || effect.Duration() == -1 {
effect.Alive(true)
}
}
} else {
//到这里已经是强制miss或者命中,所以根本不存在强制miss改命中的情况,因为miss的时候不会执行到这里
if !skill.Hit {
for _, effect := range attacker.EffectCache {
effect.Hit(true) //我方效果命中
effect.Alive(false) //我方效果命中
}
//这时候将被覆盖的效果全部装回来enterturn
for _, effect := range attacker.EffectLost {
if effect.Duration() > 0 || effect.Duration() == -1 {
//effect.Alive(true)
attacker.AddEffect(effect.GetInput(), effect)
}
}
}
@@ -123,7 +125,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
f.Broadcast(func(ff *input.Input) {
ff.EffectCache = make([]input.Effect, 0) //先把上一回合数据清空,但是应该把本身延续类效果集成过来
ff.Effect_Lost = make([]input.Effect, 0)
ff.EffectLost = make([]input.Effect, 0)
ff.Exec(func(effect input.Effect) bool { //回合开始前
effect.Turn_Start(firstAttack, secondAttack)
return true

View File

@@ -61,8 +61,8 @@ type SkillEntity struct {
Pet *BattlePetEntity
//MaxValue func(ahp, bhp uint32) decimal.Decimal
Crit uint32
AttackTime uint32 //记录技能实际是否命中
Side bool
AttackTime uint32 //记录技能实际是否命中,0表示未命中,1表示命中,2表示必中
Hit bool
}
// CreateSkill 创建战斗技能实例可指定是否无限PP
@@ -115,7 +115,7 @@ func (s *SkillEntity) SetMiss() bool {
// 无效掉附带属性
func (s *SkillEntity) SetNoSide() bool {
s.Side = false
s.Hit = false
return true
}
@@ -176,14 +176,14 @@ func (s *SkillEntity) AttackTimeC(level int) uint32 {
if s.MustHit != 0 {
s.AttackTime = 2
s.Side = true
s.Hit = true
return s.AttackTime
}
a := int64(s.GetAccuracy(level))
r := s.Rand.Int63n(100)
if a >= r {
s.Side = true
s.Hit = true
s.AttackTime = 1
}
return s.AttackTime

View File

@@ -27,7 +27,7 @@ type Input struct {
// info.BattleActionI
Effects []Effect //effects 实际上全局就是effect无限回合 //effects容器 技能的
EffectCache []Effect //这里是命中前执行的容器,也就是命中前执行的所有逻辑相关,理论上一个effect被激活,就应该同时将其他的effect取消激活
Effect_Lost []Effect
EffectLost []Effect
// 删掉伤害记录,可以在回调中记录,而不是每次调用记录
SumDamage alpacadecimal.Decimal //伤害
// DamageZone struct {
@@ -105,6 +105,7 @@ func (our *Input) SetOPP(t *Input) {
}
func (our *Input) RecoverEffect() {
//println("恢复效果",our.UserID)
//根本没释放技能,这些效果全部失效
for _, e := range our.EffectCache {
@@ -114,9 +115,10 @@ func (our *Input) RecoverEffect() {
}
//这时候将被覆盖的效果全部装回来enterturn
for _, e := range our.Effect_Lost {
for _, e := range our.EffectLost {
if e.Duration() > 0 || e.Duration() == -1 {
e.Alive(true)
// e.Alive(true)
our.AddEffect(e.GetInput(), e)
}
}
@@ -125,15 +127,18 @@ func (our *Input) RecoverEffect() {
func (our *Input) ReactvieEffect() {
//根本没释放技能,这些效果全部失效
for _, e := range our.Effect_Lost {
for _, e := range our.EffectLost {
e.Alive(false)
// our.AddEffect(e.GetInput(), e)
}
//这时候将被覆盖的效果全部装回来enterturn
for _, e := range our.EffectCache {
e.Alive(true)
// e.Alive(true)
//因为后手方实际上是到了他出手阶段重新添加的结果,而非后手方重新激活效果
our.AddEffect(e.GetInput(), e)
}
}
@@ -250,7 +255,7 @@ func (our *Input) Parseskill(skill *action.SelectSkillAction) {
//t.SetArgs(i, temparg[:args]...) //设置入参
loste := our.AddEffect(our, t)
if loste != nil {
our.Effect_Lost = append(our.Effect_Lost, loste)
our.EffectLost = append(our.EffectLost, loste)
}
// }

View File

@@ -62,7 +62,7 @@ type Effect interface {
Ctx() *Ctx
//回合数,然后次数另外维护
Duration(...int) int
Hit(...bool) bool
//Hit(...bool) bool
Alive(...bool) bool
Stack(...int) int
CanStack(...bool) bool

View File

@@ -39,7 +39,7 @@ func (f *FightC) battleLoop() {
break
}
println("进入回合")
println("进入回合", f.Round)
f.resolveRound(actions[ourID], actions[oppID])
}

View File

@@ -68,16 +68,17 @@ func (e *EffectNode) ID(t ...input.EffectIDCombiner) input.EffectIDCombiner {
return e.id
}
func (e *EffectNode) Hit(t ...bool) bool {
if len(t) > 0 {
// println("效果命中", e.id.GetEffectType(), e.id.Suffix(), t[0])
e.hit = t[0]
}
// func (e *EffectNode) Hit(t ...bool) bool {
return e.hit
// if len(t) > 0 {
// // println("效果命中", e.id.GetEffectType(), e.id.Suffix(), t[0])
// e.hit = t[0]
// }
}
// return e.hit
// }
func (e *EffectNode) CanStack(t ...bool) bool {
if len(t) > 0 {