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

Commit

Permalink
fix: try to remove canattack method.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 11, 2023
1 parent e49393b commit 90623c1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion RotationSolver/Actions/BaseAction/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private bool TargetHostile(float range, bool mustUse, int aoeCount, out BattleCh
//如果不用自动找目标,那就直接返回。
if (RSCommands.StateType == StateCommandType.Manual)
{
if (Service.TargetManager.Target is BattleChara b && b.CanAttack() && b.DistanceToPlayer() <= range)
if (Service.TargetManager.Target is BattleChara b && b.IsNPCEnemy() && b.DistanceToPlayer() <= range)
{
return TargetHostileManual(b, mustUse, aoeCount, out target);
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal static unsafe void DoAnAction(bool isGCD)
//Service.ChatGui.Print($"{act}, {act.Target.Name}, {ActionUpdater.AbilityRemainCount}, {ActionUpdater.WeaponElapsed}");
#endif
//Change Target
if (Service.TargetManager.Target is not PlayerCharacter && (act.Target?.CanAttack() ?? false))
if (Service.TargetManager.Target is not PlayerCharacter && (act.Target?.IsNPCEnemy() ?? false))
{
Service.TargetManager.SetTarget(act.Target);
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Data/MarkingController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static BattleChara GetAttackMarkChara(IEnumerable<BattleChara> charas)
for (uint i = 0; i < 5; i++)
{
var b = GetChara(charas, GetMarker(i));
if (b?.CanAttack() ?? false) return b;
if (b?.IsNPCEnemy() ?? false) return b;
}
return null;
}
Expand Down
14 changes: 7 additions & 7 deletions RotationSolver/Helpers/ObjectHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ internal static EnemyPositional FindEnemyLocation(this GameObject enemy)
return EnemyPositional.Flank;
}

public unsafe static bool CanAttack(this GameObject actor)
{
if (actor == null) return false;
if (actor is not BattleChara b) return false;
if (b.CurrentHp == 0) return false;
return ((delegate*<long, IntPtr, long>)Service.Address.CanAttackFunction)(142L, actor.Address) == 1;
}
//public unsafe static bool CanAttack(this GameObject actor)
//{
// if (actor == null) return false;
// if (actor is not BattleChara b) return false;
// if (b.CurrentHp == 0) return false;
// return ((delegate*<long, IntPtr, long>)Service.Address.CanAttackFunction)(142L, actor.Address) == 1;
//}

#if DEBUG
internal static uint GetHealthFromMulty(float mult)
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/SigReplacers/PluginAddressResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace RotationSolver.SigReplacers;
internal class PluginAddressResolver : BaseAddressResolver
{
public IntPtr IsActionIdReplaceable { get; private set; }
public IntPtr CanAttackFunction { get; private set; }
//public IntPtr CanAttackFunction { get; private set; }
public IntPtr MovingController { get; private set; }
public IntPtr ReceiveAbilty { get; private set; }
public IntPtr CountdownTimerAdress { get; private set; }
Expand All @@ -22,7 +22,7 @@ protected override void Setup64Bit(SigScanner scanner)
IsActionIdReplaceable = scanner.ScanText("E8 ?? ?? ?? ?? 84 C0 74 4C 8B D3");

//IDK
CanAttackFunction = scanner.ScanText("48 89 5C 24 ?? 57 48 83 EC 20 48 8B DA 8B F9 E8 ?? ?? ?? ?? 4C 8B C3 ");
//CanAttackFunction = scanner.ScanText("48 89 5C 24 ?? 57 48 83 EC 20 48 8B DA 8B F9 E8 ?? ?? ?? ?? 4C 8B C3 ");
MovingController = scanner.ScanText("40 55 53 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 48 83 79 ?? ??");
ReceiveAbilty = scanner.ScanText("4C 89 44 24 ?? 55 56 41 54 41 55 41 56");
CountdownTimerAdress = scanner.ScanText("48 89 5C 24 ?? 57 48 83 EC 40 8B 41");
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/TargetUpdater_Hostile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private unsafe static void UpdateHostileTargets(IEnumerable<BattleChara> allTarg

if (b.StatusList.Any(StatusHelper.IsInvincible)) return false;

return b.CanAttack();
return true;
});

HostileTargets.Delay(GetHostileTargets(allAttackableTargets));
Expand Down

0 comments on commit 90623c1

Please sign in to comment.