public InsertData(string etat, Reductions ele, ReductionsViewModel view) { InitializeComponent(); this.DataContext = viewVM = view; Etat = etat; if (etat == "AJOUT") { this.Title = "Enregistrement d'un Quartier"; } else { this.Title = "Modification d'un Quartier"; } }
public void AddTransistion(ISymbol symbol, DottedRuleSet target) { if (symbol.SymbolType == SymbolType.NonTerminal) { if (!Reductions.ContainsKey(symbol)) { _reductions.Add(symbol, target); } } else if (symbol.SymbolType == SymbolType.LexerRule) { var lexerRule = symbol as ILexerRule; if (!Scans.ContainsKey(lexerRule)) { _tokenTransitions.Add(lexerRule.TokenType, target); _scans.Add(lexerRule, target); _scanKeys.Add(lexerRule); } } }
public bool HasStagnated() { double[] errorReductions = CalcRelativeErrorReductions(); if (errorReductions == null) { return(false); // Not enough data yet } double relativeImprovement = Reductions.Average(Vector.CreateFromArray(errorReductions)); if (relativeImprovementTolerance == -1) { relativeImprovementTolerance = 1E-3 * CalcInitialErrorReduction(); } if (relativeImprovement <= relativeImprovementTolerance) { return(true); } else { return(false); } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { //if (GlobalData.VerificationDroit("CanAddReductions")) //{ var result = MessageBox.Show("Voulez vous vraiment supprimer ?", "Message", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { if (dataGrid.SelectedItem != null) { try { viewM = this.Main.DataContext as ReductionsViewModel; Reductions ent = dataGrid.SelectedItem as Reductions; ent.Etat = "SUPPRIMER"; viewM.model.SaveChanges(); viewM.Refresh(); MessageBox.Show("Opération effectuée avec succès", "Reductions", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Reductions", MessageBoxButton.OK, MessageBoxImage.Warning); viewM.Refresh(); } } else { MessageBox.Show("Aucune ligne selectionnée dans la liste", "Reductions", MessageBoxButton.OK, MessageBoxImage.Warning); } } //} }
private void btnValider_Click(object sender, RoutedEventArgs e) { try { ReductionsViewModel vm = this.DataContext as ReductionsViewModel; Reductions ent = vm.SelectedData; if (Etat == "AJOUT") { try { if (prct.IsChecked == true) { ent.Type = 2; } else { ent.Type = 1; } if (open.IsChecked == true) { ent.OpenReduction = true; } else { ent.OpenReduction = false; } ent.Etat = "ACTIF"; ent.idHotel = 1; viewVM.model.Reductions.Add(ent); viewVM.model.SaveChanges(); Msg = "OK"; this.Close(); } catch (Exception ex) { Msg = "Error"; ErrorMsg = ex.Message; } } else { try { viewVM.model.SaveChanges(); Msg = "OK"; this.Close(); } catch (Exception ex) { Msg = "Error"; ErrorMsg = ex.Message; } } } catch (Exception) { } }
static DamageReductions() { #region Reductions Reductions.Add(new DamageReduction { BuffName = "SummonerExhaust", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(40); } }); Reductions.Add(new DamageReduction { BuffName = "itemphantomdancerdebuff", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { var phantomdancerBuff = source.GetBuff("itemphantomdancerdebuff"); if (phantomdancerBuff?.Caster.NetworkId == attacker?.NetworkId) { return(12); } return(0); } }); Reductions.Add(new DamageReduction { BuffName = "braumeshieldbuff", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(new[] { 30, 32.5, 35, 37.5, 40 }[source.SpellBook.GetSpell(SpellSlot.E).Level - 1]); } }); Reductions.Add(new DamageReduction { BuffName = "GalioW", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(new[] { 20, 25, 30, 35, 40 }[source.SpellBook.GetSpell(SpellSlot.W).Level - 1] +8 * (source.BonusSpellBlock / 100)); } }); Reductions.Add(new DamageReduction { BuffName = "GarenW", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { var objects = ObjectManager.Get <GameObject>().Where(o => o.IsValid && o.Name == "Garen_Base_W_Shoulder_L.troy"); if (objects.Any(o => ObjectManager.Get <Obj_AI_Hero>().Where(t => t.Team == o.Team).MinBy(t => t.Distance(o)) == source)) { return(60); } return(30); } }); Reductions.Add(new DamageReduction { BuffName = "gragaswself", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(new[] { 10, 12, 14, 16, 18 }[source.SpellBook.GetSpell(SpellSlot.W).Level - 1]); } }); Reductions.Add(new DamageReduction { BuffName = "Meditate", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(new[] { 50, 55, 60, 65, 70 }[source.SpellBook.GetSpell(SpellSlot.W).Level - 1] / (attacker is Obj_AI_Turret ? 2 : 1f)); } }); Reductions.Add(new DamageReduction { BuffName = "VoidStone", DamageType = DamageType.Magical, Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(15); } }); Reductions.Add(new DamageReduction { BuffName = "FerociousHowl", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(new[] { 55, 65, 75 }[source.SpellBook.GetSpell(SpellSlot.R).Level - 1]); } }); Reductions.Add(new DamageReduction { BuffName = "sonapassivedebuff", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { var sonapassivedebuff = source.GetBuff("sonapassivedebuff"); if (sonapassivedebuff != null) { var caster = sonapassivedebuff.Caster as Obj_AI_Hero; if (caster != null) { return(25 + 4 * (caster.TotalAbilityDamage / 100)); } } return(0); } }); #endregion }
static DamageReductions() { #region Reductions Reductions.Add(new DamageReduction { BuffName = "SummonerExhaust", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(40); } }); Reductions.Add(new DamageReduction { BuffName = "itemphantomdancerdebuff", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { var phantomdancerBuff = source.GetBuff("itemphantomdancerdebuff"); if (phantomdancerBuff?.Caster.NetworkId == attacker?.NetworkId) { return(12); } return(0); } }); Reductions.Add(new DamageReduction { BuffName = "braumeshieldbuff", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(new[] { 30, 32.5, 35, 37.5, 40 }[source.Spellbook.GetSpell(SpellSlot.E).Level - 1]); } }); Reductions.Add(new DamageReduction { BuffName = "GalioW", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(new[] { 20, 25, 30, 35, 40 }[source.Spellbook.GetSpell(SpellSlot.W).Level - 1] +8 * (source.SpellBlock - source.CharData.SpellBlock / 100)); } }); Reductions.Add(new DamageReduction { BuffName = "GarenW", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { if (ObjectManager.Get <GameObject>().Any(p => p.IsAlly && p.Name == "Garen_Base_W_Shoulder_L.troy")) { return(60); } return(30); } }); Reductions.Add(new DamageReduction { BuffName = "gragaswself", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(new[] { 10, 12, 14, 16, 18 }[source.Spellbook.GetSpell(SpellSlot.W).Level - 1]); } }); Reductions.Add(new DamageReduction { BuffName = "Meditate", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(new[] { 50, 55, 60, 65, 70 }[source.Spellbook.GetSpell(SpellSlot.W).Level - 1] / (attacker is Obj_AI_Turret ? 2 : 1f)); } }); Reductions.Add(new DamageReduction { BuffName = "VoidStone", DamageType = Damage.DamageType.Magical, Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(15); } }); Reductions.Add(new DamageReduction { BuffName = "FerociousHowl", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { return(new[] { 55, 65, 75 }[source.Spellbook.GetSpell(SpellSlot.R).Level - 1]); } }); Reductions.Add(new DamageReduction { BuffName = "sonapassivedebuff", Type = DamageReduction.ReductionDamageType.Percent, ReductionDamage = (source, attacker) => { var sonapassivedebuff = source.GetBuff("sonapassivedebuff"); if (sonapassivedebuff != null) { var caster = sonapassivedebuff.Caster as AIHeroClient; if (caster != null) { return(25 + 4 * (caster.BaseAbilityDamage / 100)); } } return(0); } }); #endregion }