public GoapAgent(ILogger logger, GoapAgentState goapAgentState, ConfigurableInput input, AddonReader addonReader, HashSet <GoapGoal> availableGoals, IBlacklist blacklist) { this.logger = logger; this.GoapAgentState = goapAgentState; this.input = input; this.addonReader = addonReader; this.playerReader = addonReader.PlayerReader; this.addonReader.CreatureHistory.KillCredit -= OnKillCredit; this.addonReader.CreatureHistory.KillCredit += OnKillCredit; this.stopMoving = new StopMoving(input, playerReader); this.AvailableGoals = availableGoals.OrderBy(a => a.CostOfPerformingAction); this.blacklist = blacklist; this.planner = new GoapPlanner(logger); }
private void OnKillCredit(object obj, EventArgs e) { if (Active) { GoapAgentState.IncKillCount(); if (CurrentGoal == null) { AvailableGoals.ToList().ForEach(x => x.OnActionEvent(this, new ActionEventArgs(GoapKey.producedcorpse, true))); } else { CurrentGoal.OnActionEvent(this, new ActionEventArgs(GoapKey.producedcorpse, true)); } logger.LogInformation($"{GetType().Name} --- Kill credit detected! Known kills: {GoapAgentState.LastCombatKillCount} | Combat mobs remaing: {addonReader.CombatCreatureCount}"); } else { logger.LogInformation($"{GetType().Name} --- Not active, but kill credit detected!"); } }