Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: add a testing blu rotation but is not pulic, too limited.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jan 28, 2023
1 parent 415cf36 commit 29a84da
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 54 deletions.
9 changes: 5 additions & 4 deletions RotationSolver/Actions/BaseAction/BaseAction_Display.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using RotationSolver.Commands;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using RotationSolver.Rotations.Basic;
using RotationSolver.Windows.RotationConfigWindow;

namespace RotationSolver.Actions.BaseAction
Expand Down Expand Up @@ -34,10 +35,10 @@ public unsafe void Display(bool IsActive) => this.DrawEnableTexture(IsActive, ()
ImGui.Text("Must Use:" + CanUse(out _, mustUse: true).ToString());
ImGui.Text("Empty Use:" + CanUse(out _, emptyOrSkipCombo: true).ToString());
ImGui.Text("IsUnlocked: " + UIState.Instance()->IsUnlockLinkUnlocked(AdjustedID).ToString());
//if (Target != null)
//{
// ImGui.Text("Target Name: " + Target.Name);
//}
if (Target != null)
{
ImGui.Text("Target Name: " + Target.Name);
}
}
catch
{
Expand Down
22 changes: 10 additions & 12 deletions RotationSolver/Actions/BaseAction/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,20 @@ private bool TargetAreaHostile(int aoeCount, out BattleChara target)

private bool TargetAreaMove(float range, bool mustUse, out BattleChara target)
{
var availableCharas = Service.ObjectTable.Where(b => b.ObjectId != Service.ClientState.LocalPlayer.ObjectId).OfType<BattleChara>();
target = TargetFilter.GetObjectInRadius(availableCharas, range).FindTargetForMoving(mustUse);
if (target == null)
if (Service.Configuration.MoveAreaActionFarthest)
{
if (Service.Configuration.MoveAreaAbilityMustUse)
{
Vector3 pPosition = Service.ClientState.LocalPlayer.Position;
float rotation = Service.ClientState.LocalPlayer.Rotation;
_position = new Vector3(pPosition.X + (float)Math.Sin(rotation) * range, pPosition.Y,
pPosition.Z + (float)Math.Cos(rotation) * range);
return true;
}
return false;
target = null;
Vector3 pPosition = Service.ClientState.LocalPlayer.Position;
float rotation = Service.ClientState.LocalPlayer.Rotation;
_position = new Vector3(pPosition.X + (float)Math.Sin(rotation) * range, pPosition.Y,
pPosition.Z + (float)Math.Cos(rotation) * range);
return true;
}
else
{
var availableCharas = Service.ObjectTable.Where(b => b.ObjectId != Service.ClientState.LocalPlayer.ObjectId).OfType<BattleChara>();
target = TargetFilter.GetObjectInRadius(availableCharas, range).FindTargetForMoving(mustUse);
if (target == null) return false;
_position = target.Position;
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class PluginConfiguration : IPluginConfiguration
public Vector3 SubTargetColor = new(1f, 0.9f, 0f);
public bool KeyBoardNoise = true;
public bool UseGroundBeneficialAbility = true;
public bool MoveAreaAbilityMustUse = true;
public bool MoveAreaActionFarthest = true;
public bool StartOnCountdown = true;
public bool NoNewHostiles = false;
public bool UseHealWhenNotAHealer = true;
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/Data/StatusID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,4 +1115,6 @@ internal enum StatusID : ushort
MightyGuard = 1719,

IceSpikes = 1307,

RespellingSpray = 556,
}
4 changes: 2 additions & 2 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
"Configwindow_Param_MoveTowardsScreenDesc": "Using movement actions towards the object in the center of the screen, otherwise toward the facing object.",
"Configwindow_Param_RaiseAll": "Raise all (include passerby)",
"Configwindow_Param_RaiseBrinkofDeath": "Raise player even has Brink of Death",
"Configwindow_Param_MoveAreaAbilityMustUse": "Must use the Moving Area Ability",
"Configwindow_Param_MoveAreaAbilityMustUseDesc": "If no character can be moved, move to the furthest position from character's face direction.",
"Configwindow_Param_MoveAreaActionFarthest": "Moving Area Ability to farthest",
"Configwindow_Param_MoveAreaActionFarthestDesc": "Move to the furthest position from character's face direction.",
"Configwindow_Param_Hostile": "Hostile",
"Configwindow_Param_HostileDesc": "You can set the logic of hostile target selection to allow flexibility in switching the logic of selecting hostile in battle.",
"Configwindow_Param_AddHostileCondition": "Add selection condition",
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ internal class Strings
public string Configwindow_Param_MoveTowardsScreenDesc { get; set; } = "Using movement actions towards the object in the center of the screen, otherwise toward the facing object.";
public string Configwindow_Param_RaiseAll { get; set; } = "Raise all (include passerby)";
public string Configwindow_Param_RaiseBrinkofDeath { get; set; } = "Raise player even has Brink of Death";
public string Configwindow_Param_MoveAreaAbilityMustUse { get; set; } = "Must use the Moving Area Ability";
public string Configwindow_Param_MoveAreaAbilityMustUseDesc { get; set; } = "If no character can be moved, move to the furthest position from character's face direction.";
public string Configwindow_Param_MoveAreaActionFarthest { get; set; } = "Moving Area Ability to farthest";
public string Configwindow_Param_MoveAreaActionFarthestDesc { get; set; } = "Move to the furthest position from character's face direction.";
public string Configwindow_Param_Hostile { get; set; } = "Hostile";
public string Configwindow_Param_HostileDesc { get; set; } = "You can set the logic of hostile target selection to allow flexibility in switching the logic of selecting hostile in battle.";
public string Configwindow_Param_AddHostileCondition { get; set; } = "Add selection condition";
Expand Down
50 changes: 36 additions & 14 deletions RotationSolver/Rotations/Basic/BLU_Base.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using RotationSolver.Actions;
using RotationSolver.Actions.BaseAction;
using RotationSolver.Configuration.RotationConfig;
using RotationSolver.Data;
using RotationSolver.Helpers;
using RotationSolver.Updaters;
Expand All @@ -11,6 +12,7 @@ namespace RotationSolver.Rotations.Basic;
internal interface IBLUAction : IBaseAction
{
bool OnSlot { get; }
bool RightType { get; }
}
internal abstract class BLU_Base : CustomRotation.CustomRotation
{
Expand All @@ -21,7 +23,6 @@ internal enum BLUID : byte
DPS,
}


internal enum BLUAttackType : byte
{
Magical,
Expand Down Expand Up @@ -53,33 +54,37 @@ public class BLUAction : BaseAction, IBLUAction

static readonly StatusID[] NoMagic = new StatusID[]
{
StatusID.RespellingSpray,
};

private BLUActionType Type;
private BLUActionType _type;
public bool RightType
{
get
{
if (AttackType == BLUAttackType.Physical && _type == BLUActionType.Magical) return false;
if (AttackType == BLUAttackType.Magical && _type == BLUActionType.Physical) return false;

if (Target.HasStatus(false, NoPhysic) && _type == BLUActionType.Physical) return false;
if (Target.HasStatus(false, NoMagic) && _type == BLUActionType.Magical) return false;
return true;
}
}

public unsafe bool OnSlot => ActionUpdater.BluSlots.Any(i => AdjustedID == Service.IconReplacer.OriginalHook(i));

internal BLUAction(ActionID actionID, BLUActionType type, bool isFriendly = false, bool shouldEndSpecial = false, bool isEot = false, bool isTimeline = false)
: base(actionID, isFriendly, shouldEndSpecial, isEot, isTimeline)
{
Type = type;
FilterForTarget = ts => ts.Where(t =>
{
if (t.HasStatus(false, NoPhysic) && Type == BLUActionType.Physical) return false;
if (t.HasStatus(false, NoMagic) && Type == BLUActionType.Magical) return false;
return true;
});
_type = type;
ActionCheck = t => OnSlot && RightType;
}

public override bool CanUse(out IAction act, bool mustUse = false, bool emptyOrSkipCombo = false, bool skipDisable = false)
{
act = null;

if (!OnSlot) return false;

if (AttackType == BLUAttackType.Physical && Type == BLUActionType.Magical) return false;
if (AttackType == BLUAttackType.Magical && Type == BLUActionType.Physical) return false;

return base.CanUse(out act, mustUse, emptyOrSkipCombo, skipDisable);
}
}
Expand Down Expand Up @@ -277,7 +282,10 @@ public override bool CanUse(out IAction act, bool mustUse = false, bool emptyOrS
/// <summary>
/// 哔哩哔哩
/// </summary>
public static IBLUAction Tingle { get; } = new BLUAction(ActionID.Tingle, BLUActionType.Magical);
public static IBLUAction Tingle { get; } = new BLUAction(ActionID.Tingle, BLUActionType.Magical)
{
StatusProvide = new StatusID[] {StatusID.Tingling},
};

/// <summary>
/// 掀地板之术
Expand Down Expand Up @@ -773,4 +781,18 @@ private protected override bool EmergencyGCD(out IAction act)
if (a is not BLUAction b) return false;
return b.OnSlot;
}).ToArray();

private protected override IRotationConfigSet CreateConfiguration()
{
return base.CreateConfiguration()
.SetCombo("BlueId", 2, "Role", "Tank", "Healer", "DPS")
.SetCombo("AttackType", 2, "Type", "Magic", "Physic", "Both");
}

private protected override void UpdateInfo()
{
BlueId = (BLUID)Configs.GetCombo("BlueId");
AttackType = (BLUAttackType)Configs.GetCombo("AttackType");
base.UpdateInfo();
}
}
47 changes: 47 additions & 0 deletions RotationSolver/Rotations/RangedMagicial/BLU/BLU_25.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using RotationSolver.Actions;
using RotationSolver.Commands;
using RotationSolver.Data;
using RotationSolver.Helpers;
using RotationSolver.Rotations.Basic;
using RotationSolver.Updaters;
#if DEBUG
namespace RotationSolver.Rotations.RangedMagicial.BLU;

internal class BLU_25 : BLU_Base
{
public override string GameVersion => "6.3";

public override string RotationName => "25";

private protected override bool AttackAbility(byte abilitiesRemaining, out IAction act)
{
act = null;
return false;
}

private protected override bool GeneralGCD(out IAction act)
{
if (TripleTrident.OnSlot && TripleTrident.RightType && TripleTrident.WillHaveOneChargeGCD(OnSlotCount(Whistle, Tingle), 0))
{
if (Whistle.CanUse(out act)) return true;

if (!Player.HasStatus(true, StatusID.Tingling)
&& Tingle.CanUse(out act, mustUse: true)) return true;
if (Offguard.CanUse(out act)) return true;

if (TripleTrident.CanUse(out act, mustUse: true)) return true;
}

if (SonicBoom.CanUse(out act)) return true;
if (DrillCannons.CanUse(out act, mustUse: true)) return true;

return false;
}

private protected override bool HealAreaGCD(out IAction act)
{
if (WhiteWind.CanUse(out act, mustUse: true)) return true;
return base.HealAreaGCD(out act);
}
}
#endif
22 changes: 6 additions & 16 deletions RotationSolver/Rotations/RangedMagicial/BLU/BLU_Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ internal sealed class BLU_Default : BLU_Base
private protected override IRotationConfigSet CreateConfiguration()
{
return base.CreateConfiguration()
.SetCombo("BlueId", 2, "Role", "Tank", "Healer", "DPS")
.SetCombo("AttackType", 2, "Type", "Magic", "Physic", "Both")
.SetBool("MoonFluteBreak", false, "MoonFlute")
.SetBool("SingleAOE", true, "Single AOE")
.SetBool("GamblerKill", false, "Gambler Kill")
Expand All @@ -46,13 +44,6 @@ private protected override IRotationConfigSet CreateConfiguration()
/// </summary>
private bool SingleAOE => Configs.GetBool("SingleAOE");

private protected override void UpdateInfo()
{
BlueId = (BLUID)Configs.GetCombo("BlueId");
AttackType = (BLUAttackType)Configs.GetCombo("AttackType");
base.UpdateInfo();
}

private protected override bool AttackAbility(byte abilitiesRemaining, out IAction act)
{
act = null;
Expand Down Expand Up @@ -138,17 +129,16 @@ private protected override bool HealAreaGCD(out IAction act)
/// <returns></returns>
private bool DBlueBreak(out IAction act)
{
act = null;
if (!HasHostilesInRange) return false;

if (AllOnSlot(TripleTrident) && TripleTrident.WillHaveOneChargeGCD(OnSlotCount(Whistle, Tingle), 0))
if (TripleTrident.OnSlot && TripleTrident.WillHaveOneChargeGCD(OnSlotCount(Whistle, Tingle), 0))
{
//口笛
if (Whistle.CanUse(out act)) return true;
//哔哩哔哩
if (!Player.HasStatus(true, StatusID.Tingling) && Player.HasStatus(true, StatusID.Harmonized) && Tingle.CanUse(out act, mustUse: true)) return true;
if (!Player.HasStatus(true, StatusID.Tingling)
&& Tingle.CanUse(out act, mustUse: true)) return true;
if (Offguard.CanUse(out act)) return true;
//鱼叉
if (TripleTrident.CanUse(out act, mustUse: true)) return true;
if(TripleTrident.CanUse(out act, mustUse: true)) return true;
}

if (AllOnSlot(Whistle, FinalSting, BasicInstinct) && UseFinalSting)
Expand Down Expand Up @@ -246,7 +236,6 @@ private bool CanUseFinalSting(out IAction act)

if (AllOnSlot(Whistle, MoonFlute, FinalSting, BasicInstinct))
{

//破防
if (Player.HasStatus(true, StatusID.WaxingNocturne) && Offguard.CanUse(out act)) return true;

Expand Down Expand Up @@ -301,6 +290,7 @@ private bool SingleGCD(out IAction act)
if (Player.CurrentMp < 1000 && BloodDrain.CanUse(out act)) return true;
//音爆
if (SonicBoom.CanUse(out act)) return true;
if (DrillCannons.CanUse(out act,mustUse:true)) return true;
//永恒射线 无法 +眩晕1s
if (PerpetualRay.CanUse(out act)) return true;
//深渊贯穿 无物 +麻痹
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver/Windows/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ private void DrawParamTarget()
ref Service.Configuration.MoveTargetAngle, 0.02f, 0, 100,
LocalizationManager.RightLang.Configwindow_Param_MoveTargetAngleDesc);

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_MoveAreaAbilityMustUse,
ref Service.Configuration.MoveAreaAbilityMustUse,
LocalizationManager.RightLang.Configwindow_Param_MoveAreaAbilityMustUseDesc);
DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_MoveAreaActionFarthest,
ref Service.Configuration.MoveAreaActionFarthest,
LocalizationManager.RightLang.Configwindow_Param_MoveAreaActionFarthestDesc);

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_RaiseAll,
ref Service.Configuration.RaiseAll);
Expand Down

0 comments on commit 29a84da

Please sign in to comment.