|
Post by John on Jan 13, 2023 9:55:34 GMT
Hi all,
I have some status effects idea that i have some issue to implement.
First one is Confuse - which will flip the driver and alliance. Those parts are simple but I don't know how to add another part of the effect: when attacked (or maybe take damage) by other unit this effect will remove automaticly.
Second one is Doom - which will kill the effected unit after the counter reach zero.
Could someone help me please?
Thanks
|
|
|
Post by Admin on Jan 15, 2023 1:30:00 GMT
Confuse: There could be an easy option or harder options depending on what you require. An easy option could be that when a confuse status is added to a unit, that it adds a listener for the DidChangeNotification of the unit's hitpoints as an opportunity to remove the status.
Of course a loss of hitpoints could occur at any time the unit looses hit points, whether from being poisoned or by performing a reckless ability that also damages the user. If the removal of Confuse should be restricted to taking damage by a direct attack, then you might need a different approach. You could modify the way that BaseAbilityEffect.HitNotification provides an int and instead return a compound object that includes both an amount and a tile target. You then let either the confuse status effect or its duration component observe that notification, and check if the target ultimately represents the unit with the confused status or not, and can also grab a reference to the parent ability and check its name, or some new component that helps determine if it is a type of ability that can remove the confuse status or not.
Doom: Add a listener for TurnOrderController's relevant notification (turn or round) (begin or end). The status would hold a count of turns to listen for and a count of matching notifications it has handled, and then when it has reached the limit, it can set apply the code to kill the unit that the status is on.
|
|
|
Post by John on Jan 19, 2023 1:35:29 GMT
Thanks for the advice, but I was thinking that if I add a listener to turn begin notification for doom status effect (because I think that's how the game works) then the kill unit action will be triggered after the unit takes the turn and it isn't what should happen... I still have no idea how to solve this issue.
|
|
|
Post by Admin on Feb 1, 2023 0:00:56 GMT
The easiest solution might be observing the turn end notification to apply doom. If your desire is to keep the user from taking their turn because of the doom killing them, then you will need to modify the various systems and state machine states to account for a scenario where a unit can die or be disabled on its own turn. Handling for that probably needed to be added anyway.
|
|