back_recharge
zhangshanxue 2020-06-18 14:07:33 +08:00
commit 93a48fc5f7
14 changed files with 179 additions and 213 deletions

View File

@ -1557,12 +1557,12 @@ local passivityList = {
[92] = function(role, args)
local i1 = args[1]
local OnRoleHit = function(defRole)
local OnRoleHit = function(defRole, damage, bCrit, finalDmg, damageType, skill)
-- local buff = Buff.Create(role, BuffName.PropertyChange, 0, BattlePropList[pro], i1, 1)
-- buff.cover = true -- 可以叠加
-- buff.clear = false -- 不可驱散
-- role:AddBuff(buff)
if defRole:IsDead() then
if skill and not skill.isAdd and defRole:IsDead() then
role:AddRage(i1, CountTypeName.Add)
end
end
@ -2088,7 +2088,7 @@ local passivityList = {
local af = 0
local onSkillCast = function(skill)
if skill.type == BattleSkillType.Normal then
if skill.type == BattleSkillType.Normal and not skill.isAdd then
af = 0
elseif skill.type == BattleSkillType.Special then
af = af + f1
@ -3109,7 +3109,7 @@ local passivityList = {
local f1 = args[1]
local ct = args[2]
local f2 = args[3]
local ct2 = args[4]
local ct2 = args[4] -- 废物参数
-- 释放技能后
local onPassiveDamaging = function(damagingFunc, defRole, damage, skill)
@ -4363,7 +4363,7 @@ local passivityList = {
-- 我方武将造成伤害时,[a]概率附加[b]效果,每回合造成攻击[c]%的伤害,持续[d]秒。
-- 普攻时,[a]概率附加[b]效果,每回合造成攻击[c]%的伤害,持续[d]秒。
-- a[float],b[持续伤害效果],c[float],d[int]
[223] = function(role, args)
local rand = args[1]
@ -4371,11 +4371,13 @@ local passivityList = {
local f1 = args[3]
local i1 = args[3]
local function _OnRoleHit(target)
local function _OnRoleHit(target, damage, _, finalDmg, _, skill)
-- BattleUtil.RandomDot(rand, dot, role, target, i1, 1, )
BattleUtil.RandomAction(rand, function()
target:AddBuff(Buff.Create(role, BuffName.DOT, i1, 1, dot, 2, f1))
end)
if skill and skill.type == BattleSkillType.Normal then
BattleUtil.RandomAction(rand, function()
target:AddBuff(Buff.Create(role, BuffName.DOT, i1, 1, dot, 2, f1))
end)
end
end
role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
end,
@ -4395,6 +4397,10 @@ local passivityList = {
role.Event:AddEvent(BattleEventName.RoleHit, _OnRoleHit)
end,
--
[225] = function()
end,
-- 斩杀生命低于[a]的敌人
-- a[float]

View File

@ -38,9 +38,9 @@ end
--随机0-1
function Random.Range01()
local var = random() / 2147483647
if BattleLogic.IsOpenBattleRecord then
BattleLogic.RecordSeed(seed)
end
BattleLogManager.Log(
"random",
"seed", seed)
return var
end

View File

@ -37,9 +37,12 @@ function RoleData:SetValue(name, value)
delta = value - delta
if delta ~= 0 then
self.role.Event:DispatchEvent(BattleEventName.RolePropertyChanged, name, value, delta)
if BattleLogic.IsOpenBattleRecord then
BattleLogic.RecordRoleProperty(self.role.uid, self.role.camp, name, value, delta)
end
BattleLogManager.Log(
"property change",
"camp", self.role.camp,
"position", self.role.position,
"propId", name,
"value", value)
end
end
end

View File

@ -91,9 +91,13 @@ local function takeEffect(caster, target, effects, duration, skill)
--
if effect[e.type] then
effect[e.type](caster, target, e.args, duration, skill)
if BattleLogic.IsOpenBattleRecord then
BattleLogic.RecordEffect(caster, target, e.type, e.args, duration)
end
BattleLogManager.Log(
"Take Effect",
"tcamp", target.camp,
"tpos", target.position,
"type", e.type
)
end
end
end
@ -131,6 +135,15 @@ function Skill:Cast(func)
end
end
end
--
BattleLogManager.Log(
"Cast Skill",
"camp", self.owner.camp,
"pos", self.owner.position,
"type", self.type,
"isRage", tostring(self.isRage),
"isAdd", tostring(self.isAdd)
)
-- 对目标造成相应的效果
for i=1, self.effectList.size do

View File

@ -1,10 +1,3 @@
require("Modules.Battle.Logic.SkillManager")
require("Modules.Battle.Logic.RoleManager")
require("Modules.Battle.Logic.OutDataManager")
BattleLogic = {}
local floor = math.floor
@ -88,6 +81,7 @@ function BattleLogic.Init(data, optionData, maxRound)
SkillManager.Init()
OutDataManager.Init(fightData)
PassiveManager.Init()
BattleLogManager.Init(fightData)
end
function BattleLogic.StartOrder()
@ -165,6 +159,11 @@ function BattleLogic.TurnRound(debugTurn)
CurCamp = 0
CurSkillPos[0] = 0
CurSkillPos[1] = 0
--
BattleLogManager.Log(
"Round Change",
"round", CurRound
)
-- 轮数变化
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundChange, CurRound)
else
@ -172,6 +171,11 @@ function BattleLogic.TurnRound(debugTurn)
CurCamp = (CurCamp + 1) % 2
end
--
BattleLogManager.Log(
"Camp Change",
"camp", CurCamp
)
-- 当前阵营下一释放技能的位置
local cpos = CurSkillPos[CurCamp] + 1
-- 找到下一个释放技能的人
@ -195,10 +199,16 @@ function BattleLogic.TurnRound(debugTurn)
end
-- 如果找不到下一个人,直接交换阵营
if not SkillRole then
BattleLogManager.Log( "No Skill Position" )
BattleLogic.TurnRoundNextFrame()
return
end
--
BattleLogManager.Log(
"Position Change",
"position", CurSkillPos[CurCamp]
)
-- 如果角色无法释放技能
if not SkillRole:IsAvailable() then
@ -239,9 +249,6 @@ function BattleLogic.WaitForTrigger(delayTime, action)
item[1] = curFrame + delayFrame
item[2] = action
tbActionList:Add(item)
if BattleLogic.IsOpenBattleRecord then
BattleLogic.RecordDelayTrigger(delayTime, curFrame + delayFrame)
end
end
@ -308,11 +315,14 @@ end
function BattleLogic.BattleEnd(result)
--
BattleLogic.Event:DispatchEvent(BattleEventName.BeforeBattleEnd, result)
--
BattleLogic.IsEnd = true
BattleLogic.Result = result
BattleLogic.Event:DispatchEvent(BattleEventName.BattleEnd, result)
-- 战斗日志写入
if not BattleLogic.GetIsDebug() then
BattleLogManager.WriteFile()
end
end
--
function BattleLogic.Clear()
@ -324,75 +334,3 @@ function BattleLogic.Clear()
tbActionList:Remove(tbActionList.size)
end
end
-------++++++++++++++++++++++++++++ 战斗记录相关
--Record专用
function BattleLogic.GetRecord()
return record
end
--Record专用
function BattleLogic.RecordSeed(seed)
table.insert(record, string.format("frame:%d, seed:%d", curFrame, seed))
end
--Record专用
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.RecordMul(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, mulArgs:%s", curFrame, str))
end
--Record专用
function BattleLogic.RecordEffect(caster, target, type, args, interval)
local cUid = tostring(caster.uid) or "cTeam"
local tUid = tostring(target.uid) or "tTeam"
local str = ""
for i=1, #args do
str = str..tostring(args[i]) .. (i == #args and "" or "#")
end
table.insert(record, string.format("frame:%d, caster:%s, target:%s, effectType:%d, args:%s, interval:%d", curFrame, cUid, tUid, type, str, interval))
end
--Record专用
function BattleLogic.RecordDelayTrigger(delayFrame, triggerFrame)
table.insert(record, string.format("frame:%d, delayTime:%f, triggerFrame:%d", curFrame, delayFrame, triggerFrame))
end
--Record专用
function BattleLogic.GenerateRecordFile()
local time = string.format("%d-%d-%d-%d-%d-%d",
os.date("%Y"),
os.date("%m"),
os.date("%d"),
os.date("%H"),
os.date("%M"),
os.date("%S"))
local file = io.open("BattleRecord/"..time..".txt", "a")
for i=1, #record do
file:write(record[i].."\n")
end
io.close(file)
end

View File

@ -25,6 +25,8 @@ function NoDead:OnStart()
self.target:SetDeadFilter(false)
self.target:SetReliveFilter(self.isCanRelive)
self.target:SetIsCanAddSkill(false)
end
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd
@ -36,6 +38,8 @@ end
function NoDead:OnEnd()
self.target.Event:AddEvent(BattleEventName.PassiveDamaging, self.onPassiveDamaging, self)
self.target:SetDeadFilter(true)
-- self.target:SetIsCanAddSkill(false)
end
--只有当cover字段为true时触发返回true则被新效果覆盖

View File

@ -27,9 +27,6 @@ function BattleUtil.FP_Mul(...)
for i, v in ipairs{...} do
f = floor(f * v * 100000 + 0.5) / 100000
end
if BattleLogic.IsOpenBattleRecord then
BattleLogic.RecordMul({...})
end
return f
end
@ -227,6 +224,11 @@ function BattleUtil.ChooseTarget(role, chooseId)
end
end
end
-- table.sort(finalArr, function(a, b)
-- return a.position < b.position
-- end)
return finalArr
end
@ -363,6 +365,18 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill)
end
end
--
BattleLogManager.Log(
"Final Damage",
"acamp", atkRole.camp,
"apos", atkRole.position,
"tcamp", defRole.camp,
"tpos", defRole.position,
"damage", damage,
"dotType", tostring(dotType)
)
return finalDmg
end
@ -438,6 +452,10 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
atkRole.Event:DispatchEvent(BattleEventName.RoleDamageAfter, defRole, damageFunc, fixDamage)
defRole.Event:DispatchEvent(BattleEventName.RoleBeDamagedAfter, atkRole, damageFunc, fixDamage)
fixDamage = max(floor(attack * 0.1), fixDamage)
local finalDmg = 0 --计算实际造成的扣血
if not defRole:IsRealDead() then
finalDmg = BattleUtil.ApplyDamage(skill, atkRole, defRole, fixDamage, bCrit, damageType, dotType)
@ -494,6 +512,16 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor)
end
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat)
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
--
BattleLogManager.Log(
"Final Damage",
"acamp", castRole.camp,
"apos", castRole.position,
"tcamp", targetRole.camp,
"tpos", targetRole.position,
"value", value
)
end
@ -713,9 +741,9 @@ end
-- 根据位置类型获取数据
function BattleUtil.GetRoleListByPosType(camp, posType)
if posType == 1 then
return RoleManager.Query(function (r) return r.camp ~= camp and r.position <= 3 end)
return RoleManager.Query(function (r) return r.camp == camp and r.position <= 3 end)
elseif posType == 2 then
return RoleManager.Query(function (r) return r.camp ~= camp and r.position > 3 end)
return RoleManager.Query(function (r) return r.camp == camp and r.position > 3 end)
end
end

View File

@ -1,7 +1,6 @@
--战斗外数据管理、
OutDataManager = {}
local this = OutDataManager
--
local function _Split(input, delimiter)
input = tostring(input)

View File

@ -18,7 +18,7 @@ function RoleLogic.New()
exCalDmgList=BattleList.New(),
proTranList=BattleList.New(),
buffFilter=BattleList.New(),
Event=BattleEvent:New(),passiveList={},isDead=false,IsDebug=false}
Event = BattleEvent:New(),passiveList={},isDead=false,IsDebug=false}
setmetatable(instance, RoleLogic)
return instance
end
@ -36,6 +36,7 @@ function RoleLogic:Init(uid, data, position)
self.name = data.name
self.element = data.element
self.professionId = data.professionId
self.star = data.star or 1
self.shield:Clear() --护盾列表
self.exCalDmgList:Clear() --额外计算伤害列表
@ -100,6 +101,8 @@ function RoleLogic:Init(uid, data, position)
self.reliveFilter = true -- 控制复活的标志位置为false角色将不再享受复活效果
self.reliveHPF = 1
self.IsCanAddSkill = true -- 是否可以追加技能
end
-- 添加一个被动技能
@ -350,13 +353,39 @@ end
-- isAdd 是否是追加技能
-- isRage 是否正常操作怒气值
function RoleLogic:AddSkill(type, isRage, isAdd, targets)
if not self.IsCanAddSkill and isAdd then return end
local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill
SkillManager.AddSkill(self, effectData, type, targets, isAdd, isRage)
--
BattleLogManager.Log(
"Add Skill",
"camp", self.camp,
"pos", self.position,
"type", type,
"isRage", tostring(isRage),
"isAdd", tostring(isAdd),
"targets", targets and #targets or "0"
)
end
-- 插入一个技能
function RoleLogic:InsertSkill(type, isRage, isAdd, targets)
if not self.IsCanAddSkill and isAdd then return end
local effectData = type == BattleSkillType.Normal and self.skill or self.superSkill
SkillManager.InsertSkill(self, effectData, type, targets, isAdd, isRage)
--
BattleLogManager.Log(
"Insert Skill",
"camp", self.camp,
"pos", self.position,
"type", type,
"isRage", tostring(isRage),
"isAdd", tostring(isAdd),
"targets", targets and #targets or "0"
)
end
-- 设置是否可以追加技能
function RoleLogic:SetIsCanAddSkill(isCan)
self.IsCanAddSkill = isCan
end

View File

@ -149,6 +149,9 @@ function RoleManager.Query(func, inCludeDeadRole)
end
end
end
table.sort(list, function(a, b)
return a.position < b.position
end)
return list
end
@ -245,6 +248,9 @@ function this.GetArrAggroList(role, arr)
end
end
end
table.sort(targetList, function(a, b)
return a.position < b.position
end)
return targetList
end
--获取对位相邻站位的人 chooseType 1 我方 2 敌方(对位的敌人受到嘲讽的影响,若对位的敌人死亡,则选取相邻最近的作为目标)
@ -272,6 +278,9 @@ function this.GetNeighbor(role, chooseType)
end
end
end
table.sort(posList, function(a, b)
return a.position < b.position
end)
return posList
end

View File

@ -3170,13 +3170,9 @@ public class MapLogic {
if(map instanceof TowerMap){
int curXY = mapManager.getCurXY();
int floor = mapManager.getTrialInfo().getFloor();
if(floor>10000){
STrialwelfareConfig welfareConfig = STrialwelfareConfig.sTrialwelfareConfigMap.get(floor % 10000);
drop = getBoxReward(welfareConfig.getBoxPosition(),welfareConfig.getBoxReward(),user,curXY,type);
}else{
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(floor);
drop = getBoxReward(sTrialConfig.getBoxPosition(),sTrialConfig.getBoxReward(),user,curXY,type);
}
TreeMap<Integer, STrialConfig> sTrialConfigMap = (TreeMap<Integer,STrialConfig>)STrialConfig.sTrialConfigMap;
STrialConfig sTrialConfig = sTrialConfigMap.ceilingEntry(floor).getValue();
drop = getBoxReward(sTrialConfig.getBoxPosition(),sTrialConfig.getBoxReward(),user,curXY,type);
}
if(drop==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);

View File

@ -176,32 +176,36 @@ public class TowerMap extends AbstractMap {
return;
}
int floor = mapManager.getTrialInfo().getFloor();
STrialConfig sTrialConfig;
if(floor>10000){
int realFloor = floor%10000;
Map<Integer,STrialwelfareConfig> welfareMap = STableManager.getConfig(STrialwelfareConfig.class);
STrialwelfareConfig useConfig = null;
for(STrialwelfareConfig config :welfareMap.values()){
int[] section = config.getSection();
if(realFloor>section[0]&&realFloor<=section[1]){
useConfig = config;
break;
}
}
Map<Integer, Cell> newMap = new HashMap<>();
if(useConfig!=null&&useConfig.getBoxPosition()!=null){
for(int[] position:useConfig.getBoxPosition()){
int cellXY = CellUtil.xy2Pos(position[0], position[1]);
Cell cell = new Cell(cellXY,0,STrialSetting.sTrialSetting.getBoxPointId());
newMap.put(cellXY,cell);
}
}
//生成普通传送门
Cell transport = createTransport(floor);
newMap.put(transport.getCellId(),transport);
mapManager.setMapInfo(newMap);
return;
// int realFloor = floor%10000;
// Map<Integer,STrialwelfareConfig> welfareMap = STableManager.getConfig(STrialwelfareConfig.class);
// STrialwelfareConfig useConfig = null;
// for(STrialwelfareConfig config :welfareMap.values()){
// int[] section = config.getSection();
// if(realFloor>section[0]&&realFloor<=section[1]){
// useConfig = config;
// break;
// }
// }
// Map<Integer, Cell> newMap = new HashMap<>();
// if(useConfig!=null&&useConfig.getBoxPosition()!=null){
// for(int[] position:useConfig.getBoxPosition()){
// int cellXY = CellUtil.xy2Pos(position[0], position[1]);
// Cell cell = new Cell(cellXY,0,STrialSetting.sTrialSetting.getBoxPointId());
// newMap.put(cellXY,cell);
// }
// }
// //生成普通传送门
// mapManager.setMapInfo(newMap);
// return;
TreeMap<Integer,STrialConfig> sTrialConfigMap = (TreeMap<Integer,STrialConfig>) STrialConfig.sTrialConfigMap;
sTrialConfig = sTrialConfigMap.ceilingEntry(floor).getValue();
}else{
sTrialConfig = STrialConfig.sTrialConfigMap.get(floor);
}
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(floor);
if (sTrialConfig == null) {
LOGGER.info("initTrialMap() uid=>{} sTrialConfig == null =>{} ", user.getId(), floor);
return;
@ -277,14 +281,11 @@ public class TowerMap extends AbstractMap {
}
} else if (scMap1.getEvent() == 3) {
//初始化商店
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor()).getRandomStore());
int storeIndex = MathUtils.randomFromWeight(sTrialConfig.getRandomStore());
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
int i = 0;
while (cellMap3.size() < sTrialConfig.getGameCount()[2]) {
i++;
if (i >= 10000) {
break;
}
int randomIndex = random.nextInt(scMap1.getGroups().length);
int x = scMap1.getGroups()[randomIndex][0];
int y = scMap1.getGroups()[randomIndex][1];
@ -331,6 +332,11 @@ public class TowerMap extends AbstractMap {
newMap.putAll(cellMap3);
newMap.putAll(cellMap4);
}
//大于10000要生成传送门
if(floor>10000){
Cell transport = createTransport(floor);
newMap.put(transport.getCellId(),transport);
}
SChallengeMapConfig challengeMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(sTrialConfig.getMapId());
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
mapManager.setCurXY(xy);
@ -465,7 +471,7 @@ public class TowerMap extends AbstractMap {
private Cell createTransport(int floor){
int transportPoint;
//是否为5层整数倍
if(floor%5==0&&floor<10000){
if(floor%2==0&&floor<10000){
//如果是则进行随机
int[] treasureProbability = STrialSetting.sTrialSetting.getTreasureProbability();
int[] transportPointId= STrialSetting.sTrialSetting.getTransportPoint();

View File

@ -654,6 +654,10 @@ public class PlayerLogic {
}
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
builder.setHero(CBean2Proto.getHero(hero));
Map<Integer, Integer> guildSkill = userInMem.getGuildMyInfo().getGuildSkill();
int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession();
Integer skill = guildSkill.getOrDefault(profession, 0);
builder.setGuildSkill(skill);
MessageUtil.sendMessage(session,1,resMsgId,builder.build(),true);
}

View File

@ -1,69 +0,0 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="TrialwelfareConfig")
public class STrialwelfareConfig implements BaseConfig {
private int id;
private int[] section;
private int mapId;
private int[][] randomMonsterType;
private int[] monsterCount;
private int[][][] boxReward;
private int[][] boxPosition;
public static Map<Integer,STrialwelfareConfig> sTrialwelfareConfigMap = new HashMap<>();
@Override
public void init() throws Exception {
Map<Integer, STrialwelfareConfig> config = STableManager.getConfig(STrialwelfareConfig.class);
for(STrialwelfareConfig value:config.values()){
int[] section = value.getSection();
for(int i = section[0];i <= section[1];i++){
sTrialwelfareConfigMap.put(i,value);
}
}
}
public int getId() {
return id;
}
public int[] getSection() {
return section;
}
public int getMapId() {
return mapId;
}
public int[][] getRandomMonsterType() {
return randomMonsterType;
}
public int[] getMonsterCount() {
return monsterCount;
}
public int[][][] getBoxReward() {
return boxReward;
}
public int[][] getBoxPosition() {
return boxPosition;
}
}