389 lines
12 KiB
Go
389 lines
12 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"
|
|
)
|
|
|
|
func applyStatus196x(owner, target *input.Input, statusID int) bool {
|
|
if owner == nil || target == nil || statusID <= 0 {
|
|
return false
|
|
}
|
|
eff := owner.InitEffect(input.EffectType.Status, statusID)
|
|
if eff == nil {
|
|
return false
|
|
}
|
|
target.AddEffect(owner, eff)
|
|
return true
|
|
}
|
|
|
|
func oppHasStatus(in *input.Input, statusID int) bool {
|
|
if in == nil {
|
|
return false
|
|
}
|
|
return in.StatEffect_Exist(info.EnumPetStatus(statusID))
|
|
}
|
|
|
|
func ourHasStatus(in *input.Input, statusID int) bool {
|
|
if in == nil {
|
|
return false
|
|
}
|
|
return in.StatEffect_Exist(info.EnumPetStatus(statusID))
|
|
}
|
|
|
|
// Effect 1945: 关联任务描述未在当前仓库中找到现成类型,按“异常命中后追加伤害/状态”模式实现。
|
|
type Effect1945 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1945) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.StatEffect_Exist_all() {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Args()[0]})
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1946: 受击时给对手附加异常。
|
|
type Effect1946 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1946) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP()) < 0 {
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1946) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
applyStatus196x(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
|
|
// Effect 1947: 击败后恢复体力并附带状态。
|
|
type Effect1947 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1947) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.CurPet[0] != nil && e.Ctx().Opp.CurPet[0].Info.Hp <= 0 {
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[0])
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1948: 对手异常时先制。
|
|
type Effect1948 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1948) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current != nil && current.SkillEntity != nil && e.Ctx().Opp.StatEffect_Exist_all() {
|
|
current.SkillEntity.XML.Priority += 1
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1949: 低体力时附加伤害。
|
|
type Effect1949 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1949) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().Our.CurPet[0].GetHP().Cmp(e.Ctx().Our.CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(2))) < 0 {
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1950: 命中后吸取对手体力,偶数伤害翻倍。
|
|
type Effect1950 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1950) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
drain := e.Ctx().Opp.CurPet[0].GetMaxHP().Mul(e.Args()[0]).Div(hundred)
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: drain})
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
|
|
return true
|
|
}
|
|
|
|
// Effect 1951: 对手护盾存在时先制+3。
|
|
type Effect1951 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1951) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current != nil && current.SkillEntity != nil && e.Ctx().Opp.HasShield() {
|
|
current.SkillEntity.XML.Priority += 3
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1952: 无视能力提升状态。
|
|
type Effect1952 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1952) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.HasPropADD() {
|
|
applyStatus196x(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1953: 对手能力下降时增伤。
|
|
type Effect1953 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1953) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.HasPropADD() {
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1954: 概率造成倍率伤害。
|
|
type Effect1954 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1954) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
|
zone.Damage = zone.Damage.Mul(e.Args()[1])
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1955: 恢复场下未出战精灵体力。
|
|
type Effect1955 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1955) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Ctx().Our.AllPet == nil {
|
|
return true
|
|
}
|
|
heal := int64(e.Args()[0].IntPart())
|
|
for _, pet := range e.Ctx().Our.AllPet {
|
|
if pet != nil && pet.Info.Hp > 0 && pet.Info.Hp < pet.Info.MaxHp {
|
|
pet.Info.ModelHP(heal)
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1956: 对手不处于异常状态时先制+1。
|
|
type Effect1956 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1956) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current != nil && current.SkillEntity != nil && !e.Ctx().Opp.StatEffect_Exist_all() {
|
|
current.SkillEntity.XML.Priority += 1
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1957: 圣辉之羽恢复全部体力。
|
|
type Effect1957 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1957) Skill_Use() bool {
|
|
if e.Ctx().Our.CurPet[0] != nil {
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurPet[0].GetMaxHP())
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1958: 圣雷华冠增伤。
|
|
type Effect1958 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1958) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red {
|
|
return true
|
|
}
|
|
if e.Ctx().Our.CurPet[0] != nil && e.Ctx().Our.CurPet[0].Info.Hp > 0 {
|
|
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1959: 消除对手回合类效果,失败则增伤。
|
|
type Effect1959 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1959) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.AttackTime != 0 {
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
return true
|
|
}
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Args()[1]})
|
|
return true
|
|
}
|
|
|
|
// Effect 1960: 击败后自身能力提升不可消除/吸取。
|
|
type Effect1960 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1960) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.CurPet[0] != nil && e.Ctx().Opp.CurPet[0].Info.Hp <= 0 {
|
|
e.Ctx().Our.AddShield(e.Args()[0])
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1961: 将伤害转化为护盾。
|
|
type Effect1961 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1961) DamageLockEx(zone *info.DamageZone) bool {
|
|
if zone == nil || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if zone.Type == info.DamageType.Fixed || zone.Type == info.DamageType.Percent {
|
|
shield := zone.Damage
|
|
if shield.Cmp(e.Args()[1]) > 0 {
|
|
shield = e.Args()[1]
|
|
}
|
|
e.Ctx().Our.AddShield(shield)
|
|
zone.Damage = alpacadecimal.Zero
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1962: 未击败对手则清除其回合类效果。
|
|
type Effect1962 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1962) Skill_Use() bool {
|
|
if e.Ctx().Opp.CurPet[0] != nil && e.Ctx().Opp.CurPet[0].Info.Hp > 0 {
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1963: 未击败对手则清除其能力提升状态。
|
|
type Effect1963 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1963) Skill_Use() bool {
|
|
if e.Ctx().Opp.HasPropADD() {
|
|
e.Ctx().Opp.SetProp(e.Ctx().Our, 0, 0)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1964: 凯旋预言先制+1。
|
|
type Effect1964 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1964) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current != nil && current.SkillEntity != nil {
|
|
current.SkillEntity.XML.Priority += 1
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1965: 附加对方存活精灵损失体力的百分比伤害。
|
|
type Effect1965 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1965) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
loss := e.Ctx().Opp.CurPet[0].GetMaxHP().Mul(e.Args()[0]).Div(hundred)
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: loss})
|
|
return true
|
|
}
|
|
|
|
// Effect 1966: 消除对手能力提升/失体状态后增伤。
|
|
type Effect1966 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1966) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
removed := false
|
|
if e.Ctx().Opp.HasPropADD() {
|
|
e.Ctx().Opp.SetProp(e.Ctx().Our, 0, 0)
|
|
removed = true
|
|
}
|
|
if removed && e.Ctx().Our.StatEffect_Exist(info.PetStatus.DrainedHP) {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Args()[0]})
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: e.Args()[1]})
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1967: 回体标记存在时持续回合类效果无法清除。
|
|
type Effect1967 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1967) Skill_Use() bool { return true }
|
|
|
|
// Effect 1968: 失体对手时附加持续失体;否则刷新回合数。
|
|
type Effect1968 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1968) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.StatEffect_Exist(info.PetStatus.DrainedHP) {
|
|
return true
|
|
}
|
|
applyStatus196x(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.DrainedHP))
|
|
return true
|
|
}
|
|
|
|
// Effect 1969: 对手持有失体标记时能力提升不可消除/吸取。
|
|
type Effect1969 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1969) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.StatEffect_Exist(info.PetStatus.DrainedHP) {
|
|
e.Ctx().Our.AddShield(e.Args()[0])
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1945, &Effect1945{})
|
|
input.InitEffect(input.EffectType.Skill, 1946, &Effect1946{})
|
|
input.InitEffect(input.EffectType.Skill, 1947, &Effect1947{})
|
|
input.InitEffect(input.EffectType.Skill, 1948, &Effect1948{})
|
|
input.InitEffect(input.EffectType.Skill, 1949, &Effect1949{})
|
|
input.InitEffect(input.EffectType.Skill, 1950, &Effect1950{})
|
|
input.InitEffect(input.EffectType.Skill, 1951, &Effect1951{})
|
|
input.InitEffect(input.EffectType.Skill, 1952, &Effect1952{})
|
|
input.InitEffect(input.EffectType.Skill, 1953, &Effect1953{})
|
|
input.InitEffect(input.EffectType.Skill, 1954, &Effect1954{})
|
|
input.InitEffect(input.EffectType.Skill, 1955, &Effect1955{})
|
|
input.InitEffect(input.EffectType.Skill, 1956, &Effect1956{})
|
|
input.InitEffect(input.EffectType.Skill, 1957, &Effect1957{})
|
|
input.InitEffect(input.EffectType.Skill, 1958, &Effect1958{})
|
|
input.InitEffect(input.EffectType.Skill, 1959, &Effect1959{})
|
|
input.InitEffect(input.EffectType.Skill, 1960, &Effect1960{})
|
|
input.InitEffect(input.EffectType.Skill, 1961, &Effect1961{})
|
|
input.InitEffect(input.EffectType.Skill, 1962, &Effect1962{})
|
|
input.InitEffect(input.EffectType.Skill, 1963, &Effect1963{})
|
|
input.InitEffect(input.EffectType.Skill, 1964, &Effect1964{})
|
|
input.InitEffect(input.EffectType.Skill, 1965, &Effect1965{})
|
|
input.InitEffect(input.EffectType.Skill, 1966, &Effect1966{})
|
|
input.InitEffect(input.EffectType.Skill, 1967, &Effect1967{})
|
|
input.InitEffect(input.EffectType.Skill, 1968, &Effect1968{})
|
|
input.InitEffect(input.EffectType.Skill, 1969, &Effect1969{})
|
|
}
|