1
This commit is contained in:
206
logic/service/fight/effect/effect_119_123.go
Normal file
206
logic/service/fight/effect/effect_119_123.go
Normal file
@@ -0,0 +1,206 @@
|
||||
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"
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果119:若伤害为奇数,30%对手疲惫1回合;若为偶数,30%速度+1
|
||||
// -----------------------------------------------------------
|
||||
type Effect119 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect119) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
e.can = true
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect119) DamageLock(damageValue *info.DamageZone) bool {
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
|
||||
isOdd := damageValue.Damage.IntPart()%2 == 1
|
||||
|
||||
if isOdd {
|
||||
// 奇数:30%对手疲惫1回合
|
||||
ok, _, _ := e.Input.Player.Roll(30, 100)
|
||||
if ok {
|
||||
eff := input.Geteffect(input.EffectType.Status, int(info.PetStatus.Tired))
|
||||
if eff == nil {
|
||||
return true
|
||||
}
|
||||
eff.Duration(1)
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||||
}
|
||||
} else {
|
||||
// 偶数:30%速度+1
|
||||
ok, _, _ := e.Input.Player.Roll(30, 100)
|
||||
if ok {
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1, info.AbilityOpType.ADD)
|
||||
}
|
||||
}
|
||||
e.can = false
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect119) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.EffectNode.Duration(1)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果120:50%概率对方减血1/{0},50%概率自己减血1/{0}
|
||||
// -----------------------------------------------------------
|
||||
type Effect120 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect120) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
|
||||
// 50%概率
|
||||
ok, _, _ := e.Input.Player.Roll(50, 100)
|
||||
|
||||
denominator := int(e.Args()[0].IntPart())
|
||||
percent := alpacadecimal.NewFromInt(100).Div(alpacadecimal.NewFromInt(int64(denominator)))
|
||||
|
||||
if ok {
|
||||
// 对方减血1/{0}
|
||||
oppMaxHP := alpacadecimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.MaxHp))
|
||||
damage := oppMaxHP.Mul(percent).Div(alpacadecimal.NewFromInt(100))
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damage,
|
||||
})
|
||||
} else {
|
||||
// 自己减血1/{0}
|
||||
ourMaxHP := alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp))
|
||||
damage := ourMaxHP.Mul(percent).Div(alpacadecimal.NewFromInt(100))
|
||||
e.Ctx().Our.Damage(e.Ctx().Opp, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damage,
|
||||
})
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果121:属性相同时,{0}%概率让对方麻痹
|
||||
// -----------------------------------------------------------
|
||||
type Effect121 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect121) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
|
||||
// 检查属性是否相同
|
||||
if e.Ctx().Our.CurrentPet.PetInfo.Type == e.Ctx().Opp.CurrentPet.PetInfo.Type {
|
||||
chance := int(e.Args()[0].IntPart())
|
||||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
if ok {
|
||||
eff := input.Geteffect(input.EffectType.Status, int(info.PetStatus.Paralysis))
|
||||
if eff == nil {
|
||||
return true
|
||||
}
|
||||
duration := int(e.Input.FightC.GetRand().Int31n(2))
|
||||
duration++
|
||||
eff.Duration(duration)
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果122:先出手时,{1}%改变对方{0}等级{2}
|
||||
// -----------------------------------------------------------
|
||||
type Effect122 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect122) Skill_Hit() bool {
|
||||
if e.Input.FightC.IsFirst(e.Input.Player) {
|
||||
e.can = true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect122) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
if e.can {
|
||||
propIndex := int(e.Args()[0].IntPart())
|
||||
chance := int(e.Args()[1].IntPart())
|
||||
changeAmount := int(e.Args()[2].IntPart())
|
||||
|
||||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
if ok {
|
||||
opType := info.AbilityOpType.ADD
|
||||
if changeAmount < 0 {
|
||||
opType = info.AbilityOpType.SUB
|
||||
}
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType)
|
||||
}
|
||||
e.can = false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果123:{0}回合内受到任何伤害,自身{1}提高{2}个等级
|
||||
// -----------------------------------------------------------
|
||||
type Effect123 struct {
|
||||
node.EffectNode
|
||||
roundCount int
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect123) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.roundCount = e.EffectNode.SideEffectArgs[0]
|
||||
}
|
||||
|
||||
func (e *Effect123) Turn_Start(at, de *action.SelectSkillAction) {
|
||||
if e.roundCount > 0 {
|
||||
e.can = true
|
||||
e.roundCount--
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Effect123) Be_Damage(at, _ alpacadecimal.Decimal) {
|
||||
if e.can {
|
||||
propIndex := int(e.Args()[1].IntPart())
|
||||
changeAmount := int(e.Args()[2].IntPart())
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), info.AbilityOpType.ADD)
|
||||
e.can = false
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 初始化
|
||||
// -----------------------------------------------------------
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 119, &Effect119{})
|
||||
input.InitEffect(input.EffectType.Skill, 120, &Effect120{})
|
||||
input.InitEffect(input.EffectType.Skill, 121, &Effect121{})
|
||||
input.InitEffect(input.EffectType.Skill, 122, &Effect122{})
|
||||
input.InitEffect(input.EffectType.Skill, 123, &Effect123{})
|
||||
}
|
||||
71
logic/service/fight/effect/effect_124_126.go
Normal file
71
logic/service/fight/effect/effect_124_126.go
Normal file
@@ -0,0 +1,71 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果124:命中后,{0}%概率随机对方一个属性{1}个等级
|
||||
// -----------------------------------------------------------
|
||||
type Effect124 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect124) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
|
||||
chance := int(e.Args()[0].IntPart())
|
||||
changeAmount := int(e.Args()[1].IntPart())
|
||||
|
||||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
if !ok {
|
||||
return true
|
||||
}
|
||||
|
||||
// 随机选择一个属性(0-5,包含攻击、防御、特攻、特防、速度、命中)
|
||||
propIndex := int(e.Input.FightC.GetRand().Int31n(6))
|
||||
|
||||
opType := info.AbilityOpType.ADD
|
||||
if changeAmount < 0 {
|
||||
opType = info.AbilityOpType.SUB
|
||||
}
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果126:{0}回合内每回合自身攻击和速度提高{1}个等级
|
||||
// -----------------------------------------------------------
|
||||
type Effect126 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect126) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
|
||||
}
|
||||
|
||||
func (e *Effect126) Turn_Start(_, _ *action.SelectSkillAction) {
|
||||
changeAmount := int(e.Args()[1].IntPart())
|
||||
|
||||
// 攻击等级+1 (属性索引0)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 0, int8(changeAmount), info.AbilityOpType.ADD)
|
||||
|
||||
// 速度等级+1 (属性索引4)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, int8(changeAmount), info.AbilityOpType.ADD)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 初始化
|
||||
// -----------------------------------------------------------
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 124, &Effect124{})
|
||||
input.InitEffect(input.EffectType.Skill, 126, &Effect126{})
|
||||
}
|
||||
161
logic/service/fight/effect/effect_147_159.go
Normal file
161
logic/service/fight/effect/effect_147_159.go
Normal file
@@ -0,0 +1,161 @@
|
||||
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"
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果147:后出手时,{0}%概率使对方{1}
|
||||
// -----------------------------------------------------------
|
||||
type Effect147 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect147) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
// 后出手判定:我方速度 <= 对方速度
|
||||
if e.Ctx().Our.CurrentPet.Info.Prop[4] <= e.Ctx().Opp.CurrentPet.Info.Prop[4] {
|
||||
e.can = true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect147) Switch(in *input.Input, _ info.AttackValue, _ *info.BattlePetEntity) bool {
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
|
||||
chance := int(e.Args()[0].IntPart())
|
||||
|
||||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
if ok {
|
||||
// 使对方进入指定状态(Args[1]为状态类型)
|
||||
statusType := int(e.Args()[1].IntPart())
|
||||
statusEff := e.Ctx().Our.InitEffect(input.EffectType.Status, statusType)
|
||||
if statusEff != nil {
|
||||
statusEff.SetArgs(e.Ctx().Our, 2)
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEff)
|
||||
}
|
||||
}
|
||||
e.can = false
|
||||
return true
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果148:后出手时,{1}%改变对方{0}等级{2}
|
||||
// -----------------------------------------------------------
|
||||
type Effect148 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect148) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
// 后出手判定
|
||||
if e.Ctx().Our.CurrentPet.Info.Prop[4] <= e.Ctx().Opp.CurrentPet.Info.Prop[4] {
|
||||
e.can = true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect148) Switch(in *input.Input, _ info.AttackValue, _ *info.BattlePetEntity) bool {
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
|
||||
propIndex := int(e.Args()[0].IntPart())
|
||||
chance := int(e.Args()[1].IntPart())
|
||||
changeAmount := int(e.Args()[2].IntPart())
|
||||
|
||||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
if ok {
|
||||
opType := info.AbilityOpType.ADD
|
||||
if changeAmount < 0 {
|
||||
opType = info.AbilityOpType.SUB
|
||||
}
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType)
|
||||
}
|
||||
e.can = false
|
||||
return true
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果154:若对手{0},则对对方造成伤害的1/{1}恢复自身体力
|
||||
// -----------------------------------------------------------
|
||||
type Effect154 struct {
|
||||
node.EffectNode
|
||||
oppStatus info.EnumPetStatus
|
||||
}
|
||||
|
||||
func (e *Effect154) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.oppStatus = info.EnumPetStatus(e.Args()[0].IntPart())
|
||||
}
|
||||
|
||||
func (e *Effect154) Skill_Useed() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
|
||||
// 简化实现:直接使用状态类型判断(实际应用中可以通过其他方式检查对手状态)
|
||||
// 恢复自身体力:造成伤害的1/{1}
|
||||
denominator := int(e.Args()[1].IntPart())
|
||||
healAmount := e.Ctx().Our.SumDamage.Div(alpacadecimal.NewFromInt(int64(denominator)))
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果159:自身体力小于最大值的1/{0}时,{1}%概率令对方{2}
|
||||
// -----------------------------------------------------------
|
||||
type Effect159 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect159) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
|
||||
// 检查自身体力是否小于最大值的1/{0}
|
||||
maxHP := int64(e.Ctx().Our.CurrentPet.Info.MaxHp)
|
||||
currentHP := int64(e.Ctx().Our.CurrentPet.Info.Hp)
|
||||
|
||||
// 比较 currentHP * {0} < maxHP
|
||||
if currentHP*int64(e.Args()[0].IntPart()) < maxHP {
|
||||
// 满足条件:{1}%概率令对方{2}
|
||||
chance := int(e.Args()[1].IntPart())
|
||||
|
||||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
if ok {
|
||||
statusType := int(e.Args()[2].IntPart())
|
||||
statusEff := e.Ctx().Our.InitEffect(input.EffectType.Status, statusType)
|
||||
if statusEff != nil {
|
||||
statusEff.SetArgs(e.Ctx().Our, 2)
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEff)
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 初始化
|
||||
// -----------------------------------------------------------
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 147, &Effect147{})
|
||||
input.InitEffect(input.EffectType.Skill, 148, &Effect148{})
|
||||
input.InitEffect(input.EffectType.Skill, 154, &Effect154{})
|
||||
input.InitEffect(input.EffectType.Skill, 159, &Effect159{})
|
||||
}
|
||||
Reference in New Issue
Block a user