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