Skip to content

Commit

Permalink
M1s and m4s improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
xpdota committed Sep 6, 2024
1 parent e5eb73b commit 52be751
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import gg.xp.xivsupport.callouts.ModifiableCallout;
import gg.xp.xivsupport.events.actlines.events.AbilityCastStart;
import gg.xp.xivsupport.events.actlines.events.AbilityUsedEvent;
import gg.xp.xivsupport.events.actlines.events.BuffApplied;
import gg.xp.xivsupport.events.actlines.events.HeadMarkerEvent;
import gg.xp.xivsupport.events.state.XivState;
import gg.xp.xivsupport.events.state.combatstate.StatusEffectRepository;
Expand All @@ -18,6 +19,7 @@
import gg.xp.xivsupport.events.triggers.support.NpcCastCallout;
import gg.xp.xivsupport.models.ArenaPos;
import gg.xp.xivsupport.models.ArenaSector;
import gg.xp.xivsupport.models.XivCombatant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -310,21 +312,28 @@ public boolean enabled(EventContext context) {

private static final ArenaPos ap = new ArenaPos(100, 100, 5, 5);

private static final ModifiableCallout<AbilityCastStart> soulshadeCardinalFirst = ModifiableCallout.durationBasedCallWithOffset("Soul Shade One-Two: Cardinal First", "Start {cardinal}-{intercard.opposite()}", Duration.ofSeconds(1));
private static final ModifiableCallout<AbilityCastStart> soulshadeIntercardFirst = ModifiableCallout.durationBasedCallWithOffset("Soul Shade One-Two: Cardinal First", "Start {intercard}-{cardinal.opposite()}", Duration.ofSeconds(1));
private static final ModifiableCallout<?> soulshadeMove = new ModifiableCallout<>("Soul Shade One-Two: Cross Over", "Move");
// 24410 ms delay between fake and real cast, plus the 1s extra from the fake casts being longer
private static final Duration soulshadeOneTwoOffset = Duration.ofMillis(24_410).plusSeconds(1);
private final ModifiableCallout<AbilityCastStart> soulshadeCardinalFirst = ModifiableCallout.durationBasedCallWithOffset("Soul Shade One-Two: Cardinal First", "Start {cardinal}-{intercard.opposite()}", soulshadeOneTwoOffset);
private final ModifiableCallout<AbilityCastStart> soulshadeIntercardFirst = ModifiableCallout.durationBasedCallWithOffset("Soul Shade One-Two: Cardinal First", "Start {intercard}-{cardinal.opposite()}", soulshadeOneTwoOffset);
private final ModifiableCallout<?> soulshadeMove = new ModifiableCallout<>("Soul Shade One-Two: Cross Over", "Move");

// 9464 = hitting right first
// 9467 = hitting left first
// can ignore the actual damaging casts
@AutoFeed
private final SequentialTrigger<BaseEvent> soulshadeOneTwo = SqtTemplates.multiInvocation(30_000,
AbilityCastStart.class, acs -> acs.abilityIdMatches(0x9464, 0x9467),
(e1, s) -> {
private final SequentialTrigger<BaseEvent> soulshadeOneTwo = SqtTemplates.multiInvocation(50_000,
AbilityCastStart.class, acs -> acs.abilityIdMatches(0x9436, 0x9439),
(initialCast, s) -> {
log.info("Soulshade one-two: start");
var e2 = s.waitEvent(AbilityCastStart.class, acs -> acs.abilityIdMatches(0x9464, 0x9467));
ArenaSector pos1 = ap.forCombatant(e1.getSource());
ArenaSector pos2 = ap.forCombatant(e2.getSource());
var buff1 = s.waitEvent(BuffApplied.class, ba -> ba.buffIdMatches(0x891));
var buff2 = s.waitEvent(BuffApplied.class, ba -> ba.buffIdMatches(0x891));
s.waitThenRefreshCombatants(100);
XivCombatant fakeCbt1 = state.getLatestCombatantData(buff1.getTarget());
XivCombatant fakeCbt2 = state.getLatestCombatantData(buff2.getTarget());
ArenaSector pos1 = ap.forCombatant(fakeCbt1);
ArenaSector pos2 = ap.forCombatant(fakeCbt2);
boolean leftSafeFirst = initialCast.abilityIdMatches(0x9436);
log.info("Soulshade one-two: sectors {} and {}", pos1, pos2);
ArenaSector cardinalPos;
ArenaSector intercardPos;
Expand All @@ -337,35 +346,36 @@ else if (pos2.isCardinal()) {
intercardPos = pos1;
}
else {
throw new RuntimeException("Could not determine positions! %s %s".formatted(e1.getSource().getPos(), e2.getSource().getPos()));
throw new RuntimeException("Could not determine positions! %s %s".formatted(fakeCbt1.getPos(), fakeCbt2.getPos()));
}
s.setParam("cardinal", cardinalPos);
s.setParam("intercard", intercardPos);
int delta = cardinalPos.eighthsTo(intercardPos);
if (delta == 3) {
// e.g. S + NW
// If hitting left first, start on cardinal side. S cleaves W, NW cleaves NE, so only S-SE is safe
if (e1.abilityIdMatches(0x9467)) {
s.updateCall(soulshadeCardinalFirst, e1);
if (!leftSafeFirst) {
s.updateCall(soulshadeCardinalFirst, initialCast);
}
else {
s.updateCall(soulshadeIntercardFirst, e1);
s.updateCall(soulshadeIntercardFirst, initialCast);
}
}
else if (delta == -3) {
// e.g. S + NE
// If hitting left first, start on intercardinal side. S cleaves W, NE cleaves SE, so only N-NW is afe.
if (e1.abilityIdMatches(0x9467)) {
s.updateCall(soulshadeIntercardFirst, e1);
if (!leftSafeFirst) {
s.updateCall(soulshadeIntercardFirst, initialCast);
}
else {
s.updateCall(soulshadeCardinalFirst, e1);
s.updateCall(soulshadeCardinalFirst, initialCast);
}
}
else {
throw new RuntimeException("Could not determine delta! %s %s".formatted(e1.getSource().getPos(), e2.getSource().getPos()));
throw new RuntimeException("Could not determine delta! %s %s".formatted(fakeCbt1.getPos(), fakeCbt2.getPos()));
}
s.waitEvent(AbilityUsedEvent.class, aue -> aue.getPrecursor() == e1);
var cloneCast = s.waitEvent(AbilityCastStart.class, acs -> acs.abilityIdMatches(0x9464, 0x9467));
s.waitEvent(AbilityUsedEvent.class, aue -> aue.getPrecursor() == cloneCast);
s.waitMs(1000);
s.updateCall(soulshadeMove);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ else if (rawStacks == 758) {
baitOuts[i] = baitOut(nextBuff);
}

s.waitEvent(AbilityUsedEvent.class, aue -> aue.abilityIdMatches(0x4D11, 0x4D12));
s.waitEvent(AbilityUsedEvent.class, aue -> aue.abilityIdMatches(0x4D11, 0x4D12) && aue.isFirstTarget());

for (int i = 1; i <= 3; i++) {
s.setParam("baitOut", baitOuts[i]);
Expand All @@ -202,7 +202,7 @@ else if (rawStacks == 758) {
else {
s.updateCall(wideNarrowInF);
}
s.waitEvent(AbilityUsedEvent.class, aue -> aue.abilityIdMatches(0x4D11, 0x4D12));
s.waitEvent(AbilityUsedEvent.class, aue -> aue.abilityIdMatches(0x4D11, 0x4D12) && aue.isFirstTarget());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ protected List<CalloutInitialValues> getExpectedCalls() {
call(27300, "Tankbuster on Liliwure Ririwure", "Tankbuster on Liliwure Ririwure (4.7)"),
call(51444, "Left then Right", "Left then Right (5.7)"),
call(57449, "Right", "Right"),
// TODO: this can call out a lot earlier
call(75858, "Start Northwest-North", "Start Northwest-North (5.7)"),
call(61808, "Start Northwest-North", "Start Northwest-North (19.7)"),
call(81869, "Move", "Move"),
call(82894, "Partners", "Partners (3.7)"),
call(94990, "Quadruple Crossing - Leaping Left", "Quadruple Crossing - Leaping Left (4.7)"),
Expand Down
4 changes: 4 additions & 0 deletions xivsupport/src/main/resources/te_changelog.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<html lang="en">
<body style="margin: 5px 20px 5px 20px">
<h2>September 5, 2024</h2>
<ul>
<li>Improvements to M1S and M4S.</li>
</ul>
<h2>August 14, 2024</h2>
<ul>
<li>Some additions for M4S.</li>
Expand Down

0 comments on commit 52be751

Please sign in to comment.