public void AddNewModifier(string modifierName) { var modifier = ModifierManager.GetModifier(modifierName); //免疫的状态下要判断是否能加上buff if (!GetModifierState(Modifier_State.MODIFIER_STATE_INVULNERABLE) || (modifier.attributes & ModifierAttribute.MODIFIER_ATTRIBUTE_IGNORE_INVULNERABLE) > 0) { //判断buff是否能叠加 if ((modifier.attributes & ModifierAttribute.MODIFIER_ATTRIBUTE_MULTIPLE) > 0) { modifiers.Add(new BaseModifier(modifierName)); } else //不能叠加,就刷新buff { bool hasModifier = false; int count = modifiers.Count; for (int i = 0; i < count; i++) { if (modifiers[i].Name == modifier.name) { modifiers[i].ForceRefresh(); hasModifier = true; break; } } if (!hasModifier) { modifiers.Add(new BaseModifier(modifierName)); } } } //TriggerModifierEvent(ModifierEventType) }
public BaseModifier(string modifierName) { eventActions = new Dictionary <ModifierEventType, List <BaseAction> >(); properties = new Dictionary <Modifier_Property, AbilitySpecial>(); modifierParams = ModifierManager.GetModifier(modifierName); isAura = modifierParams.isAura; isOrb = eventActions.ContainsKey(ModifierEventType.Orb); if (isAura) { auraRadius = modifierParams.auraRadius; auraTarget = new EntityTarget(modifierParams.auraTargetTeam, modifierParams.auraTargetType, modifierParams.auraTargetFlags); } //name = modifierName; }