Skip to content

Commit

Permalink
[add] Clear FRU !! (#250)
Browse files Browse the repository at this point in the history
* [add] script add

* [add] scripts

* [add] scripts

* added

* [fix] Fix Ended
  • Loading branch information
Redmoonwow authored Jan 26, 2025
1 parent e32c662 commit 6c9bf1d
Show file tree
Hide file tree
Showing 12 changed files with 9,477 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public DirectionalVector(Direction direction, Vector3 position)

#region public properties
public override HashSet<uint>? ValidTerritories => [1238];
public override Metadata? Metadata => new(4, "redmoon");
public override Metadata? Metadata => new(7, "redmoon");
#endregion

#region private properties
Expand Down Expand Up @@ -182,9 +182,9 @@ public override void OnStartingCast(uint source, uint castId)
{
if (castId == CircleCastId) _aoeType = AoeType.Circle;
else if (castId == DonutCastId) _aoeType = AoeType.Donut;
else if (castId == 40198u && _firstIcicleImpactDirection == Direction.None)
else if (castId == 40198u && _firstIcicleImpactDirection == Direction.None && source.TryGetObject(out var obj))
{
Direction direction = DividePoint(source.GetObject().Position);
Direction direction = DividePoint(obj.Position);

// 北,北東, 東, 南東以外の方向は対角の方向に変換
if (direction == Direction.NorthWest)
Expand Down Expand Up @@ -238,6 +238,12 @@ public override void OnActionEffectEvent(ActionEffectSet set)
if (_partyDataList.Count == 0) return;
else _state = State.CastedDD;
}
if (set.Action.Value.RowId == 40199)
{
_state = State.AOESet;
HideAllElements();
ShowKnockBack();
}
if (set.Action.Value.RowId == 40203)
{
HideAllElements();
Expand Down Expand Up @@ -328,15 +334,7 @@ public override void OnUpdate()
ShowAvoidKick();
_state = State.DynamoChariotCasting;
}
if (_state == State.DynamoChariotCasting)
{
var obj = Svc.Objects.First(x => x.DataId == 0x45A0);
if (Vector3.Distance(obj.Position, new(100, 0, 100)) > 9.8f)
{
ShowKnockBack();
_state = State.AOESet;
}
}

if (_state == State.KnockbackEnded || _state == State.HitHoly || _state == State.HitHolyEnded)
{
var el = Controller.GetElementByName("Bait");
Expand Down Expand Up @@ -388,7 +386,7 @@ public override void OnSettingsDraw()
{
Entries.Add(new ImGuiEx.EzTableEntry("Index", true, () => ImGui.Text(x.index.ToString())));
Entries.Add(new ImGuiEx.EzTableEntry("EntityId", true, () => ImGui.Text(x.EntityId.ToString())));
Entries.Add(new ImGuiEx.EzTableEntry("Name", true, () => ImGui.Text(x.EntityId.GetObject().Name.ToString())));
Entries.Add(new ImGuiEx.EzTableEntry("Name", true, () => ImGui.Text(x.EntityId.TryGetObject(out var obj) ? obj.Name.ToString() : "-")));
Entries.Add(new ImGuiEx.EzTableEntry("Mine", true, () => ImGui.Text(x.Mine.ToString())));
Entries.Add(new ImGuiEx.EzTableEntry("HasAoe", true, () => ImGui.Text(x.HasAoe.ToString())));
Entries.Add(new ImGuiEx.EzTableEntry("AvoidDirection", true, () => ImGui.Text(x.AvoidDrection.ToString())));
Expand Down Expand Up @@ -665,7 +663,7 @@ private void ShowAvoidKick()

if (_aoeType == AoeType.Circle)
{
if (pc.HasAoe) ApplyElement("Bait", pc.AvoidDrection, 20f - 1.5f);
if (pc.HasAoe) ApplyElement("Bait", pc.AvoidDrection, 20f);
else ApplyElement("Bait", pc.AvoidDrection, 20f - 3.5f);

}
Expand All @@ -688,7 +686,7 @@ private void ShowSetIciclePosWhenChariot()
{
var pc = _partyDataList.Find(x => x.Mine);
if (pc == null) return;
if (pc.HasAoe) ApplyElement("Bait", pc.AvoidDrection, 8.4f, 0.5f);
if (pc.HasAoe) ApplyElement("Bait", pc.AvoidDrection, 16.0f, 0.5f);
else ApplyElement("Bait", pc.AvoidDrection, 0.0f, 0.5f);
}

Expand Down Expand Up @@ -872,12 +870,11 @@ private void ShowAvoidSliceSecond()
private void LockFace()
{
if (!C.LockFace) return;
var obj = Svc.Objects.First(x => x.DataId == 0x45A0);
Direction dressUp1drection = DividePoint(obj.Position);
Direction dressUp2drection = DividePoint(Svc.Objects.First(x => x.DataId == 0x459F).Position);
//var obj = Svc.Objects.First(x => x.DataId == 0x45A0);
//Direction dressUp1drection = DividePoint(obj.Position);
//Direction dressUp2drection = DividePoint(Svc.Objects.First(x => x.DataId == 0x459F).Position);

// 自身の方向を取得
var myDirection = DividePoint(Player.Object.Position);
Direction dressUpdrection = DividePoint(Svc.Objects.First(x => x.DataId == 0x459F).Position);

// ドレスアップの方向が自身の方向と同じ場合はそのまま
if (myDirection == dressUp1drection)
Expand Down Expand Up @@ -917,7 +914,7 @@ private void LockFace()
}
}
// 方向からrotationを取得
var rot = myDirection switch
var rot = GetOppositeDirection(dressUpdrection) switch
{
Direction.North => 0,
Direction.NorthEast => 45,
Expand Down Expand Up @@ -1064,7 +1061,7 @@ private Direction GetStartDirection(Direction knockBackDirection, int angle)
// 角度が0または180度の場合に、時計回りに45度回転
if (angle == 0 || angle == 180 || angle == -180)
{
return GetDirectionFromAngle(knockBackDirection, 45);
return Rotate45Clockwise(knockBackDirection);
}
return knockBackDirection;
}
Expand All @@ -1083,7 +1080,37 @@ private Direction GetEndDirection(Direction direction, Direction knockBackDirect
}
}

private Direction GetOppositeDirection(Direction direction) => GetDirectionFromAngle(direction, 180);
private Direction Rotate45Clockwise(Direction direction)
{
return direction switch
{
Direction.North => Direction.NorthEast,
Direction.NorthEast => Direction.East,
Direction.East => Direction.SouthEast,
Direction.SouthEast => Direction.South,
Direction.South => Direction.SouthWest,
Direction.SouthWest => Direction.West,
Direction.West => Direction.NorthWest,
Direction.NorthWest => Direction.North,
_ => Direction.None
};
}

private Direction GetOppositeDirection(Direction direction)
{
return direction switch
{
Direction.North => Direction.South,
Direction.NorthEast => Direction.SouthWest,
Direction.East => Direction.West,
Direction.SouthEast => Direction.NorthWest,
Direction.South => Direction.North,
Direction.SouthWest => Direction.NorthEast,
Direction.West => Direction.East,
Direction.NorthWest => Direction.SouthEast,
_ => Direction.None
};
}

private void ApplyElement(string elementName, Direction direction, float radius, float elementRadius = 0.3f)
{
Expand Down Expand Up @@ -1118,7 +1145,7 @@ private void FaceTarget(float rotation, ulong unkObjId = 0xE0000000)
{
if (Svc.Condition[ConditionFlag.DutyRecorderPlayback] && EzThrottler.Throttle("FaceTarget", 10000))
{
if (false) PluginLog.Information($"FaceTarget {rotation}");
if (true) PluginLog.Information($"FaceTarget {rotation}");
EzThrottler.Throttle("FaceTarget", 1000, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,28 @@ public SphereData(uint entityId, Direction towerDirection)
new (Direction.West, new Vector3(80, 0, 100)),
};

private readonly Vector2[] WestNeetSetReminderPos =
private readonly Vector3[] WestNeetSetReminderPos =
{
new Vector2(120f, 100f),
new Vector2(113.740f, 100f),
new Vector2(107.460f, 100f),
new Vector2(100f, 103.000f),
new Vector2(100f, 109.320f),
new Vector3(120f, 0f, 100f),
new Vector3(113.740f, 0f, 100f),
new Vector3(107.460f, 0f, 100f),
new Vector3(100f, 0f, 103.000f),
new Vector3(103.940f, 0f, 109.320f),
};

private readonly Vector2[] EastNeetSetReminderPos =
private readonly Vector3[] EastNeetSetReminderPos =
{
new Vector2(80f, 100f),
new Vector2(86.260f, 100f),
new Vector2(92.540f, 100f),
new Vector2(100f, 96.000f),
new Vector2(100f, 90.680f),
new Vector3(80f, 0f, 100f),
new Vector3(86.260f, 0f, 100f),
new Vector3(92.540f, 0f, 100f),
new Vector3(100f, 0f, 96.000f),
new Vector3(96.040f, 0f, 90.260f),
};
#endregion

#region public properties
public override HashSet<uint>? ValidTerritories => [1238];
public override Metadata? Metadata => new(2, "redmoon");
public override Metadata? Metadata => new(9, "redmoon");
#endregion

#region private properties
Expand All @@ -142,18 +142,18 @@ public override void OnSetup()
for (var i = 0; i < 5; i++)
{
Controller.RegisterElement($"WestDropSpot{i}", new Element(0) { radius = 0.2f, thicc = 2f, Filled = true, fillIntensity = 1f });
Controller.GetElementByName($"WestDropSpot{i}").SetRefPosition(MathHelper.ToVector3(WestNeetSetReminderPos[i]));
Controller.GetElementByName($"WestDropSpot{i}").SetRefPosition(WestNeetSetReminderPos[i]);
Controller.RegisterElement($"EastDropSpot{i}", new Element(0) { radius = 0.2f, thicc = 2f, Filled = true, fillIntensity = 1f });
Controller.GetElementByName($"EastDropSpot{i}").SetRefPosition(MathHelper.ToVector3(EastNeetSetReminderPos[i]));
Controller.GetElementByName($"EastDropSpot{i}").SetRefPosition(EastNeetSetReminderPos[i]);
}
for (var i = 0; i < 4; i++)
{
Controller.RegisterElement($"WestDropLine{i}", new Element(2) { radius = 0f, thicc = 3f, Filled = true, fillIntensity = 1f });
Controller.GetElementByName($"WestDropLine{i}").SetRefPosition(MathHelper.ToVector3(WestNeetSetReminderPos[i]));
Controller.GetElementByName($"WestDropLine{i}").SetOffPosition(MathHelper.ToVector3(WestNeetSetReminderPos[i + 1]));
Controller.GetElementByName($"WestDropLine{i}").SetRefPosition(WestNeetSetReminderPos[i]);
Controller.GetElementByName($"WestDropLine{i}").SetOffPosition(WestNeetSetReminderPos[i + 1]);
Controller.RegisterElement($"EastDropLine{i}", new Element(2) { radius = 0f, thicc = 3f, Filled = true, fillIntensity = 1f });
Controller.GetElementByName($"EastDropLine{i}").SetRefPosition(MathHelper.ToVector3(EastNeetSetReminderPos[i]));
Controller.GetElementByName($"EastDropLine{i}").SetOffPosition(MathHelper.ToVector3(WestNeetSetReminderPos[i + 1]));
Controller.GetElementByName($"EastDropLine{i}").SetRefPosition(EastNeetSetReminderPos[i]);
Controller.GetElementByName($"EastDropLine{i}").SetOffPosition(EastNeetSetReminderPos[i + 1]);
}
}

Expand Down Expand Up @@ -382,18 +382,22 @@ private bool ParseTether()
h2.TowerDirection = Direction.SouthEast;

var pc = (h2.TetherPairId1 == h1.EntityId) ? _partyDataList.Find(x => x.EntityId == h2.TetherPairId2) : _partyDataList.Find(x => x.EntityId == h2.TetherPairId1);
DuoLog.Information($"pc: {pc.Object.Name}");
if (pc == null) return false;
pc.TowerDirection = Direction.NorthWest;

var pc2 = (pc.TetherPairId1 == h2.EntityId) ? _partyDataList.Find(x => x.EntityId == pc.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc.TetherPairId1);
DuoLog.Information($"pc2: {pc2.Object.Name}");
if (pc2 == null) return false;
pc2.TowerDirection = Direction.South;

var pc3 = (pc2.TetherPairId1 == pc.EntityId) ? _partyDataList.Find(x => x.EntityId == pc2.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc2.TetherPairId1);
DuoLog.Information($"pc3: {pc3.Object.Name}");
if (pc3 == null) return false;
pc3.TowerDirection = Direction.NorthEast;

var pc4 = (pc3.TetherPairId1 == h1.EntityId) ? _partyDataList.Find(x => x.EntityId == pc3.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc3.TetherPairId1);
var pc4 = (pc3.TetherPairId1 == pc2.EntityId) ? _partyDataList.Find(x => x.EntityId == pc3.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc3.TetherPairId1);
DuoLog.Information($"pc4: {pc4.Object.Name}");
if (pc4 == null) return false;
pc4.TowerDirection = Direction.SouthWest;

Expand All @@ -407,26 +411,28 @@ private bool ParseTether()
DuoLog.Information("Healer is all neet");
// index = 1から始める
var mt = _partyDataList.Find(x => x.index == 1);
var d1 = _partyDataList.Find(x => x.index == 2);
if (mt == null) return false;
var pc = _partyDataList.Find(x => x.EntityId == mt.TetherPairId1);
if (pc == null) return false;

mt.TowerDirection = Direction.North;
d1.TowerDirection = Direction.SouthEast;

var pc = (d1.TetherPairId1 == mt.EntityId) ? _partyDataList.Find(x => x.EntityId == d1.TetherPairId2) : _partyDataList.Find(x => x.EntityId == d1.TetherPairId1);
if (pc == null) return false;
pc.TowerDirection = Direction.NorthWest;
pc.TowerDirection = Direction.SouthEast;

var pc2 = (pc.TetherPairId1 == d1.EntityId) ? _partyDataList.Find(x => x.EntityId == pc.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc.TetherPairId1);
var pc2 = (pc.TetherPairId1 == mt.EntityId) ? _partyDataList.Find(x => x.EntityId == pc.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc.TetherPairId1);
if (pc2 == null) return false;
pc2.TowerDirection = Direction.South;
pc2.TowerDirection = Direction.NorthWest;

var pc3 = (pc2.TetherPairId1 == mt.EntityId) ? _partyDataList.Find(x => x.EntityId == pc2.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc2.TetherPairId1);
var pc3 = (pc2.TetherPairId1 == pc.EntityId) ? _partyDataList.Find(x => x.EntityId == pc2.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc2.TetherPairId1);
if (pc3 == null) return false;
pc3.TowerDirection = Direction.NorthEast;
pc3.TowerDirection = Direction.South;

var pc4 = (pc3.TetherPairId1 == d1.EntityId) ? _partyDataList.Find(x => x.EntityId == pc3.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc3.TetherPairId1);
var pc4 = (pc3.TetherPairId1 == pc2.EntityId) ? _partyDataList.Find(x => x.EntityId == pc3.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc3.TetherPairId1);
if (pc4 == null) return false;
pc4.TowerDirection = Direction.SouthWest;
pc4.TowerDirection = Direction.NorthEast;

var pc5 = (pc4.TetherPairId1 == pc3.EntityId) ? _partyDataList.Find(x => x.EntityId == pc4.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc4.TetherPairId1);
if (pc5 == null) return false;
pc5.TowerDirection = Direction.SouthWest;

// NEETは適当
neetPc.Find(x => x.index == 0).TowerDirection = Direction.West;
Expand All @@ -449,15 +455,15 @@ private bool ParseTether()
if (pc2 == null) return false;
pc2.TowerDirection = Direction.NorthWest;

var pc3 = (pc2.TetherPairId1 == h.EntityId) ? _partyDataList.Find(x => x.EntityId == pc2.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc2.TetherPairId1);
var pc3 = (pc2.TetherPairId1 == pc.EntityId) ? _partyDataList.Find(x => x.EntityId == pc2.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc2.TetherPairId1);
if (pc3 == null) return false;
pc3.TowerDirection = Direction.South;

var pc4 = (pc3.TetherPairId1 == h.EntityId) ? _partyDataList.Find(x => x.EntityId == pc3.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc3.TetherPairId1);
var pc4 = (pc3.TetherPairId1 == pc2.EntityId) ? _partyDataList.Find(x => x.EntityId == pc3.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc3.TetherPairId1);
if (pc4 == null) return false;
pc4.TowerDirection = Direction.NorthEast;

var pc5 = (pc4.TetherPairId1 == h.EntityId) ? _partyDataList.Find(x => x.EntityId == pc4.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc4.TetherPairId1);
var pc5 = (pc4.TetherPairId1 == pc3.EntityId) ? _partyDataList.Find(x => x.EntityId == pc4.TetherPairId2) : _partyDataList.Find(x => x.EntityId == pc4.TetherPairId1);
if (pc5 == null) return false;
pc5.TowerDirection = Direction.SouthWest;

Expand All @@ -472,7 +478,7 @@ private bool ParseTether()

// NEETは適当
var neet = neetPc.Find(x => x.EntityId != neetHealer.EntityId);
neet.TowerDirection = Direction.East;
neet.TowerDirection = Direction.West;
}

if (_partyDataList.Where(x => x.TowerDirection != Direction.None).Count() != 8) return false;
Expand Down Expand Up @@ -530,22 +536,22 @@ private void ShowSphereAoeAndGuide1()
{
if (_northSpawn)
{
element.SetRefPosition(new Vector3(112, 0, 85));
element.SetRefPosition(new Vector3(111.280f, 0, 88.640f));
}
else
{
element.SetRefPosition(new Vector3(106, 0, 83));
element.SetRefPosition(new Vector3(103.300f, 0, 84.320f));
}
}
else // South
{
if (_northSpawn)
{
element.SetRefPosition(new Vector3(93, 0, 118));
element.SetRefPosition(new Vector3(95.680f, 0, 115.480f));
}
else
{
element.SetRefPosition(new Vector3(88, 0, 115));
element.SetRefPosition(new Vector3(88.7f, 0, 111.280f));
}
}
}
Expand Down
Loading

0 comments on commit 6c9bf1d

Please sign in to comment.