top of page

One Use Ability

Starting Date: 01/03/2025

Ending Date: 15/04/2025

This blog is about one use abilities on how each player can only those abilities once per game, the one use ability also provides unique behaviour depending on the character the player is currently playing as.

Objective

The goal of this blog is to create one use abilities for all of the characters, this involves the player able to use the ability at the start of their turn, however they can only use that ability once per game, meaning that once they used it then they cannot use it again.

​

The first objective is to have double wielder's stance swap functioning which swaps the stance around, this involves changing the current stance to the other stance and resetting the cooldown back to 3 turns.

​

The second objective is to have grim reaper's last reapsort functioning which goes to a status of reaping which will triple the player's movement and thrust if they defeat their opponent before the end of their turn then they'll gain 25% of their health and increase their max health by 25%, otherwise the player loses the game, this involves adding three methods:

  1. Begin Reaping - Increases the multipliers by three, and enables the other two methods in their suitable event to listen to

  2. End Reaping - Ends the status with the player gaining health and max health

  3. Failed Reaping - Player loses

​​

The third objective  is to have lucky gambler's luck of your life functioning which provides a random outcome with five of them being good and one being bad, this involves providing a random number to generate as well as providing unique behaviour to implement on each outcome, these outcomes include:

  1. Jumping Jackpot - Increase the player's cash by 300

  2. Buff Bonanza - Apply lucky, hasty, healthy and invincible for three turns

  3. Random Relic - Obtain a random relic

  4. Surprised Steal - Steal 20 coins for each opponent

  5. Health and Wealthy - Gain health equal to cash, then gain cash equal to health

  6. Cashout Crashout - Lose all the player's cash

​

The final objective is to have robotic superstar's ruthless retaliation functioning which goes to a status of ruthless which reduces the damage to 0 and deals 50 damage to the attacker if the player is currently in the defend state. If the player hasn't been in the defend state before their next turn then they'll be affected by slow, feared and exposed for five turns and then stunned for two turns, this involves adding more methods to check if the player is currently in ruthless status and then provides two methods with one ending the ruthless status without the negative effects and the other one affecting the player with those effects.

Techniques

Observer Pattern

The observer pattern is a design pattern that provides a one to many dependency with one event subject invoking all the observer methods that are listening to the subject, this provides one event to call multiple methods in different classes.

 

I used observer pattern for all one use abilities by adding the a observer method to the one use event which when the player presses Q and the confirm with space will invoke the one use ability, this will then play the method that was listening to the one use event.

​

Furthermore, I added more observers in both grim reaper's and robotic superstar's one use ability both abilities identifying when they're currently in their ability status which add more observers to listen to other event subjects which will either play the ability being successful or failed.

​

Using the observer pattern was very useful for me as I can add the events onto the scripts that are referenced to then have the one use abilities to be called once the player has input one use ability and confirm, which leads the players to use the one use ability at a suitable moment.​​

Random Range

Random range is a unity engine method that can select a random range between the minimum and maximum value, with floats they include the maximum float value whilst integers exclude the maximum value.

​

I used random range on the lucky gambler's one use ability which depending on the outcome will play a method from the ability to have one of the behaviours occur in the game when playing as lucky gambler.

​

Using random range was very helpful because a simple usage of random range is capable of providing even odds for the abilities to occur, this leads the player to have a even chance to get any of the outcomes when using lucky gambler's one use ability.​

Challenges

No Reward for Last Reapsort (Technically)

Technically towards the grim reaper's one use ability as the game is current at, the player will not be rewarded with bonus health and max health when defeating the enemy. This is because the game currently has one game mode which is duel (1 on 1), meaning that if the player defeats their opponent they just win.

​

Is not a major issue, however this can provide no actual reward to defeating an opponent afterwards and just provide risk of losing the game with the benefit of tripling the thrust and roll multiplier, which can lead the player to use the one use only when they're low on health or when the opponent is low on health.

Unpreventable Luck of Your Life Exploit

Unfortunately, there isn't a possible solution from my knowledge towards preventing the player from exploiting the one use ability, this is because due to having save and load data, the player can identify the outcome and if it's not in their favour then they can leave and try to get the outcome they want.

​

This is a major issue because the player can exploit this issue and ignore the luck element of obtaining a random outcome to always be in their favour every game, causing no risk on using the one use ability.

​

I did provide a solution to reduce the player's favour by ensuring that the outcome changes at the end of the player's turn, meaning that the player will always obtain the same outcome on their turn and only changes when the player ends their turn, which leads the player to find exploiting the one use ability harder due to trying to get the right outcome on the specific turn.

Ruthless Retaliation Changes

Throughout implementing the one use ability, I had to change the ability's behaviour to ensure that the player cannot quit the game and then load back the game to remove the thrust, guard and roll decrease, this is due to adding save and load data to the game which the player can leave and load up the game again to remove negative multipliers.

​

This is a major exploit from the player as they can remove the negative multipliers to prevent them to halve the movement, attack and defend value, which would lead the player to have small consequences towards failing to become ruthless to the opponent.

​

I managed to fix this issue by changing the design of the failed attempt by applying slow, feared and exposed for five turns and then applying stun for two turns, this is because the player cannot remove these effects, meaning that the player will have full consequence when failing to use the one use ability, leading to balancing the risk and reward on using the ability.

Achieved

Stance Swap Complete

Stance swap has been completed by using the observer pattern for the swap stance method to listen to the one use event subject which once invoked will call the method to reference the passive aggressive script (wielder's passive ability) to change the stance and set the cooldown to three.

​

Despite a very basic implementation, this does provide meaningful action for the player to use because they can change the stance whenever they want to at the start of their turn, meaning that they can use the one use ability for risk to deal high damage or act as a safety ability to prevent taking high amount of damage, leading to decision making on using the ability at the right time.

Last Reapsort Complete

Last reapsort has been completed by using the observer pattern multiple times with the begin reaping method to listen to the one use ability event which once invoke will add four methods into specific events: chase method will be listening to the move event which triples the movement value, reap method will be listening to the before combat event which will triple the attack value, defeated opponent method will be listening to after combat event which will gain basically make the player win in a duel but in a battle royale (in the future) will increase the player's health and max health and failed reaping method will listen to end events which at the end of their turn will cause the player to lose.

​

This ability is arguably the most risk and reward in the game because this ability determines on who wins and who loses, in a duel this will mean that if the opponent is defeated then the player wins otherwise the opponent wins, this leads the player playing as the grim reaper to have the most game changing ability in the game out of all of the characters.

Luck of Your Life Complete

Luck of your life has been completed by using the observer pattern with luck of your life method to listen to the one use event which when invoked will have the random range choose a random number between 1 to 6, which will provide the outcome to the player.

​

Despite my attempts on preventing the exploit, the player can still provide a suitable outcome that favours them in the game, this is because if the player can still exploit the outcome then they can get the outcome they want by leaving and joining, it's still an issue for me to solve in the future, however as it stands, it does make the outcome harder for the player to favour them, leading the outcome to have some risk of not being advantageous the player.

Ruthless Retaliation Complete

Ruthless retaliation has been completed by using the observer pattern multiple times with ruthless retaliation method to listen to the one use event which will then add other observer methods to listen to other subjects such as: prepared method will be listening to the before combat event which will negate the attack to the player and then deal 50 damage to the opponent and the overprepared method will be listening to the start item events (it needs to be start items because it doesn't function when it's on the start event somehow) which will apply negative affects to the player such as slow, feared, exposed and stunned.

​

​The ability is very strong to the player if they managed to pull it off because 50 damage in the game is at least half of any character's base health with the highest being wielder at 100 and with the consequence being very impactful to the player on providing a major risk if failed. This can provide a massive risk and reward factor with the benefit being to deal extremely high amount of damage to the opponent with the risk of being affected with four affects that all except stun remain until five turns.​

Conclusion

Overall, I learnt that the observer pattern is a very effective towards events due to adding and removing events at the right moment and calling all methods at the right time in the game. Random range does also provide some usefulness towards providing specific abilities in order to add randomness, however with players behave towards finding exploits could be an issue to provide if the outcomes aren't entirely balanced.

​

As a programmer I feel like the observer pattern can be a very reliable pattern to learn due to adding methods into the event and then calling all of them at once rather than to reference the script and call the method from the script component. Although I'm not a designer I should reconsider my idea on balancing out the outcomes where the player wouldn't know which one is the best one to exploit, this would reduce the chance of the player's behaviour to exploit the one use ability.

​

The observer pattern will be likely used in most occasions in my projects in the future, especially for inputs as they can identify the inputs made to invoke the events that are added onto the input event subjects. As for random range it still can be used, however I would either need to find a suitable solution to fully prevent the player from exploiting mechanics whether this be the implementation or design side of the mechanic.

bottom of page