Files
bl/logic/service/fight/boss/json_eid_basic.go

380 lines
10 KiB
Go
Raw Normal View History

package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
"github.com/gogf/gf/v2/util/grand"
)
type BossJsonEid0 struct {
NewSel0
}
func (e *BossJsonEid0) ownerActive() bool {
return e.IsOwner()
}
func bossJsonIntArg(args []alpacadecimal.Decimal, idx int, def int) int {
if idx >= 0 && idx < len(args) {
return int(args[idx].IntPart())
}
return def
}
func bossJsonFirstPositiveArg(args []alpacadecimal.Decimal, def int) int {
for _, arg := range args {
if arg.IntPart() > 0 {
return int(arg.IntPart())
}
}
return def
}
func bossJsonIsAttackSkill(skill *info.SkillEntity) bool {
return skill != nil && skill.Category() != info.Category.STATUS
}
func bossJsonBoostAll(target, source *input.Input, delta int8) {
for i := 0; i < 6; i++ {
target.SetProp(source, int8(i), delta)
}
}
func bossJsonSetAll(target *input.Input, value int8) {
for i := 0; i < 6; i++ {
target.AttackValue.Prop[i] = value
}
}
func bossJsonClearPositive(target *input.Input) bool {
changed := false
for i := 0; i < 6; i++ {
if target.AttackValue.Prop[i] > 0 {
target.AttackValue.Prop[i] = 0
changed = true
}
}
return changed
}
func bossJsonHasPositive(target *input.Input) bool {
for i := 0; i < 6; i++ {
if target.AttackValue.Prop[i] > 0 {
return true
}
}
return false
}
func bossJsonAnyTurnEffect(target *input.Input) bool {
for _, effect := range target.Effects {
if effect.Alive() && effect.Duration() > 0 {
return true
}
}
return false
}
// 1261/2346: 神话
// 免疫异常状态和能力下降状态所有技能必中且PP值无限
type BossJsonEidMyth struct{ BossJsonEid0 }
func (e *BossJsonEidMyth) PropBefer(in *input.Input, prop int8, level int8) bool {
if !e.ownerActive() || in == e.Ctx().Our {
return true
}
return level >= 0
}
func (e *BossJsonEidMyth) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
if !e.ownerActive() || in != e.Ctx().Opp {
return true
}
return !input.IS_Stat(effEffect)
}
func (e *BossJsonEidMyth) ActionStart(a, b *action.SelectSkillAction) bool {
if !e.ownerActive() || e.Ctx().SkillEntity == nil {
return true
}
e.Ctx().SkillEntity.XML.MustHit = 1
return true
}
func (e *BossJsonEidMyth) HookPP(count *int) bool {
if !e.ownerActive() {
return true
}
*count = 0
return true
}
// 600: 所有技能必定先手
type BossJsonEid600 struct{ BossJsonEid0 }
func (e *BossJsonEid600) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if !e.ownerActive() {
return true
}
userID := e.Ctx().Our.Player.GetInfo().UserID
if fattack != nil && fattack.PlayerID == userID && fattack.SkillEntity != nil {
fattack.SkillEntity.XML.Priority += 1000
}
if sattack != nil && sattack.PlayerID == userID && sattack.SkillEntity != nil {
sattack.SkillEntity.XML.Priority += 1000
}
return true
}
// 390: 自身使用技能后全属性+1
type BossJsonEid390 struct{ BossJsonEid0 }
func (e *BossJsonEid390) Action_end() bool {
if !e.ownerActive() || e.Ctx().SkillEntity == nil {
return true
}
bossJsonBoostAll(e.Ctx().Our, e.Ctx().Our, int8(bossJsonFirstPositiveArg(e.Args(), 1)))
return true
}
// 792: 格挡物攻/特攻
type BossJsonEid792 struct{ BossJsonEid0 }
func (e *BossJsonEid792) DamageLockEx(zone *info.DamageZone) bool {
if !e.ownerActive() || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil {
return true
}
mode := bossJsonIntArg(e.Args(), 0, 0)
if mode == 1 && e.Ctx().SkillEntity.Category() == info.Category.PHYSICAL {
zone.Damage = alpacadecimal.Zero
}
if mode == 2 && e.Ctx().SkillEntity.Category() == info.Category.SPECIAL {
zone.Damage = alpacadecimal.Zero
}
return true
}
// 219: 抵挡未打出致命一击的攻击
type BossJsonEid219 struct{ BossJsonEid0 }
func (e *BossJsonEid219) DamageLockEx(zone *info.DamageZone) bool {
if !e.ownerActive() || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Crit == 0 {
zone.Damage = alpacadecimal.Zero
}
return true
}
// 208: 抵挡非先制攻击
type BossJsonEid208 struct{ BossJsonEid0 }
func (e *BossJsonEid208) DamageLockEx(zone *info.DamageZone) bool {
if !e.ownerActive() || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.XML.Priority <= 0 {
zone.Damage = alpacadecimal.Zero
}
return true
}
// 1216: 免疫固定伤害、百分比伤害
type BossJsonEid1216 struct{ BossJsonEid0 }
func (e *BossJsonEid1216) DamageLockEx(zone *info.DamageZone) bool {
if !e.ownerActive() {
return true
}
if zone.Type == info.DamageType.Fixed || zone.Type == info.DamageType.Percent {
zone.Damage = alpacadecimal.Zero
}
return true
}
// 805: 死亡后概率满血复活
type BossJsonEid805 struct {
BossJsonEid0
used bool
}
func (e *BossJsonEid805) revive() bool {
2026-04-04 04:34:43 +08:00
if !e.ownerActive() || e.used || e.Ctx().Our.CurPet[0].Info.Hp != 0 {
return true
}
e.used = true
if !grand.Meet(bossJsonFirstPositiveArg(e.Args(), 0), 100) {
return true
}
2026-04-04 04:34:43 +08:00
e.Ctx().Our.CurPet[0].Info.Hp = e.Ctx().Our.CurPet[0].Info.MaxHp
e.Ctx().Our.HealPP(-1)
return true
}
func (e *BossJsonEid805) Action_end() bool { return e.revive() }
func (e *BossJsonEid805) Action_end_ex() bool { return e.revive() }
// 1215: 攻击技能概率造成倍数伤害
type BossJsonEid1215 struct{ BossJsonEid0 }
func (e *BossJsonEid1215) Damage_Mul(zone *info.DamageZone) bool {
if !e.ownerActive() || zone.Type != info.DamageType.Red || !bossJsonIsAttackSkill(e.Ctx().SkillEntity) {
return true
}
chance := bossJsonIntArg(e.Args(), 0, 0)
multiple := bossJsonIntArg(e.Args(), 1, 1)
if chance > 0 && multiple > 1 && grand.Meet(chance, 100) {
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(int64(multiple)))
}
return true
}
// 280: 闪避率提升n%
type BossJsonEid280 struct{ BossJsonEid0 }
func (e *BossJsonEid280) SkillHit_ex() bool {
if !e.ownerActive() || e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.AttackTime == 2 {
return true
}
hit, _, _ := e.Input.Player.Roll(bossJsonFirstPositiveArg(e.Args(), 0), 100)
if hit {
e.Ctx().SkillEntity.SetMiss()
}
return true
}
// 377: 与对手精灵互换属性
type BossJsonEid377 struct {
BossJsonEid0
used bool
}
func (e *BossJsonEid377) Fight_Start() bool {
2026-04-04 04:34:43 +08:00
if !e.ownerActive() || e.used || e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp.CurPet[0] == nil {
return true
}
e.used = true
2026-04-04 04:34:43 +08:00
e.Ctx().Our.CurPet[0].Type, e.Ctx().Opp.CurPet[0].Type = e.Ctx().Opp.CurPet[0].Type, e.Ctx().Our.CurPet[0].Type
return true
}
// 121: 概率令对手属性技能失效
type BossJsonEid121 struct{ BossJsonEid0 }
func (e *BossJsonEid121) SkillHit_ex() bool {
if !e.ownerActive() || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
hit, _, _ := e.Input.Player.Roll(bossJsonFirstPositiveArg(e.Args(), 0), 100)
if hit {
e.Ctx().SkillEntity.SetMiss()
}
return true
}
// 735: 每回合吸取固定体力
type BossJsonEid735 struct{ BossJsonEid0 }
func (e *BossJsonEid735) TurnStart(fattack, sattack *action.SelectSkillAction) {
if !e.ownerActive() {
return
}
value := alpacadecimal.NewFromInt(int64(bossJsonFirstPositiveArg(e.Args(), 0)))
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: value})
e.Ctx().Our.Heal(e.Ctx().Our, nil, value)
}
// 261: 每回合按最大体力比例恢复
type BossJsonEid261 struct{ BossJsonEid0 }
func (e *BossJsonEid261) TurnStart(fattack, sattack *action.SelectSkillAction) {
if !e.ownerActive() {
return
}
num := bossJsonIntArg(e.Args(), 0, 0)
den := bossJsonIntArg(e.Args(), 1, 1)
if num <= 0 || den <= 0 {
return
}
2026-04-04 04:34:43 +08:00
heal := e.Ctx().Our.CurPet[0].GetMaxHP().Mul(alpacadecimal.NewFromInt(int64(num))).Div(alpacadecimal.NewFromInt(int64(den)))
e.Ctx().Our.Heal(e.Ctx().Our, nil, heal)
}
// 209: 每n回合恢复固定体力
type BossJsonEid209 struct {
BossJsonEid0
turns int
}
func (e *BossJsonEid209) TurnEnd() {
if !e.ownerActive() {
return
}
e.turns++
interval := bossJsonIntArg(e.Args(), 0, 0)
value := bossJsonIntArg(e.Args(), 1, 0)
if interval > 0 && value > 0 && e.turns%interval == 0 {
e.Ctx().Our.Heal(e.Ctx().Our, nil, alpacadecimal.NewFromInt(int64(value)))
}
}
// 342: 免疫低于/高于阈值的伤害
type BossJsonEid342 struct{ BossJsonEid0 }
func (e *BossJsonEid342) DamageLockEx(zone *info.DamageZone) bool {
if !e.ownerActive() {
return true
}
mode := bossJsonIntArg(e.Args(), 0, 0)
limit := bossJsonIntArg(e.Args(), 1, 0)
dmg := int(zone.Damage.IntPart())
if mode == 1 && dmg < limit {
zone.Damage = alpacadecimal.Zero
}
if mode == 2 && dmg > limit {
zone.Damage = alpacadecimal.Zero
}
return true
}
// 1233: 免疫并反弹致命一击伤害
type BossJsonEid1233 struct{ BossJsonEid0 }
func (e *BossJsonEid1233) DamageLockEx(zone *info.DamageZone) bool {
if !e.ownerActive() || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Crit == 0 {
return true
}
reflectDamage := zone.Damage
zone.Damage = alpacadecimal.Zero
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: reflectDamage})
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 1261, &BossJsonEidMyth{})
input.InitEffect(input.EffectType.NewSel, 2346, &BossJsonEidMyth{})
input.InitEffect(input.EffectType.NewSel, 600, &BossJsonEid600{})
input.InitEffect(input.EffectType.NewSel, 390, &BossJsonEid390{})
input.InitEffect(input.EffectType.NewSel, 792, &BossJsonEid792{})
input.InitEffect(input.EffectType.NewSel, 219, &BossJsonEid219{})
input.InitEffect(input.EffectType.NewSel, 208, &BossJsonEid208{})
input.InitEffect(input.EffectType.NewSel, 1216, &BossJsonEid1216{})
input.InitEffect(input.EffectType.NewSel, 805, &BossJsonEid805{})
input.InitEffect(input.EffectType.NewSel, 1215, &BossJsonEid1215{})
input.InitEffect(input.EffectType.NewSel, 280, &BossJsonEid280{})
input.InitEffect(input.EffectType.NewSel, 377, &BossJsonEid377{})
input.InitEffect(input.EffectType.NewSel, 121, &BossJsonEid121{})
input.InitEffect(input.EffectType.NewSel, 735, &BossJsonEid735{})
input.InitEffect(input.EffectType.NewSel, 261, &BossJsonEid261{})
input.InitEffect(input.EffectType.NewSel, 209, &BossJsonEid209{})
input.InitEffect(input.EffectType.NewSel, 342, &BossJsonEid342{})
input.InitEffect(input.EffectType.NewSel, 1233, &BossJsonEid1233{})
}