refactor: 迁移 effect 至新语义上下文
This commit is contained in:
@@ -46,11 +46,11 @@ func randomSkillPPZero(target *input.Input, count int) {
|
||||
type Effect1448 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1448) Damage_Mul(zone *info.DamageZone) bool {
|
||||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 || e.Ctx().Our.CurPet[0] == nil {
|
||||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 || e.CarrierInput().CurPet[0] == nil {
|
||||
return true
|
||||
}
|
||||
maxHP := e.Ctx().Our.CurPet[0].GetMaxHP()
|
||||
curHP := e.Ctx().Our.CurPet[0].GetHP()
|
||||
maxHP := e.CarrierInput().CurPet[0].GetMaxHP()
|
||||
curHP := e.CarrierInput().CurPet[0].GetHP()
|
||||
if curHP.Mul(e.Args()[0]).Cmp(maxHP) >= 0 {
|
||||
return true
|
||||
}
|
||||
@@ -65,9 +65,9 @@ func (e *Effect1449) Skill_Use() bool {
|
||||
if len(e.Args()) < 2 {
|
||||
return true
|
||||
}
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1449, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1449, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||||
e.OpponentInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -82,7 +82,7 @@ func (e *Effect1449Sub) Heal_Pre(_ action.BattleActionI, amount *int) bool {
|
||||
}
|
||||
damage := alpacadecimal.NewFromInt(int64(*amount)).Div(e.Args()[1])
|
||||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
|
||||
e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
|
||||
}
|
||||
*amount = 0
|
||||
return true
|
||||
@@ -96,14 +96,14 @@ func (e *Effect1450) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
drain := e.Args()[0]
|
||||
for _, s := range e.Ctx().Opp.CurPet[0].Info.SkillList {
|
||||
for _, s := range e.OpponentInput().CurPet[0].Info.SkillList {
|
||||
if s.PP < uint32(e.Args()[1].IntPart()) {
|
||||
drain = drain.Mul(alpacadecimal.NewFromInt(2))
|
||||
break
|
||||
}
|
||||
}
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: drain})
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
|
||||
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: drain})
|
||||
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, drain)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -114,12 +114,12 @@ func (e *Effect1451) Skill_Use() bool {
|
||||
if len(e.Args()) < 2 {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) > 0 {
|
||||
e.Ctx().Our.AddShield(e.Args()[0])
|
||||
if e.CarrierInput().CurPet[0].GetHP().Cmp(e.OpponentInput().CurPet[0].GetHP()) > 0 {
|
||||
e.CarrierInput().AddShield(e.Args()[0])
|
||||
return true
|
||||
}
|
||||
heal := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[1])
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||||
heal := e.CarrierInput().CurPet[0].GetMaxHP().Div(e.Args()[1])
|
||||
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, heal)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -130,9 +130,9 @@ func (e *Effect1452) Skill_Use() bool {
|
||||
if len(e.Args()) == 0 {
|
||||
return true
|
||||
}
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1452, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1452, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -151,9 +151,9 @@ func (e *Effect1452Sub) Damage_Mul(zone *info.DamageZone) bool {
|
||||
type Effect1453 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1453) Skill_Use() bool {
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1453, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1453, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -196,7 +196,7 @@ func (e *Effect1455) Damage_Mul(zone *info.DamageZone) bool {
|
||||
maxHits := int(e.Args()[1].IntPart())
|
||||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(int64(maxHits)))
|
||||
if maxHits > 0 {
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Opp.CurPet[0].GetHP()})
|
||||
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.OpponentInput().CurPet[0].GetHP()})
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -208,12 +208,12 @@ func (e *Effect1456) Skill_Use() bool {
|
||||
if len(e.Args()) < 2 {
|
||||
return true
|
||||
}
|
||||
maxHP := e.Ctx().Our.CurPet[0].GetMaxHP()
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()})
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: maxHP.Div(e.Args()[0])})
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1456, e.SideEffectArgs...)
|
||||
maxHP := e.CarrierInput().CurPet[0].GetMaxHP()
|
||||
e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()})
|
||||
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: maxHP.Div(e.Args()[0])})
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1456, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -236,10 +236,10 @@ func (e *Effect1457) OnSkill() bool {
|
||||
}
|
||||
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||||
if success {
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
||||
addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[2].IntPart()))
|
||||
return true
|
||||
}
|
||||
randomSkillPPZero(e.Ctx().Opp, int(e.Args()[3].IntPart()))
|
||||
randomSkillPPZero(e.OpponentInput(), int(e.Args()[3].IntPart()))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -247,9 +247,9 @@ func (e *Effect1457) OnSkill() bool {
|
||||
type Effect1458 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1458) Skill_Use() bool {
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1458, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1458, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -267,7 +267,7 @@ func (e *Effect1458Sub) SkillHit_ex() bool {
|
||||
}
|
||||
if len(e.Args()) >= 4 {
|
||||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100); ok {
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[3].IntPart()))
|
||||
addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[3].IntPart()))
|
||||
}
|
||||
}
|
||||
return true
|
||||
@@ -281,12 +281,12 @@ func (e *Effect1459) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
return true
|
||||
}
|
||||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||||
addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart()))
|
||||
return true
|
||||
}
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1459, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1459, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||||
e.OpponentInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -322,10 +322,10 @@ func (e *Effect1461) Skill_Use() bool {
|
||||
if len(e.Args()) == 0 {
|
||||
return true
|
||||
}
|
||||
heal := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[0])
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||||
if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Opp.CurPet[0].GetHP()) < 0 {
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: heal})
|
||||
heal := e.CarrierInput().CurPet[0].GetMaxHP().Div(e.Args()[0])
|
||||
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, heal)
|
||||
if e.CarrierInput().CurPet[0].GetHP().Cmp(e.OpponentInput().CurPet[0].GetHP()) < 0 {
|
||||
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: heal})
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -334,9 +334,9 @@ func (e *Effect1461) Skill_Use() bool {
|
||||
type Effect1462 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1462) Skill_Use() bool {
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1462, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1462, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -349,7 +349,7 @@ func (e *Effect1462Sub) DamageAdd(zone *info.DamageZone) bool {
|
||||
}
|
||||
bonus := e.Args()[1]
|
||||
boosted := false
|
||||
for _, v := range e.Ctx().Our.Prop[:] {
|
||||
for _, v := range e.CarrierInput().Prop[:] {
|
||||
if v > 0 {
|
||||
boosted = true
|
||||
break
|
||||
@@ -369,9 +369,9 @@ func (e *Effect1463) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
if !e.IsFirst() {
|
||||
return true
|
||||
}
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1463)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1463)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -382,11 +382,11 @@ func (e *Effect1463Sub) DamageLock(zone *info.DamageZone) bool {
|
||||
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Our.CurPet[0].GetHP().Cmp(zone.Damage) > 0 {
|
||||
if e.CarrierInput().CurPet[0].GetHP().Cmp(zone.Damage) > 0 {
|
||||
return true
|
||||
}
|
||||
zone.Damage = alpacadecimal.Zero
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurPet[0].GetMaxHP())
|
||||
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, e.CarrierInput().CurPet[0].GetMaxHP())
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -394,14 +394,14 @@ func (e *Effect1463Sub) DamageLock(zone *info.DamageZone) bool {
|
||||
type Effect1464 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1464) OnSkill() bool {
|
||||
if e.Ctx().Opp.CurPet[0].Info.Hp > 0 || len(e.Args()) < 3 {
|
||||
if e.OpponentInput().CurPet[0].Info.Hp > 0 || len(e.Args()) < 3 {
|
||||
return true
|
||||
}
|
||||
if !e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) {
|
||||
if !e.OpponentInput().StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) {
|
||||
return true
|
||||
}
|
||||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
||||
addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[2].IntPart()))
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -419,8 +419,8 @@ func (e *Effect1465) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
for i := range e.Ctx().Opp.Prop[:] {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(-e.Args()[0].IntPart()))
|
||||
for i := range e.OpponentInput().Prop[:] {
|
||||
e.OpponentInput().SetProp(e.CarrierInput(), int8(i), int8(-e.Args()[0].IntPart()))
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -429,9 +429,9 @@ func (e *Effect1465) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
type Effect1466 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1466) Skill_Use() bool {
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1466, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1466, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -443,7 +443,7 @@ func (e *Effect1466Sub) SkillHit_ex() bool {
|
||||
return true
|
||||
}
|
||||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
||||
addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[2].IntPart()))
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -465,7 +465,7 @@ func (e *Effect1467) Skill_Use() bool {
|
||||
}
|
||||
indexes := grand.Perm(6)
|
||||
for i := 0; i < count && i < len(indexes); i++ {
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(indexes[i]), int8(boost))
|
||||
e.CarrierInput().SetProp(e.CarrierInput(), int8(indexes[i]), int8(boost))
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -478,7 +478,7 @@ func (e *Effect1468) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
triggered := false
|
||||
for _, target := range []*input.Input{e.Ctx().Our, e.Ctx().Opp} {
|
||||
for _, target := range []*input.Input{e.CarrierInput(), e.OpponentInput()} {
|
||||
for _, eff := range target.Effects {
|
||||
if eff != nil && eff.Alive() {
|
||||
eff.Alive(false)
|
||||
@@ -487,8 +487,8 @@ func (e *Effect1468) Skill_Use() bool {
|
||||
}
|
||||
}
|
||||
if triggered {
|
||||
damageByFixed(e.Ctx().Our, e.Ctx().Opp, e.Args()[0].IntPart())
|
||||
randomSkillPPZero(e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||||
damageByFixed(e.CarrierInput(), e.OpponentInput(), e.Args()[0].IntPart())
|
||||
randomSkillPPZero(e.OpponentInput(), int(e.Args()[1].IntPart()))
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -497,9 +497,9 @@ func (e *Effect1468) Skill_Use() bool {
|
||||
type Effect1469 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1469) Skill_Use() bool {
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1469, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1469, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -521,7 +521,7 @@ func (e *Effect1470) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
e.Ctx().SkillEntity.XML.Power += int(e.Ctx().Our.CurPet[0].Info.Dv)
|
||||
e.Ctx().SkillEntity.XML.Power += int(e.CarrierInput().CurPet[0].Info.Dv)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ func (e *Effect1471) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
removed := false
|
||||
for _, eff := range e.Ctx().Opp.Effects {
|
||||
for _, eff := range e.OpponentInput().Effects {
|
||||
if eff != nil && eff.Alive() {
|
||||
eff.Alive(false)
|
||||
removed = true
|
||||
@@ -541,12 +541,12 @@ func (e *Effect1471) Skill_Use() bool {
|
||||
}
|
||||
if removed {
|
||||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||||
addStatusByID(e.CarrierInput(), e.OpponentInput(), int(e.Args()[1].IntPart()))
|
||||
}
|
||||
return true
|
||||
}
|
||||
heal := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[2])
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||||
heal := e.CarrierInput().CurPet[0].GetMaxHP().Div(e.Args()[2])
|
||||
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, heal)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ func (e *Effect1472) Damage_Mul(zone *info.DamageZone) bool {
|
||||
return true
|
||||
}
|
||||
boosted := false
|
||||
for _, v := range e.Ctx().Our.Prop[:] {
|
||||
for _, v := range e.CarrierInput().Prop[:] {
|
||||
if v > 0 {
|
||||
boosted = true
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user