So I have been studying game programming for a while now, and something I can never figure out is how you code a skills for characters.
For example, imagine you have a game where a character can perform an attack, a unique skill, and use items. Lets say all characters use their 100% of their attack stat when performing an attack, and all your characters can use any item available in your inventory. In this case, you can just create a class for characters and code the function to perform an attack and use items, because all characters can do the same thing.
But then how does one go about making unique skills? For example, a skill that:
1. Compares the user and target's current health, and deals 200%/50% of the user's atk depending on if their current health is less/more than that of the target
2. User deals damage to target, and if that damage results in a kill, the user can then get an extra turn
3. After performing the skill, the user switches places with another character in their party, etc.
Another example would be in card games like Hearthstone or Shadowverse, every card has their own attack/defense stats, and they have unique effects when played
EDIT: I'm most experienced with Unity so if anyone could explain to me in the context of Unity I think it'd be the most helpful