public void OnModifierAdded(Unit sender, Modifier modifier) { if (!Menu.Hotkeys.EnabledEvader) { return; } Debugger.WriteLine("====", Debugger.Type.Modifiers); Debugger.WriteLine("modifier name: " + modifier.Name, Debugger.Type.Modifiers); Debugger.WriteLine("modifier tname: " + modifier.TextureName, Debugger.Type.Modifiers); Debugger.WriteLine("sender: " + sender.Name, Debugger.Type.Modifiers); Debugger.WriteLine("e time: " + modifier.ElapsedTime, Debugger.Type.Modifiers); Debugger.WriteLine("r time: " + modifier.RemainingTime, Debugger.Type.Modifiers); string name; if (AdditionalAbilityData.ModifierThinkers.TryGetValue(modifier.Name, out name)) { var ability = abilityUpdater.EvadableAbilities.FirstOrDefault(x => x.Name == name && x.Enabled) as IModifierObstacle; ability?.AddModifierObstacle(modifier, sender); return; } var hero = sender as Hero; if (hero == null) { return; } var abilityName = modifier.AbilityName(); if (string.IsNullOrEmpty(abilityName)) { return; } var modifierAbility = abilityUpdater.EvadableAbilities.FirstOrDefault( x => x.ModifierCounterEnabled && x.Name == abilityName && x.TimeSinceCast() < 0.5) as IModifier; modifierAbility?.AddModifer(modifier, hero); }
public void OnModifierRemoved(Modifier modifier) { Debugger.WriteLine("====", Debugger.Type.Modifiers); Debugger.WriteLine("- modifier name: " + modifier.Name, Debugger.Type.Modifiers); Debugger.WriteLine("- modifier tname: " + modifier.TextureName, Debugger.Type.Modifiers); Debugger.WriteLine("- modifier owner: " + modifier.Owner.Name, Debugger.Type.Modifiers); var abilityName = modifier.AbilityName(); if (string.IsNullOrEmpty(abilityName)) { return; } var modifierAbility = abilityUpdater.EvadableAbilities.OfType <IModifier>() .FirstOrDefault(x => x.ModifierHandle == modifier.Handle); modifierAbility?.RemoveModifier(modifier); }