新纪元
This commit is contained in:
@@ -21,13 +21,14 @@ func (e *NewSel0) SwitchOut(in *input.Input) bool {
|
||||
return true
|
||||
}
|
||||
func (e *NewSel0) IsOwner() bool {
|
||||
if e.Ctx().Our == nil {
|
||||
source := e.SourceInput()
|
||||
if source == nil {
|
||||
return false
|
||||
}
|
||||
if e.Ctx().Our.CurPet[0] == nil {
|
||||
if source.CurPet[0] == nil {
|
||||
return false
|
||||
}
|
||||
return e.ID().GetCatchTime() == e.Ctx().Our.CurPet[0].Info.CatchTime
|
||||
return e.ID().GetCatchTime() == source.CurPet[0].Info.CatchTime
|
||||
}
|
||||
|
||||
// 免疫"能力(battle_lv)下降"
|
||||
@@ -41,7 +42,7 @@ func (e *NewSel1) PropBefer(in *input.Input, prop int8, level int8) bool {
|
||||
if !e.IsOwner() {
|
||||
return true
|
||||
}
|
||||
if in == e.Ctx().Our {
|
||||
if in == e.SourceInput() {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ func (e *Effect2228) Skill_Use() bool {
|
||||
|
||||
type Effect2228Sub struct {
|
||||
RoundEffectArg0Base
|
||||
reduce alpacadecimal.Decimal
|
||||
reduce alpacadecimal.Decimal
|
||||
}
|
||||
|
||||
func (e *Effect2228Sub) SetArgs(t *input.Input, a ...int) {
|
||||
|
||||
@@ -48,30 +48,33 @@ func registerDefeatTriggerEffects() {
|
||||
// OnSkill:命中时标记当次攻击可触发效果
|
||||
|
||||
func (e *EffectDefeatTrigger) SwitchOut(in *input.Input) bool {
|
||||
carrier := e.CarrierInput()
|
||||
opp := e.OpponentInput()
|
||||
// 1. 检查效果是否生效(当次攻击有效)
|
||||
|
||||
// 2. 过滤我方切精灵的情况(只处理对方切精灵)
|
||||
if in == e.Ctx().Our {
|
||||
if in == carrier {
|
||||
return true
|
||||
}
|
||||
|
||||
if e.Ctx().Opp.CurPet[0].Info.Hp > 0 {
|
||||
if opp == nil || opp.CurPet[0].Info.Hp > 0 {
|
||||
return true
|
||||
}
|
||||
e.isd = true
|
||||
e.info = *e.Ctx().Opp.AttackValue
|
||||
e.info = *opp.AttackValue
|
||||
return true
|
||||
}
|
||||
|
||||
// Switch:检查是否击败对方,满足条件则根据effectID触发对应行为
|
||||
func (e *EffectDefeatTrigger) SwitchIn(in *input.Input) bool {
|
||||
carrier := e.CarrierInput()
|
||||
// 1. 检查效果是否生效(当次攻击有效)
|
||||
|
||||
if !e.isd { //不是击败触发
|
||||
return true
|
||||
}
|
||||
// 2. 过滤我方切精灵的情况(只处理对方切精灵)
|
||||
if in == e.Ctx().Our {
|
||||
if in == carrier {
|
||||
return true
|
||||
}
|
||||
e.triggerByID(e.info)
|
||||
@@ -104,20 +107,29 @@ func (e *EffectDefeatTrigger) triggerByID(at model.AttackValue) {
|
||||
|
||||
// triggerHealSelfOnDefeat:击败对方后,恢复自身最大体力的1/n(对应Effect66)
|
||||
func (e *EffectDefeatTrigger) triggerHealSelfOnDefeat(_ model.AttackValue) {
|
||||
source := e.SourceInput()
|
||||
if source == nil {
|
||||
return
|
||||
}
|
||||
// 计算恢复量:自身最大体力 / n(n=SideEffectArgs[0])
|
||||
maxHP := e.Ctx().Our.CurPet[0].Info.MaxHp
|
||||
maxHP := source.CurPet[0].Info.MaxHp
|
||||
healAmount := alpacadecimal.NewFromInt(int64(maxHP)).Div(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[0])))
|
||||
// 执行回血
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||||
source.Heal(source, &action.SelectSkillAction{}, healAmount)
|
||||
}
|
||||
|
||||
// triggerReduceNextHPOnDefeat:击败对方后,减少对方下次出战精灵最大体力的1/n(对应Effect67)
|
||||
func (e *EffectDefeatTrigger) triggerReduceNextHPOnDefeat(_ model.AttackValue) {
|
||||
source := e.SourceInput()
|
||||
opp := e.OpponentInput()
|
||||
if source == nil || opp == nil {
|
||||
return
|
||||
}
|
||||
// 计算伤害量:对方下只精灵最大体力 / n(n=SideEffectArgs[0])
|
||||
nextMaxHP := e.Ctx().Opp.CurPet[0].Info.MaxHp // 假设CurPet为下次出战精灵
|
||||
nextMaxHP := opp.CurPet[0].Info.MaxHp // 假设CurPet为下次出战精灵
|
||||
damageAmount := alpacadecimal.NewFromInt(int64(nextMaxHP)).Div(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[0])))
|
||||
// 执行伤害
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
opp.Damage(source, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damageAmount,
|
||||
})
|
||||
@@ -129,6 +141,10 @@ func (e *EffectDefeatTrigger) triggerReduceNextHPOnDefeat(_ model.AttackValue) {
|
||||
// SideEffectArgs[1] = XX等级类型(如1=攻击等级,对应info.LevelType枚举)
|
||||
// SideEffectArgs[2] = n(提升的等级值,如1=+1级)
|
||||
func (e *EffectDefeatTrigger) triggerLevelUpOnDefeat(_ model.AttackValue) {
|
||||
source := e.SourceInput()
|
||||
if source == nil {
|
||||
return
|
||||
}
|
||||
// 1. 检查参数是否足够
|
||||
if len(e.SideEffectArgs) < 3 {
|
||||
return
|
||||
@@ -136,13 +152,13 @@ func (e *EffectDefeatTrigger) triggerLevelUpOnDefeat(_ model.AttackValue) {
|
||||
|
||||
// 2. 概率判定(m% = SideEffectArgs[0])
|
||||
m := e.SideEffectArgs[1]
|
||||
success, _, _ := e.Input.Player.Roll(m, 100)
|
||||
success, _, _ := source.Player.Roll(m, 100)
|
||||
if !success {
|
||||
return
|
||||
}
|
||||
|
||||
// 3. 提升对应等级
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[2]))
|
||||
source.SetProp(source, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[2]))
|
||||
}
|
||||
|
||||
// triggerNextEnemyStatusOnDefeat:击败指定类型对手后,下一个出场对手进入指定状态(对应Effect185)
|
||||
@@ -151,14 +167,19 @@ func (e *EffectDefeatTrigger) triggerLevelUpOnDefeat(_ model.AttackValue) {
|
||||
// SideEffectArgs[1] = 要施加的状态(如info.PetStatus.Burned表示烧伤)
|
||||
// SideEffectArgs[2] = 状态持续回合
|
||||
func (e *EffectDefeatTrigger) triggerNextEnemyStatusOnDefeat(at model.AttackValue) {
|
||||
source := e.SourceInput()
|
||||
opp := e.OpponentInput()
|
||||
if source == nil || opp == nil {
|
||||
return
|
||||
}
|
||||
// 这里补充原逻辑中状态施加的完整判断(如检查对手类型是否匹配)
|
||||
// 简化示例:直接处理状态施加
|
||||
for i, v := range at.Status {
|
||||
if v > 0 {
|
||||
nv := e.Ctx().Our.InitEffect(input.EffectType.Status, int(i))
|
||||
nv := source.InitEffect(input.EffectType.Status, int(i))
|
||||
if nv != nil {
|
||||
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, nv)
|
||||
opp.AddEffect(source, nv)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,11 +187,15 @@ func (e *EffectDefeatTrigger) triggerNextEnemyStatusOnDefeat(at model.AttackValu
|
||||
|
||||
// triggerTransferBoostsOnDefeat:击败对手后,复制其所有能力提升效果到自身(对应Effect421)
|
||||
func (e *EffectDefeatTrigger) triggerTransferBoostsOnDefeat(at model.AttackValue) {
|
||||
source := e.SourceInput()
|
||||
if source == nil {
|
||||
return
|
||||
}
|
||||
// 复制被击败对手的能力提升
|
||||
|
||||
for i, v := range at.Prop[:] {
|
||||
if v > 0 {
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
||||
source.SetProp(source, int8(i), v)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,6 +46,11 @@ func registerPhysicalAttackAddStatusEffects() {
|
||||
// 核心逻辑:受物理攻击时触发(覆盖父类方法)
|
||||
// -----------------------------------------------------------
|
||||
func (e *EffectPhysicalAttackAddStatus) Skill_Use_ex() bool {
|
||||
source := e.SourceInput()
|
||||
target := e.OpponentInput()
|
||||
if source == nil || target == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
// 2. 技能为空或非物理攻击,不触发
|
||||
skill := e.Ctx().SkillEntity
|
||||
@@ -54,19 +59,19 @@ func (e *EffectPhysicalAttackAddStatus) Skill_Use_ex() bool {
|
||||
}
|
||||
|
||||
// 3. 概率判定(Args()[1]为触发概率)
|
||||
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||||
success, _, _ := source.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||||
if !success {
|
||||
return true
|
||||
}
|
||||
|
||||
// 5. 获取状态效果实例并设置参数
|
||||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.targetStatus))
|
||||
statusEffect := source.InitEffect(input.EffectType.Status, int(e.targetStatus))
|
||||
if statusEffect == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
// 6. 给对手添加状态
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||||
target.AddEffect(source, statusEffect)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ type BaseStatus struct {
|
||||
// 重写切换事件:我方单位切换时清除状态
|
||||
func (e *BaseStatus) SwitchOut(in *input.Input) bool {
|
||||
// 我方单位下场时,状态失效
|
||||
if in == e.Ctx().Our {
|
||||
if in == e.CarrierInput() {
|
||||
e.Alive(false)
|
||||
}
|
||||
return true
|
||||
@@ -68,9 +68,15 @@ type ContinuousDamage struct {
|
||||
|
||||
// 技能命中前触发伤害(1/8最大生命值真实伤害)
|
||||
func (e *ContinuousDamage) ActionStart(attacker, defender *action.SelectSkillAction) bool {
|
||||
carrier := e.CarrierInput()
|
||||
source := e.SourceInput()
|
||||
opp := e.OpponentInput()
|
||||
if carrier == nil {
|
||||
return true
|
||||
}
|
||||
damage := e.calculateDamage()
|
||||
|
||||
e.Ctx().Our.Damage(e.Input, &info.DamageZone{
|
||||
carrier.Damage(source, &info.DamageZone{
|
||||
Type: info.DamageType.True,
|
||||
Damage: damage,
|
||||
})
|
||||
@@ -78,22 +84,26 @@ func (e *ContinuousDamage) ActionStart(attacker, defender *action.SelectSkillAct
|
||||
return true
|
||||
}
|
||||
// 额外效果
|
||||
e.Ctx().Our.Damage(e.Input, &info.DamageZone{
|
||||
carrier.Damage(source, &info.DamageZone{
|
||||
Type: info.DamageType.True,
|
||||
Damage: damage,
|
||||
})
|
||||
if e.Ctx().Opp.CurPet[0].GetHP().IntPart() == 0 {
|
||||
if opp == nil || opp.CurPet[0].GetHP().IntPart() == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
// 给对方回血(不受回血限制影响)
|
||||
e.Ctx().Opp.Heal(e.Ctx().Our, nil, damage)
|
||||
opp.Heal(carrier, nil, damage)
|
||||
return true
|
||||
}
|
||||
|
||||
// 计算伤害:最大生命值的1/8
|
||||
func (e *ContinuousDamage) calculateDamage() alpacadecimal.Decimal {
|
||||
return alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurPet[0].Info.MaxHp)).
|
||||
carrier := e.CarrierInput()
|
||||
if carrier == nil || carrier.CurPet[0] == nil {
|
||||
return alpacadecimal.Zero
|
||||
}
|
||||
return alpacadecimal.NewFromInt(int64(carrier.CurPet[0].Info.MaxHp)).
|
||||
Div(alpacadecimal.NewFromInt(8))
|
||||
}
|
||||
|
||||
@@ -115,7 +125,7 @@ type ParasiticSeed struct {
|
||||
|
||||
func (e *ParasiticSeed) SwitchOut(in *input.Input) bool {
|
||||
//如果我放切换
|
||||
if in == e.Ctx().Our {
|
||||
if in == e.CarrierInput() {
|
||||
e.Alive(false)
|
||||
}
|
||||
return true
|
||||
@@ -123,22 +133,28 @@ func (e *ParasiticSeed) SwitchOut(in *input.Input) bool {
|
||||
|
||||
// 技能命中前触发寄生效果
|
||||
func (e *ParasiticSeed) ActionStartEx(attacker, defender *action.SelectSkillAction) bool {
|
||||
carrier := e.CarrierInput()
|
||||
source := e.SourceInput()
|
||||
opp := e.OpponentInput()
|
||||
if carrier == nil {
|
||||
return true
|
||||
}
|
||||
// 过滤特定类型单位(假设1是植物类型,使用枚举替代魔法数字)
|
||||
|
||||
damage := alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurPet[0].Info.MaxHp)).
|
||||
damage := alpacadecimal.NewFromInt(int64(carrier.CurPet[0].Info.MaxHp)).
|
||||
Div(alpacadecimal.NewFromInt(8))
|
||||
|
||||
// 对我方造成真实伤害
|
||||
e.Ctx().Our.Damage(e.Input, &info.DamageZone{
|
||||
carrier.Damage(source, &info.DamageZone{
|
||||
Type: info.DamageType.True,
|
||||
Damage: damage,
|
||||
})
|
||||
if e.Ctx().Opp.CurPet[0].GetHP().IntPart() == 0 {
|
||||
if opp == nil || opp.CurPet[0].GetHP().IntPart() == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
// 给对方回血(不受回血限制影响)
|
||||
e.Ctx().Opp.Heal(e.Ctx().Our, nil, damage)
|
||||
opp.Heal(carrier, nil, damage)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, skill *info
|
||||
}
|
||||
skill.AttackTimeC(attacker.Prop[5]) //计算命中
|
||||
|
||||
defender.Exec(func(effect input.Effect) bool { //计算闪避,然后修改对方命中),同时相当于计算属性无效这种
|
||||
defender.ExecWithOpponent(attacker, func(effect input.Effect) bool { //计算闪避,然后修改对方命中),同时相当于计算属性无效这种
|
||||
effect.Ctx().SkillEntity = skill
|
||||
effect.SkillHit_ex()
|
||||
return true
|
||||
})
|
||||
|
||||
attacker.Exec(func(effect input.Effect) bool {
|
||||
attacker.ExecWithOpponent(defender, func(effect input.Effect) bool {
|
||||
//计算变威力
|
||||
effect.Ctx().SkillEntity = skill
|
||||
effect.SkillHit() //相当于先调整基础命中,不光调整命中,这里还能调整技能属性,暴击率
|
||||
@@ -38,7 +38,7 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, skill *info
|
||||
//复制属性
|
||||
originalProps[0], originalProps[1] = attacker.Prop, defender.Prop
|
||||
originalPetInfo[0], originalPetInfo[1] = attacker.CurPet[0].Info, defender.CurPet[0].Info
|
||||
attacker.Exec(func(effect input.Effect) bool {
|
||||
attacker.ExecWithOpponent(defender, func(effect input.Effect) bool {
|
||||
//计算变威力
|
||||
effect.Ctx().SkillEntity = skill
|
||||
effect.CalculatePre() //相当于先调整基础命中,不光调整命中,这里还能调整技能属性,暴击率
|
||||
@@ -88,7 +88,7 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, skill *info
|
||||
}
|
||||
|
||||
// 扣减防御方血量
|
||||
attacker.Exec(func(effect input.Effect) bool {
|
||||
attacker.ExecWithOpponent(defender, func(effect input.Effect) bool {
|
||||
effect.Ctx().SkillEntity = skill
|
||||
effect.OnSkill() //调用伤害计算
|
||||
return true
|
||||
@@ -235,14 +235,14 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
}
|
||||
|
||||
currentSkill = originalSkill
|
||||
defender.Exec(func(effect input.Effect) bool { //这个是能否使用技能
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
return effect.ActionStartEx(firstAttack, secondAttack)
|
||||
})
|
||||
canUseSkill := attacker.Exec(func(effect input.Effect) bool { //这个是能否使用技能
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
return effect.ActionStart(firstAttack, secondAttack)
|
||||
})
|
||||
defender.ExecWithOpponent(attacker, func(effect input.Effect) bool { //这个是能否使用技能
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
return effect.ActionStartEx(firstAttack, secondAttack)
|
||||
})
|
||||
canUseSkill := attacker.ExecWithOpponent(defender, func(effect input.Effect) bool { //这个是能否使用技能
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
return effect.ActionStart(firstAttack, secondAttack)
|
||||
})
|
||||
|
||||
canUse := canUseSkill && action.CanUse(currentSkill) && attacker != nil && attacker.CurPet[0].Info.Hp > 0
|
||||
|
||||
@@ -273,7 +273,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
})
|
||||
if ok {
|
||||
usecount := 1
|
||||
attacker.Exec(func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
attacker.ExecWithOpponent(defender, func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
effect.HookPP(&usecount)
|
||||
return true
|
||||
@@ -283,7 +283,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
}
|
||||
if defender.CurPet[0].Info.Hp > 0 {
|
||||
//技能使用后
|
||||
defender.Exec(func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
defender.ExecWithOpponent(attacker, func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
effect.Skill_Use_ex()
|
||||
return true
|
||||
@@ -292,20 +292,20 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
|
||||
if attacker.CurPet[0].Info.Hp > 0 {
|
||||
//技能使用后
|
||||
attacker.Exec(func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
attacker.ExecWithOpponent(defender, func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
effect.Skill_Use()
|
||||
return true
|
||||
})
|
||||
}
|
||||
//技能使用后
|
||||
defender.Exec(func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
defender.ExecWithOpponent(attacker, func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
effect.Action_end_ex()
|
||||
return true
|
||||
})
|
||||
//技能使用后
|
||||
attacker.Exec(func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
attacker.ExecWithOpponent(defender, func(effect input.Effect) bool { //技能使用后的我方效果
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
effect.Action_end()
|
||||
return true
|
||||
|
||||
@@ -10,11 +10,11 @@ type LegacySides struct {
|
||||
}
|
||||
|
||||
type EffectBinding struct {
|
||||
Source *Input // effect 绑定的输入源,等价于 e.GetInput()
|
||||
Source *Input // effect 绑定的输入源,等价于 e.GetInput()
|
||||
|
||||
Carrier *Input // 当前持有该 effect 的输入源
|
||||
|
||||
Target *Input // 当前 effect 实际作用/挂载的输入源
|
||||
Target *Input // 当前 effect 实际作用/挂载的输入源
|
||||
}
|
||||
|
||||
type Ctx struct {
|
||||
|
||||
@@ -184,7 +184,7 @@ func (our *Input) AddEffect(in *Input, e Effect) Effect {
|
||||
}
|
||||
|
||||
if in != our {
|
||||
canuseskill := our.Exec(func(t Effect) bool { //这个是能否使用技能
|
||||
canuseskill := our.ExecWithOpponent(in, func(t Effect) bool { //这个是能否使用技能
|
||||
//结算状态
|
||||
return t.EFFect_Befer(in, e) //返回本身结算,如果false,说明不能使用技能了
|
||||
|
||||
@@ -241,12 +241,16 @@ func (our *Input) AddEffect(in *Input, e Effect) Effect {
|
||||
// 参数 fn:接收单个 Effect,返回 bool(如 func(e Effect) bool { return e.OnBattleStart() })
|
||||
// 返回值:所有 Effect 的方法返回值列表
|
||||
func (our *Input) Exec(fn func(Effect) bool) bool {
|
||||
return our.ExecWithOpponent(our.Opp, fn)
|
||||
}
|
||||
|
||||
func (our *Input) ExecWithOpponent(opponent *Input, fn func(Effect) bool) bool {
|
||||
result := true
|
||||
for _, value := range our.Effects {
|
||||
if value.Alive() {
|
||||
ctx := value.Ctx()
|
||||
ctx.Our = our
|
||||
ctx.Opp = our.Opp
|
||||
ctx.Opp = opponent
|
||||
ctx.Carrier = our
|
||||
ctx.Target = our
|
||||
ctx.Source = value.GetInput()
|
||||
|
||||
@@ -51,7 +51,7 @@ func (our *Input) Heal(in *Input, ac action.BattleActionI, value alpacadecimal.D
|
||||
|
||||
if ac != nil {
|
||||
if _, ok := ac.(*action.UseItemAction); !ok {
|
||||
our.Exec(func(t Effect) bool {
|
||||
our.ExecWithOpponent(in, func(t Effect) bool {
|
||||
t.Heal_Pre(ac, &healValue)
|
||||
return true
|
||||
})
|
||||
@@ -102,14 +102,18 @@ func (our *Input) DelPP(value int) {
|
||||
// 这个方法是对对方造成伤害
|
||||
// 伤害落实 // 血量扣减节点比如触发回神,反弹也在这里实现
|
||||
func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
attacker := in
|
||||
if attacker == nil {
|
||||
attacker = our
|
||||
}
|
||||
// if sub.Type == info.DamageType.Red { //每回合计算伤害的时候重置伤害
|
||||
// our.Opp.SumDamage = sub.Damage
|
||||
|
||||
// }
|
||||
// 对方对我方造成,需要吃到对方的加成
|
||||
var ok bool
|
||||
if our != in {
|
||||
ok = our.Opp.Exec(func(t Effect) bool {
|
||||
if our != attacker {
|
||||
ok = attacker.ExecWithOpponent(our, func(t Effect) bool {
|
||||
|
||||
t.DamageAdd(sub) //红伤落实前,我方增伤
|
||||
|
||||
@@ -118,7 +122,7 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
|
||||
//sub.BeforeMul = sub.Damage
|
||||
if ok {
|
||||
ok = our.Opp.Exec(func(t Effect) bool {
|
||||
ok = attacker.ExecWithOpponent(our, func(t Effect) bool {
|
||||
|
||||
t.Damage_Mul(sub) //红伤落实前,我方增伤
|
||||
|
||||
@@ -127,7 +131,7 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
}
|
||||
//sub.BeforeFloor = sub.Damage
|
||||
if ok {
|
||||
ok = our.Opp.Exec(func(t Effect) bool {
|
||||
ok = attacker.ExecWithOpponent(our, func(t Effect) bool {
|
||||
|
||||
t.DamageFloor(sub) //红伤落实,内部有befer
|
||||
|
||||
@@ -138,7 +142,7 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
|
||||
// sub.BeforeMul = sub.Damage
|
||||
if ok {
|
||||
ok = our.Exec(func(t Effect) bool {
|
||||
ok = our.ExecWithOpponent(attacker, func(t Effect) bool {
|
||||
|
||||
t.DamageDivEx(sub) //红伤落实,内部有befer
|
||||
|
||||
@@ -148,7 +152,7 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
|
||||
//sub.BeforeSUB = sub.Damage
|
||||
if ok {
|
||||
ok = our.Exec(func(t Effect) bool {
|
||||
ok = our.ExecWithOpponent(attacker, func(t Effect) bool {
|
||||
|
||||
t.DamageSubEx(sub)
|
||||
|
||||
@@ -157,7 +161,7 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
}
|
||||
//sub.BeforeLocked = sub.Damage
|
||||
if ok {
|
||||
our.Exec(func(t Effect) bool {
|
||||
our.ExecWithOpponent(attacker, func(t Effect) bool {
|
||||
|
||||
t.DamageLockEx(sub)
|
||||
|
||||
@@ -165,8 +169,8 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
})
|
||||
}
|
||||
// sub.BeforeLock = sub.Damage
|
||||
if ok && in != our {
|
||||
ok = our.Opp.Exec(func(t Effect) bool {
|
||||
if ok && attacker != our {
|
||||
ok = attacker.ExecWithOpponent(our, func(t Effect) bool {
|
||||
|
||||
t.DamageLock(sub)
|
||||
|
||||
@@ -174,7 +178,7 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
})
|
||||
}
|
||||
if ok {
|
||||
our.Exec(func(t Effect) bool {
|
||||
our.ExecWithOpponent(attacker, func(t Effect) bool {
|
||||
|
||||
t.Damage_Shield(sub)
|
||||
|
||||
@@ -188,11 +192,11 @@ func (our *Input) Damage(in *Input, sub *info.DamageZone) {
|
||||
sub.Damage = sub.Damage.Sub(shieldAbsorb)
|
||||
}
|
||||
if sub.Type == info.DamageType.Red { //红才会产生造成伤害
|
||||
our.Opp.SumDamage = sub.Damage.Add(our.Opp.SumDamage) // 叠加总伤害 这里相当于记录红伤
|
||||
attacker.SumDamage = sub.Damage.Add(attacker.SumDamage) // 叠加总伤害 这里相当于记录红伤
|
||||
|
||||
}
|
||||
if sub.Type == info.DamageType.Red { //红才会产生造成伤害
|
||||
our.Opp.AttackValue.LostHp += uint32(sub.Damage.IntPart()) //红伤落实
|
||||
attacker.AttackValue.LostHp += uint32(sub.Damage.IntPart()) //红伤落实
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ func (our *Input) HasPropSub() bool {
|
||||
}
|
||||
func (target *Input) SetProp(source *Input, index, level int8) bool {
|
||||
// 前置状态结算:判断是否允许执行属性操作
|
||||
canExecute := target.Exec(func(effect Effect) bool {
|
||||
canExecute := target.ExecWithOpponent(source, func(effect Effect) bool {
|
||||
// 执行前置效果,返回true表示可以继续操作
|
||||
return effect.PropBefer(source, index, level)
|
||||
})
|
||||
|
||||
@@ -49,6 +49,31 @@ func (e *EffectNode) GetInput() *input.Input {
|
||||
return e.Input
|
||||
|
||||
}
|
||||
|
||||
func (e *EffectNode) SourceInput() *input.Input {
|
||||
if e.Ctx().Source != nil {
|
||||
return e.Ctx().Source
|
||||
}
|
||||
return e.Input
|
||||
}
|
||||
|
||||
func (e *EffectNode) CarrierInput() *input.Input {
|
||||
if e.Ctx().Carrier != nil {
|
||||
return e.Ctx().Carrier
|
||||
}
|
||||
return e.Ctx().Our
|
||||
}
|
||||
|
||||
func (e *EffectNode) TargetInput() *input.Input {
|
||||
if e.Ctx().Target != nil {
|
||||
return e.Ctx().Target
|
||||
}
|
||||
return e.Ctx().Opp
|
||||
}
|
||||
|
||||
func (e *EffectNode) OpponentInput() *input.Input {
|
||||
return e.Ctx().Opp
|
||||
}
|
||||
func (e *EffectNode) Ctx() *input.Ctx {
|
||||
|
||||
return &e.EffectContextHolder.Ctx
|
||||
@@ -140,8 +165,12 @@ func (e *EffectNode) PropBefer(in *input.Input, prop int8, level int8) bool {
|
||||
}
|
||||
|
||||
func (e *EffectNode) ISNaturalEnemy() bool {
|
||||
|
||||
t, _ := element.Calculator.GetOffensiveMultiplier(e.Ctx().Opp.CurPet[0].Type, e.Ctx().Our.CurPet[0].Type)
|
||||
source := e.SourceInput()
|
||||
opp := e.OpponentInput()
|
||||
if source == nil || opp == nil || source.CurPet[0] == nil || opp.CurPet[0] == nil {
|
||||
return false
|
||||
}
|
||||
t, _ := element.Calculator.GetOffensiveMultiplier(opp.CurPet[0].Type, source.CurPet[0].Type)
|
||||
|
||||
if t <= 1 {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user