protected void AppRemoveBuff(int buffID, long targetID) { if (LocalAgent.CheckBuffByTargetIDAndBuffID(targetID, buffID)) { this.OnLeaveBuff(buffID, targetID); } }
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); }
protected bool CheckAddGlobalBuff(Buff buffData, EntityParent caster, EntityParent target) { if (buffData == null) { return(false); } if (caster == null) { return(false); } if (target == null) { return(false); } if (!EntityWorld.Instance.TargetTypeFilter <EntityParent>(target, caster, buffData.globalTarget)) { return(false); } if (!BattleCalculator.CalculateAddBuff(caster.BattleBaseAttrs, target.BattleBaseAttrs, (double)buffData.buffProp, 0)) { return(false); } XDict <int, BuffState> buffListByEntityID = this.GetBuffListByEntityID(target.ID); if (buffListByEntityID == null) { return(false); } for (int i = 0; i < buffListByEntityID.Count; i++) { if (LocalAgent.GetBuffDataByID(buffListByEntityID.ElementKeyAt(i)).resist.Contains(buffData.type)) { return(false); } } for (int j = 0; j < buffListByEntityID.Count; j++) { if (LocalAgent.GetBuffDataByID(buffListByEntityID.ElementKeyAt(j)).resistId.Contains(buffData.id)) { return(false); } } List <int> list = new List <int>(); for (int k = 0; k < buffListByEntityID.Count; k++) { if (LocalAgent.GetBuffDataByID(buffListByEntityID.ElementKeyAt(k)).cover.Contains(buffData.type)) { list.Add(buffListByEntityID.ElementKeyAt(k)); } } for (int l = 0; l < list.get_Count(); l++) { this.AppRemoveBuff(list.get_Item(l), target.ID); } list.Clear(); for (int m = 0; m < buffListByEntityID.Count; m++) { if (buffData.delete.Contains(LocalAgent.GetBuffDataByID(buffListByEntityID.ElementKeyAt(m)).type)) { list.Add(buffListByEntityID.ElementKeyAt(m)); } } for (int n = 0; n < list.get_Count(); n++) { this.AppRemoveBuff(list.get_Item(n), target.ID); } if (LocalAgent.CheckBuffByTargetIDAndBuffID(target.ID, buffData.id)) { int overlayModeId = buffData.overlayModeId; if (overlayModeId != 1 && overlayModeId != 2) { this.AppRemoveBuff(buffData.id, target.ID); } } return(true); }
protected bool CheckBuff(Buff buffData, EntityParent caster, EntityParent target, int fromSkillID, int elementType, bool isCommunicateMix = false) { if (buffData == null) { return(false); } if (caster == null) { return(false); } if (target == null) { return(false); } if (LocalAgent.GetSpiritIsDead(target, isCommunicateMix)) { return(false); } if (!target.IsFighting) { return(false); } if (!BattleCalculator.CalculateAddBuff(caster.BattleBaseAttrs, target.BattleBaseAttrs, (double)buffData.buffProp, elementType)) { return(false); } XDict <int, BuffState> buffListByEntityID = this.GetBuffListByEntityID(target.ID); if (buffListByEntityID == null) { return(false); } for (int i = 0; i < buffListByEntityID.Count; i++) { if (LocalAgent.GetBuffDataByID(buffListByEntityID.ElementKeyAt(i)).resist.Contains(buffData.type)) { return(false); } } for (int j = 0; j < buffListByEntityID.Count; j++) { if (LocalAgent.GetBuffDataByID(buffListByEntityID.ElementKeyAt(j)).resistId.Contains(buffData.id)) { return(false); } } List <int> list = new List <int>(); for (int k = 0; k < buffListByEntityID.Count; k++) { if (LocalAgent.GetBuffDataByID(buffListByEntityID.ElementKeyAt(k)).cover.Contains(buffData.type)) { list.Add(buffListByEntityID.ElementKeyAt(k)); } } for (int l = 0; l < buffListByEntityID.Count; l++) { if (LocalAgent.GetBuffDataByID(buffListByEntityID.ElementKeyAt(l)).coverId.Contains(buffData.id)) { list.Add(buffListByEntityID.ElementKeyAt(l)); } } for (int m = 0; m < list.get_Count(); m++) { this.AppRemoveBuff(list.get_Item(m), target.ID); } list.Clear(); for (int n = 0; n < buffListByEntityID.Count; n++) { if (buffData.delete.Contains(LocalAgent.GetBuffDataByID(buffListByEntityID.ElementKeyAt(n)).type)) { list.Add(buffListByEntityID.ElementKeyAt(n)); } } for (int num = 0; num < list.get_Count(); num++) { this.AppRemoveBuff(list.get_Item(num), target.ID); } if (LocalAgent.CheckBuffByTargetIDAndBuffID(target.ID, buffData.id)) { int overlayModeId = buffData.overlayModeId; if (overlayModeId != 1 && overlayModeId != 2) { this.AppRemoveBuff(buffData.id, target.ID); } } return(true); }