Actions with more cost than Max Action Points

Hi, I’ve just finished the complete course, and I was thinking about how to implement an action that costs more than the max action points of the unit, like an special attack that resolves in the next turn.

I tried to put a wainting state to the unit and control it in de UnitActionSystem, but it seems not to be a good idea. Any sugestions?

Hmm that’s a tricky one, I think what I would probably do is make the action have two states.
First time you use it you warm up the attack, the second time you use it it triggers the actual attack.

So on the action you would store some kind of bool isWarmedUp; when taking the action check if it’s false, set it to true and play some pre-attack animation, if it’s already warmed up do the big attack.

I think that would be the best way to implement and would keep all the logic on the attack itself rather than having the UnitActionSystem responsible for keeping track of that logic.

2 Likes

Nice idea, but, how do you prevent from do any other action while this action is in warm up state?

Perhaps a variable in the Unit that can be set to indicate that a turn is pending…

System.Action pendingAction;

public void SetPendingAction(System.Action action) => pendingAction=action;

public bool HasPendingAction()=>pendingAction!=null;

public void FinishPendingAction()
{
    pendingAction?.Invoke();
    pendingAction=null;
}

Then our two state Action can do it’s first state and then call

unit.SetPendingAction(FinishAction);

The FinishAction can deal with the deduction of points for the second half of the action.
UnitActionSystem automatically call FinishPendingAction() on the Unit if it HasPendingAction();

This is a rough sketch… I may play with this some more later, flesh it out, as there are still a few bits missing to ensure that the pending action doesn’t fire prematurely… Perhaps checking to see if the user has sufficient energy before firing the action…

3 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms