fix(task): 修复任务奖励与宠物
This commit is contained in:
@@ -39,7 +39,6 @@ func (h Controller) AddTaskBuf(data *task.AddTaskBufInboundInfo, c *player.Playe
|
||||
// if data.Head.CMD != 2204 { //判断是每日任务
|
||||
// isdaliy = true
|
||||
// }
|
||||
|
||||
|
||||
c.Service.Task(data.TaskId, func(te *model.TaskEX) bool {
|
||||
te.Data = data.TaskList
|
||||
@@ -94,7 +93,7 @@ func (h Controller) Complete_Task(data *task.CompleteTaskInboundInfo, c *player.
|
||||
// log.Printf("任务86未知分支out_id=%d,默认奖励布布种子", data.OutState)
|
||||
}
|
||||
// 生成宠物(pet_dv=31,锁个体)
|
||||
r := c.GenPetInfo(petType, 31, -1, 0, 0, 5)
|
||||
r := c.GenPetInfo(petType, 31, -1, 0, 0, 50)
|
||||
result.CaptureTime = r.CatchTime
|
||||
result.PetTypeId = r.ID
|
||||
c.Service.PetAdd(*r)
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------
|
||||
@@ -70,7 +69,7 @@ func (e *Effect10) OnSkill(ctx input.Ctx) bool {
|
||||
// 持续回合
|
||||
|
||||
if duration == 0 {
|
||||
duration = int(rand.Int31n(2)) // 默认随机 1~3 回合
|
||||
duration = int(e.Input.FightC.GetRand().Int31n(2)) // 默认随机 1~3 回合
|
||||
duration++
|
||||
}
|
||||
|
||||
|
||||
56
logic/service/fight/effect/effect_117.go
Normal file
56
logic/service/fight/effect/effect_117.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
/**
|
||||
* n回合,若自己先手,则m%几率让对手害怕1到3回合
|
||||
*/
|
||||
|
||||
func init() {
|
||||
t := &Effect117{
|
||||
EffectNode: node.EffectNode{},
|
||||
}
|
||||
// t.Duration(-1) //设置成无限回合,到回合数就停止
|
||||
input.InitEffect(input.EffectType.Skill, 117, t)
|
||||
|
||||
}
|
||||
|
||||
type Effect117 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
// 默认添加回合
|
||||
func (e *Effect117) SetArgs(t *input.Input, a ...int) {
|
||||
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
|
||||
|
||||
}
|
||||
func (e *Effect117) OnSkill(ctx input.Ctx) bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
|
||||
if e.Input.FightC.IsFirst(e.Input.Player) {
|
||||
// 概率判定
|
||||
ok, _, _ := e.Input.Player.Roll(e.EffectNode.SideEffectArgs[1], 100)
|
||||
if !ok {
|
||||
return true
|
||||
}
|
||||
// 获取状态效果
|
||||
eff := input.Geteffect(input.EffectType.Status, int(info.PetStatus.Fear))
|
||||
if eff == nil {
|
||||
return true
|
||||
}
|
||||
duration := int(e.Input.FightC.GetRand().Int31n(2)) // 默认随机 1~3 回合
|
||||
duration++
|
||||
eff.Duration(duration)
|
||||
ctx.AddEffect(eff)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/brunoga/deep"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
@@ -28,10 +27,16 @@ func (e *Effect28) OnSkill(ctx input.Ctx) bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
eff := deep.MustCopy(ctx)
|
||||
eff.DamageZone.Type = info.DamageType.Fixed
|
||||
eff := input.Ctx{
|
||||
Input: e.Input,
|
||||
|
||||
SelectSkillAction: nil,
|
||||
DamageZone: &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: decimal.NewFromInt(int64(ctx.CurrentPet.Info.Hp)).Div(decimal.NewFromInt(int64(e.SideEffectArgs[0]))),
|
||||
},
|
||||
}
|
||||
|
||||
ctx.DamageZone.Damage = decimal.NewFromInt(int64(eff.CurrentPet.Info.Hp)).Div(decimal.NewFromInt(int64(e.SideEffectArgs[0])))
|
||||
ctx.Input.Damage(eff)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/brunoga/deep"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
@@ -28,9 +27,16 @@ func (e *Effect29) OnSkill(ctx input.Ctx) bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
eff := deep.MustCopy(ctx)
|
||||
eff.DamageZone.Type = info.DamageType.Fixed
|
||||
ctx.DamageZone.Damage = decimal.NewFromInt(int64(e.SideEffectArgs[0]))
|
||||
eff := input.Ctx{
|
||||
Input: e.Input,
|
||||
|
||||
SelectSkillAction: nil,
|
||||
DamageZone: &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: decimal.NewFromInt(int64(e.SideEffectArgs[0])),
|
||||
},
|
||||
}
|
||||
|
||||
ctx.Input.Damage(eff)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ type Effect31 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect31) Damage_Floor(ctx input.Ctx) bool {
|
||||
func (e *Effect31) Damage_Mul(ctx input.Ctx) bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/brunoga/deep"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
@@ -24,9 +23,9 @@ type Effect6 struct {
|
||||
}
|
||||
|
||||
func (e *Effect6) Skill_Useed(ctx input.Ctx) bool {
|
||||
eff := deep.MustCopy(ctx)
|
||||
ctx.DamageZone.Damage = eff.DamageZone.Damage.Div(decimal.NewFromInt(int64(e.SideEffectArgs[0])))
|
||||
e.Input.Damage(eff)
|
||||
//eff := deep.MustCopy(ctx)
|
||||
ctx.DamageZone.Damage = ctx.DamageZone.Damage.Div(decimal.NewFromInt(int64(e.SideEffectArgs[0])))
|
||||
e.Input.Damage(ctx)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -16,11 +16,9 @@ type Effect62 struct {
|
||||
|
||||
func init() {
|
||||
t := &Effect62{
|
||||
EffectNode: node.EffectNode{
|
||||
|
||||
},
|
||||
EffectNode: node.EffectNode{},
|
||||
}
|
||||
t.Owner(true)
|
||||
|
||||
input.InitEffect(input.EffectType.Skill, 62, t)
|
||||
|
||||
}
|
||||
|
||||
@@ -17,12 +17,8 @@ func init() {
|
||||
t := &Effect67{
|
||||
EffectNode: node.EffectNode{},
|
||||
}
|
||||
t.Owner(true)
|
||||
input.InitEffect(input.EffectType.Skill, 67, &Effect67{
|
||||
EffectNode: node.EffectNode{
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
input.InitEffect(input.EffectType.Skill, 67, t)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package input
|
||||
|
||||
import (
|
||||
element "blazing/common/data/Element"
|
||||
"blazing/common/data/xmlres"
|
||||
"blazing/common/utils"
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
@@ -68,10 +69,10 @@ func (u *Input) Heal(ac action.BattleActionI, value decimal.Decimal) {
|
||||
}
|
||||
func (u *Input) HealPP(value int) {
|
||||
|
||||
for i := 0; i < len(u.CurrentPet.Skills); i++ {
|
||||
for i := 0; i < len(u.CurrentPet.Info.SkillList); i++ {
|
||||
|
||||
u.CurrentPet.Skills[i].Info.PP += uint32(value)
|
||||
u.CurrentPet.Skills[i].Info.PP = utils.Min(u.SkillList[i].PP, uint32(u.CurrentPet.Skills[i].MaxPP))
|
||||
u.CurrentPet.Info.SkillList[i].PP += uint32(value)
|
||||
u.CurrentPet.Info.SkillList[i].PP = utils.Min(u.CurrentPet.Info.SkillList[i].PP, uint32(xmlres.SkillMap[int(u.CurrentPet.Info.SkillList[i].ID)].MaxPP))
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -38,15 +38,6 @@ func (e *EffectNode) GetInput() *input.Input {
|
||||
|
||||
}
|
||||
|
||||
func (e *EffectNode) Owner(t ...bool) bool {
|
||||
if len(t) > 0 {
|
||||
e.owner = t[0]
|
||||
}
|
||||
|
||||
return e.owner
|
||||
|
||||
}
|
||||
|
||||
func (e *EffectNode) Stack(t ...int) int {
|
||||
if len(t) > 0 {
|
||||
e.stacks = t[0]
|
||||
|
||||
Reference in New Issue
Block a user