override public BuffSuperpositionRet OnBuffSuperposition(SkillObj tarObj, SkillObj srcObj, BattleReason reason, BuffConfig_New buffConfig) { BuffSuperpositionRet ret; ret.bType = BuffSuperpositionType.None; ret.buff = null; var tarBuff = tarObj.GetBuffList().Where(b => tarObj.GetBuffID(b) == tarObj.GetBuffID(buffConfig)); if (tarBuff != null && tarBuff.FirstOrDefault() != null) { ret.bType = BuffSuperpositionType.AddStateTime; var buff = tarBuff.First(); ret.buff = buff; double addTime = tarObj.GetBuffSuperpositionDoubleParam(buffConfig, Key_AddTime_SkillConfig); tarObj.SetBuffTime(buff, tarObj.GetBuffTime(buff) + addTime); tarObj.SetBuffStateTime(buff, tarObj.GetBuffStateTime(buff) + addTime); tarObj.NotifyBuffInfo(buff, BattleInfoNotifyType.Time_Buff, BattleNotifyTime.TickEnd); } else { ret.bType = BuffSuperpositionType.Add; ret.buff = new BuffInfo_New(); } return(ret); }
public override void OnDie(SkillObj self, SkillObj attacker, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { return; if (self.GetBuffIntParam(buffInfo, Key_Int_Bombed_BuffInfo) != Key_Int_Bombed_Value) { var targetSelectName = self.GetTargetSelect(buffConfig); var targetSelect = BattleModule.GetTargetSelect(targetSelectName); if (targetSelect == null) { self.LogInfo("targetSelect == null buffId:[{0}] targetSelectName:[{1}]".F(self.GetBuffID(buffInfo), targetSelectName)); return; } var targetTypeName = self.GetTargetType(buffConfig); var targetType = BattleModule.GetTargetType(targetTypeName); if (targetType == null) { self.LogInfo("targetSelect == null buffId:[{0}] targetType:[{1}]".F(self.GetBuffID(buffInfo), targetTypeName)); return; } var targets = BattleModule.GetTargets(self, targetSelect, targetType, buffInfo, buffConfig); foreach (var tar in targets.Where(t => !t.IsDead())) { OnEffect(self, tar, buffInfo, buffConfig); } } }
public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig); if (ret == LogicStateTickRet.TimeFinish) { return ret; } double effectTickTime = self.GetBuffStateDoubleParam(buffConfig, key_EffectTickTime, self.GetBuffStateIndex(buffInfo)); if(effectTickTime < 0) { self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Effect effectTickTime< 0".F(self.GetID(), self.GetBuffID(buffInfo))); return LogicStateTickRet.TimeFinish; } self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime()); var leftTickTime = self.GetBuffDoubleParam(buffInfo, key_ticlLeftTime_BuffInfo); if (leftTickTime - self.GetBuffStateTime(buffInfo) >= effectTickTime) { self.SetBuffDoubleParam(buffInfo, leftTickTime - effectTickTime, key_ticlLeftTime_BuffInfo); self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Effect".F(self.GetID(), self.GetBuffID(buffInfo))); ret = LogicStateTickRet.OnEffect; } else if (self.GetBuffStateTime(buffInfo) <= 0) { ret = LogicStateTickRet.NextState; self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Finish".F(self.GetID(), self.GetBuffID(buffInfo))); } else { ret = LogicStateTickRet.None; } return ret; }
/// <summary> /// 单人技能的tick,这个需要手动调用 /// </summary> /// <param name="self"></param> public static void Tick_Battle(SkillObj self) { if (self.IsDead()) { return; } var skillList = self.GetSkillList(true); var buffList = self.GetBuffList(true); var CDKeyList = self.GetCDKeyList(); //buff if (buffList != null) { foreach (var buffInfo in buffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, self); if (buffLogic != null) { int buffId = self.GetBuffID(buffInfo); BuffConfig_New buffConfig = self.GetBuffConfig(buffId); buffLogic.Tick(self, buffInfo, buffConfig); } else { self.LogInfo("something error {0}".F(self.GetBuffID(buffInfo))); } } } //技能 if (skillList != null) { foreach (var skillInfo in skillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, self); if (skillLogic != null) { int skillId = self.GetSkillID(skillInfo); SkillConfig_New skillConfig = self.GetSkillConfig(skillId); skillLogic.Tick(self, skillInfo, skillConfig); } else { self.LogInfo("something error2 {0}".F(self.GetSkillID(skillInfo))); } } } //CD if (CDKeyList != null) { foreach (var key in CDKeyList) { self.SetCD(key, self.GetCD(key) - self.GetDeltaTime()); } } }
public static bool IsActionLimited(SkillObj self, ActionLimitType limit) { var skillList = self.GetSkillList(); var buffList = self.GetBuffList(); //buff if (buffList != null) { foreach (var buffInfo in buffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, self); if (buffLogic != null) { int buffId = self.GetBuffID(buffInfo); BuffConfig_New buffConfig = self.GetBuffConfig(buffId); if (buffLogic.IsActionLimited(self, limit, buffInfo, buffConfig)) { return(true); } } else { self.LogInfo("something error {0}".F(self.GetBuffID(buffInfo))); } } } //技能 if (skillList != null) { foreach (var skillInfo in skillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, self); if (skillLogic != null) { int skillId = self.GetSkillID(skillInfo); SkillConfig_New skillConfig = self.GetSkillConfig(skillId); if (skillLogic.IsActionLimited(self, limit, skillInfo, skillConfig)) { return(true); } } else { self.LogInfo("something error2 {0}".F(self.GetSkillID(skillInfo))); } } } return(false); }
public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig); if (ret == LogicStateTickRet.TimeFinish) { return ret; } self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime()); //help harm 判断是否停留 int harmHelpType = self.GetBuffStateIntParam(buffConfig, Key_Int__BuffConfig, self.GetBuffStateIndex(buffInfo)); bool needNextState = false; switch(harmHelpType) { case 1: //这个是友好,没错 needNextState = self.GetCamp() != self.GetSrcCamp(buffInfo); break; case 2: //这个是友好,没错敌对 needNextState = self.GetCamp() == self.GetSrcCamp(buffInfo); break; } if (self.GetBuffStateTime(buffInfo) <= 0 || needNextState) { ret = LogicStateTickRet.NextState; self.LogInfo("ChargeState:buffObj[{0}] buff:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetBuffID(buffInfo))); } return ret; }
public static SkillObj Summon(int id, SkillObj srcObj, SkillObj tarObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig) { SkillObj summonObj = null; if (srcObj != null) { summonObj = srcObj.Summon(id, tarObj, skillInfo, skillConfig); var srcBuffList = srcObj.GetBuffList(); //Source buff fix if (srcBuffList != null) { foreach (var buffInfo in srcBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, srcObj); int buffId = srcObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New buffConfig = srcObj.GetBuffConfig(buffId); buffLogic.OnSummon(id, srcObj, summonObj, buffInfo, buffConfig); } else { srcObj.LogInfo("something error in BattleModule.Summon src buff:[{0}]".F(buffId)); } } } } return(summonObj); }
public override void Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { Dictionary<int, int> keyValues = new Dictionary<int, int>(); foreach(var buff in self.GetBuffIntParams(buffConfig).Skip(Key_Int_SummonId_BuffConfig+1)) { keyValues.Add(buff, buff); } bool bAddTime = false; foreach (var buff in self.GetBuffList(true)) { int buffId = self.GetBuffID(buff); if(keyValues.ContainsKey(buffId)) { bAddTime = true; break; } } if (bAddTime) { self.SetBuffTime(buffInfo, self.GetBuffTime(buffInfo) + self.GetDeltaTime()); self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) + self.GetDeltaTime()); self.NotifyBuffInfo(buffInfo, BattleInfoNotifyType.Time_Buff, BattleNotifyTime.TickEnd); } base.Tick(self, buffInfo, buffConfig); }
public override void Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { Dictionary <int, int> keyValues = new Dictionary <int, int>(); foreach (var buff in self.GetBuffIntParams(buffConfig).Skip(Key_Int_SummonId_BuffConfig + 1)) { keyValues.Add(buff, buff); } bool bAddTime = false; foreach (var buff in self.GetBuffList(true)) { int buffId = self.GetBuffID(buff); if (keyValues.ContainsKey(buffId)) { bAddTime = true; break; } } if (bAddTime) { self.SetBuffTime(buffInfo, self.GetBuffTime(buffInfo) + self.GetDeltaTime()); self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) + self.GetDeltaTime()); self.NotifyBuffInfo(buffInfo, BattleInfoNotifyType.Time_Buff, BattleNotifyTime.TickEnd); } base.Tick(self, buffInfo, buffConfig); }
public override BuffSuperpositionRet OnBuffSuperposition(SkillObj tarObj, SkillObj srcObj, BattleReason reason, BuffConfig_New buffConfig) { BuffSuperpositionRet ret; ret.bType = BuffSuperpositionType.None; ret.buff = null; var tarBuff = tarObj.GetBuffList().Where(b => tarObj.GetBuffID(b) == tarObj.GetBuffID(buffConfig)); if (tarBuff != null && tarBuff.FirstOrDefault() != null) { ret.bType = BuffSuperpositionType.Refresh; var buff = tarBuff.First(); ret.buff = buff; } else { ret.bType = BuffSuperpositionType.Add; ret.buff = new BuffInfo_New(); } return ret; }
public override BuffSuperpositionRet OnBuffSuperposition(SkillObj tarObj, SkillObj srcObj, BattleReason reason, BuffConfig_New buffConfig) { BuffSuperpositionRet ret; ret.bType = BuffSuperpositionType.None; ret.buff = null; var buffKey = tarObj.GetBuffKey(buffConfig); foreach (var tarBuff in tarObj.GetBuffList()) { var tarBuffConfig = tarObj.GetBuffConfig(tarObj.GetBuffID(tarBuff)); if(tarBuffConfig != null && tarObj.GetBuffKey(tarBuffConfig).Equals(buffKey)) { BattleModule.RemoveBuff(tarObj, srcObj, tarObj.GetBuffID(tarBuff), BattleReason.Replace); //BattleModule.DetachBuff(tarObj, srcObj, tarBuff, tarBuffConfig); } } ret.bType = BuffSuperpositionType.Add; ret.buff = new BuffInfo_New(); return ret; }
override public BuffSuperpositionRet OnBuffSuperposition(SkillObj tarObj, SkillObj srcObj, BattleReason reason, BuffConfig_New buffConfig) { BuffSuperpositionRet ret; ret.bType = BuffSuperpositionType.None; ret.buff = null; var tarBuff = tarObj.GetBuffList().Where(b => tarObj.GetBuffID(b) == tarObj.GetBuffID(buffConfig)); if (tarBuff != null && tarBuff.FirstOrDefault() != null) { ret.bType = BuffSuperpositionType.Refresh; var buff = tarBuff.First(); ret.buff = buff; } else { ret.bType = BuffSuperpositionType.Add; ret.buff = new BuffInfo_New(); } return(ret); }
public override BuffSuperpositionRet OnBuffSuperposition(SkillObj tarObj, SkillObj srcObj, BattleReason reason, BuffConfig_New buffConfig) { BuffSuperpositionRet ret; ret.bType = BuffSuperpositionType.None; ret.buff = null; var tarBuff = tarObj.GetBuffList().Where(b => tarObj.GetBuffID(b) == tarObj.GetBuffID(buffConfig)); if (tarBuff != null && tarBuff.FirstOrDefault() != null) { ret.bType = BuffSuperpositionType.AddStateTime; var buff = tarBuff.First(); double addTime = tarObj.GetBuffSuperpositionDoubleParam(buffConfig, Key_AddTime_SkillConfig); tarObj.SetBuffTime(buff, tarObj.GetBuffTime(buff) + addTime); tarObj.SetBuffStateTime(buff, tarObj.GetBuffStateTime(buff) + addTime); tarObj.NotifyBuffInfo(buff, BattleInfoNotifyType.Time_Buff, BattleNotifyTime.TickEnd); } else { ret.bType = BuffSuperpositionType.Add; ret.buff = new BuffInfo_New(); } return ret; }
override public BuffSuperpositionRet OnBuffSuperposition(SkillObj tarObj, SkillObj srcObj, BattleReason reason, BuffConfig_New buffConfig) { BuffSuperpositionRet ret; ret.bType = BuffSuperpositionType.None; ret.buff = null; var buffKey = tarObj.GetBuffKey(buffConfig); foreach (var tarBuff in tarObj.GetBuffList()) { var tarBuffConfig = tarObj.GetBuffConfig(tarObj.GetBuffID(tarBuff)); if (tarBuffConfig != null && tarObj.GetBuffKey(tarBuffConfig).Equals(buffKey)) { BattleModule.RemoveBuff(tarObj, srcObj, tarObj.GetBuffID(tarBuff), BattleReason.Replace); //BattleModule.DetachBuff(tarObj, srcObj, tarBuff, tarBuffConfig); } } ret.bType = BuffSuperpositionType.Add; ret.buff = new BuffInfo_New(); return(ret); }
public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig); if (ret == LogicStateTickRet.TimeFinish) { return ret; } self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime()); if (self.GetBuffStateTime(buffInfo) <= 0) { ret = LogicStateTickRet.NextState; self.LogInfo("ChargeState:buffObj[{0}] buff:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetBuffID(buffInfo))); } return ret; }
public virtual bool InitBuffInfo(SkillObj self, SkillObj srcObj, BattleReason reason, BuffInfo_New buffInfo, BuffConfig_New buffConfig, bool RefreshGUID = true) { var buffId = self.GetBuffID(buffConfig); self.SetBuffId(buffInfo, buffId); if (RefreshGUID) { var guid = BattleModule.BattleID; self.SetBuffGuid(buffInfo, guid); } self.SetBuffStateIndex(buffInfo, 0); if (srcObj != null) { if (srcObj.GetParentID() > 0) { self.SetSrcID(buffInfo, srcObj.GetParentID()); } else { self.SetSrcID(buffInfo, srcObj.GetID()); } } var startLogicStateName = self.GetLogicState(buffConfig, 0); var startLogicState = BattleModule.GetBuffLogicState(startLogicStateName); if (startLogicState == null) { self.LogInfo("startLogicState == null BuffId:[{0}] startLogicStateName:[{1}]".F(buffId, startLogicStateName)); return(false); } //init startLogicState.InitBuff(self, buffInfo, buffConfig, 0); startLogicState.InitState(self, buffInfo, buffConfig, 0); var targetSelectName = self.GetTargetSelect(buffConfig); if (targetSelectName != null) { var targetSelect = BattleModule.GetTargetSelect(targetSelectName); if (targetSelect == null) { self.LogInfo("targetSelect == null buffId:[{0}] targetSelectName:[{1}]".F(buffId, targetSelectName)); return(false); } targetSelect.Init(self, buffInfo, buffConfig); } return(true); }
// private const int key_BuffId3_SkillConfig = 2; public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig) { var buffId1 = self.GetSkillIntParam(skillConfig, key_BuffId1_SkillConfig); var buffId2 = self.GetSkillIntParam(skillConfig, key_BuffId2_SkillConfig); var tarBuff = target.GetBuffList().Where(b => target.GetBuffID(b) == buffId1); if (tarBuff != null && tarBuff.FirstOrDefault() != null) { BattleModule.AddBuff(target, self, buffId2, BattleReason.Skill); BattleModule.RemoveBuff(target, self, buffId1, BattleReason.Skill); } else { BattleModule.AddBuff(target, self, buffId1, BattleReason.Skill); BattleModule.RemoveBuff(target, self, buffId2, BattleReason.Skill); } return true; }
// private const int key_BuffId3_SkillConfig = 2; public override bool OnEffect(SkillObj self, SkillObj target, SkillInfo_New skillInfo, SkillConfig_New skillConfig) { var buffId1 = self.GetSkillIntParam(skillConfig, key_BuffId1_SkillConfig); var buffId2 = self.GetSkillIntParam(skillConfig, key_BuffId2_SkillConfig); var tarBuff = target.GetBuffList().Where(b => target.GetBuffID(b) == buffId1); if (tarBuff != null && tarBuff.FirstOrDefault() != null) { BattleModule.AddBuff(target, self, buffId2, BattleReason.Skill); BattleModule.RemoveBuff(target, self, buffId1, BattleReason.Skill); } else { BattleModule.AddBuff(target, self, buffId1, BattleReason.Skill); BattleModule.RemoveBuff(target, self, buffId2, BattleReason.Skill); } return(true); }
private static BuffLogic GetBuffLogic(BuffInfo_New buffInfo, SkillObj logObj) { int buffId = logObj.GetBuffID(buffInfo); BuffConfig_New buffConfig = logObj.GetBuffConfig(buffId); if (buffConfig == null) { logObj.LogInfo("BuffConfig not found buffId[{0}]".F(buffId)); return(null); } string buffLogicId = logObj.GetBuffLogicId(buffConfig); if (!BuffLogics.ContainsKey(buffLogicId)) { logObj.LogInfo("BuffLogic not found buffId[{0}] buffLogicId[{1}]".F(buffId, buffLogicId)); return(null); } BuffLogic buffLogic = BuffLogics[buffLogicId]; return(buffLogic); }
public override void OnEffect(SkillObj self, SkillObj tarObj, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { int key = Key_Double_AddTime1_BuffConfig; if (self.GetSrcID(buffInfo) == tarObj.GetID() || self.GetSrcParentID(buffInfo) == tarObj.GetID()) { key = Key_Double_AddTime1_BuffConfig; } else { key = Key_Double_AddTime2_BuffConfig; } foreach (var buff in self.GetBuffList(true)) { int buffId = self.GetBuffID(buff); if (buffId > 0 && buffId == self.GetBuffIntParam(buffConfig, Key_Int_BuffId_BuffConfig)) { double addTime = self.GetBuffDoubleParam(buffConfig, key); self.SetBuffTime(buff, self.GetBuffTime(buff) + addTime); self.SetBuffStateTime(buff, self.GetBuffStateTime(buff) + addTime); self.NotifyBuffInfo(buff, BattleInfoNotifyType.Time_Buff, BattleNotifyTime.TickEnd); } } }
/// <summary> /// 技能的late tick,这是处理一些技能时间到,buff时间到之后的后续处理,需要手动调用 /// </summary> /// <param name="self"></param> public static void Tick_Battle_Late(SkillObj self) { self.Tick_Battle_Late(); //这个时候已经不再使用buff的迭代器,可以改变集合了,因为这里边的buff已经认为是被加在角色身上了,所以需要有后续处理得先加进去 foreach (var b in self.GetTempBuffList()) { self.AddBuffList(b); } self.ClearTempBuffList(); IEnumerable <BuffInfo_New> detachBuffs = null; if (self.IsDead()) { detachBuffs = self.RemoveAllBuffs((b) => true); self.RemoveAllSkills((s) => true); self.RemoveAllCDKey((c) => true); } else { detachBuffs = self.RemoveAllBuffs(b => self.GetBuffTime(b) <= 0); self.RemoveAllSkills(s => self.GetSkillTime(s) <= 0); self.RemoveAllCDKey(s => self.GetCD(s) <= 0); } foreach (var delBuf in detachBuffs) { var buffConfig = self.GetBuffConfig(self.GetBuffID(delBuf)); if (buffConfig == null) { continue; } //foreach (var buff in GetTankData().BuffInfos) { BattleModule.DetachBuff(self, null, delBuf, buffConfig); } } }
public static void DetachBuff(SkillObj tarObj, SkillObj srcObj, BuffInfo_New buff, BuffConfig_New buffConfig) { var buffLogicId = tarObj.GetBuffLogicId(buffConfig); if (!BuffLogics.ContainsKey(buffLogicId)) { return; } BuffLogic buffLogic = BuffLogics[buffLogicId]; //先从src方进行修正 if (srcObj != null) { var srcSkillList = srcObj.GetSkillList(); var srcBuffList = srcObj.GetBuffList(); if (srcSkillList != null) { foreach (var skillInfo in srcSkillList) { int skillId = srcObj.GetSkillID(skillInfo); SkillConfig_New skillConfig = srcObj.GetSkillConfig(skillId); var logic = GetSkillLogic(skillInfo, srcObj); logic.OnClearBuff(tarObj, srcObj, buff, skillInfo, skillConfig); } } if (srcBuffList != null) { foreach (var buffInfo in srcBuffList) { int buffId = srcObj.GetBuffID(buffInfo); BuffConfig_New srcBuffConfig = srcObj.GetBuffConfig(buffId); var logic = GetBuffLogic(buffInfo, srcObj); logic.OnClearBuff(tarObj, srcObj, buff, buffInfo, srcBuffConfig); } } } { var tarSkillList = tarObj.GetSkillList(); var tarBuffList = tarObj.GetBuffList(); if (tarSkillList != null) { foreach (var skillInfo in tarSkillList) { int skillId = tarObj.GetSkillID(skillInfo); SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); var logic = GetSkillLogic(skillInfo, tarObj); logic.OnDetachBuff(tarObj, srcObj, buff, skillInfo, skillConfig); } } if (tarBuffList != null) { foreach (var buffInfo in tarBuffList.Where(b => b.buff != buff.buff)) { int buffId = tarObj.GetBuffID(buffInfo); BuffConfig_New tarBuffConfig = tarObj.GetBuffConfig(buffId); var logic = GetBuffLogic(buffInfo, tarObj); logic.OnDetachBuff(tarObj, srcObj, buff, buffInfo, tarBuffConfig); } } } buffLogic.BuffOnEnd(tarObj, buff, buffConfig); buffLogic.OnDetach(tarObj, srcObj, buff, buffConfig); }
private static void DamageFix(SkillObj tarObj, SkillObj srcObj, Damage damage) { if (tarObj == null) { return; } if (srcObj != null) { var srcSkillList = srcObj.GetSkillList(); var srcBuffList = srcObj.GetBuffList(); //Source skill fix if (srcSkillList != null) { foreach (var skillInfo in srcSkillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, srcObj); int skillId = srcObj.GetSkillID(skillInfo); if (skillLogic != null) { SkillConfig_New skillConfig = srcObj.GetSkillConfig(skillId); skillLogic.DamageTargetFix(srcObj, tarObj, damage, skillInfo, skillConfig); } else { srcObj.LogInfo("something error in BattleModule.DamageFix src skill:[{0}]".F(skillId)); } } } //Source buff fix if (srcBuffList != null) { foreach (var buffInfo in srcBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, srcObj); int buffId = srcObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New skillConfig = srcObj.GetBuffConfig(buffId); buffLogic.DamageTargetFix(srcObj, tarObj, damage, buffInfo, skillConfig); } else { srcObj.LogInfo("something error in BattleModule.DamageFix src buff:[{0}]".F(buffId)); } } } } { var tarBuffList = tarObj.GetBuffList(); var tarSkillList = tarObj.GetSkillList(); //Target skill fix if (tarSkillList != null) { foreach (var skillInfo in tarSkillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj); int skillId = tarObj.GetSkillID(skillInfo); if (skillLogic != null) { SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); skillLogic.BeHurtDamageFix(tarObj, srcObj, damage, skillInfo, skillConfig); } else { tarObj.LogInfo("something error in BattleModule.DamageFix tar skill:[{0}]".F(skillId)); } } } //Target buff fix if (tarBuffList != null) { foreach (var buffInfo in tarBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj); int buffId = tarObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New skillConfig = tarObj.GetBuffConfig(buffId); buffLogic.BeHurtDamageFix(tarObj, srcObj, damage, buffInfo, skillConfig); } else { tarObj.LogInfo("something error in BattleModule.DamageFix tar buff:[{0}]".F(buffId)); } } } } }
/// <summary> /// 造成伤害或治疗 /// </summary> /// <param name="tarObj"></param> /// <param name="srcObj"></param> /// <param name="damage">大于0是伤害,小于0是治疗</param> public static void DamageTarget(SkillObj tarObj, SkillObj srcObj, Damage damage) { SkillObj realSrcObj = srcObj; if (tarObj == null || tarObj.IsDead()) { return; } if (realSrcObj != null && damage.srcId > 0 && realSrcObj.GetID() != damage.srcId) { realSrcObj = tarObj.GetSkillObj(damage.srcId); } BattleModule.CalcDamage(tarObj, realSrcObj, damage); //先修正伤害 BattleModule.DamageFix(tarObj, realSrcObj, damage); //质量和造成伤害都是这个 //造成伤害 if (damage.value >= 0) { tarObj.OnDamage(damage, realSrcObj); } else { tarObj.OnDamage(damage, realSrcObj); } //检查技能与BUFF的相应触发 if (realSrcObj != null && !realSrcObj.IsDead()) { var srcSkillList = realSrcObj.GetSkillList(); var srcBuffList = realSrcObj.GetBuffList(); //Source skill fix if (srcSkillList != null) { foreach (var skillInfo in srcSkillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, realSrcObj); int skillId = realSrcObj.GetSkillID(skillInfo); if (skillLogic != null) { SkillConfig_New skillConfig = realSrcObj.GetSkillConfig(skillId); if (damage.value >= 0) { skillLogic.OnDamageTarget(realSrcObj, tarObj, damage, skillInfo, skillConfig); } else { skillLogic.OnHealTarget(realSrcObj, tarObj, damage, skillInfo, skillConfig); } } else { realSrcObj.LogInfo("something error in BattleModule.DamageTarget src skill:[{0}]".F(skillId)); } } } //Source buff fix if (srcBuffList != null) { foreach (var buffInfo in srcBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, realSrcObj); int buffId = realSrcObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New buffConfig = realSrcObj.GetBuffConfig(buffId); if (damage.value >= 0) { buffLogic.OnDamageTarget(realSrcObj, tarObj, damage, buffInfo, buffConfig); } else { buffLogic.OnHealTarget(realSrcObj, tarObj, damage, buffInfo, buffConfig); } } else { realSrcObj.LogInfo("something error in BattleModule.DamageTarget src buff:[{0}]".F(buffId)); } } } } var tarSkillList = tarObj.GetSkillList(); var tarBuffList = tarObj.GetBuffList(); //Target skill fix if (!tarObj.IsDead()) { if (tarSkillList != null) { foreach (var skillInfo in tarSkillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj); int skillId = tarObj.GetSkillID(skillInfo); if (skillLogic != null) { SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); if (damage.value >= 0) { skillLogic.OnBeHurt(tarObj, realSrcObj, damage, skillInfo, skillConfig); } else { skillLogic.OnBeHeal(tarObj, realSrcObj, damage, skillInfo, skillConfig); } } else { tarObj.LogInfo("something error in BattleModule.DamageTarget tar skill:[{0}]".F(skillId)); } } } //Target buff fix if (tarBuffList != null) { foreach (var buffInfo in tarBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj); int buffId = tarObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New buffConfig = tarObj.GetBuffConfig(buffId); if (damage.value >= 0) { buffLogic.OnBeHurt(tarObj, realSrcObj, damage, buffInfo, buffConfig); } else { buffLogic.OnBeHeal(tarObj, realSrcObj, damage, buffInfo, buffConfig); } } else { tarObj.LogInfo("something error in BattleModule.DamageTarget tar buff:[{0}]".F(buffId)); } } } } if (tarObj.IsDead()) { if (tarSkillList != null) { foreach (var skillInfo in tarSkillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj); int skillId = tarObj.GetSkillID(skillInfo); if (skillLogic != null) { SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); skillLogic.OnDie(tarObj, realSrcObj, skillInfo, skillConfig); } else { tarObj.LogInfo("something error in BattleModule.DamageTarget tar skill:[{0}]".F(skillId)); } } } //Target buff fix if (tarBuffList != null) { foreach (var buffInfo in tarBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj); int buffId = tarObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New buffConfig = tarObj.GetBuffConfig(buffId); buffLogic.OnDie(tarObj, realSrcObj, buffInfo, buffConfig); } else { tarObj.LogInfo("something error in BattleModule.DamageTarget tar buff:[{0}]".F(buffId)); } } } bool ret = tarObj.OnDie(realSrcObj); } }
private static BuffLogic GetBuffLogic(BuffInfo_New buffInfo, SkillObj logObj) { int buffId = logObj.GetBuffID(buffInfo); BuffConfig_New buffConfig = logObj.GetBuffConfig(buffId); if (buffConfig == null) { logObj.LogInfo("BuffConfig not found buffId[{0}]".F(buffId)); return null; } string buffLogicId = logObj.GetBuffLogicId(buffConfig); if (!BuffLogics.ContainsKey(buffLogicId)) { logObj.LogInfo("BuffLogic not found buffId[{0}] buffLogicId[{1}]".F(buffId, buffLogicId)); return null; } BuffLogic buffLogic = BuffLogics[buffLogicId]; return buffLogic; }
public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig); if (ret == LogicStateTickRet.TimeFinish) { return(ret); } double effectTickTime = self.GetBuffStateDoubleParam(buffConfig, key_EffectTickTime, self.GetBuffStateIndex(buffInfo)); if (effectTickTime < 0) { self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Effect effectTickTime< 0".F(self.GetID(), self.GetBuffID(buffInfo))); return(LogicStateTickRet.TimeFinish); } self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime()); var leftTickTime = self.GetBuffStateDoubleParam(buffInfo, key_ticlLeftTime_BuffInfo); if (leftTickTime - self.GetBuffStateTime(buffInfo) >= effectTickTime) { self.SetBuffStateDoubleParam(buffInfo, key_ticlLeftTime_BuffInfo, leftTickTime - effectTickTime); self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Effect".F(self.GetID(), self.GetBuffID(buffInfo))); ret = LogicStateTickRet.OnEffect; } else if (self.GetBuffStateTime(buffInfo) <= 0) { ret = LogicStateTickRet.NextState; self.LogInfo("TickBuffState:buffObj[{0}] buff:[{1}] Tick Finish".F(self.GetID(), self.GetBuffID(buffInfo))); } else { ret = LogicStateTickRet.None; } return(ret); }
public static bool AddBuff(SkillObj tarObj, SkillObj srcObj, int newBuffId, BattleReason reason) { if (tarObj == null) { return(false); } var buffConfig = tarObj.GetBuffConfig(newBuffId); if (buffConfig == null) { return(false); } var buffSuperpositionLogicId = tarObj.GetBuffSuperpositionLogicId(buffConfig); if (!BuffSuperpositionLogics.ContainsKey(buffSuperpositionLogicId)) { return(false); } BuffSuperpositionLogic buffSuperpositionLogic = BuffSuperpositionLogics[buffSuperpositionLogicId]; var buffRet = buffSuperpositionLogic.OnBuffSuperposition(tarObj, srcObj, reason, buffConfig); BuffInfo_New buff = buffRet.buff; if (buffRet.bType == BuffSuperpositionType.Refresh) { var buffLogicId = tarObj.GetBuffLogicId(buffConfig); if (!BuffLogics.ContainsKey(buffLogicId)) { return(false); } BuffLogic buffLogic = BuffLogics[buffLogicId]; buffLogic.InitBuffInfo(tarObj, srcObj, reason, buff, buffConfig, false); } else if (buffRet.bType == BuffSuperpositionType.Add) { var buffLogicId = tarObj.GetBuffLogicId(buffConfig); if (!BuffLogics.ContainsKey(buffLogicId)) { return(false); } BuffLogic buffLogic = BuffLogics[buffLogicId]; buffLogic.InitBuffInfo(tarObj, srcObj, reason, buff, buffConfig); //先从src方进行修正 if (srcObj != null) { var srcSkillList = srcObj.GetSkillList(); var srcBuffList = srcObj.GetBuffList(); if (srcSkillList != null) { foreach (var skillInfo in srcSkillList) { int skillId = srcObj.GetSkillID(skillInfo); SkillConfig_New skillConfig = srcObj.GetSkillConfig(skillId); var logic = GetSkillLogic(skillInfo, srcObj); logic.OnSendBuff(tarObj, srcObj, buff, skillInfo, skillConfig); } } if (srcBuffList != null) { foreach (var buffInfo in srcBuffList) { int buffId = srcObj.GetBuffID(buffInfo); BuffConfig_New srcBuffConfig = srcObj.GetBuffConfig(buffId); var logic = GetBuffLogic(buffInfo, srcObj); logic.OnSendBuff(tarObj, srcObj, buff, buffInfo, srcBuffConfig); } } } { var tarSkillList = tarObj.GetSkillList(); var tarBuffList = tarObj.GetBuffList(); if (tarSkillList != null) { foreach (var skillInfo in tarSkillList) { int skillId = tarObj.GetSkillID(skillInfo); SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); var logic = GetSkillLogic(skillInfo, tarObj); logic.OnAttachBuff(tarObj, srcObj, buff, skillInfo, skillConfig); } } if (tarBuffList != null) { foreach (var buffInfo in tarBuffList) { int buffId = tarObj.GetBuffID(buffInfo); BuffConfig_New tarBuffConfig = tarObj.GetBuffConfig(buffId); var logic = GetBuffLogic(buffInfo, tarObj); logic.OnAttachBuff(tarObj, srcObj, buff, buffInfo, tarBuffConfig); } } } buffLogic.OnAttach(tarObj, srcObj, buff, buffConfig); tarObj.AddTempBuffList(buff); } tarObj.NotifyBuffInfo(buff, BattleInfoNotifyType.All_Buff, BattleNotifyTime.TickEnd); return(true); }
/// <summary> /// 技能的late tick,这是处理一些技能时间到,buff时间到之后的后续处理,需要手动调用 /// </summary> /// <param name="self"></param> public static void Tick_Battle_Late(SkillObj self) { self.Tick_Battle_Late(); //这个时候已经不再使用buff的迭代器,可以改变集合了,因为这里边的buff已经认为是被加在角色身上了,所以需要有后续处理得先加进去 foreach (var b in self.GetTempBuffList()) { self.AddBuffList(b); } self.ClearTempBuffList(); IEnumerable<BuffInfo_New> detachBuffs = null; if (self.IsDead()) { detachBuffs = self.RemoveAllBuffs((b) => true); self.RemoveAllSkills((s) => true); self.RemoveAllCDKey((c) => true); }else { detachBuffs = self.RemoveAllBuffs(b => self.GetBuffTime(b) <= 0); self.RemoveAllSkills(s => self.GetSkillTime(s) <= 0); self.RemoveAllCDKey(s => self.GetCD(s) <= 0); } foreach (var delBuf in detachBuffs) { var buffConfig = self.GetBuffConfig(self.GetBuffID(delBuf)); if (buffConfig == null) { continue; } //foreach (var buff in GetTankData().BuffInfos) { BattleModule.DetachBuff(self, null, delBuf, buffConfig); } } }
/// <summary> /// 单人技能的tick,这个需要手动调用 /// </summary> /// <param name="self"></param> public static void Tick_Battle(SkillObj self) { if (self.IsDead()) { return; } var skillList = self.GetSkillList(true); var buffList = self.GetBuffList(true); var CDKeyList = self.GetCDKeyList(); //buff if (buffList != null) { foreach (var buffInfo in buffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, self); if (buffLogic != null) { int buffId = self.GetBuffID(buffInfo); BuffConfig_New buffConfig = self.GetBuffConfig(buffId); buffLogic.Tick(self, buffInfo, buffConfig); } else { self.LogInfo("something error {0}".F(self.GetBuffID(buffInfo))); } } } //技能 if (skillList != null) { foreach (var skillInfo in skillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, self); if (skillLogic != null) { int skillId = self.GetSkillID(skillInfo); SkillConfig_New skillConfig = self.GetSkillConfig(skillId); skillLogic.Tick(self, skillInfo, skillConfig); } else { self.LogInfo("something error2 {0}".F(self.GetSkillID(skillInfo))); } } } //CD if(CDKeyList != null) { foreach (var key in CDKeyList) { self.SetCD(key, self.GetCD(key) - self.GetDeltaTime()); } } }
public static SkillObj Summon(int id, SkillObj srcObj, SkillObj tarObj, SkillInfo_New skillInfo, SkillConfig_New skillConfig) { SkillObj summonObj = null; if (srcObj != null) { summonObj = srcObj.Summon(id, tarObj, skillInfo, skillConfig); var srcBuffList = srcObj.GetBuffList(); //Source buff fix if (srcBuffList != null) { foreach (var buffInfo in srcBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, srcObj); int buffId = srcObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New buffConfig = srcObj.GetBuffConfig(buffId); buffLogic.OnSummon(id, srcObj, summonObj, buffInfo, buffConfig); } else { srcObj.LogInfo("something error in BattleModule.Summon src buff:[{0}]".F(buffId)); } } } } return summonObj; }
public static bool RemoveBuff(SkillObj tarObj, SkillObj srcObj, int deleteBuffId, BattleReason reason) { if (tarObj == null) { return false; } var buffConfig = tarObj.GetBuffConfig(deleteBuffId); if (buffConfig == null) { return false; } var tarBuffList = tarObj.GetBuffList(); BuffInfo_New buff = null; foreach (var b in tarBuffList) { if (tarObj.GetBuffID(b) == deleteBuffId) { buff = b; break; } } if (buff == null) { return false; } //DetachBuff(tarObj, srcObj, buff, buffConfig); var buffLogicId = tarObj.GetBuffLogicId(buffConfig); if (!BuffLogics.ContainsKey(buffLogicId)) { return false; } BuffLogic buffLogic = BuffLogics[buffLogicId]; buffLogic.BuffOnEnd(tarObj, buff, buffConfig); ////先从src方进行修正 //if (srcObj != null) //{ // var srcSkillList = srcObj.GetSkillList(); // var srcBuffList = srcObj.GetBuffList(); // if (srcSkillList != null) // { // foreach (var skillInfo in srcSkillList) // { // int skillId = srcObj.GetSkillID(skillInfo); // SkillConfig_New skillConfig = srcObj.GetSkillConfig(skillId); // var logic = GetSkillLogic(skillInfo, srcObj); // logic.OnClearBuff(tarObj, srcObj, buff, skillInfo, skillConfig); // } // } // if (srcBuffList != null) // { // foreach (var buffInfo in srcBuffList) // { // int buffId = srcObj.GetBuffID(buffInfo); // BuffConfig_New srcBuffConfig = srcObj.GetBuffConfig(buffId); // var logic = GetBuffLogic(buffInfo, srcObj); // logic.OnClearBuff(tarObj, srcObj, buff, buffInfo, srcBuffConfig); // } // } //} //{ // var tarSkillList = tarObj.GetSkillList(); // if (tarSkillList != null) // { // foreach (var skillInfo in tarSkillList) // { // int skillId = tarObj.GetSkillID(skillInfo); // SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); // var logic = GetSkillLogic(skillInfo, tarObj); // logic.OnDetachBuff(tarObj, srcObj, buff, skillInfo, skillConfig); // } // } // if (tarBuffList != null) // { // foreach (var buffInfo in tarBuffList) // { // int buffId = tarObj.GetBuffID(buffInfo); // BuffConfig_New tarBuffConfig = tarObj.GetBuffConfig(buffId); // var logic = GetBuffLogic(buffInfo, tarObj); // logic.OnDetachBuff(tarObj, srcObj, buff, buffInfo, tarBuffConfig); // } // } //} //buffLogic.BuffOnEnd(tarObj, buff, buffConfig); return true; }
public static bool IsActionLimited(SkillObj self, ActionLimitType limit) { var skillList = self.GetSkillList(); var buffList = self.GetBuffList(); //buff if (buffList != null) { foreach (var buffInfo in buffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, self); if (buffLogic != null) { int buffId = self.GetBuffID(buffInfo); BuffConfig_New buffConfig = self.GetBuffConfig(buffId); if(buffLogic.IsActionLimited(self, limit, buffInfo, buffConfig)) { return true; } } else { self.LogInfo("something error {0}".F(self.GetBuffID(buffInfo))); } } } //技能 if (skillList != null) { foreach (var skillInfo in skillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, self); if (skillLogic != null) { int skillId = self.GetSkillID(skillInfo); SkillConfig_New skillConfig = self.GetSkillConfig(skillId); if (skillLogic.IsActionLimited(self, limit, skillInfo, skillConfig)) { return true; } } else { self.LogInfo("something error2 {0}".F(self.GetSkillID(skillInfo))); } } } return false; }
public static void DetachBuff(SkillObj tarObj, SkillObj srcObj, BuffInfo_New buff, BuffConfig_New buffConfig) { var buffLogicId = tarObj.GetBuffLogicId(buffConfig); if (!BuffLogics.ContainsKey(buffLogicId)) { return ; } BuffLogic buffLogic = BuffLogics[buffLogicId]; //先从src方进行修正 if (srcObj != null) { var srcSkillList = srcObj.GetSkillList(); var srcBuffList = srcObj.GetBuffList(); if (srcSkillList != null) { foreach (var skillInfo in srcSkillList) { int skillId = srcObj.GetSkillID(skillInfo); SkillConfig_New skillConfig = srcObj.GetSkillConfig(skillId); var logic = GetSkillLogic(skillInfo, srcObj); logic.OnClearBuff(tarObj, srcObj, buff, skillInfo, skillConfig); } } if (srcBuffList != null) { foreach (var buffInfo in srcBuffList) { int buffId = srcObj.GetBuffID(buffInfo); BuffConfig_New srcBuffConfig = srcObj.GetBuffConfig(buffId); var logic = GetBuffLogic(buffInfo, srcObj); logic.OnClearBuff(tarObj, srcObj, buff, buffInfo, srcBuffConfig); } } } { var tarSkillList = tarObj.GetSkillList(); var tarBuffList = tarObj.GetBuffList(); if (tarSkillList != null) { foreach (var skillInfo in tarSkillList) { int skillId = tarObj.GetSkillID(skillInfo); SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); var logic = GetSkillLogic(skillInfo, tarObj); logic.OnDetachBuff(tarObj, srcObj, buff, skillInfo, skillConfig); } } if (tarBuffList != null) { foreach (var buffInfo in tarBuffList.Where(b=>b.buff!=buff.buff)) { int buffId = tarObj.GetBuffID(buffInfo); BuffConfig_New tarBuffConfig = tarObj.GetBuffConfig(buffId); var logic = GetBuffLogic(buffInfo, tarObj); logic.OnDetachBuff(tarObj, srcObj, buff, buffInfo, tarBuffConfig); } } } buffLogic.BuffOnEnd(tarObj, buff, buffConfig); buffLogic.OnDetach(tarObj, srcObj, buff, buffConfig); }
public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig); if (ret == LogicStateTickRet.TimeFinish) { return(ret); } self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime()); //help harm 判断是否停留 int harmHelpType = self.GetBuffStateIntParam(buffConfig, Key_Int__BuffConfig, self.GetBuffStateIndex(buffInfo)); bool needNextState = false; switch (harmHelpType) { case 1: //这个是友好,没错 needNextState = self.GetCamp() != self.GetSrcCamp(buffInfo); break; case 2: //这个是友好,没错敌对 needNextState = self.GetCamp() == self.GetSrcCamp(buffInfo); break; } if (self.GetBuffStateTime(buffInfo) <= 0 || needNextState) { ret = LogicStateTickRet.NextState; self.LogInfo("ChargeState:buffObj[{0}] buff:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetBuffID(buffInfo))); } return(ret); }
private static void DamageFix(SkillObj tarObj, SkillObj srcObj, Damage damage) { if(tarObj == null) { return; } if(srcObj != null) { var srcSkillList = srcObj.GetSkillList(); var srcBuffList = srcObj.GetBuffList(); //Source skill fix if(srcSkillList != null) { foreach (var skillInfo in srcSkillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, srcObj); int skillId = srcObj.GetSkillID(skillInfo); if (skillLogic != null) { SkillConfig_New skillConfig = srcObj.GetSkillConfig(skillId); skillLogic.DamageTargetFix(srcObj, tarObj, damage, skillInfo, skillConfig); } else { srcObj.LogInfo("something error in BattleModule.DamageFix src skill:[{0}]".F(skillId)); } } } //Source buff fix if (srcBuffList != null) { foreach (var buffInfo in srcBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, srcObj); int buffId = srcObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New skillConfig = srcObj.GetBuffConfig(buffId); buffLogic.DamageTargetFix(srcObj, tarObj, damage, buffInfo, skillConfig); } else { srcObj.LogInfo("something error in BattleModule.DamageFix src buff:[{0}]".F(buffId)); } } } } { var tarBuffList = tarObj.GetBuffList(); var tarSkillList = tarObj.GetSkillList(); //Target skill fix if (tarSkillList != null) { foreach (var skillInfo in tarSkillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj); int skillId = tarObj.GetSkillID(skillInfo); if (skillLogic != null) { SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); skillLogic.BeHurtDamageFix(tarObj, srcObj, damage, skillInfo, skillConfig); } else { tarObj.LogInfo("something error in BattleModule.DamageFix tar skill:[{0}]".F(skillId)); } } } //Target buff fix if (tarBuffList != null) { foreach (var buffInfo in tarBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj); int buffId = tarObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New skillConfig = tarObj.GetBuffConfig(buffId); buffLogic.BeHurtDamageFix(tarObj, srcObj, damage, buffInfo, skillConfig); } else { tarObj.LogInfo("something error in BattleModule.DamageFix tar buff:[{0}]".F(buffId)); } } } } }
public static bool RemoveBuff(SkillObj tarObj, SkillObj srcObj, int deleteBuffId, BattleReason reason) { if (tarObj == null) { return(false); } var buffConfig = tarObj.GetBuffConfig(deleteBuffId); if (buffConfig == null) { return(false); } var tarBuffList = tarObj.GetBuffList(); BuffInfo_New buff = null; foreach (var b in tarBuffList) { if (tarObj.GetBuffID(b) == deleteBuffId) { buff = b; break; } } if (buff == null) { return(false); } //DetachBuff(tarObj, srcObj, buff, buffConfig); var buffLogicId = tarObj.GetBuffLogicId(buffConfig); if (!BuffLogics.ContainsKey(buffLogicId)) { return(false); } BuffLogic buffLogic = BuffLogics[buffLogicId]; buffLogic.BuffOnEnd(tarObj, buff, buffConfig); ////先从src方进行修正 //if (srcObj != null) //{ // var srcSkillList = srcObj.GetSkillList(); // var srcBuffList = srcObj.GetBuffList(); // if (srcSkillList != null) // { // foreach (var skillInfo in srcSkillList) // { // int skillId = srcObj.GetSkillID(skillInfo); // SkillConfig_New skillConfig = srcObj.GetSkillConfig(skillId); // var logic = GetSkillLogic(skillInfo, srcObj); // logic.OnClearBuff(tarObj, srcObj, buff, skillInfo, skillConfig); // } // } // if (srcBuffList != null) // { // foreach (var buffInfo in srcBuffList) // { // int buffId = srcObj.GetBuffID(buffInfo); // BuffConfig_New srcBuffConfig = srcObj.GetBuffConfig(buffId); // var logic = GetBuffLogic(buffInfo, srcObj); // logic.OnClearBuff(tarObj, srcObj, buff, buffInfo, srcBuffConfig); // } // } //} //{ // var tarSkillList = tarObj.GetSkillList(); // if (tarSkillList != null) // { // foreach (var skillInfo in tarSkillList) // { // int skillId = tarObj.GetSkillID(skillInfo); // SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); // var logic = GetSkillLogic(skillInfo, tarObj); // logic.OnDetachBuff(tarObj, srcObj, buff, skillInfo, skillConfig); // } // } // if (tarBuffList != null) // { // foreach (var buffInfo in tarBuffList) // { // int buffId = tarObj.GetBuffID(buffInfo); // BuffConfig_New tarBuffConfig = tarObj.GetBuffConfig(buffId); // var logic = GetBuffLogic(buffInfo, tarObj); // logic.OnDetachBuff(tarObj, srcObj, buff, buffInfo, tarBuffConfig); // } // } //} //buffLogic.BuffOnEnd(tarObj, buff, buffConfig); return(true); }
public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig); self.SetBuffTime(buffInfo, self.GetBuffTime(buffInfo) - self.GetDeltaTime()); if (self.GetBuffTime(buffInfo) <= 0) { ret = LogicStateTickRet.TimeFinish; self.LogInfo("BuffLogicState:buffObj[{0}] buff:[{1}] [{2}]".F(self.GetID(), self.GetBuffID(buffInfo), ret.ToString())); } return(ret); }
public static bool AddBuff(SkillObj tarObj, SkillObj srcObj, int newBuffId, BattleReason reason) { if (tarObj == null) { return false; } var buffConfig = tarObj.GetBuffConfig(newBuffId); if(buffConfig == null) { return false; } var buffSuperpositionLogicId = tarObj.GetBuffSuperpositionLogicId(buffConfig); if (!BuffSuperpositionLogics.ContainsKey(buffSuperpositionLogicId)) { return false; } BuffSuperpositionLogic buffSuperpositionLogic = BuffSuperpositionLogics[buffSuperpositionLogicId]; var buffRet = buffSuperpositionLogic.OnBuffSuperposition(tarObj, srcObj, reason, buffConfig); BuffInfo_New buff = buffRet.buff; if(buffRet.bType == BuffSuperpositionType.Refresh) { var buffLogicId = tarObj.GetBuffLogicId(buffConfig); if (!BuffLogics.ContainsKey(buffLogicId)) { return false; } BuffLogic buffLogic = BuffLogics[buffLogicId]; buffLogic.InitBuffInfo(tarObj, srcObj, reason, buff, buffConfig, false); } else if(buffRet.bType == BuffSuperpositionType.Add) { var buffLogicId = tarObj.GetBuffLogicId(buffConfig); if (!BuffLogics.ContainsKey(buffLogicId)) { return false; } BuffLogic buffLogic = BuffLogics[buffLogicId]; buffLogic.InitBuffInfo(tarObj, srcObj, reason, buff, buffConfig); //先从src方进行修正 if (srcObj != null) { var srcSkillList = srcObj.GetSkillList(); var srcBuffList = srcObj.GetBuffList(); if (srcSkillList != null) { foreach (var skillInfo in srcSkillList) { int skillId = srcObj.GetSkillID(skillInfo); SkillConfig_New skillConfig = srcObj.GetSkillConfig(skillId); var logic = GetSkillLogic(skillInfo, srcObj); logic.OnSendBuff(tarObj, srcObj, buff, skillInfo, skillConfig); } } if (srcBuffList != null) { foreach (var buffInfo in srcBuffList) { int buffId = srcObj.GetBuffID(buffInfo); BuffConfig_New srcBuffConfig = srcObj.GetBuffConfig(buffId); var logic = GetBuffLogic(buffInfo, srcObj); logic.OnSendBuff(tarObj, srcObj, buff, buffInfo, srcBuffConfig); } } } { var tarSkillList = tarObj.GetSkillList(); var tarBuffList = tarObj.GetBuffList(); if (tarSkillList != null) { foreach (var skillInfo in tarSkillList) { int skillId = tarObj.GetSkillID(skillInfo); SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); var logic = GetSkillLogic(skillInfo, tarObj); logic.OnAttachBuff(tarObj, srcObj, buff, skillInfo, skillConfig); } } if (tarBuffList != null) { foreach (var buffInfo in tarBuffList) { int buffId = tarObj.GetBuffID(buffInfo); BuffConfig_New tarBuffConfig = tarObj.GetBuffConfig(buffId); var logic = GetBuffLogic(buffInfo, tarObj); logic.OnAttachBuff(tarObj, srcObj, buff, buffInfo, tarBuffConfig); } } } buffLogic.OnAttach(tarObj, srcObj, buff, buffConfig); tarObj.AddTempBuffList(buff); } tarObj.NotifyBuffInfo(buff, BattleInfoNotifyType.All_Buff, BattleNotifyTime.TickEnd); return true; }
public override LogicStateTickRet Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { LogicStateTickRet ret = base.Tick(self, buffInfo, buffConfig); if (ret == LogicStateTickRet.TimeFinish) { return(ret); } self.SetBuffStateTime(buffInfo, self.GetBuffStateTime(buffInfo) - self.GetDeltaTime()); if (self.GetBuffStateTime(buffInfo) <= 0) { ret = LogicStateTickRet.NextState; self.LogInfo("ChargeState:buffObj[{0}] buff:[{1}] ShowEffectState Finish".F(self.GetID(), self.GetBuffID(buffInfo))); } return(ret); }
/// <summary> /// 造成伤害或治疗 /// </summary> /// <param name="tarObj"></param> /// <param name="srcObj"></param> /// <param name="damage">大于0是伤害,小于0是治疗</param> public static void DamageTarget(SkillObj tarObj, SkillObj srcObj, Damage damage) { SkillObj realSrcObj = srcObj; if(tarObj == null || tarObj.IsDead()) { return; } if(realSrcObj != null && damage.srcId > 0 && realSrcObj.GetID() != damage.srcId) { realSrcObj = tarObj.GetSkillObj(damage.srcId); } BattleModule.CalcDamage(tarObj, realSrcObj, damage); //先修正伤害 BattleModule.DamageFix(tarObj, realSrcObj, damage); //质量和造成伤害都是这个 //造成伤害 if(damage.value >= 0) { tarObj.OnDamage(damage, realSrcObj); } else { tarObj.OnDamage(damage, realSrcObj); } //检查技能与BUFF的相应触发 if (realSrcObj != null && !realSrcObj.IsDead()) { var srcSkillList = realSrcObj.GetSkillList(); var srcBuffList = realSrcObj.GetBuffList(); //Source skill fix if (srcSkillList != null) { foreach (var skillInfo in srcSkillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, realSrcObj); int skillId = realSrcObj.GetSkillID(skillInfo); if (skillLogic != null) { SkillConfig_New skillConfig = realSrcObj.GetSkillConfig(skillId); if (damage.value >= 0) { skillLogic.OnDamageTarget(realSrcObj, tarObj, damage, skillInfo, skillConfig); } else { skillLogic.OnHealTarget(realSrcObj, tarObj, damage, skillInfo, skillConfig); } } else { realSrcObj.LogInfo("something error in BattleModule.DamageTarget src skill:[{0}]".F(skillId)); } } } //Source buff fix if (srcBuffList != null) { foreach (var buffInfo in srcBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, realSrcObj); int buffId = realSrcObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New buffConfig = realSrcObj.GetBuffConfig(buffId); if (damage.value >= 0) { buffLogic.OnDamageTarget(realSrcObj, tarObj, damage, buffInfo, buffConfig); } else { buffLogic.OnHealTarget(realSrcObj, tarObj, damage, buffInfo, buffConfig); } } else { realSrcObj.LogInfo("something error in BattleModule.DamageTarget src buff:[{0}]".F(buffId)); } } } } var tarSkillList = tarObj.GetSkillList(); var tarBuffList = tarObj.GetBuffList(); //Target skill fix if(!tarObj.IsDead()) { if (tarSkillList != null) { foreach (var skillInfo in tarSkillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj); int skillId = tarObj.GetSkillID(skillInfo); if (skillLogic != null) { SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); if (damage.value >= 0) { skillLogic.OnBeHurt(tarObj, realSrcObj, damage, skillInfo, skillConfig); } else { skillLogic.OnBeHeal(tarObj, realSrcObj, damage, skillInfo, skillConfig); } } else { tarObj.LogInfo("something error in BattleModule.DamageTarget tar skill:[{0}]".F(skillId)); } } } //Target buff fix if (tarBuffList != null) { foreach (var buffInfo in tarBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj); int buffId = tarObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New buffConfig = tarObj.GetBuffConfig(buffId); if (damage.value >= 0) { buffLogic.OnBeHurt(tarObj, realSrcObj, damage, buffInfo, buffConfig); } else { buffLogic.OnBeHeal(tarObj, realSrcObj, damage, buffInfo, buffConfig); } } else { tarObj.LogInfo("something error in BattleModule.DamageTarget tar buff:[{0}]".F(buffId)); } } } } if (tarObj.IsDead()) { if (tarSkillList != null) { foreach (var skillInfo in tarSkillList) { SkillLogic skillLogic = GetSkillLogic(skillInfo, tarObj); int skillId = tarObj.GetSkillID(skillInfo); if (skillLogic != null) { SkillConfig_New skillConfig = tarObj.GetSkillConfig(skillId); skillLogic.OnDie(tarObj, realSrcObj, skillInfo, skillConfig); } else { tarObj.LogInfo("something error in BattleModule.DamageTarget tar skill:[{0}]".F(skillId)); } } } //Target buff fix if (tarBuffList != null) { foreach (var buffInfo in tarBuffList) { BuffLogic buffLogic = GetBuffLogic(buffInfo, tarObj); int buffId = tarObj.GetBuffID(buffInfo); if (buffLogic != null) { BuffConfig_New buffConfig = tarObj.GetBuffConfig(buffId); buffLogic.OnDie(tarObj, realSrcObj, buffInfo, buffConfig); } else { tarObj.LogInfo("something error in BattleModule.DamageTarget tar buff:[{0}]".F(buffId)); } } } bool ret = tarObj.OnDie(realSrcObj); } }
public virtual void Tick(SkillObj self, BuffInfo_New buffInfo, BuffConfig_New buffConfig) { if (!CommonCheck(self, buffInfo, buffConfig)) { return; } var logicState = BattleModule.GetBuffLogicState(buffInfo, self); if (logicState == null) { return; } var ret = logicState.Tick(self, buffInfo, buffConfig); switch (ret) { case LogicStateTickRet.TimeFinish: BuffOnEnd(self, buffInfo, buffConfig); break; case LogicStateTickRet.NextState: int index = self.GetBuffStateIndex(buffInfo); string nextStateName = self.GetLogicState(buffConfig, ++index); if (nextStateName == null || nextStateName.Equals("")) { BuffOnEnd(self, buffInfo, buffConfig); return; } var nextLogicState = BattleModule.GetBuffLogicState(nextStateName); if (nextLogicState == null) { self.LogInfo("startLogicState {0} not found".F(nextStateName)); return; } double fixTime = logicState.OnStateChanged(nextStateName, self, buffInfo, buffConfig); self.SetBuffStateIndex(buffInfo, index); nextLogicState.InitState(self, buffInfo, buffConfig, fixTime); self.NotifyBuffInfo(buffInfo, BattleInfoNotifyType.ChangeState_Buff, BattleNotifyTime.TickEnd); break; case LogicStateTickRet.OnEffect: //var srcObj = self.GetBuffSrcObj(buffInfo); { var targetSelectName = self.GetTargetSelect(buffConfig); var targetSelect = BattleModule.GetTargetSelect(targetSelectName); if (targetSelect == null) { self.LogInfo("targetSelect == null buffId:[{0}] targetSelectName:[{1}]".F(self.GetBuffID(buffInfo), targetSelectName)); return; } var targetTypeName = self.GetTargetType(buffConfig); var targetType = BattleModule.GetTargetType(targetTypeName); if (targetType == null) { self.LogInfo("targetSelect == null buffId:[{0}] targetType:[{1}]".F(self.GetBuffID(buffInfo), targetTypeName)); return; } var targets = BattleModule.GetTargets(self, targetSelect, targetType, buffInfo, buffConfig); foreach (var tar in targets) { OnEffect(self, tar, buffInfo, buffConfig); } } break; } }