Hello,
I'm working on a RPG game with elemental trait interactions similar to pokemon. Currently I can only think of a CheckInteraction() function everytime there is an attack or interaction, an a bunch of switch statement to calculate the damage output. Is there a “cleaner” way to do this?
I'm only doing 5 elements (or rather, agents, they are strictly not elements, I'm only calling them elements to simplify the idea) based on the Chinese Traditional thinking system: wood, fire, earth, water, and metal. All of them will have interactions with others like so. I'll take Fire for example:
- Being supported: Fire is supported by Wood:
- When attacking each other, damage output of both is reduced.
- When combined as one attack, damage output of both is increased.
- Neutral: Fire is neutral againts Fire:
- When attacking each other, damage output of both is unchanged.
- When combined, damage output of both is increased.
- Being contrasted: Fire is contrasted by Water:
- When attacking each other, damage output of Water is increased, damage output of Fire is decreased.
- When combining, damage output of both is decreased.
- Support: Fire supports Earth:
- When attacking each other, damage output of both is reduced.
- When combined, damage output of both is increased
- Contrast: Fire contrasts Metal:
- When attacking each other, damage output of Fire is increased, damage output of Metal is decreased.
- When combining, damage output of both is decreased.
There will be other interactions as well, such as when one heals other, stats bonuses when 2 supporting elements goes together in a pair. But all of them falls on the above idea.
Everthing can be sumarized by the chart below:
Thank you very much in advance. I know this sounds like homework, but it is really just my hobby project to understand how games with element like pokemon works.