refactor: 迁移 effect 至新语义上下文
This commit is contained in:
@@ -17,7 +17,7 @@ func (e *Effect1473) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
cleared := false
|
||||
for _, eff := range e.Ctx().Opp.Effects {
|
||||
for _, eff := range e.OpponentInput().Effects {
|
||||
if eff == nil || !eff.Alive() {
|
||||
continue
|
||||
}
|
||||
@@ -25,7 +25,7 @@ func (e *Effect1473) Skill_Use() bool {
|
||||
cleared = true
|
||||
}
|
||||
if cleared {
|
||||
randomSkillPPZero(e.Ctx().Opp, int(e.Args()[0].IntPart()))
|
||||
randomSkillPPZero(e.OpponentInput(), int(e.Args()[0].IntPart()))
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -34,9 +34,9 @@ func (e *Effect1473) Skill_Use() bool {
|
||||
type Effect1474 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1474) Skill_Use() bool {
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1474, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1474, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -47,11 +47,11 @@ type Effect1474Sub struct {
|
||||
}
|
||||
|
||||
func (e *Effect1474Sub) PropBefer(in *input.Input, prop, level int8) bool {
|
||||
if in != e.Ctx().Our || level >= 0 {
|
||||
if in != e.CarrierInput() || level >= 0 {
|
||||
return true
|
||||
}
|
||||
e.removed++
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: e.Args()[1],
|
||||
})
|
||||
@@ -62,9 +62,9 @@ func (e *Effect1474Sub) PropBefer(in *input.Input, prop, level int8) bool {
|
||||
type Effect1475 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1475) Skill_Use() bool {
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1475, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1475, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -87,11 +87,11 @@ func (e *Effect1476) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
delta := int8(-e.Args()[0].IntPart())
|
||||
if e.Ctx().Our.CurPet[0].GetHP().Mul(e.Args()[1]).Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) < 0 {
|
||||
if e.CarrierInput().CurPet[0].GetHP().Mul(e.Args()[1]).Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) < 0 {
|
||||
delta *= 2
|
||||
}
|
||||
for i := range e.Ctx().Opp.Prop[:] {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), delta)
|
||||
for i := range e.OpponentInput().Prop[:] {
|
||||
e.OpponentInput().SetProp(e.CarrierInput(), int8(i), delta)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -104,7 +104,7 @@ func (e *Effect1477) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
cleared := 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() {
|
||||
continue
|
||||
@@ -114,9 +114,9 @@ func (e *Effect1477) Skill_Use() bool {
|
||||
}
|
||||
}
|
||||
if cleared {
|
||||
drain := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[0])
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: drain})
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
|
||||
drain := e.OpponentInput().CurPet[0].GetMaxHP().Div(e.Args()[0])
|
||||
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Percent, Damage: drain})
|
||||
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, drain)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -125,9 +125,9 @@ func (e *Effect1477) Skill_Use() bool {
|
||||
type Effect1478 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1478) Skill_Use() bool {
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1478, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1478, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -135,7 +135,7 @@ func (e *Effect1478) Skill_Use() bool {
|
||||
type Effect1478Sub struct{ RoundEffectArg0Base }
|
||||
|
||||
func (e *Effect1478Sub) SwitchOut(in *input.Input) bool {
|
||||
if in == e.Ctx().Opp {
|
||||
if in == e.OpponentInput() {
|
||||
e.Alive(false)
|
||||
}
|
||||
return true
|
||||
@@ -148,10 +148,10 @@ func (e *Effect1479) Skill_Use() bool {
|
||||
if len(e.Args()) == 0 {
|
||||
return true
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()})
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1479, e.SideEffectArgs...)
|
||||
e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()})
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1479, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||||
e.OpponentInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -194,7 +194,7 @@ func (e *Effect1481) Damage_Mul(zone *info.DamageZone) bool {
|
||||
return true
|
||||
}
|
||||
chance := int(e.Args()[0].IntPart())
|
||||
for _, v := range e.Ctx().Opp.Prop[:] {
|
||||
for _, v := range e.OpponentInput().Prop[:] {
|
||||
if v < 0 {
|
||||
chance *= 2
|
||||
break
|
||||
@@ -217,10 +217,10 @@ func (e *Effect1482) Skill_Use() 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
|
||||
}
|
||||
for _, eff := range e.Ctx().Opp.Effects {
|
||||
for _, eff := range e.OpponentInput().Effects {
|
||||
if eff != nil && eff.Alive() {
|
||||
eff.Alive(false)
|
||||
}
|
||||
@@ -232,9 +232,9 @@ func (e *Effect1482) Skill_Use() bool {
|
||||
type Effect1483 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1483) Skill_Use() bool {
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1483, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1483, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -243,9 +243,9 @@ type Effect1483Sub struct{ RoundEffectArg0Base }
|
||||
|
||||
func (e *Effect1483Sub) Skill_Use() bool {
|
||||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Crit > 0 {
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1483, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1483, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||||
e.OpponentInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
}
|
||||
return true
|
||||
@@ -262,10 +262,10 @@ func (e *Effect1483Sub) SkillHit_ex() bool {
|
||||
type Effect1484 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1484) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
if e.Ctx().Our.CurPet[0].GetHP().Mul(alpacadecimal.NewFromInt(2)).Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) >= 0 {
|
||||
if e.CarrierInput().CurPet[0].GetHP().Mul(alpacadecimal.NewFromInt(2)).Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) >= 0 {
|
||||
return true
|
||||
}
|
||||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||||
current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID)
|
||||
if current != nil && current.SkillEntity != nil {
|
||||
current.SkillEntity.XML.Priority += 1
|
||||
}
|
||||
@@ -280,7 +280,7 @@ func (e *Effect1485) OnSkill() bool {
|
||||
return true
|
||||
}
|
||||
boosted := false
|
||||
for _, v := range e.Ctx().Opp.Prop[:] {
|
||||
for _, v := range e.OpponentInput().Prop[:] {
|
||||
if v > 0 {
|
||||
boosted = true
|
||||
break
|
||||
@@ -290,11 +290,11 @@ func (e *Effect1485) OnSkill() 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
|
||||
}
|
||||
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
|
||||
}
|
||||
@@ -307,7 +307,7 @@ func (e *Effect1486) Damage_Mul(zone *info.DamageZone) bool {
|
||||
return true
|
||||
}
|
||||
chance := int(e.Args()[0].IntPart())
|
||||
if e.Ctx().Our.HasShield() {
|
||||
if e.CarrierInput().HasShield() {
|
||||
chance *= 2
|
||||
}
|
||||
if chance > 100 {
|
||||
@@ -323,10 +323,10 @@ func (e *Effect1486) Damage_Mul(zone *info.DamageZone) bool {
|
||||
type Effect1487 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1487) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
if !e.Ctx().Our.HasShield() {
|
||||
if !e.CarrierInput().HasShield() {
|
||||
return true
|
||||
}
|
||||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||||
current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID)
|
||||
if current != nil && current.SkillEntity != nil {
|
||||
current.SkillEntity.XML.Priority += 1
|
||||
}
|
||||
@@ -341,7 +341,7 @@ func (e *Effect1488) OnSkill() 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
|
||||
}
|
||||
@@ -354,12 +354,12 @@ func (e *Effect1489) OnSkill() 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, 1489, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1489, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -384,12 +384,12 @@ func (e *Effect1490) OnSkill() 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, 1490, e.SideEffectArgs...)
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1490, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||||
e.OpponentInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -410,7 +410,7 @@ func (e *Effect1491) ComparePre(fattack, sattack *action.SelectSkillAction) bool
|
||||
if !e.ISNaturalEnemy() {
|
||||
return true
|
||||
}
|
||||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||||
current := actionByPlayer(fattack, sattack, e.CarrierInput().UserID)
|
||||
if current != nil && current.SkillEntity != nil {
|
||||
current.SkillEntity.XML.Priority += 1
|
||||
}
|
||||
@@ -425,7 +425,7 @@ func (e *Effect1492) OnSkill() bool {
|
||||
return true
|
||||
}
|
||||
down := false
|
||||
for _, v := range e.Ctx().Opp.Prop[:] {
|
||||
for _, v := range e.OpponentInput().Prop[:] {
|
||||
if v < 0 {
|
||||
down = true
|
||||
break
|
||||
@@ -434,7 +434,7 @@ func (e *Effect1492) OnSkill() bool {
|
||||
if !down {
|
||||
return true
|
||||
}
|
||||
applyRandomStatuses1507(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart()))
|
||||
applyRandomStatuses1507(e.CarrierInput(), e.OpponentInput(), int(e.Args()[0].IntPart()))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -442,10 +442,10 @@ func (e *Effect1492) OnSkill() bool {
|
||||
type Effect1493 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1493) Skill_Use() bool {
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()})
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1493)
|
||||
e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()})
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1493)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -453,7 +453,7 @@ func (e *Effect1493) Skill_Use() bool {
|
||||
type Effect1493Sub struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1493Sub) SwitchIn(in *input.Input) bool {
|
||||
if in != e.Ctx().Our {
|
||||
if in != e.CarrierInput() {
|
||||
return true
|
||||
}
|
||||
e.Duration(3)
|
||||
@@ -464,11 +464,11 @@ func (e *Effect1493Sub) SwitchIn(in *input.Input) bool {
|
||||
type Effect1494 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1494) OnSkill() bool {
|
||||
if len(e.Args()) < 2 || e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) != 0 {
|
||||
if len(e.Args()) < 2 || e.CarrierInput().CurPet[0].GetHP().Cmp(e.CarrierInput().CurPet[0].GetMaxHP()) != 0 {
|
||||
return true
|
||||
}
|
||||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
||||
randomSkillPPZero(e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||||
randomSkillPPZero(e.OpponentInput(), int(e.Args()[1].IntPart()))
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -481,7 +481,7 @@ func (e *Effect1495) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
swapped := false
|
||||
for _, i := range e.Ctx().Opp.Prop[:] {
|
||||
for _, i := range e.OpponentInput().Prop[:] {
|
||||
if i > 0 {
|
||||
swapped = true
|
||||
break
|
||||
@@ -491,7 +491,7 @@ func (e *Effect1495) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
||||
randomSkillPPZero(e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||||
randomSkillPPZero(e.OpponentInput(), int(e.Args()[1].IntPart()))
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -503,11 +503,11 @@ func (e *Effect1496) Skill_Use() bool {
|
||||
if len(e.Args()) < 3 {
|
||||
return true
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurPet[0].GetHP()})
|
||||
e.Ctx().Our.AddShield(e.Args()[0])
|
||||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1496, e.SideEffectArgs...)
|
||||
e.CarrierInput().Damage(e.CarrierInput(), &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.CarrierInput().CurPet[0].GetHP()})
|
||||
e.CarrierInput().AddShield(e.Args()[0])
|
||||
eff := e.CarrierInput().InitEffect(input.EffectType.Sub, 1496, e.SideEffectArgs...)
|
||||
if eff != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||||
e.CarrierInput().AddEffect(e.CarrierInput(), eff)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -516,7 +516,7 @@ type Effect1496Sub struct{ RoundEffectArg0Base }
|
||||
|
||||
func (e *Effect1496Sub) TurnEnd() {
|
||||
if len(e.Args()) >= 3 {
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[2])
|
||||
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, e.Args()[2])
|
||||
}
|
||||
e.EffectNode.TurnEnd()
|
||||
}
|
||||
@@ -525,9 +525,9 @@ func (e *Effect1496Sub) TurnEnd() {
|
||||
type Effect1497 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1497) Skill_Use() bool {
|
||||
heal := e.Ctx().Our.CurrentShield().Add(e.Ctx().Opp.CurrentShield())
|
||||
heal := e.CarrierInput().CurrentShield().Add(e.OpponentInput().CurrentShield())
|
||||
if heal.Cmp(alpacadecimal.Zero) > 0 {
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||||
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, heal)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user