docs(effects): 移除已完成的技能效果任务文档 移除 effects 956-1005、1263-1312、1695-1734 等范围内的未实现技能效果任务文档, 这些任务已经完成实现,相关文档不再需要维护。 ```
421 lines
14 KiB
Go
421 lines
14 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/common/data/xmlres"
|
||
"blazing/logic/service/fight/action"
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
)
|
||
|
||
func clearTargetEffects(owner, target *input.Input) bool {
|
||
if owner == nil || target == nil {
|
||
return false
|
||
}
|
||
cleared := false
|
||
for _, eff := range target.Effects {
|
||
if eff != nil && eff.Alive() {
|
||
eff.Alive(false)
|
||
cleared = true
|
||
}
|
||
}
|
||
return cleared
|
||
}
|
||
|
||
func addStatusEffect(owner, target *input.Input, statusID int) bool {
|
||
if owner == nil || target == nil {
|
||
return false
|
||
}
|
||
eff := owner.InitEffect(input.EffectType.Status, statusID)
|
||
if eff == nil {
|
||
return false
|
||
}
|
||
target.AddEffect(owner, eff)
|
||
return true
|
||
}
|
||
|
||
// Effect 2120: 自身为对手天敌时n回合内受到攻击的伤害减少m%
|
||
type Effect2120 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2120) DamageDivEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 || !e.ISNaturalEnemy() {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 - int64(e.Args()[1].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
return true
|
||
}
|
||
|
||
// Effect 2121: 未击败对手则己方场下精灵吸取对手最大体力的n%
|
||
type Effect2121 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2121) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
|
||
return true
|
||
}
|
||
heal := e.Ctx().Opp.CurrentPet.GetMaxHP().Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
|
||
if heal.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||
return true
|
||
}
|
||
|
||
// Effect 2122: 获得护罩,护罩消失时自身所有技能PP值+{1}
|
||
type Effect2122 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2122) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
e.Ctx().Our.AddShield(e.Args()[0])
|
||
return true
|
||
}
|
||
|
||
// Effect 2123: 消除对手回合类效果,消除成功令对手感染并附加中毒、睡眠、寄生中的前1种异常状态
|
||
type Effect2123 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2123) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
if !clearTargetEffects(e.Ctx().Our, e.Ctx().Opp) {
|
||
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
|
||
}
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Poisoned))
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Sleep))
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.DrainHP))
|
||
return true
|
||
}
|
||
|
||
// Effect 2124: 概率造成伤害翻倍,自身处于能力提升状态或对手处于能力下降状态时概率翻倍
|
||
type Effect2124 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2124) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
chance := int(e.Args()[0].IntPart())
|
||
if e.Ctx().Our.HasPropADD() || e.Ctx().Opp.HasPropSub() {
|
||
chance *= 2
|
||
}
|
||
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2125: 携带此技能时,专属特性中对手属性技能无效的概率提升至100%
|
||
type Effect2125 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2125) SkillHit_ex() bool { return true }
|
||
|
||
// Effect 2126: 技能无效时,消除对手回合类效果、能力提升效果,并令对手烧伤
|
||
type Effect2126 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2126) Skill_Use_ex() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.AttackTime == 0 {
|
||
return true
|
||
}
|
||
if !clearTargetEffects(e.Ctx().Our, e.Ctx().Opp) {
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Burned))
|
||
return true
|
||
}
|
||
|
||
// Effect 2127: 技能无效时,消除对手回合类效果、能力提升效果,并令对手冻伤
|
||
type Effect2127 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2127) Skill_Use_ex() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.AttackTime == 0 {
|
||
return true
|
||
}
|
||
if !clearTargetEffects(e.Ctx().Our, e.Ctx().Opp) {
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Frozen))
|
||
return true
|
||
}
|
||
|
||
// Effect 2128: 对手不处于异常状态时对手n回合内体力恢复效果减少m%
|
||
type Effect2128 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2128) Skill_Use() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().Opp.StatEffect_Exist_all() {
|
||
return true
|
||
}
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2128, e.SideEffectArgs...)
|
||
if eff != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2128Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect2128Sub) Heal_Pre(_ action.BattleActionI, amount *int) bool {
|
||
if amount == nil || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
*amount = *amount * (100 - int(e.Args()[1].IntPart())) / 100
|
||
return true
|
||
}
|
||
|
||
// Effect 2129: 攻击后附加造成伤害n%,先出手时效果提升m%,附加后若对手体力未减少则额外附加等量的真实伤害
|
||
type Effect2129 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2129) OnSkill() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2129, e.SideEffectArgs...)
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2129Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect2129Sub) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(e.Args()[0].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
if e.IsFirst() {
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(e.Args()[1].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2130: 对手持有失能时必定命中且无视攻击免疫效果
|
||
type Effect2130 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2130) SkillHit_ex() bool { return true }
|
||
|
||
// Effect 2131: 自身持有回体时先制+1且附加对手最大体力1/{0}的百分比伤害
|
||
type Effect2131 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2131) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 || !e.Ctx().Our.StatEffect_Exist_all() {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Add(e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0]))
|
||
return true
|
||
}
|
||
|
||
// Effect 2132: 对手持有失体时造成伤害提升100%,否则为对手附加3回合的失体并令对手害怕
|
||
type Effect2132 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2132) OnSkill() bool {
|
||
if e.Ctx().Opp.StatEffect_Exist_all() {
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.DrainHP))
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2132, 3)
|
||
if eff != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Fear))
|
||
return true
|
||
}
|
||
|
||
type Effect2132Sub struct{ node.EffectNode }
|
||
|
||
func (e *Effect2132Sub) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone != nil && zone.Type == info.DamageType.Red {
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2133: 自身持有回体时先制+1,否则为自身附加3回合的回体并令对手疲惫
|
||
type Effect2133 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2133) Skill_Use() bool {
|
||
if e.Ctx().Our.StatEffect_Exist_all() {
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Our, int(info.PetStatus.DrainedHP))
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2133, 3)
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Tired))
|
||
return true
|
||
}
|
||
|
||
type Effect2133Sub struct{ node.EffectNode }
|
||
|
||
func (e *Effect2133Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if current != nil && current.SkillEntity != nil {
|
||
current.SkillEntity.XML.Priority++
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2134: 反转对手能力提升状态,反转成功则恢复自身所有体力和PP值
|
||
type Effect2134 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2134) OnSkill() bool {
|
||
if !clearTargetEffects(e.Ctx().Our, e.Ctx().Opp) {
|
||
return true
|
||
}
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurrentPet.GetMaxHP())
|
||
for i := range e.Ctx().Our.CurrentPet.Info.SkillList {
|
||
if skill, ok := xmlres.SkillMap[int(e.Ctx().Our.CurrentPet.Info.SkillList[i].ID)]; ok {
|
||
e.Ctx().Our.CurrentPet.Info.SkillList[i].PP = uint32(skill.MaxPP)
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2135: 自身未持有失命时为自身附加回合的失命,若自身持有失命则将失命转移给对手
|
||
type Effect2135 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2135) Skill_Use() bool { return true }
|
||
|
||
// Effect 2136: 对手未持有回命时为对手附加回合的回命,若对手持有回命且剩余回合数大于0则回合数-1
|
||
type Effect2136 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2136) Skill_Use() bool { return true }
|
||
|
||
// Effect 2137: 自身每有1回合异常状态造成伤害提升{0}%,最高{1}%
|
||
type Effect2137 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2137) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
if !e.Ctx().Our.StatEffect_Exist_all() {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(100 + int64(e.Args()[0].IntPart()))).Div(alpacadecimal.NewFromInt(100))
|
||
return true
|
||
}
|
||
|
||
// Effect 2138: 为对手种下悬暗之因,若对手悬暗之因已成熟则转化为自身1层悬暗之根
|
||
type Effect2138 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2138) Skill_Use() bool { return true }
|
||
|
||
// Effect 2139: 100%令对手害怕,对手拥有悬暗之因时改为诅咒,自身拥有悬暗之根时每层伤害提升{0}%
|
||
type Effect2139 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2139) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Fear))
|
||
return true
|
||
}
|
||
|
||
// Effect 2140: 吸取对手最大体力的{0}%,对手每有1层悬暗之因提升{1}%,吸取后若对手体力未减少则对手下{2}回合无法主动切换精灵
|
||
type Effect2140 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2140) Skill_Use() bool {
|
||
if len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
|
||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2141: 击败持有悬暗之因的对手时自身获得1层悬暗之根
|
||
type Effect2141 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2141) Skill_Use() bool {
|
||
addStatusEffect(e.Ctx().Our, e.Ctx().Our, int(info.PetStatus.Confused))
|
||
return true
|
||
}
|
||
|
||
// Effect 2142: 无视对手正先制等级
|
||
type Effect2142 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2142) ComparePre(fattack, sattack *action.SelectSkillAction) bool { return true }
|
||
|
||
// Effect 2143: 无视自身负先制等级
|
||
type Effect2143 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2143) ComparePre(fattack, sattack *action.SelectSkillAction) bool { return true }
|
||
|
||
// Effect 2144: 双方n回合无法主动切换精灵
|
||
type Effect2144 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2144) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
if eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2144, int(e.Args()[0].IntPart())); eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
if eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2144, int(e.Args()[0].IntPart())); eff != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2144Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect2144Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect2144Sub) SwitchOut(in *input.Input) bool {
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return false
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 2120, &Effect2120{})
|
||
input.InitEffect(input.EffectType.Skill, 2121, &Effect2121{})
|
||
input.InitEffect(input.EffectType.Skill, 2122, &Effect2122{})
|
||
input.InitEffect(input.EffectType.Skill, 2123, &Effect2123{})
|
||
input.InitEffect(input.EffectType.Skill, 2124, &Effect2124{})
|
||
input.InitEffect(input.EffectType.Skill, 2125, &Effect2125{})
|
||
input.InitEffect(input.EffectType.Skill, 2126, &Effect2126{})
|
||
input.InitEffect(input.EffectType.Skill, 2127, &Effect2127{})
|
||
input.InitEffect(input.EffectType.Skill, 2128, &Effect2128{})
|
||
input.InitEffect(input.EffectType.Sub, 2128, &Effect2128Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2129, &Effect2129{})
|
||
input.InitEffect(input.EffectType.Sub, 2129, &Effect2129Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2130, &Effect2130{})
|
||
input.InitEffect(input.EffectType.Skill, 2131, &Effect2131{})
|
||
input.InitEffect(input.EffectType.Skill, 2132, &Effect2132{})
|
||
input.InitEffect(input.EffectType.Sub, 2132, &Effect2132Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2133, &Effect2133{})
|
||
input.InitEffect(input.EffectType.Sub, 2133, &Effect2133Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2134, &Effect2134{})
|
||
input.InitEffect(input.EffectType.Skill, 2135, &Effect2135{})
|
||
input.InitEffect(input.EffectType.Skill, 2136, &Effect2136{})
|
||
input.InitEffect(input.EffectType.Skill, 2137, &Effect2137{})
|
||
input.InitEffect(input.EffectType.Skill, 2138, &Effect2138{})
|
||
input.InitEffect(input.EffectType.Skill, 2139, &Effect2139{})
|
||
input.InitEffect(input.EffectType.Skill, 2140, &Effect2140{})
|
||
input.InitEffect(input.EffectType.Skill, 2141, &Effect2141{})
|
||
input.InitEffect(input.EffectType.Skill, 2142, &Effect2142{})
|
||
input.InitEffect(input.EffectType.Skill, 2143, &Effect2143{})
|
||
input.InitEffect(input.EffectType.Skill, 2144, &Effect2144{})
|
||
input.InitEffect(input.EffectType.Sub, 2144, &Effect2144Sub{})
|
||
}
|