Skip to content

Commit 2c47ad7

Browse files
authored
m12s p1 snake: fix rotation logic (#342)
* fix : rotation logic * version up
1 parent 840ae0a commit 2c47ad7

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

SplatoonScripts/Duties/Dawntrail/M12S P1 Snake.cs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace SplatoonScriptsOfficial.Duties.Dawntrail;
2020

2121
public class M12S_P1_Snake : SplatoonScript
2222
{
23-
public override Metadata Metadata { get; } = new(2, "NightmareXIV, Garume");
23+
public override Metadata Metadata { get; } = new(3, "NightmareXIV, Garume");
2424
public override HashSet<uint>? ValidTerritories { get; } = [1327];
2525

2626
public enum Debuff
@@ -162,6 +162,7 @@ public override void OnSetup()
162162
int RotationCount = 0;
163163
bool CoilSeen = false;
164164
int LastExitSector = -1;
165+
bool RotationStarted = false;
165166
Dictionary<uint, PlayerData> PlayerDatas = new();
166167
const float CenterX = 100f;
167168
const float CenterZ = 100f;
@@ -171,30 +172,38 @@ public override void OnSetup()
171172
public override void OnReset()
172173
{
173174
Towers.Clear(); BlackTowers.Clear(); MyDebuff = null; LastExitRot = 0f; RotationCount = 0; CoilSeen = false;
175+
RotationStarted = false;
174176
LastExitSector = -1; PlayerDatas.Clear();
175177
}
176178

177179
public override void OnUpdate()
178180
{
179181
Controller.Hide();
180182
var exitActor = GetExitActor();
181-
if(exitActor != null)
183+
if(exitActor != null )
182184
{
183-
if(!CoilSeen)
184-
{
185-
CoilSeen = true;
186-
LastExitRot = exitActor.Rotation;
187-
LastExitSector = GetExitSector(exitActor.Rotation);
188-
RotationCount = 0;
189-
}
185+
if (!RotationStarted)
186+
RotationStarted = FakeParty.Get().All(x =>
187+
x.StatusList.FirstOrDefault(s => s.StatusId == (uint)Debuff.Alpha) is { RemainingTime: < 22 } ||
188+
x.StatusList.FirstOrDefault(s => s.StatusId == (uint)Debuff.Beta) is { RemainingTime: < 22 });
190189
else
191190
{
192-
var sector = GetExitSector(exitActor.Rotation);
193-
if(sector != LastExitSector)
191+
if (!CoilSeen)
194192
{
195-
RotationCount = Math.Min(RotationCount + 1, 7);
193+
CoilSeen = true;
196194
LastExitRot = exitActor.Rotation;
197-
LastExitSector = sector;
195+
LastExitSector = GetExitSector(exitActor.Rotation);
196+
RotationCount = 0;
197+
}
198+
else
199+
{
200+
var sector = GetExitSector(exitActor.Rotation);
201+
if (sector != LastExitSector)
202+
{
203+
RotationCount = Math.Min(RotationCount + 1, 7);
204+
LastExitRot = exitActor.Rotation;
205+
LastExitSector = sector;
206+
}
198207
}
199208
}
200209
}

0 commit comments

Comments
 (0)