feat(boss_fight): 完善宠物捕获和战斗奖励机制 - 在宠物捕获时记录当前地图ID作为CatchMap - 将经验值奖励改为通过道具系统发放,统一使用ItemAdd方法处理 - 调整EXP奖励的计算方式,移除原有S2C_GET_BOSS_MONSTER中的EXP字段 feat(arena): 优化竞技场对战奖励和EV分配 - 将竞技场胜利奖励的EV值
This commit is contained in:
@@ -180,6 +180,7 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
|
||||
|
||||
int(refPet.Lv),
|
||||
refPet.ShinyInfo, -1)
|
||||
monster.CatchMap = p.Info.MapID //设置当前地图
|
||||
if refPet.Ext != 0 {
|
||||
if grand.Meet(2, 1000) {
|
||||
monster.RandShiny()
|
||||
@@ -203,11 +204,13 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
|
||||
addlevel, poolevel := p.CanGetExp()
|
||||
addexp := gconv.Float32(addlevel * gconv.Float32(exp))
|
||||
poolexp := gconv.Float32(poolevel) * gconv.Float32((exp))
|
||||
items := &info.S2C_GET_BOSS_MONSTER{
|
||||
//EV: 45,
|
||||
EXP: uint32(poolexp),
|
||||
}
|
||||
p.Info.ExpPool += int64(poolexp + addexp)
|
||||
items := &info.S2C_GET_BOSS_MONSTER{}
|
||||
|
||||
p.ItemAdd(3, int64(poolexp+addexp))
|
||||
items.ItemList = append(items.ItemList, data.ItemInfo{
|
||||
ItemId: 3,
|
||||
ItemCnt: int64(poolexp),
|
||||
})
|
||||
p.AddPetExp(foi.Winpet, int64(addexp))
|
||||
if refPet.Item != 0 {
|
||||
count := int64(grand.Intn(2) + 1)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blazing/common/data"
|
||||
"blazing/common/socket/errorcode"
|
||||
"sync/atomic"
|
||||
|
||||
"blazing/logic/service/fight"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/pet"
|
||||
"blazing/logic/service/player"
|
||||
"blazing/logic/service/space"
|
||||
)
|
||||
@@ -39,7 +39,7 @@ func (h Controller) ArenaSetOwner(data *fight.ARENA_SET_OWENR, c *player.Player)
|
||||
// 后端到前端无数据内容 空包
|
||||
// 还是后端主动发送2503的包给双方前端后 等待前端加载完毕 主动发送2404包通知后端开始战斗
|
||||
// ArenaFightOwner 并不会通知对方是否接受挑战。只要有人挑战就直接进入对战
|
||||
func (h Controller) ArenaFightOwner(data *fight.ARENA_FIGHT_OWENR, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
func (h Controller) ArenaFightOwner(data1 *fight.ARENA_FIGHT_OWENR, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
|
||||
if !c.CanFight() {
|
||||
return nil, errorcode.ErrorCodes.ErrNoEligiblePokemon
|
||||
@@ -78,25 +78,36 @@ func (h Controller) ArenaFightOwner(data *fight.ARENA_FIGHT_OWENR, c *player.Pla
|
||||
|
||||
if foi.Reason == 0 { //正常获胜
|
||||
// addev := int64(int(1) * int(cool.Connected) * int(c.GetSpace().Owner.HostWins) * (int(c.GetSpace().User.Count()) / int(cool.Connected)))
|
||||
addev := int64(int(1) * int(c.GetSpace().Owner.HostWins) * (int(c.GetSpace().User.Count())))
|
||||
addev := int64(int(2) * int(c.GetSpace().Owner.HostWins) * (int(c.GetSpace().User.Count())))
|
||||
if foi.WinnerId == c.GetInfo().UserID {
|
||||
c.Info.MaxArenaWins += 1
|
||||
c.Info.EVPool += addev
|
||||
if addev != 0 {
|
||||
c.Info.EVPool += addev
|
||||
|
||||
c.SendPackCmd(8004, &info.S2C_GET_BOSS_MONSTER{ //发送EV
|
||||
ItemList: []data.ItemInfo{data.ItemInfo{
|
||||
ItemId: 9,
|
||||
ItemCnt: int64(addev),
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
||||
c.SendPackCmd(50001, &pet.S2C_50001{
|
||||
UseEV: int32(addev),
|
||||
})
|
||||
} else {
|
||||
oper := c.GetSpace().Owner.ARENA_Player
|
||||
if oper != nil {
|
||||
if oper.GetInfo() != nil {
|
||||
c.GetSpace().Owner.ARENA_Player.GetInfo().MaxArenaWins += 1
|
||||
if addev != 0 {
|
||||
c.GetSpace().Owner.ARENA_Player.GetInfo().EVPool += addev
|
||||
|
||||
c.GetSpace().Owner.ARENA_Player.GetInfo().EVPool += addev
|
||||
c.GetSpace().Owner.ARENA_Player.SendPackCmd(8004, &info.S2C_GET_BOSS_MONSTER{ //发送EV
|
||||
ItemList: []data.ItemInfo{data.ItemInfo{
|
||||
ItemId: 9,
|
||||
ItemCnt: int64(addev),
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
||||
c.GetSpace().Owner.ARENA_Player.SendPackCmd(50001, &pet.S2C_50001{
|
||||
UseEV: int32(addev),
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package controller
|
||||
|
||||
import (
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/logic/service/fight"
|
||||
"blazing/logic/service/pet"
|
||||
"blazing/logic/service/player"
|
||||
|
||||
@@ -12,7 +13,7 @@ import (
|
||||
// data: 包含宠物捕获时间和EV分配数据的输入信息
|
||||
// c: 当前玩家对象
|
||||
// 返回: 分配结果和错误码
|
||||
func (h Controller) PetEVDiy(data *pet.PetEV, c *player.Player) (result *pet.S2C_50001, err errorcode.ErrorCode) {
|
||||
func (h Controller) PetEVDiy(data *pet.PetEV, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
_, currentPet, found := c.FindPet(data.CacthTime)
|
||||
if !found {
|
||||
return nil, errorcode.ErrorCodes.Err10401
|
||||
@@ -45,7 +46,7 @@ func (h Controller) PetEVDiy(data *pet.PetEV, c *player.Player) (result *pet.S2C
|
||||
currentPet.CalculatePetPane(false)
|
||||
c.Info.EVPool -= int64(usedEV)
|
||||
|
||||
result = &pet.S2C_50001{}
|
||||
result.UseEV = -int32(usedEV)
|
||||
// result = &pet.S2C_50001{}
|
||||
// result.UseEV = -int32(usedEV)
|
||||
return result, 0
|
||||
}
|
||||
|
||||
@@ -63,5 +63,6 @@ func (h Controller) GetPlayerExp(data *item.ExpTotalRemainInboundInfo, player *p
|
||||
return &item.ExpTotalRemainOutboundInfo{
|
||||
|
||||
TotalExp: uint32(player.Info.ExpPool),
|
||||
TotalEv: uint32(player.Info.EVPool),
|
||||
}, 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user