177 lines
4.7 KiB
Go
177 lines
4.7 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"
|
||
"github.com/gogf/gf/v2/util/grand"
|
||
)
|
||
|
||
// Effect 1685: 1回合做{0}-{1}次攻击,对手处于异常状态时连击上限为{2}
|
||
// 当前战斗模型未逐段执行多段攻击,这里按随机连击次数折算为红伤倍率提升。
|
||
type Effect1685 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1685) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red {
|
||
return true
|
||
}
|
||
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
minHits := int(e.Args()[0].IntPart())
|
||
maxHits := int(e.Args()[1].IntPart())
|
||
if minHits <= 0 {
|
||
minHits = 1
|
||
}
|
||
if maxHits < minHits {
|
||
maxHits = minHits
|
||
}
|
||
|
||
if e.Ctx().Opp.StatEffect_Exist_all() {
|
||
statusCap := int(e.Args()[2].IntPart())
|
||
if statusCap > 0 && statusCap < maxHits {
|
||
maxHits = statusCap
|
||
}
|
||
if maxHits < minHits {
|
||
maxHits = minHits
|
||
}
|
||
}
|
||
|
||
hits := minHits
|
||
if maxHits > minHits {
|
||
hits += grand.Intn(maxHits - minHits + 1)
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(int64(hits)))
|
||
return true
|
||
}
|
||
|
||
// Effect 1686: 先出手时造成的攻击伤害提升{0}%,若对手当前体力值高于自身则伤害额外提升{1}%
|
||
type Effect1686 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1686) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || !e.IsFirst() {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
|
||
percent := e.Args()[0]
|
||
if e.Ctx().Opp.CurrentPet.GetHP().Cmp(e.Ctx().Our.CurrentPet.GetHP()) > 0 {
|
||
percent = percent.Add(e.Args()[1])
|
||
}
|
||
|
||
zone.Damage = zone.Damage.Mul(hundred.Add(percent)).Div(hundred)
|
||
return true
|
||
}
|
||
|
||
// Effect 1687: {0}回合内免疫并反弹所有受到的控制类异常状态
|
||
type Effect1687 struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1687) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
||
if in != e.Ctx().Opp || !input.IS_Stat(effEffect) {
|
||
return true
|
||
}
|
||
if !isControlStatus1687(int(effEffect.ID().Suffix())) {
|
||
return true
|
||
}
|
||
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(effEffect.ID().Suffix()))
|
||
if statusEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
return false
|
||
}
|
||
|
||
func isControlStatus1687(statusID int) bool {
|
||
switch info.EnumPetStatus(statusID) {
|
||
case info.PetStatus.Paralysis,
|
||
info.PetStatus.Tired,
|
||
info.PetStatus.Fear,
|
||
info.PetStatus.Petrified,
|
||
info.PetStatus.Sleep:
|
||
return true
|
||
default:
|
||
return false
|
||
}
|
||
}
|
||
|
||
// Effect 1688: 消除敌我双方能力提升状态和回合类效果,消除任意一项成功则吸取对手最大体力的1/{0}且{1}%令对手{2}
|
||
type Effect1688 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1688) Skill_Use() bool {
|
||
if len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
|
||
success := false
|
||
if clearPositiveProps(e.Ctx().Our, e.Ctx().Our) {
|
||
success = true
|
||
}
|
||
if clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
|
||
success = true
|
||
}
|
||
|
||
ourTurnEffects := activeTurnEffectCount(e.Ctx().Our)
|
||
oppTurnEffects := activeTurnEffectCount(e.Ctx().Opp)
|
||
e.Ctx().Our.CancelTurn(e.Ctx().Our)
|
||
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
||
if ourTurnEffects > 0 || oppTurnEffects > 0 {
|
||
success = true
|
||
}
|
||
if !success {
|
||
return true
|
||
}
|
||
|
||
if e.Args()[0].Cmp(alpacadecimal.Zero) > 0 {
|
||
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[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)
|
||
}
|
||
|
||
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||
if ok {
|
||
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1689: 本回合未打出致命一击则恢复自己所有技能{0}点PP值并降低对手所有技能{1}点PP值
|
||
type Effect1689 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1689) Skill_Use() bool {
|
||
skill := e.Ctx().SkillEntity
|
||
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || skill.Crit != 0 || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Our.HealPP(int(e.Args()[0].IntPart()))
|
||
e.Ctx().Opp.DelPP(int(e.Args()[1].IntPart()))
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1685, &Effect1685{})
|
||
input.InitEffect(input.EffectType.Skill, 1686, &Effect1686{})
|
||
input.InitEffect(input.EffectType.Skill, 1687, &Effect1687{})
|
||
input.InitEffect(input.EffectType.Skill, 1688, &Effect1688{})
|
||
input.InitEffect(input.EffectType.Skill, 1689, &Effect1689{})
|
||
}
|