private void TargetingAddMonsterbtn_Click(object sender, RoutedEventArgs e) { try { if (!String.IsNullOrEmpty(TargetingAddMonsterTxt.Text)) { TargetinRule targetingRule = new TargetinRule(); targetingRule.MonsterName = TargetingAddMonsterTxt.Text; TargetSetting settingOne = new TargetSetting(); settingOne.Name = String.Format("Settings {0}", targetingRule.Settings.Count + 1); targetingRule.Settings.Add(settingOne); Targeting.Instance.TargetingRules.Add(targetingRule); TargetingAddMonsterTxt.Text = ""; } } catch { } }
public TargetingEventArgs(TargetinRule TargetingRule, Creature Creature, Collection<Creature> Creatures) { _targetingRule = TargetingRule; _creature = Creature; _creatures = Creatures; }
public void ExecuteRule(Creature creature, TargetinRule targetingRule, int settingID) { OnTargetingRuleExecute(new TargetingEventArgs(null, creature)); Targeter.Instance.Target = creature; Targeter.Instance.Rule = targetingRule.Settings[settingID]; Targeter.Instance.Attack(); }
public TargetingEventArgs(TargetinRule TargetingRule, Creature Creature) { _targetingRule = TargetingRule; _creature = Creature; }
public bool RuleMatch(ref Collection<Creature> creatures, TargetinRule targetingRule, out int settingID) { settingID = -1; try { TargetState = TargetingState.CheckingRule; if (creatures.Where(c => c.Name.ToLower() == targetingRule.MonsterName.ToLower()).Count() == 0) return false; if (creatures.Where(c => c.Name.ToLower() == targetingRule.MonsterName.ToLower()).Count() < targetingRule.Count) return false; List<Creature> creaturesToCheck = creatures.Where(c => c.Name.ToLower() == targetingRule.MonsterName.ToLower()).ToList(); foreach (TargetSetting t in targetingRule.Settings) { if (creaturesToCheck.Any(c => c.HPBar >= t.HpRangeMin && c.HPBar <= t.HpRangeMax)) { settingID = targetingRule.Settings.IndexOf(t); break; } } if (settingID == -1) return false; return true; } catch (InvalidOperationException ex) { Helpers.Debug.Report(ex); } return false; }