1081 lines
28 KiB
Go
1081 lines
28 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/action"
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
)
|
||
|
||
// 181 - n%几率令对手XX,连续攻击每次提高m%几率最高提高k%
|
||
type Effect181 struct {
|
||
node.EffectNode
|
||
increaseChance int
|
||
maxChance int
|
||
currentChance int
|
||
}
|
||
|
||
func (e *Effect181) OnSkill() bool {
|
||
if !e.Hit() {
|
||
return true
|
||
}
|
||
|
||
baseChance := e.Args()[0].IntPart()
|
||
e.currentChance = int(baseChance) + e.increaseChance
|
||
|
||
if e.currentChance > e.maxChance {
|
||
e.currentChance = e.maxChance
|
||
}
|
||
|
||
success, _, _ := e.Input.Player.Roll(e.currentChance, 100)
|
||
if success {
|
||
// 添加异常状态
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Paralysis)) // 以麻痹为例
|
||
if statusEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
|
||
// 增加下次攻击的触发几率
|
||
e.increaseChance += int(e.Args()[1].IntPart())
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect181) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.maxChance = a[2] // 最大几率
|
||
}
|
||
|
||
// 441 - 每次攻击提升n%的致命几率,最高提升m%
|
||
type Effect441 struct {
|
||
node.EffectNode
|
||
totalCritIncrease int
|
||
maxCritIncrease int
|
||
}
|
||
|
||
func (e *Effect441) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
|
||
currentCrit := e.Ctx().Our.CurrentPet.CritRate
|
||
increase := int(e.Args()[0].IntPart())
|
||
|
||
if e.totalCritIncrease+increase <= e.maxCritIncrease {
|
||
e.totalCritIncrease += increase
|
||
e.Ctx().Our.CurrentPet.CritRate = currentCrit + increase
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect441) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.maxCritIncrease = a[1]
|
||
}
|
||
|
||
// 165 - n回合内,每回合防御和特防等级+m
|
||
type Effect165 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect165) OnSkill() bool {
|
||
// 增加防御和特防等级
|
||
defBoostEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefUp))
|
||
if defBoostEffect != nil {
|
||
defBoostEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart()))
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, defBoostEffect)
|
||
}
|
||
|
||
spDefBoostEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefUp))
|
||
if spDefBoostEffect != nil {
|
||
spDefBoostEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart()))
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, spDefBoostEffect)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect165) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 483 - -1 -1 -1 -1 -1 -1,后出手时弱化效果翻倍
|
||
type Effect483 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect483) OnSkill() bool {
|
||
if e.Ctx().Our.Speed < e.Ctx().Opp.Speed { // 后出手
|
||
// 这里是标记后出手时弱化效果翻倍的逻辑
|
||
// 实际的翻倍逻辑需要在应用弱化效果的地方实现
|
||
e.Ctx().Our.DoubleNegativeEffects = true
|
||
}
|
||
return true
|
||
}
|
||
|
||
// 485 - 消除对手能力强化状态,若消除成功,则自身恢复所有体力
|
||
type Effect485 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect485) OnSkill() bool {
|
||
if !e.Hit() {
|
||
return true
|
||
}
|
||
|
||
// 检查是否有能力强化状态可以消除
|
||
if e.Ctx().Opp.CurrentPet.HasPositiveBuff() {
|
||
// 消除对手的能力强化状态
|
||
e.Ctx().Opp.RemoveAllPositiveBuffs()
|
||
|
||
// 恢复自身所有体力
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 188 - 若对手处于异常状态,则威力翻倍并消除对手相应的防御能力提升效果
|
||
type Effect188 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect188) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
|
||
if e.Ctx().Opp.CurrentPet.HasAnyStatus() { // 对手处于异常状态
|
||
// 威力翻倍
|
||
e.Ctx().SkillEntity.Power *= 2
|
||
|
||
// 消除对手相应的防御能力提升效果
|
||
e.Ctx().Opp.RemovePositiveBuffs()
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 420 - 使用了该技能后,若受到消除强化类技能攻击,则对方则对方攻击和特攻等级+/-n
|
||
type Effect420 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect420) OnSkill() bool {
|
||
// 这里注册监听对手强化消除事件的逻辑
|
||
// 暂时使用一个flag标记
|
||
e.Ctx().Our.TriggerOnBuffRemoved = true
|
||
return true
|
||
}
|
||
|
||
// 407 - 下回合起,每回合XX等级+n,持续m回合
|
||
type Effect407 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect407) OnSkill() bool {
|
||
// 创建一个延迟生效的效果,在下一回合开始生效
|
||
go func() {
|
||
effectType := int(e.Args()[0].IntPart()) // XX类型
|
||
effectValue := int(e.Args()[1].IntPart()) // 等级+n
|
||
duration := int(e.Args()[2].IntPart()) // 持续m回合
|
||
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||
if statusEffect != nil {
|
||
statusEffect.SetArgs(e.Ctx().Our, effectValue)
|
||
statusEffect.Duration(duration)
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}()
|
||
|
||
return true
|
||
}
|
||
|
||
// 491 - 3回合内对手造成的伤害降低m%
|
||
type Effect491 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect491) OnSkill() bool {
|
||
// 创建一个降低对手伤害的效果
|
||
damageReduceEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ReduceDamageTaken))
|
||
if damageReduceEffect != nil {
|
||
damageReduceEffect.SetArgs(e.Ctx().Our, int(e.Args()[0].IntPart()))
|
||
damageReduceEffect.Duration(3) // 持续3回合
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, damageReduceEffect)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 462 - n回合内受攻击时反弹m点固定伤害
|
||
type Effect462 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect462) Skill_Use_ex() bool {
|
||
if !e.Hit() {
|
||
return true
|
||
}
|
||
|
||
// 反弹m点固定伤害
|
||
bounceDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart()))
|
||
damageZone := &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: bounceDamage,
|
||
}
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect462) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 184 - 若对手处于能力提升状态,则m%自身XX等级k
|
||
type Effect184 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect184) OnSkill() bool {
|
||
if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力提升状态
|
||
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)
|
||
if statusEffect != nil {
|
||
statusEffect.SetArgs(e.Ctx().Our, effectValue)
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 1044 - 吸取对手能力提升状态,吸取成功则下n回合造成的伤害翻倍
|
||
type Effect1044 struct {
|
||
node.EffectNode
|
||
damageMultiplierActive bool
|
||
multiplierDuration int
|
||
}
|
||
|
||
func (e *Effect1044) OnSkill() bool {
|
||
// 检查对手是否有能力提升状态可以吸取
|
||
if e.Ctx().Opp.CurrentPet.HasPositiveBuff() {
|
||
// 吸取对手的能力提升状态
|
||
e.Ctx().Our.StealPositiveBuffsFrom(e.Ctx().Opp)
|
||
|
||
// 下n回合造成的伤害翻倍
|
||
e.damageMultiplierActive = true
|
||
e.multiplierDuration = int(e.Args()[0].IntPart())
|
||
|
||
// 添加一个临时效果来处理伤害翻倍
|
||
damageDoubleEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DamageDouble))
|
||
if damageDoubleEffect != nil {
|
||
damageDoubleEffect.Duration(e.multiplierDuration)
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, damageDoubleEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 523 - 若当回合未击败对手,则自身1 1 1 1 1 1能力+1
|
||
type Effect523 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect523) Action_end_ex() bool {
|
||
// 检查对手是否还活着
|
||
if e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
|
||
// 提升自身的全部能力等级
|
||
stats := []int{
|
||
int(info.PetStatus.AtkUp),
|
||
int(info.PetStatus.DefUp),
|
||
int(info.PetStatus.SpAtkUp),
|
||
int(info.PetStatus.SpDefUp),
|
||
int(info.PetStatus.SpeedUp),
|
||
int(info.PetStatus.AccuracyUp),
|
||
}
|
||
|
||
for _, stat := range stats {
|
||
statEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, stat)
|
||
if statEffect != nil {
|
||
statEffect.SetArgs(e.Ctx().Our, 1) // 提升1级
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, statEffect)
|
||
}
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 177 - n回合内,若对手MISS则自身恢复1/m的最大体力值
|
||
type Effect177 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect177) Skill_Use_ex() bool {
|
||
if e.Ctx().Opp.LastAttackMissed {
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
healAmount := maxHp.Div(e.Args()[1]) // 1/m
|
||
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||
}
|
||
return true
|
||
}
|
||
|
||
func (e *Effect177) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 178 - 造成伤害的1/n回复自身体力,若属性相同则造成伤害的1/m回复自身体力
|
||
type Effect178 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect178) SkillHit_ex() bool {
|
||
damageDone := e.Ctx().Our.SumDamage
|
||
var healAmount alpacadecimal.Decimal
|
||
|
||
if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type {
|
||
// 属性相同,1/m
|
||
healAmount = damageDone.Div(e.Args()[1])
|
||
} else {
|
||
// 属性不同,1/n
|
||
healAmount = damageDone.Div(e.Args()[0])
|
||
}
|
||
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||
|
||
return true
|
||
}
|
||
|
||
// 444 - 降低对手所有PP一点,并恢复自身所有PP一点
|
||
type Effect444 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect444) OnSkill() bool {
|
||
// 降低对手所有技能PP
|
||
for _, skill := range e.Ctx().Opp.CurrentPet.Skills {
|
||
if skill.PP > 0 {
|
||
skill.PP--
|
||
}
|
||
}
|
||
|
||
// 恢复自身所有技能PP
|
||
for _, skill := range e.Ctx().Our.CurrentPet.Skills {
|
||
if skill.MaxPP > skill.PP {
|
||
skill.PP = skill.MaxPP
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 475 - 若造成的伤害不足m,则下n回合的攻击必定致命一击
|
||
type Effect475 struct {
|
||
node.EffectNode
|
||
damageThreshold int
|
||
critDuration int
|
||
}
|
||
|
||
func (e *Effect475) SkillHit_ex() bool {
|
||
damageThreshold := int(e.Args()[0].IntPart())
|
||
damageDone := e.Ctx().Our.SumDamage
|
||
|
||
if damageDone.IntPart() < int64(damageThreshold) {
|
||
critDuration := int(e.Args()[1].IntPart())
|
||
|
||
// 添加必定暴击效果
|
||
critEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.MustCrit))
|
||
if critEffect != nil {
|
||
critEffect.Duration(critDuration)
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, critEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 496 - 若打出致命一击则恢复自身所有体力
|
||
type Effect496 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect496) SkillHit_ex() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.WasCritical {
|
||
// 如果造成了致命一击,恢复所有体力
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 430 - 消除对手能力强化状态,若消除状态成功,则自身XX等级m
|
||
type Effect430 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect430) OnSkill() bool {
|
||
// 检查对手是否有能力强化状态
|
||
if e.Ctx().Opp.CurrentPet.HasPositiveBuff() {
|
||
// 消除对手的能力强化状态
|
||
removedCount := e.Ctx().Opp.RemoveAllPositiveBuffs()
|
||
|
||
if removedCount > 0 {
|
||
// 如果成功消除了状态,提升自身能力等级
|
||
effectType := int(e.Args()[0].IntPart()) // XX类型
|
||
effectValue := int(e.Args()[1].IntPart()) // 等级m
|
||
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||
if statusEffect != nil {
|
||
statusEffect.SetArgs(e.Ctx().Our, effectValue)
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 465 - m%令对手疲惫n回合,每次使用几率提升x%,最高y%
|
||
type Effect465 struct {
|
||
node.EffectNode
|
||
accumulatedChance int
|
||
maxChance int
|
||
incrementPerUse int
|
||
}
|
||
|
||
func (e *Effect465) OnSkill() bool {
|
||
chance := int(e.Args()[0].IntPart()) + e.accumulatedChance
|
||
if chance > e.maxChance {
|
||
chance = e.maxChance
|
||
}
|
||
|
||
success, _, _ := e.Input.Player.Roll(chance, 100)
|
||
if success {
|
||
// 令对手疲惫n回合
|
||
tiredEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired))
|
||
if tiredEffect != nil {
|
||
tiredEffect.Duration(int(e.Args()[1].IntPart()))
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, tiredEffect)
|
||
}
|
||
}
|
||
|
||
// 增加下次使用的几率
|
||
e.accumulatedChance += e.incrementPerUse
|
||
if e.accumulatedChance > e.maxChance {
|
||
e.accumulatedChance = e.maxChance
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect465) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.maxChance = a[2] // 最高y%
|
||
e.incrementPerUse = a[3] // 每次使用几率提升x%
|
||
}
|
||
|
||
// 501 - 若造成的伤害不足m,则对手XX等级-n
|
||
type Effect501 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect501) SkillHit_ex() bool {
|
||
damageThreshold := int(e.Args()[0].IntPart())
|
||
damageDone := e.Ctx().Our.SumDamage
|
||
|
||
if damageDone.IntPart() < int64(damageThreshold) {
|
||
effectType := int(e.Args()[1].IntPart()) // XX类型
|
||
effectValue := int(e.Args()[2].IntPart()) // 等级-n
|
||
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||
if statusEffect != nil {
|
||
statusEffect.SetArgs(e.Ctx().Our, -effectValue) // 负值表示降低
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 474 - 先出手时m%自身XX等级+n
|
||
type Effect474 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect474) OnSkill() bool {
|
||
if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手
|
||
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()) // 等级+n
|
||
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||
if statusEffect != nil {
|
||
statusEffect.SetArgs(e.Ctx().Our, effectValue)
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 440 - n回合内对手使用技能消耗的PP值变为m倍
|
||
type Effect440 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect440) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 516 - 1 1 1 1 1 1 1 体力低于1/n时强化效果翻倍
|
||
type Effect516 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect516) OnSkill() bool {
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||
threshold := maxHp.Div(e.Args()[0]) // 1/n
|
||
|
||
if currentHp.Cmp(threshold) < 0 {
|
||
// 体力低于1/n时,设置强化效果翻倍
|
||
e.Ctx().Our.BoostPositiveEffects = true
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 434 - 若自身处于能力强化状态,则n%几率令对手XX
|
||
type Effect434 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect434) OnSkill() bool {
|
||
if e.Ctx().Our.CurrentPet.HasPositiveBuff() { // 自身处于能力强化状态
|
||
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)
|
||
if statusEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 495 - 若对手处于XX状态,则30%几率秒杀对手
|
||
type Effect495 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect495) OnSkill() bool {
|
||
if e.Ctx().Opp.CurrentPet.HasAnyStatus() { // 对手处于异常状态
|
||
chance := 30 // 固定30%
|
||
success, _, _ := e.Input.Player.Roll(chance, 100)
|
||
if success {
|
||
// 秒杀对手
|
||
e.Ctx().Opp.CurrentPet.Info.Hp = 0
|
||
e.Ctx().Opp.CurrentPet.NotAlive = true
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 457 - 复制对手释放的技能(组队对战时无效)
|
||
type Effect457 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect457) Skill_Use_ex() bool {
|
||
// 这里需要检查是否在组队对战中
|
||
if !e.Ctx().IsTeamBattle { // 不是组队对战
|
||
if e.Ctx().SkillEntity != nil {
|
||
// 复制对手释放的技能
|
||
e.Ctx().Our.CopySkill(e.Ctx().SkillEntity)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 144 - 消耗自己所有体力,使下一个出战的精灵n回合免疫异常状态
|
||
type Effect144 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect144) OnSkill() bool {
|
||
// 消耗所有体力
|
||
e.Ctx().Our.CurrentPet.Info.Hp = 0
|
||
e.Ctx().Our.CurrentPet.NotAlive = true
|
||
|
||
// 设置下一个出战精灵的免疫异常状态效果
|
||
nextPetImmunityEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ImmuneStatus))
|
||
if nextPetImmunityEffect != nil {
|
||
nextPetImmunityEffect.Duration(int(e.Args()[0].IntPart())) // n回合
|
||
e.Ctx().Our.SetNextPetStatusImmunity(nextPetImmunityEffect)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 468 - 回合开始时,若自身处于能力下降状态,则威力翻倍,同时解除能力下降状态
|
||
type Effect468 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect468) Action_start() bool {
|
||
if e.Ctx().Our.CurrentPet.HasNegativeBuff() {
|
||
// 威力翻倍
|
||
if e.Ctx().SkillEntity != nil {
|
||
e.Ctx().SkillEntity.Power *= 2
|
||
}
|
||
|
||
// 解除能力下降状态
|
||
e.Ctx().Our.RemoveNegativeBuffs()
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 492 - 2回合内若对手使用属性技能,自身立刻恢复1/m体力且防御+x特防+y
|
||
type Effect492 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
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.CurrentPet.GetMaxHP()
|
||
healAmount := maxHp.Div(e.Args()[0])
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||
|
||
// 防御+x
|
||
defUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefUp))
|
||
if defUpEffect != nil {
|
||
defUpEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // x
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, defUpEffect)
|
||
}
|
||
|
||
// 特防+y
|
||
spDefUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefUp))
|
||
if spDefUpEffect != nil {
|
||
spDefUpEffect.SetArgs(e.Ctx().Our, int(e.Args()[2].IntPart())) // y
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, spDefUpEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect492) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(2) // 持续2回合
|
||
}
|
||
|
||
// 138 - 先出手时,n回合自己不会受到对手攻击性技能伤害并反弹对手1/n造成的伤害
|
||
type Effect138 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect138) Skill_Use_ex() bool {
|
||
if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||
// 本次受到的攻击伤害无效
|
||
e.Ctx().Our.CancelDamage()
|
||
|
||
// 反弹1/n造成的伤害
|
||
damageToBounce := e.Ctx().Opp.SumDamage.Div(e.Args()[1]) // 1/n
|
||
damageZone := &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: damageToBounce,
|
||
}
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect138) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 469 - m回合内若对手使用属性技能则n%几率另对手XX
|
||
type Effect469 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect469) Skill_Use_ex() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
chance := e.Args()[1].IntPart() // n%
|
||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||
if success {
|
||
effectType := int(e.Args()[2].IntPart()) // XX类型
|
||
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||
if statusEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect469) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||
}
|
||
|
||
// 156 - n回合内,使得对手所有能力增强效果失效
|
||
type Effect156 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect156) OnSkill() bool {
|
||
// 使对手的所有能力增强效果失效
|
||
e.Ctx().Opp.DisablePositiveBuffs()
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect156) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 486 - 下n回合若自身选择使用技能则无视对手能力提升状态
|
||
type Effect486 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect486) OnSkill() bool {
|
||
// 设置标志,接下来n回合内无视对手能力提升
|
||
e.Ctx().Our.IgnoreOpponentPositiveBuffsForNDuration(int(e.Args()[0].IntPart()))
|
||
|
||
return true
|
||
}
|
||
|
||
// 429 - 附加m点固定伤害,连续使用每次增加n点固定伤害,最高附加k点固定伤害
|
||
type Effect429 struct {
|
||
node.EffectNode
|
||
stackedDamage int
|
||
maxDamage int
|
||
incrementPerUse int
|
||
}
|
||
|
||
func (e *Effect429) OnSkill() bool {
|
||
// 计算附加伤害
|
||
baseDamage := int(e.Args()[0].IntPart()) // m点固定伤害
|
||
currentDamage := baseDamage + e.stackedDamage
|
||
|
||
if currentDamage > e.maxDamage {
|
||
currentDamage = e.maxDamage
|
||
}
|
||
|
||
// 附加固定伤害
|
||
damageZone := &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: alpacadecimal.NewFromInt(int64(currentDamage)),
|
||
}
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||
|
||
// 更新叠加伤害
|
||
e.stackedDamage += e.incrementPerUse
|
||
if e.stackedDamage > e.maxDamage-baseDamage {
|
||
e.stackedDamage = e.maxDamage - baseDamage
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect429) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.maxDamage = a[2] // 最高k点
|
||
e.incrementPerUse = a[1] // 每次增加n点
|
||
}
|
||
|
||
// 471 - 先出手时n回合内免疫异常状态
|
||
type Effect471 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect471) OnSkill() bool {
|
||
if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手
|
||
immunityEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ImmuneStatus))
|
||
if immunityEffect != nil {
|
||
immunityEffect.Duration(int(e.Args()[0].IntPart())) // n回合
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, immunityEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 197 - n回合内若被对方击败,则对手所有能力加强状态消失
|
||
type Effect197 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect197) SkillUseed() bool {
|
||
if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 被击败
|
||
// 清除对手的所有能力加强状态
|
||
e.Ctx().Opp.RemoveAllPositiveBuffs()
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect197) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 453 - 消除对手能力强化状态,若消除成功,则对手XX
|
||
type Effect453 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect453) OnSkill() bool {
|
||
// 检查对手是否有能力强化状态
|
||
if e.Ctx().Opp.CurrentPet.HasPositiveBuff() {
|
||
// 消除对手的能力强化状态
|
||
removedCount := e.Ctx().Opp.RemoveAllPositiveBuffs()
|
||
|
||
if removedCount > 0 {
|
||
// 如果成功消除了状态,对对手施加异常状态
|
||
effectType := int(e.Args()[0].IntPart()) // XX类型,比如麻痹
|
||
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||
if statusEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 505 - 若打出致命一击,则造成伤害值的m%恢复自身体力
|
||
type Effect505 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect505) SkillHit_ex() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.WasCritical {
|
||
damageDone := e.Ctx().Our.SumDamage
|
||
healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // m%
|
||
healAmount := damageDone.Mul(healPercent)
|
||
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 170 - 若先出手,则免疫当回合伤害并回复1/n的最大体力值
|
||
type Effect170 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect170) OnSkill() bool {
|
||
if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手
|
||
// 免疫当回合伤害
|
||
e.Ctx().Our.ImmuneDamageThisTurn = true
|
||
|
||
// 回复1/n的最大体力值
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
healAmount := maxHp.Div(e.Args()[1]) // 1/n
|
||
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 425 - 随机使对手n项属性m,并将该属性附加给自己
|
||
type Effect425 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect425) OnSkill() bool {
|
||
numStats := int(e.Args()[0].IntPart()) // n项属性
|
||
changeValue := int(e.Args()[1].IntPart()) // m
|
||
|
||
// 定义可变化的属性列表
|
||
stats := []int{
|
||
int(info.PetStatus.AtkUp),
|
||
int(info.PetStatus.DefUp),
|
||
int(info.PetStatus.SpAtkUp),
|
||
int(info.PetStatus.SpDefUp),
|
||
int(info.PetStatus.SpeedUp),
|
||
int(info.PetStatus.AccuracyUp),
|
||
}
|
||
|
||
// 随机选择n项属性
|
||
for i := 0; i < numStats && i < len(stats); i++ {
|
||
randomIndex := int(e.Input.FightC.GetRand().Int31n(int32(len(stats))))
|
||
selectedStat := stats[randomIndex]
|
||
|
||
// 对对手施加降低效果
|
||
oppEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStat)
|
||
if oppEffect != nil {
|
||
oppEffect.SetArgs(e.Ctx().Our, -changeValue) // 负值表示降低
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, oppEffect)
|
||
}
|
||
|
||
// 对自己施加提升效果
|
||
selfEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStat)
|
||
if selfEffect != nil {
|
||
selfEffect.SetArgs(e.Ctx().Our, changeValue) // 正值表示提升
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, selfEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 521 - 反转自身能力下降状态
|
||
type Effect521 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect521) OnSkill() bool {
|
||
// 反转自身的能力下降状态,即将下降变为提升
|
||
e.Ctx().Our.ReverseNegativeBuffs()
|
||
|
||
return true
|
||
}
|
||
|
||
// 412 - 若自身体力小于1/n,则每次攻击不消耗PP值
|
||
type Effect412 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect412) SkillHit() bool {
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||
threshold := maxHp.Div(e.Args()[0]) // 1/n
|
||
|
||
if currentHp.Cmp(threshold) < 0 {
|
||
// 本次攻击不消耗PP
|
||
e.Ctx().Our.SkipPpConsumption = true
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 191 - n回合内免疫并反弹所有受到的异常状态
|
||
type Effect191 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect191) OnSkill() bool {
|
||
// 设置免疫异常状态效果
|
||
immunityEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ImmuneStatus))
|
||
if immunityEffect != nil {
|
||
immunityEffect.Duration(int(e.Args()[0].IntPart())) // n回合
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, immunityEffect)
|
||
}
|
||
|
||
// 设置反弹异常状态效果
|
||
reflectEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ReflectStatus))
|
||
if reflectEffect != nil {
|
||
reflectEffect.Duration(int(e.Args()[0].IntPart())) // n回合
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, reflectEffect)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 199 - 下次被击败后,下一个出场的精灵xx等级+k
|
||
type Effect199 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect199) SkillUseed() bool {
|
||
if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 被击败
|
||
// 设置下一个出场精灵的增益效果
|
||
effectType := int(e.Args()[0].IntPart()) // xx类型
|
||
effectValue := int(e.Args()[1].IntPart()) // 等级+k
|
||
|
||
buffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||
if buffEffect != nil {
|
||
buffEffect.SetArgs(e.Ctx().Our, effectValue)
|
||
e.Ctx().Our.SetNextPetBuff(buffEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 461 - 使用后若自身体力低于1/m则从下回合开始必定致命一击
|
||
type Effect461 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect461) OnSkill() bool {
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||
threshold := maxHp.Div(e.Args()[1]) // 1/m
|
||
|
||
if currentHp.Cmp(threshold) < 0 {
|
||
// 添加必定暴击效果,从下回合开始
|
||
critEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.MustCrit))
|
||
if critEffect != nil {
|
||
critEffect.Duration(int(e.Args()[0].IntPart())) // 持续回合数
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, critEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 506 - 下回合受到致命伤害时残留m点体力
|
||
type Effect506 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect506) OnSkill() bool {
|
||
minHealth := int(e.Args()[0].IntPart()) // m点体力
|
||
|
||
// 设置保护效果,下回合受到致命伤害时保留m点体力
|
||
protectEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.ProtectFromKO))
|
||
if protectEffect != nil {
|
||
protectEffect.SetArgs(e.Ctx().Our, minHealth)
|
||
protectEffect.Duration(1) // 仅下回合有效
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, protectEffect)
|
||
}
|
||
|
||
return true
|
||
}
|