Here's a VERY short (partial) sample of some ideas ... I'm going to throw out some specifics as an example, the intent is that you can see a small example and then adapt it into something very different to meet your specific needs ... I'm just trying to show you a little about the "composition" thing. (and there are hundreds of ways this can be done, this is just a simple quick starting idea).
I'm going to use SOME pseudocode for parts below, representing things that would exist OUTSIDE the scope of that part I'm showing you ... you will need to adapt to your system of couse. The main 2 things I'm assuming are that there is some base "game object" (something interface or class like IGameObject, GameObject or ITargetable that all of your "affectable" objects inheirit from ... so they can be passed around the api ... this does NOT assume that that core interface defines all the properties at that level, but instead there can be further interfaces or derived types that add features ... ). I'm also not trying to dictate how you pass around your "context" (ie game state, world info etc ..) I'm just assuming you have some simple way to access such a thing outside the scope of this example.
public interface IEffect
{
bool CanTarget(IGameObject target);
void ApplyEffect(IGameObject target);
}
public class Card
{
List<IEffect> Effects { get; }
// lots of other unshown stuff likely here too ...
}
public DamageEffect : IEffect
{
public DamageType DamageType { get; set; } // an enum for Physical, Lightning, Arcane, whatever ... the use might involve damage modifiers, or just different graphical effects
public float DamageAmount {get; set; }
bool CanTarget(IGameObject target)
{
return (target.Owner != card.Owner);
}
void ApplyEffect(IGameObject target)
{
float realDamage = DamageAmount - target.DefenseRating(DamageType);
target.ReduceHealth(realDamage);
}
}
Once again, just a primative illustration of the idea ... not a working implementation ... tons more to add like target selection options (single enemy, self, enemy and self, group, all enemies, ...)
But if you can get a system working that deals with multiple effects being arbitraily combined with single enemy target support ... then you can add self target cards, group targets cards ... and finally the ability for a single card to have different targetting for different parts of it (its effects) ... such as "blast all enemies of a single type for X damage each, and heal 1 for each target affected" ... but start small and work your way up ...