I’m currently working on a card game. Each card describes what is does as well as the damage dealt. My current issue is when the user has an attack buff or debuff the damage it will deal changes. The damage value is backed into the description of the card. So far my only thought is to specifically place the damage value once the description is written but this seems like a terrible idea for 100+ cards. Is there a better way?
I could also reposition where the damage is displayed on the card outside of the description but prefer for the players sake to keep it in the same place.
Currently each card pulls from a scripted object with the description to a TextMeshProUGUI on the card.
A typical way to handle this would be for the card text to have some sort of placeholder string indicating where the damage should go, and then replace that substring with the actual damage value when you are actually ready to display it.
So the card text might be something like “Deals {dmg} points of damage to every flying enemy in target row.” And then you’d use String.Replace to replace {dmg} with the actual number.
A more-extreme way of handling this would be for the entire text to be generated programmatically based on the card’s effect, so no human being ever has to write body text specifically for that exact card. This is more difficult, but avoids a whole class of bugs where the text accidentally gets out of sync with the actual effect.
I would actually go this way ^ ^ ^ … define all your card effects in data structures, perhaps JSON files or else ScriptableObjects.
Then when you create the cards, pluck out the human-readable parts and fill them into the card text and geometry (image, etc.), and you would also have access to precisely what that card is, so it would never get out of sync with the data, which would drive behavior.
Update on this! I decided to add a string that replaces the damage values as Antistone suggested. Right now, the effects of the cards can be very unique that I think (for now) just replacing the damage values works for me. Thanks for the advice I’m super happy to have this functionality in the game!