Hot answers tagged

2

Based on your description, I would make each card effect verb a class & then use composition to combine them into cards as needed. E.G. the draw cards action would be an effect class, its parameters might be # of cards, source drawn from & type of draw. Damage player might be another effect class & its parameters might be amount & ...


2

Card and Slot concepts should not be mixed. They're not the same. My behind is not fused with the chair on which I'm sitting. This allows me to play musical chairs. Let's organize your data: // A card; belongs to a player, has abilities (among which we find 'CanJump') Card Owner : Player // Blue or red CanJump : bool // Tells if the card can jump two ...


1

I'm not 100% sure I caught your main idea between card relationships here, but to me it looks like some sort of network-like structure might work here. Your cards would have neighbours specified with some relation. It seems like you are trying to force a generic array here, but I think this is where using some traditional OOP simplifies the thinking process ...



Only top voted, non community-wiki answers of a minimum length are eligible