refactor: 重构效果系统中的上下文引用

This commit is contained in:
xinian
2026-04-04 07:22:28 +08:00
committed by cnb
parent 5a5a1db2a3
commit c89632b409
95 changed files with 221 additions and 207 deletions

View File

@@ -17,11 +17,11 @@ type Effect1044 struct {
func (e *Effect1044) OnSkill() bool {
// 检查对手是否有能力提升状态可以吸取
for i, v := range e.Ctx().Opp.Prop[:] {
for i, v := range e.OpponentInput().Prop[:] {
if v > 0 {
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
if e.OpponentInput().SetProp(e.CarrierInput(), int8(i), 0) {
e.can = true
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
e.CarrierInput().SetProp(e.CarrierInput(), int8(i), v)
}
}

View File

@@ -24,12 +24,12 @@ func (e *Effect138) DamageLockEx(t *info.DamageZone) bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
// 反弹1/n造成的伤害
damageToBounce := e.Ctx().Opp.SumDamage.Div(e.Args()[1]) // 1/n
damageToBounce := e.OpponentInput().SumDamage.Div(e.Args()[1]) // 1/n
damageZone := &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damageToBounce,
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
e.OpponentInput().Damage(e.CarrierInput(), damageZone)
if t.Type == info.DamageType.Fixed {
t.Damage = alpacadecimal.Zero
}

View File

@@ -15,9 +15,9 @@ type Effect143 struct {
// ----------------------
func (e *Effect143) OnSkill() bool {
for i, v := range e.Ctx().Opp.Prop[:] {
for i, v := range e.OpponentInput().Prop[:] {
if v > 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v)
e.OpponentInput().SetProp(e.CarrierInput(), int8(i), -2*v)
}
}

View File

@@ -15,9 +15,9 @@ func (e *Effect146) Skill_Use_ex() bool {
chance := e.Args()[1].IntPart() // m%
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
poisonEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Poisoned))
poisonEffect := e.CarrierInput().InitEffect(input.EffectType.Status, int(info.PetStatus.Poisoned))
if poisonEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, poisonEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), poisonEffect)
}
}
}

View File

@@ -18,9 +18,9 @@ func (e *Effect149) OnSkill() bool {
if success1 {
effectType1 := int(e.Args()[2].IntPart()) // 第一个异常状态类型
statusEffect1 := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType1)
statusEffect1 := e.CarrierInput().InitEffect(input.EffectType.Status, effectType1)
if statusEffect1 != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect1)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect1)
}
}
@@ -30,9 +30,9 @@ func (e *Effect149) OnSkill() bool {
if success2 {
effectType2 := int(e.Args()[3].IntPart()) // 第二个异常状态类型
statusEffect2 := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType2)
statusEffect2 := e.CarrierInput().InitEffect(input.EffectType.Status, effectType2)
if statusEffect2 != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect2)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect2)
}
}

View File

@@ -10,9 +10,9 @@ type Effect150 struct {
}
func (e *Effect150) Skill_Use() bool {
e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1]))
e.OpponentInput().SetProp(e.OpponentInput(), 1, int8(e.SideEffectArgs[1]))
e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1]))
e.OpponentInput().SetProp(e.OpponentInput(), 3, int8(e.SideEffectArgs[1]))
return true
}
func init() {

View File

@@ -14,19 +14,19 @@ type Effect155 struct {
func (e *Effect155) OnSkill() bool {
// 恢复全部体力
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, maxHp)
// 消除所有能力下降
for i := 0; i < 6; i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0)
e.CarrierInput().SetProp(e.CarrierInput(), int8(i), 0)
}
// 使自己进入睡眠n回合
sleepEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Sleep))
sleepEffect := e.CarrierInput().InitEffect(input.EffectType.Status, int(info.PetStatus.Sleep))
if sleepEffect != nil {
sleepEffect.Duration(int(e.Args()[0].IntPart())) // n回合
e.Ctx().Our.AddEffect(e.Ctx().Our, sleepEffect)
e.CarrierInput().AddEffect(e.CarrierInput(), sleepEffect)
}
return true

View File

@@ -12,15 +12,15 @@ type Effect156 struct {
func (e *Effect156) Skill_Use() bool {
for i, v := range e.Ctx().Opp.Prop[:] {
for i, v := range e.OpponentInput().Prop[:] {
if v > 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
e.OpponentInput().SetProp(e.CarrierInput(), int8(i), 0)
}
}
addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect156_sub{}, e.SideEffectArgs[0])
addSubEffect(e.CarrierInput(), e.OpponentInput(), &e.EffectNode, &Effect156_sub{}, e.SideEffectArgs[0])
return true
}
@@ -36,7 +36,7 @@ type Effect156_sub struct {
func (e *Effect156_sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
if in != e.Ctx().Our {
if in != e.CarrierInput() {
return true
}
if input.IS_Stat(effEffect) {

View File

@@ -13,9 +13,9 @@ func (e *Effect157) Skill_Use_ex() bool {
if e.Ctx().SkillEntity == nil {
return true
}
e.Ctx().Opp.SetProp(e.Ctx().Our, 1, -1)
e.Ctx().Opp.SetProp(e.Ctx().Our, 3, -1)
e.Ctx().Opp.SetProp(e.Ctx().Our, 5, -1)
e.OpponentInput().SetProp(e.CarrierInput(), 1, -1)
e.OpponentInput().SetProp(e.CarrierInput(), 3, -1)
e.OpponentInput().SetProp(e.CarrierInput(), 5, -1)
return true
}

View File

@@ -10,8 +10,8 @@ type Effect165 struct {
}
func (e *Effect165) Skill_Use() bool {
e.Ctx().Our.SetProp(e.Ctx().Our, 1, int8(e.SideEffectArgs[1]))
e.Ctx().Our.SetProp(e.Ctx().Our, 3, int8(e.SideEffectArgs[1]))
e.CarrierInput().SetProp(e.CarrierInput(), 1, int8(e.SideEffectArgs[1]))
e.CarrierInput().SetProp(e.CarrierInput(), 3, int8(e.SideEffectArgs[1]))
return true
}
func init() {

View File

@@ -17,7 +17,7 @@ func (e *Effect166) Skill_Use_ex() bool {
if success {
effectType := int8(e.Args()[1].IntPart()) // XX类型
effectValue := int8(e.Args()[2].IntPart()) // 等级k
e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue)
e.OpponentInput().SetProp(e.CarrierInput(), effectType, effectValue)
}
}

View File

@@ -15,9 +15,9 @@ func (e *Effect169) OnSkill() bool {
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
// 添加异常状态
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart())) // 以麻痹为例
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart())) // 以麻痹为例
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect)
}
}
return true

View File

@@ -18,10 +18,10 @@ func (e *Effect170) Skill_Use() bool {
if e.IsFirst() { // 先出手
// 回复1/n的最大体力值
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
healAmount := maxHp.Div(e.Args()[0]) // 1/n
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, healAmount)
}
return true

View File

@@ -12,7 +12,7 @@ type Effect171 struct {
func (e *Effect171) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
if !e.IsOwner() {
return true
}

View File

@@ -16,9 +16,9 @@ func (e *Effect173) OnSkill() bool {
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) // 以麻痹为例
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) // 以麻痹为例
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect)
}
}
}

View File

@@ -11,17 +11,17 @@ type Effect175 struct {
}
func (e *Effect175) OnSkill() bool {
if e.Ctx().Opp.StatEffect_Exist_all() { // 对手处于异常状态
if e.OpponentInput().StatEffect_Exist_all() { // 对手处于异常状态
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
effectType := int(e.Args()[1].IntPart()) // XX类型
effectValue := int(e.Args()[2].IntPart()) // 等级k
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
statusEffect.SetArgs(e.Ctx().Our, effectValue)
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
statusEffect.SetArgs(e.CarrierInput(), effectValue)
e.CarrierInput().AddEffect(e.CarrierInput(), statusEffect)
}
}
}

View File

@@ -30,9 +30,9 @@ func (e *Effect176) OnSkill() bool {
randomIndex := grand.Intn(len(statusTypes))
selectedStatus := statusTypes[randomIndex]
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStatus)
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, selectedStatus)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect)
}
}

View File

@@ -12,10 +12,10 @@ type Effect177 struct {
func (e *Effect177) Skill_Use_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.AttackTime == 0 {
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
healAmount := maxHp.Div(e.Args()[1]) // 1/m
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, healAmount)
}
return true
}

View File

@@ -14,10 +14,10 @@ type Effect178 struct {
}
func (e *Effect178) Skill_Use_ex() bool {
damageDone := e.Ctx().Our.SumDamage
damageDone := e.CarrierInput().SumDamage
var healAmount alpacadecimal.Decimal
if e.Ctx().Our.CurPet[0].Type == e.Ctx().Opp.CurPet[0].Type {
if e.CarrierInput().CurPet[0].Type == e.OpponentInput().CurPet[0].Type {
// 属性相同1/m
healAmount = damageDone.Div(e.Args()[1])
} else {
@@ -25,7 +25,7 @@ func (e *Effect178) Skill_Use_ex() bool {
healAmount = damageDone.Div(e.Args()[0])
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, healAmount)
return true
}

View File

@@ -15,7 +15,7 @@ func (e *Effect179) SkillHit() bool {
return true
}
if e.Ctx().Our.CurPet[0].Type == e.Ctx().Opp.CurPet[0].Type {
if e.CarrierInput().CurPet[0].Type == e.OpponentInput().CurPet[0].Type {
// 属性相同技能威力提升n
e.Ctx().SkillEntity.XML.Power += int(e.Args()[0].IntPart())
}

View File

@@ -11,17 +11,17 @@ type Effect184 struct {
}
func (e *Effect184) OnSkill() bool {
if e.Ctx().Opp.HasPropADD() { // 对手处于能力提升状态
if e.OpponentInput().HasPropADD() { // 对手处于能力提升状态
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
effectType := int(e.Args()[1].IntPart()) // XX类型
effectValue := int(e.Args()[2].IntPart()) // 等级k
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
statusEffect.SetArgs(e.Ctx().Our, effectValue)
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
statusEffect.SetArgs(e.CarrierInput(), effectValue)
e.CarrierInput().AddEffect(e.CarrierInput(), statusEffect)
}
}
}

View File

@@ -15,12 +15,12 @@ func (e *Effect188) SkillHit() bool {
return true
}
if e.Ctx().Opp.StatEffect_Exist_all() { // 对手处于异常状态
if e.OpponentInput().StatEffect_Exist_all() { // 对手处于异常状态
// 威力翻倍
e.Ctx().SkillEntity.XML.Power *= 2
// 消除对手相应的防御能力提升效果
e.Ctx().Opp.SetProp(e.Ctx().Our, 1, 0)
e.OpponentInput().SetProp(e.CarrierInput(), 1, 0)
}
return true

View File

@@ -15,9 +15,9 @@ func (e *Effect190) Skill_Use_ex() bool {
}
// 消除对手所有能力强化状态
for i, v := range e.Ctx().Opp.Prop[:] {
for i, v := range e.OpponentInput().Prop[:] {
if v > 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
e.OpponentInput().SetProp(e.CarrierInput(), int8(i), 0)
}
}

View File

@@ -16,7 +16,7 @@ func (e *Effect193) SkillHit() bool {
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())) { // 对手处于异常状态
// 设定必定暴击
e.Ctx().SkillEntity.XML.CritRate = 16
}

View File

@@ -15,16 +15,16 @@ type Effect194 struct {
}
func (e *Effect194) Skill_Use() bool {
damageDone := e.Ctx().Our.SumDamage
damageDone := e.CarrierInput().SumDamage
var healAmount alpacadecimal.Decimal
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[1].IntPart())) { // 假设有检查异常状态的方法
if e.OpponentInput().StatEffect_Exist(info.EnumPetStatus(e.Args()[1].IntPart())) { // 假设有检查异常状态的方法
healAmount = damageDone.Div(e.Args()[2]) // 1/m
} else {
healAmount = damageDone.Div(e.Args()[0]) // 1/n
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, healAmount)
return true
}

View File

@@ -16,14 +16,14 @@ func (e *Effect196) OnSkill() bool {
effectValue := e.Args()[5].IntPart() // 等级-k
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[3].IntPart()), int8(effectValue))
e.OpponentInput().SetProp(e.OpponentInput(), int8(e.Args()[3].IntPart()), int8(effectValue))
}
} else { // 后出手
chance := e.Args()[1].IntPart() // j%
effectValue := e.Args()[2].IntPart() // 等级-k
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), int8(effectValue))
e.OpponentInput().SetProp(e.OpponentInput(), int8(e.Args()[0].IntPart()), int8(effectValue))
}
}

View File

@@ -11,10 +11,10 @@ type Effect197 struct {
func (e *Effect197) SwitchOut(in *input.Input) bool {
if e.Input == in {
if !e.Ctx().Our.CurPet[0].Alive() { // 被击败
for i, v := range e.Ctx().Opp.Prop[:] {
if !e.CarrierInput().CurPet[0].Alive() { // 被击败
for i, v := range e.OpponentInput().Prop[:] {
if v > 0 {
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(i), 0)
e.OpponentInput().SetProp(e.OpponentInput(), int8(i), 0)
}
}

View File

@@ -18,7 +18,7 @@ func (e *Effect198) OnSkill() bool {
// 随机选择n种能力
for i := 0; i < numStats; i++ {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(grand.Intn(5)), reduction)
e.OpponentInput().SetProp(e.CarrierInput(), int8(grand.Intn(5)), reduction)
}
return true

View File

@@ -11,11 +11,11 @@ type Effect199 struct {
func (e *Effect199) SwitchOut(in *input.Input) bool {
if e.Input == in {
if !e.Ctx().Our.CurPet[0].Alive() { // 被击败
if !e.CarrierInput().CurPet[0].Alive() { // 被击败
// 设置下一个出场精灵的增益效果
effectType := int8(e.Args()[0].IntPart()) // xx类型
effectValue := int8(e.Args()[1].IntPart()) // 等级+k
e.Ctx().Our.SetProp(e.Ctx().Our, effectType, effectValue)
e.CarrierInput().SetProp(e.CarrierInput(), effectType, effectValue)
}
e.Alive(false)
}

View File

@@ -11,15 +11,15 @@ type Effect200 struct {
}
func (e *Effect200) OnSkill() bool {
if e.Ctx().Opp.HasPropADD() {
if e.OpponentInput().HasPropADD() {
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
effectType := int(e.Args()[1].IntPart()) // XX类型
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect)
}
}

View File

@@ -17,7 +17,7 @@ func (e *Effect400) SkillHit() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().Our.CurPet[0].PetInfo.Type != e.Ctx().Opp.CurPet[0].PetInfo.Type {
if e.CarrierInput().CurPet[0].PetInfo.Type != e.OpponentInput().CurPet[0].PetInfo.Type {
return true
}
e.Ctx().SkillEntity.XML.Power *= 2
@@ -107,7 +107,7 @@ func (e *Effect610) ComparePre(fattack, sattack *action.SelectSkillAction) bool
if !e.ISNaturalEnemy() {
return true
}
if fattack == nil || fattack.PlayerID == e.Ctx().Our.UserID {
if fattack == nil || fattack.PlayerID == e.CarrierInput().UserID {
return true
}
if sattack == nil || sattack.SkillEntity == nil {
@@ -129,7 +129,7 @@ func (e *Effect611) OnSkill() bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[1],
})

View File

@@ -17,12 +17,12 @@ func (e *Effect403) OnSkill() bool {
if success {
boostValue := int8(e.Args()[1].IntPart())
// 检查属性是否相同
if e.Ctx().Our.CurPet[0].Type == e.Ctx().Opp.CurPet[0].Type {
if e.CarrierInput().CurPet[0].Type == e.OpponentInput().CurPet[0].Type {
boostValue *= 2
}
e.Ctx().Our.SetProp(e.Ctx().Our, 4, boostValue)
e.Ctx().Our.SetProp(e.Ctx().Our, 2, boostValue)
e.CarrierInput().SetProp(e.CarrierInput(), 4, boostValue)
e.CarrierInput().SetProp(e.CarrierInput(), 2, boostValue)
}
return true

View File

@@ -17,7 +17,7 @@ func (e *Effect407) Skill_Use() bool {
effectValue := int8(e.Args()[1].IntPart()) // 等级+n
duration := int(e.Args()[2].IntPart()) // 持续m回合
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect407_sub{
addSubEffect(e.CarrierInput(), e.CarrierInput(), &e.EffectNode, &Effect407_sub{
effectType: effectType,
effectValue: effectValue,
}, duration)
@@ -32,7 +32,7 @@ type Effect407_sub struct {
}
func (e *Effect407_sub) ActionStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
e.Ctx().Our.SetProp(e.Ctx().Our, e.effectType, e.effectValue)
e.CarrierInput().SetProp(e.CarrierInput(), e.effectType, e.effectValue)
return true
}

View File

@@ -16,10 +16,10 @@ func (e *Effect410) OnSkill() bool {
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
healAmount := maxHp.Div(e.Args()[1]) // 1/m
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, healAmount)
}
return true

View File

@@ -11,8 +11,8 @@ type Effect412 struct {
}
func (e *Effect412) HookPP(count *int) bool {
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
currentHp := e.Ctx().Our.CurPet[0].GetHP()
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
currentHp := e.CarrierInput().CurPet[0].GetHP()
threshold := maxHp.Div(e.Args()[0]) // 1/n
if currentHp.Cmp(threshold) < 0 {

View File

@@ -16,11 +16,11 @@ type Effect417 struct {
func (e *Effect417) SkillHit_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
// 是攻击技能
damageDone := e.Ctx().Our.SumDamage
damageDone := e.CarrierInput().SumDamage
healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // m%
healAmount := damageDone.Mul(healPercent)
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, healAmount)
}
return true

View File

@@ -11,8 +11,8 @@ type Effect418 struct {
}
func (e *Effect418) OnSkill() bool {
if e.Ctx().Opp.HasPropADD() {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]))
if e.OpponentInput().HasPropADD() {
e.OpponentInput().SetProp(e.CarrierInput(), int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]))
}

View File

@@ -11,14 +11,14 @@ type Effect420 struct {
func (e *Effect420) PropBefer(in *input.Input, prop int8, level int8) bool {
if in == e.Ctx().Our {
if in == e.CarrierInput() {
return true
}
//能力下降类
if level == 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, 0, int8(e.SideEffectArgs[0]))
e.Ctx().Opp.SetProp(e.Ctx().Our, 1, int8(e.SideEffectArgs[0]))
e.OpponentInput().SetProp(e.CarrierInput(), 0, int8(e.SideEffectArgs[0]))
e.OpponentInput().SetProp(e.CarrierInput(), 1, int8(e.SideEffectArgs[0]))
}
return true

View File

@@ -14,7 +14,7 @@ type Effect422 struct {
}
func (e *Effect422) Skill_Use() bool {
damageDone := e.Ctx().Our.SumDamage
damageDone := e.CarrierInput().SumDamage
percent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // X%
additionalDamage := damageDone.Mul(percent)
@@ -24,7 +24,7 @@ func (e *Effect422) Skill_Use() bool {
Type: info.DamageType.Fixed,
Damage: additionalDamage,
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
e.OpponentInput().Damage(e.CarrierInput(), damageZone)
}
return true

View File

@@ -10,7 +10,7 @@ type Effect424 struct {
}
func (e *Effect424) Skill_Use() bool {
e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(e.Args()[1].IntPart()))
e.OpponentInput().SetProp(e.CarrierInput(), 4, int8(e.Args()[1].IntPart()))
return true
}

View File

@@ -19,8 +19,8 @@ func (e *Effect425) Skill_Use() bool {
// 随机选择n项属性
for i := 0; i < numStats; i++ {
t := int8(grand.Intn(6))
e.Ctx().Opp.SetProp(e.Ctx().Our, t, changeValue)
e.Ctx().Our.SetProp(e.Ctx().Our, t, -changeValue)
e.OpponentInput().SetProp(e.CarrierInput(), t, changeValue)
e.CarrierInput().SetProp(e.CarrierInput(), t, -changeValue)
}
return true

View File

@@ -16,9 +16,9 @@ func (e *Effect427) Skill_Use() bool {
}
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
// 降低对手防御
e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1]))
e.OpponentInput().SetProp(e.OpponentInput(), 1, int8(e.SideEffectArgs[1]))
e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1]))
e.OpponentInput().SetProp(e.OpponentInput(), 3, int8(e.SideEffectArgs[1]))
}
return true

View File

@@ -21,7 +21,7 @@ func (e *Effect428) Skill_Use() bool {
Type: info.DamageType.Fixed,
Damage: e.Args()[0],
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
e.OpponentInput().Damage(e.CarrierInput(), damageZone)
return true
}

View File

@@ -13,10 +13,10 @@ type Effect430 struct {
func (e *Effect430) Skill_Use() bool {
var isadd bool
// 检查对手是否有能力强化状态
for i, v := range e.Ctx().Opp.Prop[:] {
for i, v := range e.OpponentInput().Prop[:] {
if v > 0 {
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
if e.OpponentInput().SetProp(e.CarrierInput(), int8(i), 0) {
isadd = true
}
return true
@@ -31,7 +31,7 @@ func (e *Effect430) Skill_Use() bool {
effectType := int8(e.Args()[0].IntPart()) // XX类型
effectValue := int8(e.Args()[1].IntPart()) // 等级m
e.Ctx().Our.SetProp(e.Ctx().Our, effectType, effectValue)
e.CarrierInput().SetProp(e.CarrierInput(), effectType, effectValue)
return true
}

View File

@@ -11,15 +11,15 @@ type Effect434 struct {
}
func (e *Effect434) OnSkill() bool {
if e.Ctx().Our.HasPropADD() { // 自身处于能力强化状态
if e.CarrierInput().HasPropADD() { // 自身处于能力强化状态
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
effectType := int(e.Args()[1].IntPart()) // XX类型比如麻痹
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect)
}
}
}

View File

@@ -12,8 +12,8 @@ type Effect437 struct {
func (e *Effect437) OnSkill() bool {
if e.Ctx().Opp.HasPropADD() {
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]))
if e.OpponentInput().HasPropADD() {
e.OpponentInput().SetProp(e.OpponentInput(), int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]))
}

View File

@@ -13,7 +13,7 @@ type Effect440 struct {
func (e *Effect440) Skill_Use() bool {
// 创建一个延迟生效的效果,在下一回合开始生效
addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect440_sub{
addSubEffect(e.CarrierInput(), e.OpponentInput(), &e.EffectNode, &Effect440_sub{
m: int(e.Args()[1].IntPart()),
}, int(e.Args()[0].IntPart()))
return true

View File

@@ -15,10 +15,10 @@ func (e *Effect442) OnSkill() bool {
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) // 以麻痹为例
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart())) // 以麻痹为例
if statusEffect != nil {
statusEffect.SetArgs(e.Ctx().Our, 1)
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
statusEffect.SetArgs(e.CarrierInput(), 1)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect)
}
}

View File

@@ -15,12 +15,12 @@ type Effect443 struct {
func (e *Effect443) Skill_Use_ex() bool {
damageThreshold := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart()))
if e.Ctx().Our.SumDamage.Cmp(damageThreshold) > 0 {
if e.CarrierInput().SumDamage.Cmp(damageThreshold) > 0 {
// 对手疲惫x回合
tiredEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired))
tiredEffect := e.CarrierInput().InitEffect(input.EffectType.Status, int(info.PetStatus.Tired))
if tiredEffect != nil {
tiredEffect.Duration(int(e.Args()[2].IntPart())) // x回合
e.Ctx().Opp.AddEffect(e.Ctx().Our, tiredEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), tiredEffect)
}
}

View File

@@ -12,9 +12,9 @@ type Effect444 struct {
func (e *Effect444) OnSkill() bool {
// 降低对手所有技能PP
e.Ctx().Opp.DelPP(1)
e.OpponentInput().DelPP(1)
e.Ctx().Our.HealPP(1)
e.CarrierInput().HealPP(1)
return true
}

View File

@@ -15,7 +15,7 @@ type Effect626 struct {
func (e *Effect626) Skill_Use() bool {
for i := 0; i < e.SideEffectArgs[0]; i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(grand.Intn(6)), int8(e.SideEffectArgs[1]))
e.CarrierInput().SetProp(e.CarrierInput(), int8(grand.Intn(6)), int8(e.SideEffectArgs[1]))
}
return true

View File

@@ -11,15 +11,15 @@ type Effect449 struct {
}
func (e *Effect449) OnSkill() bool {
if e.Ctx().Opp.HasPropSub() {
if e.OpponentInput().HasPropSub() {
chance := e.Args()[0].IntPart() // N%
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
effectType := int(e.Args()[1].IntPart()) // XX类型
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect)
}
}

View File

@@ -13,9 +13,9 @@ type Effect453 struct {
func (e *Effect453) Skill_Use() bool {
// 检查对手是否有能力强化状态
ispwoer := false
for i, v := range e.Ctx().Opp.Prop[:] {
for i, v := range e.OpponentInput().Prop[:] {
if v > 0 {
e.Ctx().Our.SetProp(e.Ctx().Opp, int8(i), 0)
e.CarrierInput().SetProp(e.OpponentInput(), int8(i), 0)
ispwoer = true
return true
}
@@ -25,9 +25,9 @@ func (e *Effect453) Skill_Use() bool {
// 如果成功消除了状态,对对手施加异常状态
effectType := int(e.Args()[0].IntPart()) // XX类型比如麻痹
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect)
}
}

View File

@@ -17,7 +17,7 @@ func (e *Effect454) ComparePre(fattack *action.SelectSkillAction, sattack *actio
return true
}
//先手是自己
if fattack.PlayerID == e.Ctx().Our.UserID {
if fattack.PlayerID == e.CarrierInput().UserID {
return true
}
if sattack == nil {
@@ -27,8 +27,8 @@ func (e *Effect454) ComparePre(fattack *action.SelectSkillAction, sattack *actio
if sattack.SkillEntity == nil {
return true
}
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
currentHp := e.Ctx().Our.CurPet[0].GetHP()
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
currentHp := e.CarrierInput().CurPet[0].GetHP()
threshold := maxHp.Div(e.Args()[0]) // 1/n

View File

@@ -12,8 +12,8 @@ type Effect456 struct {
}
func (e *Effect456) OnSkill() bool {
if e.Ctx().Opp.CurPet[0].GetHP().Cmp(e.Args()[0]) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
if e.OpponentInput().CurPet[0].GetHP().Cmp(e.Args()[0]) > 0 {
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[0],

View File

@@ -15,11 +15,11 @@ type Effect458 struct {
func (e *Effect458) Skill_Use() bool {
if e.IsFirst() { // 先出手
damageDone := e.Ctx().Our.SumDamage
damageDone := e.CarrierInput().SumDamage
healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // n%
healAmount := damageDone.Mul(healPercent)
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, healAmount)
}
return true

View File

@@ -15,15 +15,15 @@ func (e *Effect460) OnSkill() bool {
baseChance := e.Args()[0].IntPart() // m%
totalChance := baseChance
if e.Ctx().Opp.HasPropADD() {
if e.OpponentInput().HasPropADD() {
totalChance += e.Args()[1].IntPart()
}
success, _, _ := e.Input.Player.Roll(int(totalChance), 100)
if success {
fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear))
fearEffect := e.CarrierInput().InitEffect(input.EffectType.Status, int(info.PetStatus.Fear))
if fearEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), fearEffect)
}
}

View File

@@ -13,8 +13,8 @@ type Effect461 struct {
}
func (e *Effect461) Skill_Use() bool {
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
currentHp := e.Ctx().Our.CurPet[0].GetHP()
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
currentHp := e.CarrierInput().CurPet[0].GetHP()
threshold := maxHp.Div(e.Args()[0]) // 1/m
if currentHp.Cmp(threshold) < 0 {

View File

@@ -20,9 +20,9 @@ func (e *Effect462) Skill_Use_ex() bool {
damageZone := &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: alpacadecimal.Min(e.Ctx().Opp.SumDamage, bounceDamage),
Damage: alpacadecimal.Min(e.OpponentInput().SumDamage, bounceDamage),
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
e.OpponentInput().Damage(e.CarrierInput(), damageZone)
return true
}

View File

@@ -13,7 +13,7 @@ type Effect464 struct {
}
func (e *Effect464) OnSkill() bool {
t, _ := element.Calculator.GetOffensiveMultiplier(e.Ctx().Opp.CurPet[0].Type, e.Ctx().Our.CurPet[0].Type)
t, _ := element.Calculator.GetOffensiveMultiplier(e.OpponentInput().CurPet[0].Type, e.CarrierInput().CurPet[0].Type)
if t <= 1 {
return true
@@ -22,9 +22,9 @@ func (e *Effect464) OnSkill() bool {
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
burnEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Burned))
burnEffect := e.CarrierInput().InitEffect(input.EffectType.Status, int(info.PetStatus.Burned))
if burnEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, burnEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), burnEffect)
}
}
return true

View File

@@ -15,9 +15,9 @@ func (e *Effect468) SkillHit() bool {
return true
}
ispwoer := false
for i, v := range e.Ctx().Our.Prop[:] {
for i, v := range e.CarrierInput().Prop[:] {
if v < 0 {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0)
e.CarrierInput().SetProp(e.CarrierInput(), int8(i), 0)
ispwoer = true
}

View File

@@ -17,9 +17,9 @@ func (e *Effect469) Skill_Use_ex() bool {
if success {
effectType := int(e.Args()[2].IntPart()) // XX类型
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect)
}
}
}
@@ -40,7 +40,7 @@ type Effect526 struct {
func (e *Effect526) Skill_Use_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[0],
})

View File

@@ -17,9 +17,9 @@ func (e *Effect470) Skill_Use_ex() bool {
if success {
effectType := int(e.Args()[2].IntPart()) // p类型异常状态
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
statusEffect := e.CarrierInput().InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect)
}
}
}

View File

@@ -21,7 +21,7 @@ func (e *Effect471) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
return true
}
if in != e.Ctx().Opp {
if in != e.OpponentInput() {
return true
}
if input.IS_Stat(effEffect) {
@@ -50,13 +50,13 @@ type Effect191 struct {
func (e *Effect191) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
if in != e.Ctx().Opp {
if in != e.OpponentInput() {
return true
}
if input.IS_Stat(effEffect) {
statusEffect1 := e.Ctx().Our.InitEffect(input.EffectType.Status, int(effEffect.ID().Suffix()))
statusEffect1 := e.CarrierInput().InitEffect(input.EffectType.Status, int(effEffect.ID().Suffix()))
if statusEffect1 != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect1)
e.OpponentInput().AddEffect(e.CarrierInput(), statusEffect1)
}
return false
}

View File

@@ -12,12 +12,12 @@ type Effect473 struct {
func (e *Effect473) Skill_Use() bool {
damageThreshold := int(e.Args()[0].IntPart())
damageDone := e.Ctx().Our.SumDamage
damageDone := e.CarrierInput().SumDamage
if damageDone.IntPart() < int64(damageThreshold) {
effectType := int(e.Args()[1].IntPart()) // XX类型
effectValue := int(e.Args()[2].IntPart()) // 等级+n
e.Ctx().Our.SetProp(e.Ctx().Our, int8(effectType), int8(effectValue))
e.CarrierInput().SetProp(e.CarrierInput(), int8(effectType), int8(effectValue))
}
return true

View File

@@ -18,7 +18,7 @@ func (e *Effect474) OnSkill() bool {
effectType := int8(e.Args()[0].IntPart()) // XX类型
effectValue := int8(e.Args()[2].IntPart()) // 等级+n
e.Ctx().Our.SetProp(e.Ctx().Our, effectType, effectValue)
e.CarrierInput().SetProp(e.CarrierInput(), effectType, effectValue)
}
}

View File

@@ -16,12 +16,12 @@ type Effect475 struct {
func (e *Effect475) Skill_Use() bool {
damageThreshold := int(e.Args()[0].IntPart())
damageDone := e.Ctx().Our.SumDamage
damageDone := e.CarrierInput().SumDamage
if damageDone.IntPart() < int64(damageThreshold) {
critDuration := int(e.Args()[1].IntPart())
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect475_sub{}, critDuration)
addSubEffect(e.CarrierInput(), e.CarrierInput(), &e.EffectNode, &Effect475_sub{}, critDuration)
}

View File

@@ -18,7 +18,7 @@ func (e *Effect476) OnSkill() bool {
return true
}
healAmount := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, healAmount)
return true
}

View File

@@ -18,7 +18,7 @@ func (e *Effect477) Skill_Use_ex() bool {
if effectId == 0 {
continue
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId))
e.OpponentInput().SetProp(e.CarrierInput(), int8(i), int8(effectId))
}
return true

View File

@@ -18,7 +18,7 @@ func (e *Effect483) OnSkill() bool {
if v == 0 {
continue
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v))
e.OpponentInput().SetProp(e.CarrierInput(), int8(i), int8(v))
}

View File

@@ -13,11 +13,11 @@ type Effect485 struct {
func (e *Effect485) Skill_Use() bool {
isfff := false
for i, v := range e.Ctx().Opp.Prop[:] {
for i, v := range e.OpponentInput().Prop[:] {
if v > 0 {
isfff = true
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
e.OpponentInput().SetProp(e.CarrierInput(), int8(i), 0)
}
@@ -25,8 +25,8 @@ func (e *Effect485) Skill_Use() bool {
if isfff {
// 恢复自身所有体力
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, maxHp)
}
return true

View File

@@ -21,7 +21,7 @@ func (e *Effect486) CalculatePre() bool {
return true
}
e.Ctx().Opp.Prop = [6]int8{}
e.OpponentInput().Prop = [6]int8{}
return true
}

View File

@@ -18,7 +18,7 @@ func (e *Effect488) Damage_Mul(t *info.DamageZone) bool {
return true
}
opponentHp := e.Ctx().Opp.CurPet[0].GetHP()
opponentHp := e.OpponentInput().CurPet[0].GetHP()
if opponentHp.Cmp(alpacadecimal.NewFromInt(400)) < 0 {
t.Damage = t.Damage.Mul(alpacadecimal.NewFromFloat(1.1))

View File

@@ -12,10 +12,10 @@ type Effect489 struct {
}
func (e *Effect489) SkillHit_ex() bool {
if e.Ctx().Our.HasPropADD() {
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
if e.CarrierInput().HasPropADD() {
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
healAmount := maxHp.Div(e.Args()[0]) // 1/m
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, healAmount)
}

View File

@@ -14,12 +14,12 @@ type Effect492 struct {
func (e *Effect492) Skill_Use_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS {
// 恢复1/m体力
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp.Div(e.Args()[1]))
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, maxHp.Div(e.Args()[1]))
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[2].IntPart()), int8(e.Args()[3].IntPart()))
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[4].IntPart()), int8(e.Args()[5].IntPart()))
e.CarrierInput().SetProp(e.CarrierInput(), int8(e.Args()[2].IntPart()), int8(e.Args()[3].IntPart()))
e.CarrierInput().SetProp(e.CarrierInput(), int8(e.Args()[4].IntPart()), int8(e.Args()[5].IntPart()))
}
return true

View File

@@ -12,7 +12,7 @@ type Effect494 struct {
func (e *Effect494) CalculatePre() bool {
e.Ctx().Opp.Prop = [6]int8{}
e.OpponentInput().Prop = [6]int8{}
return true
}

View File

@@ -12,12 +12,12 @@ type Effect495 struct {
}
func (e *Effect495) OnSkill() bool {
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) { // 对手处于异常状态
if e.OpponentInput().StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) { // 对手处于异常状态
chance := 30 // 固定30%
success, _, _ := e.Input.Player.Roll(chance, 100)
if success {
// 秒杀对手
e.Ctx().Opp.CurPet[0].Info.Hp = 0
e.OpponentInput().CurPet[0].Info.Hp = 0
}
}

View File

@@ -14,8 +14,8 @@ type Effect496 struct {
func (e *Effect496) SkillHit_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Crit != 0 {
// 如果造成了致命一击,恢复所有体力
maxHp := e.Ctx().Our.CurPet[0].GetMaxHP()
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
maxHp := e.CarrierInput().CurPet[0].GetMaxHP()
e.CarrierInput().Heal(e.CarrierInput(), &action.SelectSkillAction{}, maxHp)
}
return true

View File

@@ -22,7 +22,7 @@ func (e *Effect457) ComparePre(fattack *action.SelectSkillAction, sattack *actio
return true
}
//先手是自己
if fattack.PlayerID == e.Ctx().Our.UserID {
if fattack.PlayerID == e.CarrierInput().UserID {
if sattack != nil {
originalSkill, _ := deepcopy.Anything(sattack.SkillEntity) //备份技能
@@ -50,7 +50,7 @@ func (e *Effect457) ComparePre(fattack *action.SelectSkillAction, sattack *actio
func (e *Effect457) TurnEnd() {
for _, v := range e.Ctx().Our.CurPet[0].Skills {
for _, v := range e.CarrierInput().CurPet[0].Skills {
if v.XML.ID == e.reid {
v = e.org

View File

@@ -21,7 +21,7 @@ func (e *Effect498) ActionStart(a, b *action.SelectSkillAction) bool {
return true
}
if !e.Ctx().Opp.StatEffect_Exist(input.StatusSleep) {
if !e.OpponentInput().StatEffect_Exist(input.StatusSleep) {
return true
}
e.Ctx().SkillEntity.XML.CritRate += int(e.Args()[1].IntPart())

View File

@@ -16,7 +16,7 @@ func (e *Effect500) SkillHit() bool {
return true
}
if e.Ctx().Opp.StatEffect_Exist(info.PetStatus.Fear) {
if e.OpponentInput().StatEffect_Exist(info.PetStatus.Fear) {
// 伤害翻倍
e.Ctx().SkillEntity.XML.Power *= 2
}

View File

@@ -12,12 +12,12 @@ type Effect501 struct {
func (e *Effect501) Skill_Use_ex() bool {
damageThreshold := int(e.Args()[0].IntPart())
damageDone := e.Ctx().Our.SumDamage
damageDone := e.CarrierInput().SumDamage
if damageDone.IntPart() < int64(damageThreshold) {
effectType := int8(e.Args()[1].IntPart()) // XX类型
effectValue := int8(e.Args()[2].IntPart()) // 等级-n
e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, -effectValue)
e.OpponentInput().SetProp(e.CarrierInput(), effectType, -effectValue)
}

View File

@@ -16,7 +16,7 @@ type Effect503 struct {
}
func (e *Effect503) Skill_Use() bool {
damageDone := e.Ctx().Our.SumDamage
damageDone := e.CarrierInput().SumDamage
e.damageThreshold = int(e.Args()[0].IntPart())
if damageDone.IntPart() < int64(e.damageThreshold) {
@@ -32,7 +32,7 @@ func (e *Effect503) Action_end_ex() bool {
Type: info.DamageType.Fixed,
Damage: fixedDamage,
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
e.OpponentInput().Damage(e.CarrierInput(), damageZone)
e.triggered = false
}
return true

View File

@@ -17,14 +17,14 @@ func (e *Effect504) OnSkill() bool {
if success {
// 令对手害怕
fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear))
fearEffect := e.CarrierInput().InitEffect(input.EffectType.Status, int(info.PetStatus.Fear))
if fearEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect)
e.OpponentInput().AddEffect(e.CarrierInput(), fearEffect)
}
} else {
for i, effectId := range e.SideEffectArgs[1:] {
if effectId != 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId))
e.OpponentInput().SetProp(e.CarrierInput(), int8(i), int8(effectId))
}
}

View File

@@ -101,7 +101,7 @@ type Effect591Sub struct {
}
func (e *Effect591Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
if !e.IsOwner() {
return true
}
if fattack == nil || fattack.PlayerID == e.Ctx().Our.UserID {

View File

@@ -89,7 +89,7 @@ type Effect623Sub struct {
}
func (e *Effect623Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
if !e.IsOwner() {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
@@ -122,7 +122,7 @@ type Effect624Sub struct {
}
func (e *Effect624Sub) DamageSubEx(zone *info.DamageZone) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
if !e.IsOwner() {
return true
}
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {

View File

@@ -9,6 +9,11 @@ import (
"github.com/alpacahq/alpacadecimal"
)
type ownerEffect interface {
input.Effect
IsOwner() bool
}
func clearStatusEffects(target *input.Input, statusID int) bool {
cleared := false
for _, eff := range target.Effects {
@@ -25,8 +30,8 @@ func clearStatusEffects(target *input.Input, statusID int) bool {
return cleared
}
func shouldAdjustNextAttackPriority(e input.Effect, fattack, sattack *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
func shouldAdjustNextAttackPriority(e ownerEffect, fattack, sattack *action.SelectSkillAction) bool {
if !e.IsOwner() {
return false
}
if fattack == nil || fattack.PlayerID == e.Ctx().Our.UserID {

View File

@@ -46,7 +46,7 @@ func (e *Effect632Sub) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect632Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
if !e.IsOwner() {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {

View File

@@ -27,7 +27,7 @@ func (e *Effect886Sub) CalculatePre() bool {
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
if !e.IsOwner() {
return true
}
if e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {

View File

@@ -11,7 +11,7 @@ type Effect164 struct {
func (e *Effect164) Action_end_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
if !e.IsOwner() {
return true
}
if e.Ctx().SkillEntity == nil {

View File

@@ -13,7 +13,7 @@ type Effect481 struct {
func (e *Effect481) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
if !e.IsOwner() {
return true
}

View File

@@ -66,7 +66,7 @@ func (e *EffectConditionalAddDamage) OnSkill() bool {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
e.OpponentInput().Damage(e.CarrierInput(), &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[0],
})
@@ -80,27 +80,27 @@ func (e *EffectConditionalAddDamage) OnSkill() bool {
// conditionIsBurned判断对方是否处于烧伤状态
func conditionIsBurned(e *EffectConditionalAddDamage) bool {
return e.Ctx().Opp.StatEffect_Exist(info.PetStatus.Burned)
return e.OpponentInput().StatEffect_Exist(info.PetStatus.Burned)
}
// conditionIsFrozen判断对方是否处于冻伤状态
func conditionIsFrozen(e *EffectConditionalAddDamage) bool {
return e.Ctx().Opp.StatEffect_Exist(info.PetStatus.Frozen)
return e.OpponentInput().StatEffect_Exist(info.PetStatus.Frozen)
}
// conditionIsTypeX判断对方是否为X属性对方为X性则附加n点伤害
func conditionIsTypeX(e *EffectConditionalAddDamage) bool {
// 示例假设Args[0]为目标属性值,判断对方属性是否匹配
return e.Ctx().Opp.CurPet[0].Info.Gender == int(e.Args()[0].IntPart())
return e.OpponentInput().CurPet[0].Info.Gender == int(e.Args()[0].IntPart())
}
// conditionIsAbnormal判断对方是否处于任意异常状态
func conditionIsAbnormal(e *EffectConditionalAddDamage) bool {
return e.Ctx().Opp.StatEffect_Exist_all()
return e.OpponentInput().StatEffect_Exist_all()
}
// conditionPropDown判断对方是否处于能力下降状态
func conditionPropDown(e *EffectConditionalAddDamage) bool {
return e.Ctx().Opp.HasPropSub()
return e.OpponentInput().HasPropSub()
}

View File

@@ -179,7 +179,7 @@ type Effect441 struct {
}
func (e *Effect441) ActionStart(a, b *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
if !e.IsOwner() {
return true
}
//fmt.Println(e.Ctx().SkillEntity)

View File

@@ -95,8 +95,8 @@ func (e *EffectPropSyncReverse) OnSkill() bool {
if e.opppet != nil {
return true
}
e.ourpet = e.Ctx().Our.CurPet[0]
e.opppet = e.Ctx().Opp.CurPet[0]
e.ourpet = e.CarrierInput().CurPet[0]
e.opppet = e.OpponentInput().CurPet[0]
e.can = true
e.active(true)

View File

@@ -74,6 +74,15 @@ func (e *EffectNode) TargetInput() *input.Input {
func (e *EffectNode) OpponentInput() *input.Input {
return e.Ctx().Opp
}
// IsOwner reports whether the current phase's Our side owns this effect.
func (e *EffectNode) IsOwner() bool {
if e.Ctx().Our == nil || len(e.Ctx().Our.CurPet) == 0 || e.Ctx().Our.CurPet[0] == nil {
return false
}
return e.ID().GetCatchTime() == e.Ctx().Our.CurPet[0].Info.CatchTime
}
func (e *EffectNode) Ctx() *input.Ctx {
return &e.EffectContextHolder.Ctx