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

Commit

Permalink
fix: refine the MP check.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 29, 2023
1 parent 85950e7 commit a4f3198
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/BaseAction_ActionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public unsafe virtual bool CanUse(out IAction act, CanUseOption option = CanUseO

if (!EnoughLevel) return false;

if (player.CurrentMp < MPNeed) return false;
if (player.GetMP() < MPNeed) return false;

if (StatusNeed != null)
{
Expand Down
11 changes: 11 additions & 0 deletions RotationSolver.Basic/Helpers/ObjectHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ or 71344 //Major Quest
return false;
}

public static uint GetMP(this BattleChara b)
{
if(b == null) return 0;
var mp = b.CurrentMp;
if (!b.IsCasting) return mp;

var subMp = (uint)ActionManager.GetActionCost(ActionType.Spell, b.CastActionId, 0, 0, 0, 0);
if (subMp < 100) subMp = 0;
return mp - subMp;
}

public static unsafe uint GetNamePlateIcon(this GameObject obj) => obj.GetAddress()->NamePlateIconId;
public static unsafe void SetNamePlateIcon(this GameObject obj, uint id) => obj.GetAddress()->NamePlateIconId = id;
public static unsafe EventHandlerType GetEventType(this GameObject obj) => obj.GetAddress()->EventId.Type;
Expand Down

0 comments on commit a4f3198

Please sign in to comment.