-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathSoullessHorror.cs
378 lines (343 loc) · 18.8 KB
/
SoullessHorror.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
using System.Numerics;
using GW2EIEvtcParser.EIData;
using GW2EIEvtcParser.Exceptions;
using GW2EIEvtcParser.Extensions;
using GW2EIEvtcParser.ParsedData;
using GW2EIEvtcParser.ParserHelpers;
using static GW2EIEvtcParser.ArcDPSEnums;
using static GW2EIEvtcParser.ParserHelpers.EncounterImages;
using static GW2EIEvtcParser.EncounterLogic.EncounterLogicPhaseUtils;
using static GW2EIEvtcParser.EncounterLogic.EncounterLogicUtils;
using static GW2EIEvtcParser.ParserHelper;
using static GW2EIEvtcParser.SkillIDs;
namespace GW2EIEvtcParser.EncounterLogic;
internal class SoullessHorror : HallOfChains
{
private static readonly Vector3 ChestOfDesminaPosition = new(-9349.45f, 258.757f, -807.954f);
public SoullessHorror(int triggerID) : base(triggerID)
{
MechanicList.AddRange([
new PlayerDstHitMechanic(InnerVortexSlash, "Vortex Slash", new MechanicPlotlySetting(Symbols.Circle,Colors.LightOrange), "Donut In","Vortex Slash (Inner Donut hit)", "Inner Donut",0),
new PlayerDstHitMechanic(OuterVortexSlash, "Vortex Slash", new MechanicPlotlySetting(Symbols.CircleOpen,Colors.LightOrange), "Donut Out","Vortex Slash (Outer Donut hit)", "Outer Donut", 0),
new PlayerDstHitMechanic([ InnerVortexSlash, OuterVortexSlash ], "Necro Dancer", new MechanicPlotlySetting(Symbols.CircleOpenDot, Colors.LightOrange), "NecDancer.Achiv", "Achievement Eligibility: Necro Dancer", "Necro Dancer", 0).UsingAchievementEligibility(true),
new PlayerDstHitMechanic(SoulRift, "Soul Rift", new MechanicPlotlySetting(Symbols.CircleOpen,Colors.Red), "Golem","Soul Rift (stood in Golem Aoe)", "Golem Aoe",0),
new PlayerDstHitMechanic(QuadSlashFirstSet, "Quad Slash", new MechanicPlotlySetting(Symbols.StarDiamondOpen,Colors.LightOrange), "Slice1","Quad Slash (4 Slices, First hit)", "4 Slices 1",0),
new PlayerDstHitMechanic(QuadSlashSecondSet, "Quad Slash", new MechanicPlotlySetting(Symbols.StarSquareOpen,Colors.LightOrange), "Slice2","Quad Slash (4 Slices, Second hit)", "4 Slices 2",0),
new PlayerDstHitMechanic(SpinningSlash, "Spinning Slash", new MechanicPlotlySetting(Symbols.StarTriangleUpOpen,Colors.DarkRed), "Scythe","Spinning Slash (hit by Scythe)", "Scythe",0),
new PlayerDstHitMechanic(DeathBloom, "Death Bloom", new MechanicPlotlySetting(Symbols.Octagon,Colors.LightOrange), "8Slice","Death Bloom (8 Slices)", "8 Slices",0),
new PlayerDstBuffApplyMechanic(FixatedSH, "Fixated", new MechanicPlotlySetting(Symbols.Star,Colors.Magenta), "Fixate","Fixated (Special Action Key)", "Fixated",0),
new PlayerDstBuffApplyMechanic(Necrosis, "Necrosis", new MechanicPlotlySetting(Symbols.StarOpen,Colors.Magenta), "Necrosis","Necrosis (Tanking Debuff)", "Necrosis Debuff",50),
new PlayerDstHitMechanic(CorruptTheLiving, "Corrupt the Living", new MechanicPlotlySetting(Symbols.Circle,Colors.Red), "Spin","Corrupt the Living (Torment+Poison Spin)", "Torment+Poison Spin",0),
new PlayerDstHitMechanic(WurmSpit, "Wurm Spit", new MechanicPlotlySetting(Symbols.DiamondOpen,Colors.DarkTeal), "Spit","Wurm Spit", "Wurm Spit",0),
new EnemyCastStartMechanic(HowlingDeath, "Howling Death", new MechanicPlotlySetting(Symbols.DiamondTall,Colors.DarkTeal), "CC","Howling Death (Breakbar)", "Breakbar",0),
new EnemyCastEndMechanic(HowlingDeath, "Howling Death", new MechanicPlotlySetting(Symbols.DiamondTall,Colors.DarkGreen), "CCed","Howling Death (Breakbar) broken", "CCed",0).UsingChecker((ce, log) => ce.ActualDuration <= 6800),
new EnemyCastEndMechanic(HowlingDeath, "Howling Death", new MechanicPlotlySetting(Symbols.DiamondTall,Colors.Red), "CC Fail","Howling Death (Breakbar failed) ", "CC Fail",0).UsingChecker((ce,log) => ce.ActualDuration > 6800),
new PlayerSrcBuffApplyMechanic(Immobile, "Immobilized Golem", new MechanicPlotlySetting(Symbols.X,Colors.Red), "Immob.Golem","Immobilized Golem", "Immobilized Golem",50).UsingChecker((ce, log) => ce.To.IsSpecies(TrashID.TormentedDead)),
]);
Extension = "sh";
GenericFallBackMethod = FallBackMethod.ChestGadget;
ChestID = ChestID.ChestOfDesmina;
Icon = EncounterIconSoullessHorror;
EncounterCategoryInformation.InSubCategoryOrder = 0;
EncounterID |= 0x000001;
}
internal override List<InstantCastFinder> GetInstantCastFinders()
{
return
[
new DamageCastFinder(ChillingAura, ChillingAura),
new BuffGainCastFinder(IssueChallengeSAK, FixatedSH),
];
}
protected override CombatReplayMap GetCombatMapInternal(ParsedEvtcLog log)
{
return new CombatReplayMap(CombatReplaySoullessHorror,
(1000, 1000),
(-12223, -771, -8932, 2420)/*,
(-21504, -12288, 24576, 12288),
(19072, 15484, 20992, 16508)*/);
}
protected override ReadOnlySpan<int> GetTargetsIDs()
{
return
[
(int)TargetID.SoullessHorror,
(int)TrashID.TormentedDead,
];
}
protected override List<TrashID> GetTrashMobsIDs()
{
return
[
TrashID.Scythe,
TrashID.SurgingSoul,
TrashID.FleshWurm
];
}
internal override IEnumerable<ErrorEvent> GetCustomWarningMessages(FightData fightData, EvtcVersionEvent evtcVersion)
{
return base.GetCustomWarningMessages(fightData, evtcVersion)
.Concat(GetConfusionDamageMissingMessage(evtcVersion).ToEnumerable());
}
internal override void CheckSuccess(CombatData combatData, AgentData agentData, FightData fightData, IReadOnlyCollection<AgentItem> playerAgents)
{
base.CheckSuccess(combatData, agentData, fightData, playerAgents);
if (!fightData.Success)
{
SingleActor mainTarget = Targets.FirstOrDefault(x => x.IsSpecies(TargetID.SoullessHorror)) ?? throw new MissingKeyActorsException("Soulless Horror not found");
BuffEvent? buffOnDeath = combatData.GetBuffDataByIDByDst(Determined895, mainTarget.AgentItem).Where(x => x is BuffApplyEvent).LastOrDefault();
if (buffOnDeath != null)
{
if (agentData.GetNPCsByID(TargetID.Desmina).Any(x => x.FirstAware <= buffOnDeath.Time + ServerDelayConstant && x.LastAware >= buffOnDeath.Time))
{
fightData.SetSuccess(true, buffOnDeath.Time);
}
}
}
}
internal override void EIEvtcParse(ulong gw2Build, EvtcVersionEvent evtcVersion, FightData fightData, AgentData agentData, List<CombatItem> combatData, IReadOnlyDictionary<uint, ExtensionHandler> extensions)
{
FindChestGadget(ChestID, agentData, combatData, ChestOfDesminaPosition, (agentItem) => agentItem.HitboxHeight == 0 || (agentItem.HitboxHeight == 1200 && agentItem.HitboxWidth == 100));
base.EIEvtcParse(gw2Build, evtcVersion, fightData, agentData, combatData, extensions);
// discard hp update events after determined apply
SingleActor soullessHorror = Targets.FirstOrDefault(x => x.IsSpecies(TargetID.SoullessHorror)) ?? throw new MissingKeyActorsException("Soulless Horror not found");
CombatItem? determined895Apply = combatData.LastOrDefault(x => x.SkillID == Determined895 && x.IsBuffApply() && x.DstMatchesAgent(soullessHorror.AgentItem));
if (determined895Apply != null)
{
foreach (var combatEvent in combatData.Where(x => x.IsStateChange == StateChange.HealthUpdate && x.SrcMatchesAgent(soullessHorror.AgentItem) && x.Time >= determined895Apply.Time))
{
combatEvent.OverrideSrcAgent(0);
}
}
// Add number to the spawned Tormented Deads
var tormentedDeads = Targets.Where(x => x.IsSpecies(TrashID.TormentedDead)).ToList();
for (int i = 0; i < tormentedDeads.Count; i++)
{
tormentedDeads[i].OverrideName(tormentedDeads[i].Character + " " + (i + 1));
}
}
/*internal override List<AbstractBuffEvent> SpecialBuffEventProcess(Dictionary<AgentItem, List<AbstractBuffEvent>> buffsByDst, Dictionary<long, List<AbstractBuffEvent>> buffsById, SkillData skillData)
{
var res = new List<AbstractBuffEvent>();
// Necrosis adjust
AdjustTimeRefreshBuff(buffsByDst, buffsById, 47414);
return res;
}*/
internal override List<PhaseData> GetPhases(ParsedEvtcLog log, bool requirePhases)
{
long fightEnd = log.FightData.FightEnd;
List<PhaseData> phases = GetInitialPhase(log);
SingleActor mainTarget = Targets.FirstOrDefault(x => x.IsSpecies(TargetID.SoullessHorror)) ?? throw new MissingKeyActorsException("Soulless Horror not found");
phases[0].AddTarget(mainTarget);
if (!requirePhases)
{
return phases;
}
var howling = mainTarget.GetCastEvents(log, log.FightData.FightStart, fightEnd).Where(x => x.SkillId == HowlingDeath);
long start = 0;
int i = 1;
foreach (CastEvent c in howling)
{
var phase = new PhaseData(start, Math.Min(c.Time, fightEnd), "Pre-Breakbar " + i++);
phase.AddTarget(mainTarget);
start = c.EndTime;
phases.Add(phase);
}
if (fightEnd - start > PhaseTimeLimit)
{
var lastPhase = new PhaseData(start, fightEnd, "Final");
lastPhase.AddTarget(mainTarget);
phases.Add(lastPhase);
}
// Add Tormented Deads as secondary target to the phases
foreach (PhaseData phase in phases)
{
var tormentedDeads = Targets.Where(x => x.IsSpecies(TrashID.TormentedDead) && phase.IntersectsWindow(x.FirstAware, x.LastAware) && phase.CanBeSubPhase);
phase.AddTargets(tormentedDeads, PhaseData.TargetPriority.NonBlocking);
}
return phases;
}
internal override void ComputeNPCCombatReplayActors(NPC target, ParsedEvtcLog log, CombatReplay replay)
{
int start = (int)replay.TimeOffsets.start;
int end = (int)replay.TimeOffsets.end;
switch (target.ID)
{
case (int)TargetID.SoullessHorror:
var cls = target.GetCastEvents(log, log.FightData.FightStart, log.FightData.FightEnd);
// arena reduction
var center = new Vector3(-10581, 825, -817);
List<(double, uint, uint)> destroyedRings;
if (log.FightData.IsCM)
{
destroyedRings =
[
(100, 1330, 1550),
(90, 1120, 1330),
(66, 910, 1120),
(33, 720, 910)
];
}
else
{
destroyedRings =
[
(90, 1330, 1550),
(66, 1120, 1330),
(33, 910, 1120),
];
}
foreach ((double hpVal, uint innerRadius, uint outerRadius) in destroyedRings)
{
Segment? hpUpdate = target.GetHealthUpdates(log).FirstOrNull((in Segment x) => x.Value <= hpVal);
if (hpUpdate != null)
{
var doughnut = new DoughnutDecoration(innerRadius, outerRadius, (hpUpdate.Value.Start, log.FightData.FightEnd), Colors.Orange, 0.3, new PositionConnector(center));
replay.Decorations.AddWithGrowing(doughnut, hpUpdate.Value.Start + 3000);
}
else
{
break;
}
}
//
var howling = cls.Where(x => x.SkillId == HowlingDeath);
foreach (CastEvent c in howling)
{
replay.Decorations.Add(new OverheadProgressBarDecoration(CombatReplayOverheadProgressBarMajorSizeInPixel, (c.Time, c.EndTime), Colors.Red, 0.6, Colors.Black, 0.2, [(c.Time, 0), (c.ExpectedEndTime, 100)], new AgentConnector(target))
.UsingRotationConnector(new AngleConnector(180)));
}
var vortex = cls.Where(x => x.SkillId == InnerVortexSlash);
foreach (CastEvent c in vortex)
{
start = (int)c.Time;
end = start + 4000;
if (target.TryGetCurrentInterpolatedPosition(log, start, out var position))
{
var circle = new CircleDecoration(380, (start, end), Colors.LightOrange, 0.5, new PositionConnector(position));
replay.Decorations.AddWithFilledWithGrowing(circle.UsingFilled(false), true, end);
replay.Decorations.Add(new DoughnutDecoration(380, 760, (end, end + 1000), Colors.LightOrange, 0.5, new PositionConnector(position)));
}
}
var deathBloom = cls.Where(x => x.SkillId == DeathBloom);
foreach (CastEvent c in deathBloom)
{
start = (int)c.Time;
end = (int)c.EndTime;
if (target.TryGetCurrentFacingDirection(log, start, out var facing))
{
float initialAngle = facing.GetRoundedZRotationDeg();
var connector = new AgentConnector(target);
for (int i = 0; i < 8; i++)
{
var rotationConnector = new AngleConnector(initialAngle + (i * 360 / 8));
replay.Decorations.Add(new PieDecoration(3500, 360 / 12, (start, end), Colors.Yellow, 0.5, connector).UsingRotationConnector(rotationConnector));
}
}
}
var quad1 = cls.Where(x => x.SkillId == QuadSlashFirstSet);
var quad2 = cls.Where(x => x.SkillId == QuadSlashSecondSet);
foreach (CastEvent c in quad1)
{
start = (int)c.Time;
end = (int)c.EndTime;
if (target.TryGetCurrentFacingDirection(log, start, out var facing))
{
float initialAngle = facing.GetRoundedZRotationDeg();
var connector = new AgentConnector(target);
for (int i = 0; i < 4; i++)
{
var rotationConnector = new AngleConnector(initialAngle + (i * 360 / 4));
replay.Decorations.Add(new PieDecoration(3500, 360 / 12, (start, end), Colors.Yellow, 0.5, connector).UsingRotationConnector(rotationConnector));
}
}
}
foreach (CastEvent c in quad2)
{
start = (int)c.Time;
end = (int)c.EndTime;
if (target.TryGetCurrentFacingDirection(log, start, out var facing))
{
float initialAngle = facing.GetRoundedZRotationDeg();
var connector = new AgentConnector(target);
for (int i = 0; i < 4; i++)
{
var rotationConnector = new AngleConnector(initialAngle + 45 + (i * 360 / 4));
replay.Decorations.Add(new PieDecoration(3500, 360 / 12, (start, end), Colors.Yellow, 0.5, connector).UsingRotationConnector(rotationConnector));
}
}
}
break;
case (int)TrashID.Scythe:
replay.Decorations.Add(new CircleDecoration(80, (start, end), Colors.Red, 0.5, new AgentConnector(target)));
break;
case (int)TrashID.TormentedDead:
if (replay.Positions.Count == 0)
{
break;
}
replay.Decorations.Add(new CircleDecoration(400, (end, end + 60000), Colors.Red, 0.5, new PositionConnector(replay.Positions.Last().XYZ)));
break;
case (int)TrashID.SurgingSoul:
if (replay.Positions.Count < 2)
{
break;
}
var firstPos = replay.Positions[0].XYZ;
if (firstPos.X < -12000 || firstPos.X > -9250)
{
replay.Decorations.Add(new RectangleDecoration(240, 660, (start, end), Colors.Orange, 0.5, new AgentConnector(target)));
break;
}
else if (firstPos.Y < -525 || firstPos.Y > 2275)
{
replay.Decorations.Add(new RectangleDecoration(645, 238, (start, end), Colors.Orange, 0.5, new AgentConnector(target)));
break;
}
break;
case (int)TrashID.FleshWurm:
break;
default:
break;
}
}
internal override void ComputePlayerCombatReplayActors(PlayerActor player, ParsedEvtcLog log, CombatReplay replay)
{
base.ComputePlayerCombatReplayActors(player, log, replay);
IEnumerable<Segment> fixations = player.GetBuffStatus(log, FixatedSH, log.FightData.LogStart, log.FightData.LogEnd).Where(x => x.Value > 0);
replay.Decorations.AddOverheadIcons(fixations, player, ParserIcons.FixationPurpleOverhead);
}
internal override FightData.EncounterMode GetEncounterMode(CombatData combatData, AgentData agentData, FightData fightData)
{
var necrosis = combatData.GetBuffData(Necrosis).Where(x => x is BuffApplyEvent);
if (!necrosis.Any())
{
return 0;
}
// split necrosis
var splitNecrosis = new Dictionary<AgentItem, List<BuffEvent>>();
foreach (BuffEvent c in necrosis)
{
AgentItem tank = c.To;
if (!splitNecrosis.TryGetValue(tank, out var value))
{
value = [];
splitNecrosis.Add(tank, value);
}
value.Add(c);
}
List<BuffEvent> longestNecrosis = splitNecrosis.Values.First(l => l.Count == splitNecrosis.Values.Max(x => x.Count));
long minDiff = long.MaxValue;
for (int i = 0; i < longestNecrosis.Count - 1; i++)
{
BuffEvent cur = longestNecrosis[i];
BuffEvent next = longestNecrosis[i + 1];
long timeDiff = next.Time - cur.Time;
if (timeDiff > 1000 && minDiff > timeDiff)
{
minDiff = timeDiff;
}
}
return (minDiff < 11000) ? FightData.EncounterMode.CM : FightData.EncounterMode.Normal;
}
}