I have a entity called Item, and every item can have two or three bonuses...
What would be a good model design in this situation. I can think of something like:
To have many optional attributes inside Item entity i.e.
(Item)
fire_rate_bonus
energy_bonus
damage_bonus
health_bonus
some_other_bonus
And then when creating an item, I would set the values for appropriate bonuses and rest of attributes will be set to null.
I find that this approach solving my problem, but is there some other/better/efficient way? If you need more info about this, I will update my question. Thanks in advance...
EDIT:
Doing like above in my case will do the job, because I don't have much possible bonuses. But let's say there is a lot of possible bonuses, and an item can have only few bonuses. Then I think this method could be overkill because:
Item entity will have too much unused attributes.
What I can think of (I know that Core Data is not relational database system, but I like to think in relational way) is to make new entity called Bonus with relationship between Item entity (one Item can have many bonuses) with attributes :
bonus_name, bonus_modifier or something like that.
And then when creating an Item just assign appropriate bonuses to it. I hope this make some sense.