Skip to content

Commit

Permalink
use ActionPointModule at EventConsumableItemCrafts
Browse files Browse the repository at this point in the history
  • Loading branch information
sonohoshi committed Mar 29, 2024
1 parent 77aaa3c commit d7b6f51
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Lib9c/Action/EventConsumableItemCrafts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,16 @@ public override IWorld Execute(IActionContext context)
// Subtract Required ActionPoint
if (costActionPoint > 0)
{
if (avatarState.actionPoint < costActionPoint)
var actionPoint = states.GetActionPoint(AvatarAddress);
if (actionPoint < costActionPoint)
{
throw new NotEnoughActionPointException(
$"{addressesHex}Aborted due to insufficient action point: {avatarState.actionPoint} < {costActionPoint}"
$"{addressesHex}Aborted due to insufficient action point: {actionPoint} < {costActionPoint}"
);
}

avatarState.actionPoint -= costActionPoint;
actionPoint -= costActionPoint;
states = states.SetActionPoint(AvatarAddress, actionPoint);
}
// ~Subtract Required ActionPoint

Expand Down

0 comments on commit d7b6f51

Please sign in to comment.