1945 lines
51 KiB
Go
1945 lines
51 KiB
Go
package effect
|
||
|
||
import (
|
||
element "blazing/common/data/Element"
|
||
"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]
|
||
}
|
||
|
||
// 507 - 下回合若受到的伤害大于m,则恢复自身所有体力
|
||
type Effect507 struct {
|
||
node.EffectNode
|
||
threshold int
|
||
triggered bool
|
||
}
|
||
|
||
func (e *Effect507) OnSkill() bool {
|
||
e.threshold = int(e.Args()[0].IntPart())
|
||
e.triggered = true
|
||
return true
|
||
}
|
||
|
||
func (e *Effect507) Skill_Use_ex() bool {
|
||
if e.triggered && e.Ctx().Our.SumDamage.IntPart() > int64(e.threshold) {
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
|
||
}
|
||
e.triggered = false
|
||
return true
|
||
}
|
||
|
||
// 477 - n回合内若受到攻击,则对手攻击,防御,特攻,特防,速度,命中等级降低
|
||
type Effect477 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect477) Skill_Use_ex() bool {
|
||
if !e.Hit() {
|
||
return true
|
||
}
|
||
|
||
// 降低对手多项能力等级
|
||
debuffEffects := []int{
|
||
int(info.PetStatus.AtkDown),
|
||
int(info.PetStatus.DefDown),
|
||
int(info.PetStatus.SpAtkDown),
|
||
int(info.PetStatus.SpDefDown),
|
||
int(info.PetStatus.SpeedDown),
|
||
int(info.PetStatus.AccuracyDown),
|
||
}
|
||
|
||
for _, effectId := range debuffEffects {
|
||
debuffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectId)
|
||
if debuffEffect != nil {
|
||
debuffEffect.SetArgs(e.Ctx().Our, 1) // 默认降低1级
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, debuffEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect477) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 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
|
||
}
|
||
|
||
// 403 - 技能使用成功时,n%令自身特攻和速度等级+m。若和对手属性相同,则技能效果翻倍
|
||
type Effect403 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect403) OnSkill() bool {
|
||
chance := e.Args()[0].IntPart()
|
||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||
|
||
if success {
|
||
boostValue := int(e.Args()[1].IntPart())
|
||
|
||
// 提升自身特攻等级
|
||
spAtkUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpAtkUp))
|
||
if spAtkUpEffect != nil {
|
||
spAtkUpEffect.SetArgs(e.Ctx().Our, boostValue)
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, spAtkUpEffect)
|
||
}
|
||
|
||
// 提升自身速度等级
|
||
speedUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedUp))
|
||
if speedUpEffect != nil {
|
||
speedUpEffect.SetArgs(e.Ctx().Our, boostValue)
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, speedUpEffect)
|
||
}
|
||
}
|
||
|
||
// 检查属性是否相同
|
||
if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type {
|
||
// 技能效果翻倍,这需要在实际的技能计算中实现
|
||
if e.Ctx().SkillEntity != nil {
|
||
e.Ctx().SkillEntity.Power *= 2
|
||
}
|
||
}
|
||
|
||
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
|
||
}
|
||
|
||
// 504 - m%令对手害怕,若没有触发害怕效果,则对手攻击,防御,特攻,特防,速度,命中等级下降
|
||
type Effect504 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect504) OnSkill() bool {
|
||
chance := e.Args()[0].IntPart()
|
||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||
|
||
if success {
|
||
// 令对手害怕
|
||
fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear))
|
||
if fearEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect)
|
||
}
|
||
} else {
|
||
// 没有触发害怕效果,降低对手各项等级
|
||
debuffEffects := []int{
|
||
int(info.PetStatus.AtkDown),
|
||
int(info.PetStatus.DefDown),
|
||
int(info.PetStatus.SpAtkDown),
|
||
int(info.PetStatus.SpDefDown),
|
||
int(info.PetStatus.SpeedDown),
|
||
int(info.PetStatus.AccuracyDown),
|
||
}
|
||
|
||
for _, effectId := range debuffEffects {
|
||
debuffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectId)
|
||
if debuffEffect != nil {
|
||
debuffEffect.SetArgs(e.Ctx().Our, 1) // 默认降低1级
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, debuffEffect)
|
||
}
|
||
}
|
||
}
|
||
|
||
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
|
||
}
|
||
|
||
// 418 - 若对手处于能力提升状态则对方XX等级+/-n
|
||
type Effect418 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect418) OnSkill() bool {
|
||
if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力提升状态
|
||
effectValue := int(e.Args()[0].IntPart()) // 等级变化值n
|
||
|
||
// 对对手施加降低能力的效果
|
||
debuffEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.RandomStatDown))
|
||
if debuffEffect != nil {
|
||
debuffEffect.SetArgs(e.Ctx().Our, effectValue)
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, debuffEffect)
|
||
}
|
||
}
|
||
|
||
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
|
||
}
|
||
|
||
// 198 - 随机使对手n种能力等级-m
|
||
type Effect198 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect198) OnSkill() bool {
|
||
numStats := int(e.Args()[0].IntPart()) // n种能力
|
||
reduction := int(e.Args()[1].IntPart()) // 等级-m
|
||
|
||
// 定义可降低的能力列表
|
||
stats := []int{
|
||
int(info.PetStatus.AtkDown),
|
||
int(info.PetStatus.DefDown),
|
||
int(info.PetStatus.SpAtkDown),
|
||
int(info.PetStatus.SpDefDown),
|
||
int(info.PetStatus.SpeedDown),
|
||
int(info.PetStatus.AccuracyDown),
|
||
}
|
||
|
||
// 随机选择n种能力
|
||
for i := 0; i < numStats && i < len(stats); i++ {
|
||
randomIndex := int(e.Input.FightC.GetRand().Int31n(int32(len(stats))))
|
||
selectedStat := stats[randomIndex]
|
||
|
||
statEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStat)
|
||
if statEffect != nil {
|
||
statEffect.SetArgs(e.Ctx().Our, reduction)
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statEffect)
|
||
}
|
||
}
|
||
|
||
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
|
||
}
|
||
|
||
// 473 - 若造成的伤害不足m,则自身XX等级+n
|
||
type Effect473 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect473) 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().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%
|
||
}
|
||
|
||
// 454 - 当自身血量少于1/n时先制+m(写死了先制只能+1)
|
||
type Effect454 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect454) Skill_Pre() 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,先制+1(固定为1)
|
||
e.Ctx().Our.TempSpeedBoost = true
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 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
|
||
}
|
||
|
||
// 494 - 无视对手能力提升状态
|
||
type Effect494 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect494) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
|
||
// 设置标志,忽略对手的强化状态
|
||
e.Ctx().IgnoreOpponentBuffs = true
|
||
|
||
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
|
||
}
|
||
|
||
// 175 - 若对手处于异常状态,则m%自身XX等级k
|
||
type Effect175 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect175) OnSkill() bool {
|
||
if e.Ctx().Opp.CurrentPet.HasAnyStatus() { // 对手处于异常状态
|
||
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
|
||
}
|
||
|
||
// 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回合
|
||
}
|
||
|
||
// 488 - 若对手的体力小于400,则造成的伤害增加10%
|
||
type Effect488 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect488) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
|
||
opponentHp := e.Ctx().Opp.CurrentPet.GetHP()
|
||
|
||
if opponentHp.Cmp(alpacadecimal.NewFromInt(400)) < 0 {
|
||
// 伤害增加10%
|
||
e.Ctx().SkillEntity.Power = int(float64(e.Ctx().SkillEntity.Power) * 1.1)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 437 - 若对手处于能力强化状态,则对手XX等级m
|
||
type Effect437 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect437) OnSkill() bool {
|
||
if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力强化状态
|
||
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().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 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点
|
||
}
|
||
|
||
// 196 - n%令对方XX等级-m;若先出手,则j%使对方XX等级-k
|
||
type Effect196 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect196) OnSkill() bool {
|
||
if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手
|
||
chance := e.Args()[2].IntPart() // j%
|
||
effectValue := e.Args()[3].IntPart() // 等级-k
|
||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||
if success {
|
||
effectType := int(e.Args()[4].IntPart()) // XX类型
|
||
|
||
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)
|
||
}
|
||
}
|
||
} else { // 后出手
|
||
chance := e.Args()[0].IntPart() // n%
|
||
effectValue := e.Args()[1].IntPart() // 等级-m
|
||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||
if success {
|
||
effectType := int(e.Args()[4].IntPart()) // XX类型
|
||
|
||
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
|
||
}
|
||
|
||
// 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
|
||
}
|
||
|
||
// 427 - n回合内每次直接攻击都会使对手防御和特防m
|
||
type Effect427 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect427) SkillHit_ex() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||
// 降低对手防御
|
||
defDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefDown))
|
||
if defDownEffect != nil {
|
||
defDownEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // m
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, defDownEffect)
|
||
}
|
||
|
||
// 降低对手特防
|
||
spDefDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefDown))
|
||
if spDefDownEffect != nil {
|
||
spDefDownEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // m
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, spDefDownEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect427) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 150 - n回合内,对手每回合防御和特防等级m
|
||
type Effect150 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect150) OnSkill() bool {
|
||
// 降低对手防御
|
||
defDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefDown))
|
||
if defDownEffect != nil {
|
||
defDownEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // m
|
||
defDownEffect.Duration(int(e.Args()[0].IntPart())) // n回合
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, defDownEffect)
|
||
}
|
||
|
||
// 降低对手特防
|
||
spDefDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefDown))
|
||
if spDefDownEffect != nil {
|
||
spDefDownEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // m
|
||
spDefDownEffect.Duration(int(e.Args()[0].IntPart())) // n回合
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, spDefDownEffect)
|
||
}
|
||
|
||
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
|
||
}
|
||
|
||
// 518 - 若伤害高于m,则自身XX等级+n
|
||
type Effect518 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect518) 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().Our.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
|
||
}
|
||
|
||
// 522 - n回合内若处于异常状态则受到伤害减少m点
|
||
type Effect522 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect522) Skill_Use_ex() bool {
|
||
if e.Ctx().Our.CurrentPet.HasAnyStatus() { // 自身处于异常状态
|
||
// 减少受到的伤害m点
|
||
damageReduction := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart()))
|
||
e.Ctx().Our.ReduceIncomingDamage(damageReduction)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect522) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 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
|
||
}
|
||
|
||
// 561 - 先出手时当回合对手使用技能后若自身体力为0,则令自身体力等于最大体力
|
||
type Effect561 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect561) OnSkill() bool {
|
||
if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手
|
||
// 设置一个标志,用于在回合结束时检查
|
||
e.Ctx().Our.ActivateReviveIfFaint = true
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 155 - 恢复全部体力,消除所有能力下降,使自己进入睡眠n回合
|
||
type Effect155 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect155) OnSkill() bool {
|
||
// 恢复全部体力
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
|
||
|
||
// 消除所有能力下降
|
||
e.Ctx().Our.RemoveNegativeBuffs()
|
||
|
||
// 使自己进入睡眠n回合
|
||
sleepEffect := e.Ctx().Our.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)
|
||
}
|
||
|
||
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
|
||
}
|
||
|
||
// 511 - n%概率威力翻倍 体力低于1/m时概率增加k%
|
||
type Effect511 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect511) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
|
||
// 基础概率
|
||
baseChance := e.Args()[0].IntPart()
|
||
|
||
// 检查体力是否低于1/m
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||
threshold := maxHp.Div(e.Args()[1]) // 1/m
|
||
|
||
chance := baseChance
|
||
if currentHp.Cmp(threshold) < 0 {
|
||
// 体力低于阈值,概率增加k%
|
||
chance += int(e.Args()[2].IntPart())
|
||
}
|
||
|
||
success, _, _ := e.Input.Player.Roll(chance, 100)
|
||
if success {
|
||
// 威力翻倍
|
||
e.Ctx().SkillEntity.Power *= 2
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 137 - 损失一半当前体力值,攻击和速度提升2个等级
|
||
type Effect137 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect137) OnSkill() bool {
|
||
// 损失一半当前体力值
|
||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||
halfHp := currentHp.Div(alpacadecimal.NewFromInt(2))
|
||
|
||
damageZone := &info.DamageZone{
|
||
Type: info.DamageType.PercentageBased,
|
||
Damage: halfHp,
|
||
}
|
||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||
|
||
// 攻击提升2个等级
|
||
atkUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.AtkUp))
|
||
if atkUpEffect != nil {
|
||
atkUpEffect.SetArgs(e.Ctx().Our, 2) // 提升2级
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, atkUpEffect)
|
||
}
|
||
|
||
// 速度提升2个等级
|
||
speedUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedUp))
|
||
if speedUpEffect != nil {
|
||
speedUpEffect.SetArgs(e.Ctx().Our, 2) // 提升2级
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, speedUpEffect)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 497 - 附加m点固定伤害,每次使用额外附加n点,最高k点,遇到天敌时效果翻倍
|
||
type Effect497 struct {
|
||
node.EffectNode
|
||
stackedDamage int
|
||
maxExtraDamage int
|
||
}
|
||
|
||
func (e *Effect497) SkillHit_ex() bool {
|
||
// 基础伤害
|
||
baseDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))
|
||
|
||
// 额外伤害
|
||
extraDamage := alpacadecimal.NewFromInt(int64(e.stackedDamage))
|
||
|
||
// 总伤害
|
||
totalDamage := baseDamage.Add(extraDamage)
|
||
|
||
// 检查是否遇到天敌
|
||
if e.isDisadvantageousMatch() {
|
||
// 遇到天敌,效果翻倍
|
||
totalDamage = totalDamage.Mul(alpacadecimal.NewFromInt(2))
|
||
}
|
||
|
||
// 附加固定伤害
|
||
damageZone := &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: totalDamage,
|
||
}
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||
|
||
// 更新叠加伤害
|
||
e.stackedDamage += int(e.Args()[1].IntPart())
|
||
if e.stackedDamage > e.maxExtraDamage {
|
||
e.stackedDamage = e.maxExtraDamage
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect497) isDisadvantageousMatch() bool {
|
||
// 检查是否遇到天敌
|
||
return e.Ctx().Our.CurrentPet.Type == element.ElementTypeFire &&
|
||
e.Ctx().Opp.CurrentPet.Type == element.ElementTypeWater
|
||
}
|
||
|
||
func (e *Effect497) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.maxExtraDamage = a[2] // 最高k点
|
||
}
|
||
|
||
// 443 - n回合内若受到的伤害超过m,则对手疲惫x回合
|
||
type Effect443 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect443) Skill_Use_ex() bool {
|
||
damageThreshold := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart()))
|
||
|
||
if e.Ctx().Our.SumDamage.Cmp(damageThreshold) > 0 {
|
||
// 对手疲惫x回合
|
||
tiredEffect := e.Ctx().Our.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)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect443) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 609 - 若对手XX,技能威力翻倍(XX代表异常状态:麻痹0,中毒1,烧伤2,冻伤5,害怕6,疲惫7,睡眠8,石化9,冰封15)
|
||
type Effect609 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect609) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
|
||
// 检查对手是否处于任何异常状态
|
||
if e.Ctx().Opp.CurrentPet.HasAnyStatus() {
|
||
// 威力翻倍
|
||
e.Ctx().SkillEntity.Power *= 2
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 157 - n回合内,若受到攻击对手防御等级-1、特防等级-1、命中等级-1
|
||
type Effect157 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect157) Skill_Use_ex() bool {
|
||
if !e.Hit() {
|
||
return true
|
||
}
|
||
|
||
// 降低对手防御等级
|
||
defDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefDown))
|
||
if defDownEffect != nil {
|
||
defDownEffect.SetArgs(e.Ctx().Our, 1) // 降低1级
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, defDownEffect)
|
||
}
|
||
|
||
// 降低对手特防等级
|
||
spDefDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefDown))
|
||
if spDefDownEffect != nil {
|
||
spDefDownEffect.SetArgs(e.Ctx().Our, 1) // 降低1级
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, spDefDownEffect)
|
||
}
|
||
|
||
// 降低对手命中等级
|
||
accuracyDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.AccuracyDown))
|
||
if accuracyDownEffect != nil {
|
||
accuracyDownEffect.SetArgs(e.Ctx().Our, 1) // 降低1级
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, accuracyDownEffect)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect157) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 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
|
||
}
|
||
|
||
// 470 - n回合内若自身攻击技能命中则m%令对手p
|
||
type Effect470 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect470) SkillHit() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||
chance := e.Args()[1].IntPart() // m%
|
||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||
if success {
|
||
effectType := int(e.Args()[2].IntPart()) // p类型(异常状态)
|
||
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||
if statusEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect470) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 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
|
||
}
|
||
|
||
// 513 - 处在烧伤、中毒、冻伤状态时威力翻倍,命中后解除这些异常状态
|
||
type Effect513 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect513) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil {
|
||
return true
|
||
}
|
||
|
||
// 检查是否处在烧伤、中毒、冻伤状态之一
|
||
hasSpecificStatus := e.Ctx().Our.CurrentPet.HasStatus(info.PetStatus.Burned) ||
|
||
e.Ctx().Our.CurrentPet.HasStatus(info.PetStatus.Poisoned) ||
|
||
e.Ctx().Our.CurrentPet.HasStatus(info.PetStatus.Frozen)
|
||
|
||
if hasSpecificStatus {
|
||
// 威力翻倍
|
||
e.Ctx().SkillEntity.Power *= 2
|
||
|
||
// 解除这些异常状态
|
||
e.Ctx().Our.RemoveSpecificStatus([]info.EnumPetStatus{
|
||
info.PetStatus.Burned,
|
||
info.PetStatus.Poisoned,
|
||
info.PetStatus.Frozen,
|
||
})
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 493 - m回合内若对手使用攻击技能则自身下n回合必定暴击
|
||
type Effect493 struct {
|
||
node.EffectNode
|
||
critDuration int
|
||
}
|
||
|
||
func (e *Effect493) Skill_Use_ex() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||
// 对手使用了攻击技能,设置下n回合必定暴击
|
||
critEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.MustCrit))
|
||
if critEffect != nil {
|
||
critEffect.Duration(e.critDuration) // n回合
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, critEffect)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect493) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.critDuration = a[1] // n回合
|
||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||
}
|
||
|
||
// 428 - 遇到天敌时附加m点固定伤害
|
||
type Effect428 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect428) SkillHit_ex() bool {
|
||
// 检查是否遇到天敌
|
||
if e.isDisadvantageousMatch() {
|
||
// 附加m点固定伤害
|
||
additionalDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))
|
||
|
||
damageZone := &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: additionalDamage,
|
||
}
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect428) isDisadvantageousMatch() bool {
|
||
// 检查是否遇到天敌
|
||
return e.Ctx().Our.CurrentPet.Type == element.ElementTypeFire &&
|
||
e.Ctx().Opp.CurrentPet.Type == element.ElementTypeWater
|
||
}
|
||
|
||
// 166 - n回合内,若对手使用属性攻击则m%对手XX等级k
|
||
type Effect166 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect166) Skill_Use_ex() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
chance := e.Args()[0].IntPart() // m%
|
||
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().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
func (e *Effect166) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||
}
|
||
|
||
// 435 - 牺牲自己,使下回合出场的精灵首次攻击必定命中,必定先手
|
||
type Effect435 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect435) SkillUseed() bool {
|
||
if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 牺牲自己(被击败)
|
||
// 设置下个出场精灵的效果
|
||
e.Ctx().Our.SetNextPetMustHit(true)
|
||
e.Ctx().Our.SetNextPetMustGoFirst(true)
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// 142 - 损失1/n的体力值,下回合能较快出手
|
||
type Effect142 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect142) OnSkill() bool {
|
||
// 损失1/n的体力值
|
||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||
damageAmount := maxHp.Div(e.Args()[0]) // 1/n
|
||
|
||
damageZone := &info.DamageZone{
|
||
Type: info.DamageType.PercentageBased,
|
||
Damage: damageAmount,
|
||
}
|
||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||
|
||
// 设置下回合能较快出手
|
||
speedBoostEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedPlus))
|
||
if speedBoostEffect != nil {
|
||
speedBoostEffect.Duration(1) // 仅下回合
|
||
speedBoostEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // 先制度+m
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, speedBoostEffect)
|
||
}
|
||
|
||
return true
|
||
}
|