public override void CheckSuccess(CombatData combatData, AgentData agentData, FightData fightData, HashSet <AgentItem> playerAgents)
 {
     base.CheckSuccess(combatData, agentData, fightData, playerAgents);
     if (!fightData.Success)
     {
         NPC desmina = Targets.Find(x => x.ID == (int)ParseEnum.TargetIDS.Desmina);
         if (desmina == null)
         {
             throw new InvalidOperationException("Error Encountered: Desmina not found");
         }
         ExitCombatEvent ooc = combatData.GetExitCombatEvents(desmina.AgentItem).LastOrDefault();
         if (ooc != null)
         {
             long time = 0;
             foreach (NPC mob in TrashMobs.Where(x => x.ID == (int)SpiritHorde3))
             {
                 DespawnEvent dspwnHorde = combatData.GetDespawnEvents(mob.AgentItem).LastOrDefault();
                 if (dspwnHorde != null)
                 {
                     time = Math.Max(dspwnHorde.Time, time);
                 }
             }
             DespawnEvent dspwn = combatData.GetDespawnEvents(desmina.AgentItem).LastOrDefault();
             if (time != 0 && dspwn == null && time <= desmina.LastAware)
             {
                 fightData.SetSuccess(true, time);
             }
         }
     }
 }
 internal override void CheckSuccess(CombatData combatData, AgentData agentData, FightData fightData, IReadOnlyCollection <AgentItem> playerAgents)
 {
     base.CheckSuccess(combatData, agentData, fightData, playerAgents);
     if (!fightData.Success)
     {
         AgentItem desmina = agentData.GetNPCsByID((int)ArcDPSEnums.TargetID.Desmina).FirstOrDefault();
         if (desmina == null)
         {
             throw new MissingKeyActorsException("Desmina not found");
         }
         ExitCombatEvent ooc = combatData.GetExitCombatEvents(desmina).LastOrDefault();
         if (ooc != null)
         {
             long time = 0;
             foreach (NPC mob in TrashMobs)
             {
                 time = Math.Max(mob.LastAware, time);
             }
             DespawnEvent dspwn = combatData.GetDespawnEvents(desmina).LastOrDefault();
             if (time != 0 && dspwn == null && time + 500 <= desmina.LastAware)
             {
                 if (!AtLeastOnePlayerAlive(combatData, fightData, time, playerAgents))
                 {
                     return;
                 }
                 fightData.SetSuccess(true, time);
             }
         }
     }
 }
示例#3
0
 public override void CheckSuccess(CombatData combatData, AgentData agentData, FightData fightData, HashSet <AgentItem> playerAgents)
 {
     base.CheckSuccess(combatData, agentData, fightData, playerAgents);
     if (!fightData.Success && _specialSplitLogTime > 0)
     {
         Target target = Targets.Find(x => x.ID == TriggerID);
         if (target == null)
         {
             throw new InvalidOperationException("Target for success by combat exit not found");
         }
         List <AttackTargetEvent> attackTargets = combatData.GetAttackTargetEvents(target.AgentItem);
         if (attackTargets.Count == 0)
         {
             return;
         }
         long      specialSplitTime         = fightData.ToFightSpace(_specialSplitLogTime);
         AgentItem attackTarget             = attackTargets.Last().AttackTarget;
         List <ExitCombatEvent> playerExits = new List <ExitCombatEvent>();
         foreach (AgentItem a in playerAgents)
         {
             playerExits.AddRange(combatData.GetExitCombatEvents(a));
         }
         ExitCombatEvent     lastPlayerExit     = playerExits.Count > 0 ? playerExits.MaxBy(x => x.Time) : null;
         TargetableEvent     notAttackableEvent = combatData.GetTargetableEvents(attackTarget).LastOrDefault(x => !x.Targetable && x.Time > specialSplitTime);
         AbstractDamageEvent lastDamageTaken    = combatData.GetDamageTakenData(target.AgentItem).LastOrDefault(x => (x.Damage > 0) && (playerAgents.Contains(x.From) || playerAgents.Contains(x.MasterFrom)));
         if (notAttackableEvent != null && lastDamageTaken != null && lastPlayerExit != null)
         {
             fightData.SetSuccess(lastPlayerExit.Time > notAttackableEvent.Time + 1000, fightData.ToLogSpace(lastDamageTaken.Time));
         }
     }
 }
        protected static void SetSuccessByCombatExit(List <NPC> targets, CombatData combatData, FightData fightData, HashSet <AgentItem> playerAgents)
        {
            if (targets.Count == 0)
            {
                return;
            }
            var playerExits       = new List <ExitCombatEvent>();
            var targetExits       = new List <ExitCombatEvent>();
            var lastTargetDamages = new List <AbstractDamageEvent>();

            foreach (AgentItem a in playerAgents)
            {
                playerExits.AddRange(combatData.GetExitCombatEvents(a));
            }
            foreach (NPC t in targets)
            {
                EnterCombatEvent enterCombat = combatData.GetEnterCombatEvents(t.AgentItem).LastOrDefault();
                if (enterCombat != null)
                {
                    targetExits.AddRange(combatData.GetExitCombatEvents(t.AgentItem).Where(x => x.Time > enterCombat.Time));
                }
                else
                {
                    targetExits.AddRange(combatData.GetExitCombatEvents(t.AgentItem));
                }
                AbstractDamageEvent lastDamage = combatData.GetDamageTakenData(t.AgentItem).LastOrDefault(x => (x.Damage > 0) && playerAgents.Contains(x.From.GetFinalMaster()));
                if (lastDamage != null)
                {
                    lastTargetDamages.Add(lastDamage);
                }
            }
            ExitCombatEvent     lastPlayerExit  = playerExits.Count > 0 ? playerExits.MaxBy(x => x.Time) : null;
            ExitCombatEvent     lastTargetExit  = targetExits.Count > 0 ? targetExits.MaxBy(x => x.Time) : null;
            AbstractDamageEvent lastDamageTaken = lastTargetDamages.Count > 0 ? lastTargetDamages.MaxBy(x => x.Time) : null;

            if (lastTargetExit != null && lastDamageTaken != null)
            {
                if (lastPlayerExit != null)
                {
                    fightData.SetSuccess(lastPlayerExit.Time > lastTargetExit.Time + 1000, lastDamageTaken.Time);
                }
                else if (fightData.FightEnd > targets.Max(x => x.LastAware) + 2000)
                {
                    fightData.SetSuccess(true, lastDamageTaken.Time);
                }
            }
        }
示例#5
0
        protected static void SetSuccessByCombatExit(List <AbstractSingleActor> targets, CombatData combatData, FightData fightData, IReadOnlyCollection <AgentItem> playerAgents)
        {
            if (targets.Count == 0)
            {
                return;
            }
            var targetExits       = new List <ExitCombatEvent>();
            var lastTargetDamages = new List <AbstractHealthDamageEvent>();

            foreach (AbstractSingleActor t in targets)
            {
                EnterCombatEvent enterCombat = combatData.GetEnterCombatEvents(t.AgentItem).LastOrDefault();
                ExitCombatEvent  exitCombat;
                if (enterCombat != null)
                {
                    exitCombat = combatData.GetExitCombatEvents(t.AgentItem).Where(x => x.Time > enterCombat.Time).LastOrDefault();
                }
                else
                {
                    exitCombat = combatData.GetExitCombatEvents(t.AgentItem).LastOrDefault();
                }
                AbstractHealthDamageEvent lastDamage = combatData.GetDamageTakenData(t.AgentItem).LastOrDefault(x => (x.HealthDamage > 0) && playerAgents.Contains(x.From.GetFinalMaster()));
                if (exitCombat == null || lastDamage == null ||
                    combatData.GetAnimatedCastData(t.AgentItem).Any(x => x.Time > exitCombat.Time + ParserHelper.ServerDelayConstant) ||
                    combatData.GetDamageData(t.AgentItem).Any(x => x.Time > exitCombat.Time + ParserHelper.ServerDelayConstant && playerAgents.Contains(x.To)))
                {
                    return;
                }
                targetExits.Add(exitCombat);
                lastTargetDamages.Add(lastDamage);
            }
            ExitCombatEvent           lastTargetExit  = targetExits.Count > 0 ? targetExits.MaxBy(x => x.Time) : null;
            AbstractHealthDamageEvent lastDamageTaken = lastTargetDamages.Count > 0 ? lastTargetDamages.MaxBy(x => x.Time) : null;

            // Make sure the last damage has been done before last combat exit
            if (lastTargetExit != null && lastDamageTaken != null && lastTargetExit.Time + 150 >= lastDamageTaken.Time)
            {
                if (!AtLeastOnePlayerAlive(combatData, fightData, lastTargetExit.Time, playerAgents))
                {
                    return;
                }
                fightData.SetSuccess(true, lastDamageTaken.Time);
            }
        }
 public override void CheckSuccess(CombatData combatData, AgentData agentData, FightData fightData, HashSet <AgentItem> playerAgents)
 {
     base.CheckSuccess(combatData, agentData, fightData, playerAgents);
     if (!fightData.Success && _specialSplit > 0)
     {
         NPC target = Targets.Find(x => x.ID == (int)ParseEnum.TargetIDS.Deimos);
         if (target == null)
         {
             throw new InvalidOperationException("Deimos not found");
         }
         List <AttackTargetEvent> attackTargets = combatData.GetAttackTargetEvents(target.AgentItem);
         if (attackTargets.Count == 0)
         {
             return;
         }
         long      specialSplitTime = _specialSplit;
         AgentItem attackTarget     = attackTargets.Last().AttackTarget;
         // sanity check
         TargetableEvent attackableEvent = combatData.GetTargetableEvents(attackTarget).LastOrDefault(x => x.Targetable && x.Time > specialSplitTime - GeneralHelper.ServerDelayConstant);
         if (attackableEvent == null)
         {
             return;
         }
         TargetableEvent notAttackableEvent = combatData.GetTargetableEvents(attackTarget).LastOrDefault(x => !x.Targetable && x.Time > attackableEvent.Time);
         if (notAttackableEvent == null)
         {
             return;
         }
         var playerExits = new List <ExitCombatEvent>();
         foreach (AgentItem a in playerAgents)
         {
             playerExits.AddRange(combatData.GetExitCombatEvents(a));
         }
         ExitCombatEvent     lastPlayerExit  = playerExits.Count > 0 ? playerExits.MaxBy(x => x.Time) : null;
         AbstractDamageEvent lastDamageTaken = combatData.GetDamageTakenData(target.AgentItem).LastOrDefault(x => (x.Damage > 0) && playerAgents.Contains(x.From.GetFinalMaster()));
         if (lastDamageTaken != null && lastPlayerExit != null)
         {
             fightData.SetSuccess(lastPlayerExit.Time > notAttackableEvent.Time + 1000, lastDamageTaken.Time);
         }
     }
 }
        protected static void SetSuccessByCombatExit(List <NPC> targets, CombatData combatData, FightData fightData, HashSet <AgentItem> playerAgents)
        {
            if (targets.Count == 0)
            {
                return;
            }
            var targetExits       = new List <ExitCombatEvent>();
            var lastTargetDamages = new List <AbstractHealthDamageEvent>();

            foreach (NPC t in targets)
            {
                EnterCombatEvent enterCombat = combatData.GetEnterCombatEvents(t.AgentItem).LastOrDefault();
                if (enterCombat != null)
                {
                    targetExits.AddRange(combatData.GetExitCombatEvents(t.AgentItem).Where(x => x.Time > enterCombat.Time));
                }
                else
                {
                    targetExits.AddRange(combatData.GetExitCombatEvents(t.AgentItem));
                }
                AbstractHealthDamageEvent lastDamage = combatData.GetDamageTakenData(t.AgentItem).LastOrDefault(x => (x.HealthDamage > 0) && playerAgents.Contains(x.From.GetFinalMaster()));
                if (lastDamage != null)
                {
                    lastTargetDamages.Add(lastDamage);
                }
            }
            ExitCombatEvent           lastTargetExit  = targetExits.Count > 0 ? targetExits.MaxBy(x => x.Time) : null;
            AbstractHealthDamageEvent lastDamageTaken = lastTargetDamages.Count > 0 ? lastTargetDamages.MaxBy(x => x.Time) : null;

            // Make sure the last damage has been done before last combat exit
            if (lastTargetExit != null && lastDamageTaken != null && lastTargetExit.Time + 100 >= lastDamageTaken.Time)
            {
                if (!AtLeastOnePlayerAlive(combatData, fightData, lastTargetExit.Time, playerAgents))
                {
                    return;
                }
                fightData.SetSuccess(true, lastDamageTaken.Time);
            }
        }