Bear with me this will take some explanations …
I'm trying to design my game as close as possible to Model-View-Controller design principles. At least to the extent that I understand these principles.
I have two relevant classes in my view and my model, respectively (with a playerInput class irrelevant in this case, playing the role of controller)
BattleSerializable (My model that manages combat logic)
BattleView (My view that manages the display of battles)
BattleSerializable has a method called DoDamage that subtracts the health of a player. BattleView has a "DoDamageView" method that calls the model method (DoDamage) and then displays a number on the screen to indicate the amount of damage done.
Until here everything is fine.
But there is a friendly shooting penalty! In the sense that if you harm an ally, you also take damage.
Ok, I can now use one of the following three methods:
1) My BattleView can handle friendly fire logic and call the DoDamage method twice in the case of a friendly fire incident, but that goes against what "View" is supposed to do. It does not make sense to think that "BattleView" has to handle friendly fire logic. It should only handle the logic of view.
2) My BattleSerializable class can handle friendly fire logic, but I now have to return a complex custom return object instead of a single integer to handle all the state that has changed. It sounds unnecessarily complex or, at the very least, eloquent.
3) Instead of calling my Model method from the View method, I could run the model independently and, in the view, "query" each image in Model, then render the combat numbers if a modification was detected. It seems to me as ineffective and not very speaking.
What is the preferred way to design this?