protected void InitBuff(Buff buffData, EntityParent caster, EntityParent target, int fromSkillID, int elementType, bool isCommunicateMix = false) { double num = BattleCalculator.CalculateBuffTime(caster.BattleBaseAttrs.GetBuffCtrlAttrs(elementType), target.BattleBaseAttrs.GetBuffCtrlAttrs(elementType), (double)buffData.time); if (LocalAgent.CheckBuffByTargetIDAndBuffID(target.ID, buffData.id)) { int overlayModeId = buffData.overlayModeId; if (overlayModeId != 1) { if (overlayModeId == 2) { this.buffStateTable[target.ID][buffData.id].removeLeftTime = num; } } else { this.buffStateTable[target.ID][buffData.id].removeLeftTime += num; } return; } BuffState buffState = new BuffState(); buffState.isBlock = false; buffState.isCommunicateMix = isCommunicateMix; buffState.isGlobalBuff = false; buffState.casterID = caster.ID; buffState.fromSkillID = fromSkillID; buffState.fromSkillLevel = caster.GetSkillLevelByID(fromSkillID); buffState.fromSkillAttrChange = caster.GetSkillAttrChangeByID(fromSkillID); buffState.intervalDefaultTime = (float)buffData.interval; buffState.intervalLeftTime = (float)buffData.interval; buffState.removeLeftTime = num; if (!this.buffStateTable.ContainsKey(target.ID)) { this.buffStateTable.Add(target.ID, new XDict <int, BuffState>()); } this.buffStateTable[target.ID].Add(buffData.id, buffState); this.HandleBuff(buffData, caster, target, fromSkillID, buffState.fromSkillLevel, buffState.fromSkillAttrChange, isCommunicateMix); AddBuffAnnouncer.Announce(LocalAgent.GetEntityByID(target.ID), buffData.id); LocalBattleProtocolSimulator.SendAddBuff(caster.ID, target.ID, buffData.id, (int)num); }