Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
3ea863dc2f
|
|
@ -72,10 +72,7 @@ end
|
|||
function BuffManager:AddBuff(target, buff)
|
||||
buff.target = target
|
||||
self.buffQueue:Enqueue(buff)
|
||||
if not buff.exCtrlTime then
|
||||
buff.exCtrlTime = 0
|
||||
end
|
||||
buff.frameDuration = floor(buff.duration * (1 + buff.exCtrlTime) * BattleLogic.GameFrameRate)
|
||||
buff.frameDuration = floor(buff.duration * BattleLogic.GameFrameRate)
|
||||
--if buff.isBuff then --TODO:增益buff持续时间加成
|
||||
-- local buffBocus = buff.caster:GetRoleData(RoleDataName.BuffBocus)
|
||||
-- buff.frameDuration = floor(buff.duration * (1 + buffBocus + buff.exCtrlTime) * BattleLogic.GameFrameRate)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ local function casterBulletEffect(caster, target, interval)
|
|||
end
|
||||
end
|
||||
|
||||
local function calBuffHit(caster, target, baseRandom)
|
||||
local hit = (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
return BattleUtil.ErrorCorrection(hit * baseRandom)
|
||||
end
|
||||
|
||||
--效果表
|
||||
local effectList = {
|
||||
--造成[a]%的[b]伤害
|
||||
|
|
@ -64,7 +69,7 @@ local effectList = {
|
|||
--[a]%概率[b],持续[c]秒
|
||||
--a[float],b[控制状态],c[float]
|
||||
[3] = function(caster, target, args, interval)
|
||||
local f1 = args[1] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f1 = calBuffHit(caster, target, args[1])
|
||||
local cb1 = args[2]
|
||||
local f2 = args[3]
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
|
|
@ -136,7 +141,7 @@ local effectList = {
|
|||
--a[float],b[float],c[改变类型]
|
||||
[8] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local f2 = args[2] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f2 = calBuffHit(caster, target, args[2])
|
||||
local ct = args[3]
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.RandomAction(f2, function ()
|
||||
|
|
@ -208,7 +213,7 @@ local effectList = {
|
|||
[14] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f2 = calBuffHit(caster, target, args[3])
|
||||
local rid = args[4]
|
||||
local f3 = args[5]
|
||||
local i1 = args[6]
|
||||
|
|
@ -273,7 +278,7 @@ local effectList = {
|
|||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local i1 = args[3]
|
||||
local f2 = args[4] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f2 = calBuffHit(caster, target, args[4])
|
||||
casterBulletEffect(caster, target, interval)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local dmg = floor(caster:GetRoleData(propertyList[dt]) * f1)
|
||||
|
|
@ -353,7 +358,7 @@ local effectList = {
|
|||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local dot = args[3]
|
||||
local f2 = args[4] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f2 = calBuffHit(caster, target, args[4])
|
||||
local ct = args[5]
|
||||
local f3 = args[6]
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
|
|
@ -507,7 +512,7 @@ local effectList = {
|
|||
--[a]%概率[b],持续[c]秒
|
||||
--a[float],b[免疫buff],c[int]
|
||||
[31] = function(caster, target, args, interval)
|
||||
local f1 = args[1] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f1 = calBuffHit(caster, target, args[1])
|
||||
local ib1 = args[2]
|
||||
local f2 = args[3]
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
|
|
@ -518,7 +523,7 @@ local effectList = {
|
|||
--a[float],b[float],c[改变类型]
|
||||
[32] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local f2 = args[2] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f2 = calBuffHit(caster, target, args[2])
|
||||
local ct = args[3]
|
||||
local d = args[4]
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
|
|
@ -539,7 +544,7 @@ local effectList = {
|
|||
[33] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f2 = calBuffHit(caster, target, args[3])
|
||||
local rid = args[4]
|
||||
local f3 = args[5]
|
||||
local i1 = args[6]
|
||||
|
|
@ -667,9 +672,9 @@ local effectList = {
|
|||
[41] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f2 = calBuffHit(caster, target, args[3])
|
||||
local f3 = args[4]
|
||||
local f4 = args[5] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f4 = calBuffHit(caster, target, args[5])
|
||||
casterBulletEffect(caster, target, interval)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.RandomAction(f2, function ()
|
||||
|
|
@ -686,7 +691,7 @@ local effectList = {
|
|||
--进入虚弱状态,有[a]%的概率受到额外[b]%的伤害,状态持续[c]秒
|
||||
--a[folat],b[float],c[int]
|
||||
[42] = function(caster, target, args, interval)
|
||||
local f1 = args[1] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
|
||||
local f1 = calBuffHit(caster, target, args[1])
|
||||
local f2 = args[2]
|
||||
local f3 = args[3]
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@ RoleData = {}
|
|||
RoleData.__index = RoleData
|
||||
local max = math.max
|
||||
local floor = math.floor
|
||||
local function isFactor(name)
|
||||
return name > 7
|
||||
end
|
||||
|
||||
function RoleData.New()
|
||||
local instance = {role=0, data={0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0},
|
||||
orginData={0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}}
|
||||
|
|
@ -12,21 +16,17 @@ end
|
|||
function RoleData:Init(role, data)
|
||||
self.role = role
|
||||
for i=1, #data do
|
||||
self.data[i] = floor(data[i] * 100000 + 0.5) / 100000 --进行精度处理,避免前后端计算不一致
|
||||
self.orginData[i] = floor(data[i] * 100000 + 0.5) / 100000 --进行精度处理,避免前后端计算不一致
|
||||
self.data[i] = BattleUtil.ErrorCorrection(data[i])
|
||||
self.orginData[i] = BattleUtil.ErrorCorrection(data[i])
|
||||
end
|
||||
end
|
||||
|
||||
function RoleData:GetData(name)
|
||||
if self.data[name] then
|
||||
return self.data[name]
|
||||
end
|
||||
return self.data[name]
|
||||
end
|
||||
|
||||
function RoleData:GetOrginData(name)
|
||||
if self.orginData[name] then
|
||||
return self.orginData[name]
|
||||
end
|
||||
return self.orginData[name]
|
||||
end
|
||||
|
||||
function RoleData:SetValue(name, value)
|
||||
|
|
@ -55,7 +55,13 @@ end
|
|||
|
||||
function RoleData:AddPencentValue(name, pencent)
|
||||
if self.data[name] then
|
||||
return self:AddValue(name, self.orginData[name] * pencent)
|
||||
local delta
|
||||
if isFactor(name) then
|
||||
delta = BattleUtil.ErrorCorrection(self.orginData[name] * pencent)
|
||||
else
|
||||
delta = floor(self.orginData[name] * pencent)
|
||||
end
|
||||
return self:AddValue(name, delta)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
|
@ -84,7 +90,13 @@ end
|
|||
|
||||
function RoleData:SubPencentValue(name, pencent)
|
||||
if self.data[name] then
|
||||
return self:SubValue(name, self.data[name] * pencent)
|
||||
local delta
|
||||
if isFactor(name) then
|
||||
delta = BattleUtil.ErrorCorrection(self.orginData[name] * pencent)
|
||||
else
|
||||
delta = floor(self.orginData[name] * pencent)
|
||||
end
|
||||
return self:SubValue(name, delta)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ function Skill:Cast()
|
|||
BattleLogic.SetAggro(self.owner)
|
||||
if not self.isTeamSkill then
|
||||
local time = max(8-self.owner:GetRoleData(RoleDataName.Speed)/(8*(self.owner:GetRoleData(RoleDataName.Level)+10)), 1.5)
|
||||
time = BattleUtil.ErrorCorrection(time)
|
||||
if self.owner.superSkill == self then
|
||||
self.sp = 0
|
||||
self.spPass = floor(self.cd * BattleLogic.GameFrameRate)
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ function BattleLogic.GetSkillUsable(camp)
|
|||
end
|
||||
|
||||
function BattleLogic.WaitForTrigger(delayTime, action)
|
||||
delayTime = floor(delayTime * 100000 + 0.5) / 100000 --进行精度处理,避免前后端计算不一致
|
||||
delayTime = BattleUtil.ErrorCorrection(delayTime)
|
||||
local delayFrame = floor(delayTime * BattleLogic.GameFrameRate + 0.5)
|
||||
if delayFrame == 0 then --0延迟的回调直接调用
|
||||
action()
|
||||
|
|
@ -537,6 +537,15 @@ function BattleLogic.RecordRoleProperty(uid, camp, name, value, delta)
|
|||
table.insert(record, string.format("frame:%d, uid:%d, camp:%d, name:%s, value:%d, delta:%d", curFrame, uid, camp, name, value, delta))
|
||||
end
|
||||
|
||||
--Record专用
|
||||
function BattleLogic.RecordDamage(args)
|
||||
local str = ""
|
||||
for i=1, #args do
|
||||
str = str..tostring(args[i]) .. (i == #args and "" or "#")
|
||||
end
|
||||
table.insert(record, string.format("frame:%d, damageArgs:%s", curFrame, str))
|
||||
end
|
||||
|
||||
--Record专用
|
||||
function BattleLogic.RecordEffect(caster, target, type, args, interval)
|
||||
local cUid = tostring(caster.uid) or "cTeam"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,21 @@ local function clamp(v, minValue, maxValue)
|
|||
return v
|
||||
end
|
||||
|
||||
function BattleUtil.ErrorCorrection(f) --进行精度处理,避免前后端计算不一致
|
||||
return floor(f * 100000 + 0.5) / 100000
|
||||
end
|
||||
|
||||
function BattleUtil.FP_Mul(...)
|
||||
local f = 1
|
||||
for i, v in ipairs{...} do
|
||||
f = floor(f * v * 100000 + 0.5) / 100000
|
||||
end
|
||||
if BattleLogic.IsOpenBattleRecord then
|
||||
BattleLogic.RecordDamage({...})
|
||||
end
|
||||
return f
|
||||
end
|
||||
|
||||
function BattleUtil.ChooseTarget(role, chooseId)
|
||||
local chooseType = floor(chooseId / 10000) % 10
|
||||
local chooseWeight = floor(chooseId / 100) % 10
|
||||
|
|
@ -221,12 +236,11 @@ function BattleUtil.CalDamage(atkRole, defRole, damageType, baseFactor, ignoreDe
|
|||
--加入被动效果
|
||||
local critFunc = function(critEx) critDamageFactor = critEx end
|
||||
atkRole.Event:DispatchEvent(BattleEventName.PassiveCriting, critFunc)
|
||||
baseDamage = max(attack * critDamageFactor - 0.5 * defence * ignoreDef, 0)
|
||||
baseDamage = max(BattleUtil.FP_Mul(attack, critDamageFactor) - BattleUtil.FP_Mul(0.5, defence, ignoreDef), 0)
|
||||
else
|
||||
baseDamage = max(attack - 0.5 * defence * ignoreDef, 0)
|
||||
baseDamage = max(attack - BattleUtil.FP_Mul(0.5, defence, ignoreDef), 0)
|
||||
end
|
||||
--伤害 =(基础伤害*(1+己伤害加成-目标伤害减免)*(1+己方属性伤害加成-目标属性伤害减免),10%*己攻)
|
||||
local exFactor = 1 + atkRole:GetRoleData(RoleDataName.DamageBocusFactor) - defRole:GetRoleData(RoleDataName.DamageReduceFactor)
|
||||
|
||||
local elementDamageReduceFactor = RoleDataName.FireDamageReduceFactor
|
||||
if atkRole.element == 1 then
|
||||
elementDamageReduceFactor = RoleDataName.FireDamageReduceFactor
|
||||
|
|
@ -241,9 +255,11 @@ function BattleUtil.CalDamage(atkRole, defRole, damageType, baseFactor, ignoreDe
|
|||
elseif atkRole.element == 6 then
|
||||
elementDamageReduceFactor = RoleDataName.DarkDamageReduceFactor
|
||||
end
|
||||
exFactor = exFactor * (1 + atkRole:GetRoleData(RoleDataName.ElementDamageBocusFactor) - defRole:GetRoleData(elementDamageReduceFactor))
|
||||
|
||||
baseDamage = baseDamage * baseFactor * exFactor
|
||||
--伤害 =(基础伤害*(1+己伤害加成-目标伤害减免)*(1+己方属性伤害加成-目标属性伤害减免),10%*己攻)
|
||||
baseDamage = BattleUtil.FP_Mul(baseDamage, baseFactor,
|
||||
1 + atkRole:GetRoleData(RoleDataName.DamageBocusFactor) - defRole:GetRoleData(RoleDataName.DamageReduceFactor),
|
||||
(1 + atkRole:GetRoleData(RoleDataName.ElementDamageBocusFactor) - defRole:GetRoleData(elementDamageReduceFactor)))
|
||||
baseDamage = floor(max(baseDamage, 0.1 * attack))
|
||||
|
||||
local func
|
||||
|
|
@ -275,7 +291,7 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor)
|
|||
|
||||
local factor = castRole.isTeam and 1 or castRole:GetRoleData(RoleDataName.TreatFacter) --释放者为team则不计算治疗加成属性
|
||||
local factor2 = targetRole:GetRoleData(RoleDataName.CureFacter)
|
||||
local baseTreat = floor(value * baseFactor * factor * factor2 + 0.5)
|
||||
local baseTreat = floor(BattleUtil.FP_Mul(value, baseFactor, factor, factor2) + 0.5)
|
||||
|
||||
--加入被动效果
|
||||
local treatingFunc = function(exFactor) baseTreat = floor(baseTreat * (exFactor + 1) + 0.5) end
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ function RoleLogic:Init(uid, data)
|
|||
self.skill = skillPool:Get()
|
||||
self.skill:Init(self, data.skill, false)
|
||||
self.skill.sp = 0
|
||||
local time = max(6-self:GetRoleData(RoleDataName.Speed)/(8*(self:GetRoleData(RoleDataName.Level)+10)), 1.5)
|
||||
self.skill.spPass = floor( time * BattleLogic.GameFrameRate)
|
||||
local time = max(8-self:GetRoleData(RoleDataName.Speed)/(8*(self:GetRoleData(RoleDataName.Level)+10)), 1.5)
|
||||
self.skill.spPass = floor( BattleUtil.ErrorCorrection(time) * BattleLogic.GameFrameRate)
|
||||
end
|
||||
if data.superSkill and #data.superSkill > 0 then
|
||||
self.superSkill = skillPool:Get()
|
||||
|
|
@ -235,7 +235,7 @@ function RoleLogic:GetRoleData(property)
|
|||
for i=1, self.proTranList.size do
|
||||
item = self.proTranList.buffer[i]
|
||||
if item.proName == property then
|
||||
tarPro = tarPro + self.data:GetData(item.tranProName) * item.tranFactor
|
||||
tarPro = tarPro + BattleUtil.ErrorCorrection(self.data:GetData(item.tranProName) * item.tranFactor)
|
||||
end
|
||||
end
|
||||
return tarPro
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="SevenDaysScore")
|
||||
public class SSevenDaysScore implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int taskValue;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
public static Map<Integer,Map<Integer,SSevenDaysScore>> SSevenDaysScoreByActivityIdAndScoreMap ;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SSevenDaysScore> config = STableManager.getConfig(SSevenDaysScore.class);
|
||||
Map<Integer,Map<Integer,SSevenDaysScore>> SSevenDaysScoreByActivityIdAndScoreMapTmp= new HashMap<>();
|
||||
for(SSevenDaysScore sSevenDaysScore:config.values()){
|
||||
int activityId = sSevenDaysScore.getActivityId();
|
||||
int taskValue = sSevenDaysScore.getTaskValue();
|
||||
if(!SSevenDaysScoreByActivityIdAndScoreMapTmp.containsKey(activityId)){
|
||||
SSevenDaysScoreByActivityIdAndScoreMapTmp.put(activityId,new HashMap<>());
|
||||
}
|
||||
SSevenDaysScoreByActivityIdAndScoreMapTmp.get(activityId).put(taskValue,sSevenDaysScore);
|
||||
}
|
||||
SSevenDaysScoreByActivityIdAndScoreMap = SSevenDaysScoreByActivityIdAndScoreMapTmp;
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int getTaskValue() {
|
||||
return taskValue;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.config;
|
|||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -30,6 +31,7 @@ public class STreasureTaskConfig implements BaseConfig {
|
|||
public static Map<Integer, List<STreasureTaskConfig>> sTreasureTaskConfigListByActivityMap;
|
||||
public static Map<Integer, List<STreasureTaskConfig>> sTreasureTaskConfigListByTypeMap;
|
||||
public static Map<Integer, STreasureTaskConfig> sTreasureTaskConfigMap;
|
||||
public static Map<Integer, STreasureTaskConfig> sTreasureSevenTaskConfigByActivityMap;
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -37,6 +39,7 @@ public class STreasureTaskConfig implements BaseConfig {
|
|||
Map<Integer, STreasureTaskConfig> config = STableManager.getConfig(STreasureTaskConfig.class);
|
||||
Map<Integer, List<STreasureTaskConfig>> treasureTaskConfigByActivityMap = new HashMap<>();
|
||||
Map<Integer, List<STreasureTaskConfig>> sTreasureTaskConfigListByTypeMapTmp = new HashMap<>();
|
||||
Map<Integer, STreasureTaskConfig> sTreasureSevenTaskConfigByActivityMapTmp = new HashMap<>();
|
||||
for(STreasureTaskConfig sTreasureTaskConfig : config.values()){
|
||||
int activityId = sTreasureTaskConfig.getActivityId();
|
||||
if(!treasureTaskConfigByActivityMap.containsKey(activityId)){
|
||||
|
|
@ -47,10 +50,14 @@ public class STreasureTaskConfig implements BaseConfig {
|
|||
}
|
||||
treasureTaskConfigByActivityMap.get(activityId).add(sTreasureTaskConfig);
|
||||
sTreasureTaskConfigListByTypeMapTmp.get(sTreasureTaskConfig.getTaskType()).add(sTreasureTaskConfig);
|
||||
if(sTreasureTaskConfig.getTaskType() == MissionType.SENVER_HAPPY.getMissionTypeValue()){
|
||||
|
||||
}
|
||||
}
|
||||
sTreasureTaskConfigListByActivityMap = treasureTaskConfigByActivityMap;
|
||||
sTreasureTaskConfigListByTypeMap = sTreasureTaskConfigListByTypeMapTmp;
|
||||
sTreasureTaskConfigMap = config;
|
||||
sTreasureSevenTaskConfigByActivityMap=sTreasureSevenTaskConfigByActivityMapTmp;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ public interface BIReason {
|
|||
int MONTH_CARD_REWARD = 38;
|
||||
int BLESS_REWARD = 39;
|
||||
|
||||
int SEVEN_SCORE_REWARD = 40;
|
||||
|
||||
//道具消耗原因 1000开头
|
||||
int ADVENTURE_UPLEVEL_CONSUME = 1000; //秘境升级
|
||||
int SECRETBOX_CONSUME = 1001; //秘盒抽卡
|
||||
|
|
|
|||
|
|
@ -189,8 +189,10 @@ public class MapLogic {
|
|||
return;
|
||||
}
|
||||
MapInfoProto.MapEnterResponse.Builder mapEnterResponse = MapInfoProto.MapEnterResponse.newBuilder();
|
||||
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId());
|
||||
mapEnterResponse.setCurXY(CellUtil.xy2Pos(sChallengeMapConfig.getPosition()[0],sChallengeMapConfig.getPosition()[1]));
|
||||
|
||||
if(type ==4){
|
||||
mapManager.updateEndlessMapId(mapId);
|
||||
List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
for (int i = 0; i <teamPosForHero.size() ; i++) {
|
||||
String endlessHeroId = teamPosForHero.get(i).getHeroId();
|
||||
|
|
@ -198,8 +200,13 @@ public class MapLogic {
|
|||
mapManager.addEndlessHero(teamPosForHero.get(i).getHeroId(),maxHp);
|
||||
}
|
||||
if(mapManager.getEndlessMapInfo().getCurCell()!=0){
|
||||
mapManager.setCurXY(mapManager.getEndlessMapInfo().getCurCell());
|
||||
if(mapManager.getEndlessMapInfo().getCurMapId()==mapId) {
|
||||
mapEnterResponse.setCurXY(mapManager.getEndlessMapInfo().getCurCell());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mapManager.updateEndlessMapId(mapId);
|
||||
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
|
||||
for(Map.Entry<Integer,Map<Integer,String>> entry :endlessMapInfo.getMapSign().entrySet()){
|
||||
int curMapId = entry.getKey();
|
||||
|
|
@ -241,14 +248,9 @@ public class MapLogic {
|
|||
}
|
||||
mapEnterResponse.addAllBuf(towerBuffs);
|
||||
}
|
||||
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId());
|
||||
mapEnterResponse.setDieCount(mapManager.getDieCount());
|
||||
mapEnterResponse.addAllMapList(cells);
|
||||
if(type==4&&mapManager.getEndlessMapInfo().getCurCell()!=0){
|
||||
mapEnterResponse.setCurXY(mapManager.getEndlessMapInfo().getCurCell());
|
||||
}else{
|
||||
mapEnterResponse.setCurXY(CellUtil.xy2Pos(sChallengeMapConfig.getPosition()[0],sChallengeMapConfig.getPosition()[1]));
|
||||
}
|
||||
|
||||
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
|
||||
if (mapManager.getTemporaryItems() != null) {
|
||||
mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
|
||||
|
|
@ -463,7 +465,7 @@ public class MapLogic {
|
|||
|
||||
|
||||
public void updateMap(ISession session, int curXY, int triggerXY, List<Integer> cells, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
// LOGGER.info("updateMap() curXY=>{},triggerXY=>{}", curXY, triggerXY);
|
||||
LOGGER.info("updateMap() curXY=>{},triggerXY=>{}", curXY, triggerXY);
|
||||
if (updateMapByOnlyConsumeActionPower(session, curXY, triggerXY, cells, messageType)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -559,6 +561,11 @@ public class MapLogic {
|
|||
|
||||
// LOGGER.info("updateMap() uid=>{} mapId =>{} eventId=>{}", uid, mapManager.getCurMapId(), cell.getEventId());
|
||||
mapManager.updateFoodBufferByStep(cells.size());
|
||||
int lastXY = cells.get(0);
|
||||
if(cells.size() >2){
|
||||
lastXY = cells.get(cells.size()-2);
|
||||
}
|
||||
mapManager.setLastXY(lastXY);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse.build(), true);
|
||||
}
|
||||
|
||||
|
|
@ -1141,6 +1148,8 @@ public class MapLogic {
|
|||
mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
|
||||
}
|
||||
if (resultCode == 0) {
|
||||
//无尽副本复活消耗
|
||||
reviveConsumeExecution(user);
|
||||
// 失败需要等待n秒后复活所有英雄
|
||||
int dieCount = user.getMapManager().getDieCount();
|
||||
dieCount++;
|
||||
|
|
@ -1171,7 +1180,9 @@ public class MapLogic {
|
|||
.setEnventDrop(dropBuilder)
|
||||
.addAllRemainHpList(remainHp)
|
||||
.setEssenceValue(mapManager.getEssenceValue())
|
||||
.setLastXY(mapManager.getLastXY())
|
||||
.build();
|
||||
mapManager.setCurXY(mapManager.getLastXY());
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse, true);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1353,20 +1364,8 @@ public class MapLogic {
|
|||
}
|
||||
mapManager.setLastFightResult(resultCode);
|
||||
if (resultCode == 0) {
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
|
||||
mapManager.updateEndlessFightCount(mapManager.getEndlessMapInfo().getFightCount()+1);
|
||||
//消耗行动力
|
||||
int [][] cost = new int[1][];
|
||||
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
|
||||
int costNum = SEndlessMapConfig.sEndlessMapConfigMap.get(mapManager.getCurMapId()).getDeathCost();
|
||||
mapManager.updateEndlessConsumeExecution(mapManager.getEndlessMapInfo().getConsumeExecution()+costNum);
|
||||
int [] cost1 = new int[]{costId,costNum};
|
||||
cost[0] = cost1;
|
||||
if(ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1)) {
|
||||
costNum = user.getItemManager().getItem(costId).getItemNum();
|
||||
ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
|
||||
}
|
||||
}
|
||||
//无尽副本复活消耗
|
||||
reviveConsumeExecution(user);
|
||||
// 失败需要等待n秒后复活所有英雄
|
||||
int dieCount = user.getMapManager().getDieCount();
|
||||
dieCount++;
|
||||
|
|
@ -1396,6 +1395,8 @@ public class MapLogic {
|
|||
fightEndResponse.setResult(resultCode);
|
||||
fightEndResponse.setEnventDrop(dropBuilder);
|
||||
fightEndResponse.addAllRemainHpList(remainHp);
|
||||
fightEndResponse.setLastXY(mapManager.getLastXY());
|
||||
mapManager.setCurXY(mapManager.getLastXY());
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==2){
|
||||
fightEndResponse.setLastTowerTime((int)(mapManager.getCurrTowerTime()/1000));
|
||||
}
|
||||
|
|
@ -2842,7 +2843,7 @@ public class MapLogic {
|
|||
continue;
|
||||
}
|
||||
if(calHp!=entry.getValue().getMaxHp()){
|
||||
int tempHp = calHp*entry.getValue().getCurHp()/entry.getValue().getMaxHp();
|
||||
int tempHp = (int)(entry.getValue().getCurHp()/entry.getValue().getMaxHp()*1.0F*calHp);
|
||||
endlessHeroInfo.put(entry.getKey(),new EndlessHero(calHp,tempHp));
|
||||
calHp = tempHp;
|
||||
}else{
|
||||
|
|
@ -2975,4 +2976,30 @@ public class MapLogic {
|
|||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无尽副本复活消耗行动力
|
||||
* @param user
|
||||
* @throws Exception
|
||||
*/
|
||||
private void reviveConsumeExecution(User user) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()!=4){
|
||||
return;
|
||||
}
|
||||
mapManager.updateEndlessFightCount(mapManager.getEndlessMapInfo().getFightCount()+1);
|
||||
//消耗行动力
|
||||
int [][] cost = new int[1][];
|
||||
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
|
||||
int costNum = SEndlessMapConfig.sEndlessMapConfigMap.get(mapManager.getCurMapId()).getDeathCost();
|
||||
mapManager.updateEndlessConsumeExecution(mapManager.getEndlessMapInfo().getConsumeExecution()+costNum);
|
||||
int [] cost1 = new int[]{costId,costNum};
|
||||
cost[0] = cost1;
|
||||
if(!ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1)) {
|
||||
costNum = user.getItemManager().getItem(costId).getItemNum();
|
||||
cost1[1]= costNum;
|
||||
cost[0] = cost1;
|
||||
ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ public class MapManager extends MongoBase {
|
|||
//无尽副本信息
|
||||
private EndlessMapInfo endlessMapInfo;
|
||||
|
||||
private int lastXY; // 上一步坐标点
|
||||
|
||||
public MapManager() {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
|
@ -734,7 +736,15 @@ public class MapManager extends MongoBase {
|
|||
public void updateEndlessConsumeExecution(int count){
|
||||
endlessMapInfo.setConsumeExecution(count);
|
||||
updateString("endlessMapInfo.consumeExecution",endlessMapInfo.getConsumeExecution());
|
||||
}
|
||||
|
||||
public int getLastXY() {
|
||||
return lastXY;
|
||||
}
|
||||
|
||||
public void setLastXY(int lastXY) {
|
||||
updateString("lastXY",lastXY);
|
||||
this.lastXY = lastXY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,13 @@ public class FinishOptionsDifficultMapProcessor implements BaseMissionProcesor{
|
|||
if(sChallengeConfig.getDifficultType()!=sAccomplishmentConfig.getValues()[1][0]){
|
||||
return GlobalsDef.MAP_MISSION_RETURN;
|
||||
}
|
||||
int[] value = sAccomplishmentConfig.getValues()[0];
|
||||
int[][] value = sAccomplishmentConfig.getValues();
|
||||
missionValue = 0-missionValue;
|
||||
for(int i = 0 ; i <value.length;i++){
|
||||
if(eventId==value[i]){
|
||||
missionValue = missionValue | (2<<i);
|
||||
for(int i = 0 ; i <value.length-1;i++){
|
||||
for(int j =0;j<value[i].length;j++){
|
||||
if(eventId==value[i][j]){
|
||||
missionValue = missionValue | (2<<i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(missionValue+2>>(value.length+1)==1){
|
||||
|
|
|
|||
|
|
@ -13,18 +13,21 @@ public class KillMonsterAccProcessor implements BaseMissionProcesor{
|
|||
int[][] configValues = sAccomplishmentConfig.getValues();
|
||||
MapManager mapManager = user.getMapManager();
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||
if(sChallengeConfig.getDifficultType()!=configValues[0][0]){
|
||||
return GlobalsDef.MAP_MISSION_RETURN;
|
||||
}
|
||||
if(missionValue==configValues[1][0]){
|
||||
if(configValues[0][0]!=0 && sChallengeConfig.getDifficultType()!=configValues[0][0]){
|
||||
return GlobalsDef.MAP_MISSION_RETURN;
|
||||
}
|
||||
if(configValues[0].length<2){
|
||||
return GlobalsDef.MAP_MISSION_RETURN;
|
||||
}
|
||||
for(int i = 1 ; i <configValues.length;i++){
|
||||
if(missionValue==configValues[1][0]){
|
||||
missionValue = -1;
|
||||
}
|
||||
if(missionValue==-1){
|
||||
return missionValue;
|
||||
}
|
||||
for(int i = 1 ; i <configValues[0].length;i++){
|
||||
if(eventId!=configValues[0][i]){
|
||||
return GlobalsDef.MAP_MISSION_RETURN;
|
||||
continue;
|
||||
}
|
||||
missionValue++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,14 @@ public class NotEventFinishEventDifficultMapProcessor implements BaseMissionProc
|
|||
if(flag){
|
||||
for(int i = 0 ; i < finishEvent.length;i++){
|
||||
if(eventId==finishEvent[i]){
|
||||
missionValue = -1;
|
||||
if(missionValue<0){
|
||||
if(missionValue==-1){
|
||||
break;
|
||||
}
|
||||
missionValue = missionValue/2;
|
||||
}else{
|
||||
missionValue =0-1<<(configValues[1][1]-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ljsd.jieling.handler.player;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TakeSevenScoreHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.TAKE_SEVEN_HAPPY_REWARD_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
PlayerLogic.getInstance().takeSevenScoreReward(iSession);
|
||||
}
|
||||
}
|
||||
|
|
@ -18,8 +18,11 @@ public class DefaultEmptyActivity extends AbstractActivity{
|
|||
ActivityMission mission = new ActivityMission();
|
||||
mission.initOtherMission(new ArrayList<>(0));
|
||||
user.getActivityManager().addActivity(id, mission);
|
||||
if(SGlobalActivity.getsGlobalActivityMap().get(id).getType() == ActivityType.SERVERHAPPY){
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if(sGlobalActivity.getType() == ActivityType.SERVERHAPPY){
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.SERVENHAPPY_REFRESH,id);
|
||||
long endTime = sGlobalActivity.getTimeLong(user.getPlayerInfoManager().getCreateTime(), 2) - 24 * 3600 * 1000;
|
||||
user.getActivityManager().setSenvenTime(endTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
public class ActivityManager extends MongoBase {
|
||||
private Map<Integer,ActivityMission> activityMissionMap = new HashMap<>();
|
||||
private long trsendTime; // 孙龙结束时间
|
||||
private long senvenTime; //七日狂欢结束时间
|
||||
|
||||
|
||||
public boolean initAllActivityMission(int activityId){
|
||||
|
|
@ -39,6 +40,16 @@ public class ActivityManager extends MongoBase {
|
|||
removeString(getMongoKey() + ".activityMissionMap." + activityId);
|
||||
}
|
||||
|
||||
|
||||
public long getSenvenTime() {
|
||||
return senvenTime;
|
||||
}
|
||||
|
||||
public void setSenvenTime(long senvenTime) {
|
||||
updateString("senvenTime" ,trsendTime);
|
||||
this.senvenTime = senvenTime;
|
||||
}
|
||||
|
||||
public long getTrsendTime() {
|
||||
return trsendTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public class UserMissionManager extends MongoBase {
|
|||
|
||||
if(!sevenHappyMissionType.getDoingMissionIds().isEmpty() ){
|
||||
List<STreasureTaskConfig> sTreasureTaskConfigs = STreasureTaskConfig.sTreasureTaskConfigListByTypeMap.get(missionType.getMissionTypeValue());
|
||||
if(sTreasureTaskConfigs!=null){
|
||||
if(sTreasureTaskConfigs!=null && user.getActivityManager().getSenvenTime()>System.currentTimeMillis()){
|
||||
CumulationData.Result result = sevenHappyCumulationData.updateData(missionType, parm);
|
||||
if(result!=null){
|
||||
sevenHappyMissionType.calCumulationDataResult(user,result,missionTypeEnumListMap.get(GameMisionType.SEVENMISSION),sevenHappyCumulationData);
|
||||
|
|
@ -205,6 +205,11 @@ public class UserMissionManager extends MongoBase {
|
|||
this.vipMissionIdsType = vipMissionIdsType;
|
||||
}
|
||||
|
||||
public void setSevenHappyMissionType(TreasureMissionType sevenHappyMissionType) {
|
||||
updateString("sevenHappyMissionType",sevenHappyMissionType);
|
||||
this.sevenHappyMissionType = sevenHappyMissionType;
|
||||
}
|
||||
|
||||
public VipMissionIdsType getVipMissionIdsType() {
|
||||
return vipMissionIdsType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,13 @@ public class MissionLoigc {
|
|||
}else{
|
||||
takeTimes = takeTimesMap.get(missionId);
|
||||
}
|
||||
if(state!=2 && sTreasureTaskConfig.getTaskType() == MissionType.SENVER_HAPPY.getMissionTypeValue()){
|
||||
if(System.currentTimeMillis()>user.getActivityManager().getSenvenTime()){
|
||||
state=1;
|
||||
}else {
|
||||
state =0;
|
||||
}
|
||||
}
|
||||
|
||||
missionList.add(CommonProto.UserMissionInfo.newBuilder().setMissionId(missionId).setState(state).setType(treasuremissionType).setProgress(sendProgress).setTakeTimes(takeTimes).build());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.ljsd.jieling.logic.hero.HeroLogic;
|
|||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionLoigc;
|
||||
import com.ljsd.jieling.logic.mission.main.TreasureMissionType;
|
||||
import com.ljsd.jieling.logic.store.GiftGoodsType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
|
|
@ -278,6 +279,7 @@ public class PlayerLogic {
|
|||
ItemManager itemManager = user.getItemManager();
|
||||
if(itemManager.getItem(frameId)==null||itemManager.getItem(frameId).getItemNum()<1){
|
||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"无此头像框");
|
||||
return;
|
||||
}
|
||||
user.getPlayerInfoManager().setHeadFrame(frameId);
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
|
|
@ -377,4 +379,36 @@ public class PlayerLogic {
|
|||
MessageUtil.sendMessage(session,1,messageType.getNumber(),playerTeamInfo.build(),true);
|
||||
|
||||
}
|
||||
|
||||
public void takeSevenScoreReward(ISession iSession) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
int msgId = MessageTypeProto.MessageType.TAKE_SEVEN_HAPPY_REWARD_RESPONSE_VALUE;
|
||||
long senvenTime = user.getActivityManager().getSenvenTime();
|
||||
if(senvenTime == 0 || senvenTime> System.currentTimeMillis()){
|
||||
MessageUtil.sendErrorResponse(iSession,0,msgId,"时间未到");
|
||||
return;
|
||||
}
|
||||
Map<Integer, ActivityMission> activityMissionMap = user.getActivityManager().getActivityMissionMap();
|
||||
int treasureActivityId = 0;
|
||||
for(Integer activityId : activityMissionMap.keySet()){
|
||||
if(SGlobalActivity.getsGlobalActivityMap().get(activityId).getType() == ActivityType.SERVERHAPPY){
|
||||
treasureActivityId = activityId;
|
||||
}
|
||||
}
|
||||
if(treasureActivityId == 0){
|
||||
MessageUtil.sendErrorResponse(iSession,0,msgId,"活动已过期");
|
||||
return;
|
||||
}
|
||||
STreasureTaskConfig sTreasureTaskConfig = STreasureTaskConfig.sTreasureSevenTaskConfigByActivityMap.get(treasureActivityId);
|
||||
int senvenScores = user.getUserMissionManager().getSevenHappyCumulationData().senvenScores;
|
||||
TreasureMissionType sevenHappyMissionType = user.getUserMissionManager().getSevenHappyMissionType();
|
||||
sevenHappyMissionType.getDoingMissionIds().remove(sTreasureTaskConfig.getId());
|
||||
sevenHappyMissionType.getFinishMissionIds().remove(sTreasureTaskConfig.getId());
|
||||
sevenHappyMissionType.getRewardedMissionIds().set(sTreasureTaskConfig.getId());
|
||||
user.getUserMissionManager().setSevenHappyMissionType(sevenHappyMissionType);
|
||||
SSevenDaysScore sSevenDaysScore = SSevenDaysScore.SSevenDaysScoreByActivityIdAndScoreMap.get(treasureActivityId).get(senvenScores);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sSevenDaysScore.getReward(), BIReason.SEVEN_SCORE_REWARD);
|
||||
PlayerInfoProto.TakeSenvenScoreRewardResponse build = PlayerInfoProto.TakeSenvenScoreRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(iSession,1,msgId,build,true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue