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 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 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 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; }
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 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 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 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); }