```
feat(fight): 更新概率判定函数注释并新增状态与属性操作类型 更新 PlayerCaptureContext.Roll 函数注释,明确返回值含义。 新增 PetStatus 枚举值 NULL,表示无效状态。 新增 AbilityOpType.COPY 操作类型,支持复制对手属性值。 ```
This commit is contained in:
41
logic/service/fight/effect/effect_112.go
Normal file
41
logic/service/fight/effect/effect_112.go
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
package effect
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/logic/service/fight/info"
|
||||||
|
"blazing/logic/service/fight/input"
|
||||||
|
"blazing/logic/service/fight/node"
|
||||||
|
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 牺牲全部体力造成对手250~300点伤害,造成致命伤害时,对手剩下1点体力
|
||||||
|
*/
|
||||||
|
type Effect112 struct {
|
||||||
|
node.EffectNode
|
||||||
|
can bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
|
||||||
|
input.InitEffect(input.EffectType.Skill, 59, &Effect112{})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 命中之后
|
||||||
|
func (e *Effect112) OnSkill() bool {
|
||||||
|
if !e.Hit() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
e.can = true
|
||||||
|
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||||
|
Type: info.DamageType.Fixed,
|
||||||
|
Damage: decimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)),
|
||||||
|
})
|
||||||
|
n := int64(e.Input.FightC.GetRand().Int31n(int32(50+1))) + 250
|
||||||
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||||
|
Type: info.DamageType.Fixed,
|
||||||
|
Damage: decimal.Min(decimal.NewFromInt(n), e.Ctx().Opp.CurrentPet.GetHP().Sub(decimal.NewFromInt(1))),
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
}
|
||||||
50
logic/service/fight/effect/effect_73.go
Normal file
50
logic/service/fight/effect/effect_73.go
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package effect
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/logic/service/fight/info"
|
||||||
|
"blazing/logic/service/fight/input"
|
||||||
|
"blazing/logic/service/fight/node"
|
||||||
|
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果先出手,则受攻击时反弹200%的伤害给对手,持续n回合
|
||||||
|
*/
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
t := &Effect73{
|
||||||
|
EffectNode: node.EffectNode{},
|
||||||
|
}
|
||||||
|
// t.Duration(-1) //设置成无限回合,到回合数就停止
|
||||||
|
input.InitEffect(input.EffectType.Skill, 73, t)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
type Effect73 struct {
|
||||||
|
node.EffectNode
|
||||||
|
}
|
||||||
|
|
||||||
|
// 默认添加回合
|
||||||
|
func (e *Effect73) SetArgs(t *input.Input, a ...int) {
|
||||||
|
|
||||||
|
e.EffectNode.SetArgs(t, a...)
|
||||||
|
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
|
||||||
|
|
||||||
|
}
|
||||||
|
func (e *Effect73) Skill_Use_ex() bool {
|
||||||
|
|
||||||
|
if !e.Hit() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if !e.Input.FightC.IsFirst(e.Ctx().Our.Player) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||||
|
Type: info.DamageType.Fixed,
|
||||||
|
Damage: e.Ctx().Opp.DamageZone.Damage.Div(decimal.NewFromInt(2)),
|
||||||
|
})
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
58
logic/service/fight/effect/effect_74.go
Normal file
58
logic/service/fight/effect/effect_74.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package effect
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/logic/service/fight/info"
|
||||||
|
"blazing/logic/service/fight/input"
|
||||||
|
"blazing/logic/service/fight/node"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10%中毒、10%烧伤、10%冻伤(剩下70%无效果)
|
||||||
|
*/
|
||||||
|
type Effect74 struct {
|
||||||
|
node.EffectNode
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
ret := &Effect74{}
|
||||||
|
|
||||||
|
input.InitEffect(input.EffectType.Skill, 74, ret)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 命中之后
|
||||||
|
func (e *Effect74) OnSkill() bool {
|
||||||
|
if !e.Hit() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
Status := info.PetStatus.NULL
|
||||||
|
|
||||||
|
// 生成0-99的随机数(共100种可能)
|
||||||
|
switch t := e.Input.FightC.GetRand().Int31n(100); {
|
||||||
|
case t < 10: // 0-9(10个数,占10%)
|
||||||
|
Status = info.PetStatus.Poisoned
|
||||||
|
case t < 20: // 10-19(10个数,占10%)
|
||||||
|
// 触发睡眠效果
|
||||||
|
Status = info.PetStatus.Burned
|
||||||
|
case t < 30: // 20-29(10个数,占10%)
|
||||||
|
// 触发害怕效果
|
||||||
|
Status = info.PetStatus.Frozen
|
||||||
|
default: // 30-99(70个数,占70%)
|
||||||
|
// 无效果
|
||||||
|
|
||||||
|
}
|
||||||
|
if Status == info.PetStatus.NULL {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 获取状态效果
|
||||||
|
eff := input.Geteffect(input.EffectType.Status, int(Status))
|
||||||
|
if eff == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
duration := int(e.Input.FightC.GetRand().Int31n(2)) // 默认随机 2~3 回合
|
||||||
|
duration++
|
||||||
|
eff.Duration(duration)
|
||||||
|
eff.SetArgs(e.Ctx().Our) //输入参数是对方
|
||||||
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||||||
|
return true
|
||||||
|
}
|
||||||
58
logic/service/fight/effect/effect_75.go
Normal file
58
logic/service/fight/effect/effect_75.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package effect
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/logic/service/fight/info"
|
||||||
|
"blazing/logic/service/fight/input"
|
||||||
|
"blazing/logic/service/fight/node"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10%麻痹、10%睡眠、10%害怕(剩下70%无效果)
|
||||||
|
*/
|
||||||
|
type Effect75 struct {
|
||||||
|
node.EffectNode
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
ret := &Effect75{}
|
||||||
|
|
||||||
|
input.InitEffect(input.EffectType.Skill, 75, ret)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 命中之后
|
||||||
|
func (e *Effect75) OnSkill() bool {
|
||||||
|
if !e.Hit() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
Status := info.PetStatus.NULL
|
||||||
|
|
||||||
|
// 生成0-99的随机数(共100种可能)
|
||||||
|
switch t := e.Input.FightC.GetRand().Int31n(100); {
|
||||||
|
case t < 10: // 0-9(10个数,占10%)
|
||||||
|
Status = info.PetStatus.Paralysis
|
||||||
|
case t < 20: // 10-19(10个数,占10%)
|
||||||
|
// 触发睡眠效果
|
||||||
|
Status = info.PetStatus.Sleep
|
||||||
|
case t < 30: // 20-29(10个数,占10%)
|
||||||
|
// 触发害怕效果
|
||||||
|
Status = info.PetStatus.Fear
|
||||||
|
default: // 30-99(70个数,占70%)
|
||||||
|
// 无效果
|
||||||
|
|
||||||
|
}
|
||||||
|
if Status == info.PetStatus.NULL {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 获取状态效果
|
||||||
|
eff := input.Geteffect(input.EffectType.Status, int(Status))
|
||||||
|
if eff == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
duration := int(e.Input.FightC.GetRand().Int31n(2)) // 默认随机 2~3 回合
|
||||||
|
duration++
|
||||||
|
eff.Duration(duration)
|
||||||
|
eff.SetArgs(e.Ctx().Our) //输入参数是对方
|
||||||
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||||||
|
return true
|
||||||
|
}
|
||||||
43
logic/service/fight/effect/effect_89.go
Normal file
43
logic/service/fight/effect/effect_89.go
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package effect
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/logic/service/fight/action"
|
||||||
|
"blazing/logic/service/fight/input"
|
||||||
|
"blazing/logic/service/fight/node"
|
||||||
|
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* n回合内,每次造成伤害的1/m会恢复自己的体力
|
||||||
|
*/
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
t := &Effect89{
|
||||||
|
EffectNode: node.EffectNode{},
|
||||||
|
}
|
||||||
|
// t.Duration(-1) //设置成无限回合,到回合数就停止
|
||||||
|
input.InitEffect(input.EffectType.Skill, 89, t)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
type Effect89 struct {
|
||||||
|
node.EffectNode
|
||||||
|
}
|
||||||
|
|
||||||
|
// 默认添加回合
|
||||||
|
func (e *Effect89) SetArgs(t *input.Input, a ...int) {
|
||||||
|
|
||||||
|
e.EffectNode.SetArgs(t, a...)
|
||||||
|
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
|
||||||
|
|
||||||
|
}
|
||||||
|
func (e *Effect89) Skill_Useed() bool {
|
||||||
|
if !e.Hit() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.DamageZone.Damage.Mul(decimal.NewFromInt(int64(e.Args()[1]))))
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
46
logic/service/fight/effect/effect_91.go
Normal file
46
logic/service/fight/effect/effect_91.go
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package effect
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/logic/service/fight/action"
|
||||||
|
"blazing/logic/service/fight/info"
|
||||||
|
"blazing/logic/service/fight/input"
|
||||||
|
"blazing/logic/service/fight/node"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* n回合内,对手的状态变化会同时作用在自己身上
|
||||||
|
*/
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
t := &Effect91{
|
||||||
|
EffectNode: node.EffectNode{},
|
||||||
|
}
|
||||||
|
// t.Duration(-1) //设置成无限回合,到回合数就停止
|
||||||
|
input.InitEffect(input.EffectType.Skill, 91, t)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
type Effect91 struct {
|
||||||
|
node.EffectNode
|
||||||
|
can bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// 默认添加回合
|
||||||
|
func (e *Effect91) SetArgs(t *input.Input, a ...int) {
|
||||||
|
|
||||||
|
e.EffectNode.SetArgs(t, a...)
|
||||||
|
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
|
||||||
|
|
||||||
|
}
|
||||||
|
func (e *Effect91) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
|
||||||
|
if !e.Hit() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, v := range e.Ctx().Opp.Prop {
|
||||||
|
|
||||||
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v, info.AbilityOpType.COPY)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ type PlayerCaptureContext struct {
|
|||||||
Guarantees map[int]int // 按分母分组的保底分子 map[denominator]numerator
|
Guarantees map[int]int // 按分母分组的保底分子 map[denominator]numerator
|
||||||
}
|
}
|
||||||
|
|
||||||
// Roll 通用概率判定(带共享保底)
|
// Roll 通用概率判定(带共享保底) 返回成功,基础,保底
|
||||||
func (c *PlayerCaptureContext) Roll(numerator, denominator int) (bool, float64, float64) {
|
func (c *PlayerCaptureContext) Roll(numerator, denominator int) (bool, float64, float64) {
|
||||||
if denominator <= 0 {
|
if denominator <= 0 {
|
||||||
return false, 0, 0
|
return false, 0, 0
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ type WeakenedS struct {
|
|||||||
|
|
||||||
// 定义战斗状态枚举
|
// 定义战斗状态枚举
|
||||||
var PetStatus = enum.New[struct {
|
var PetStatus = enum.New[struct {
|
||||||
|
NULL EnumPetStatus `enum:"-1"`
|
||||||
Paralysis EnumPetStatus `enum:"0"` // 麻痹
|
Paralysis EnumPetStatus `enum:"0"` // 麻痹
|
||||||
Poisoned EnumPetStatus `enum:"1"` // 中毒
|
Poisoned EnumPetStatus `enum:"1"` // 中毒
|
||||||
Burned EnumPetStatus `enum:"2"` // 烧伤
|
Burned EnumPetStatus `enum:"2"` // 烧伤
|
||||||
|
|||||||
@@ -308,6 +308,14 @@ func (our *Input) SetProp(in *Input, prop, level int8, ptype info.EnumAbilityOpT
|
|||||||
our.SetProp(our, prop, -1, info.AbilityOpType.RESET) //消除自身弱化
|
our.SetProp(our, prop, -1, info.AbilityOpType.RESET) //消除自身弱化
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
case info.AbilityOpType.COPY:
|
||||||
|
temp := our.Opp.AttackValue.Prop[prop]
|
||||||
|
if temp >= 0 {
|
||||||
|
our.SetProp(our, prop, temp, info.AbilityOpType.ADD)
|
||||||
|
} else {
|
||||||
|
our.SetProp(our, prop, -temp, info.AbilityOpType.SUB)
|
||||||
|
}
|
||||||
|
|
||||||
default: //增加减少重置
|
default: //增加减少重置
|
||||||
|
|
||||||
if abfunc(prop, level, ptype) {
|
if abfunc(prop, level, ptype) {
|
||||||
|
|||||||
Reference in New Issue
Block a user