-
Notifications
You must be signed in to change notification settings - Fork 0
Discover our Implementation
First of all the entire project is based on the Model View Control (MVC) architecture, in the Model you can find all the game-related classes such as the Table, the Player and so on; the Controller contains all the logical information for game-flow handling; finally you can think of our View as a simplified Model decorated with classes for I/O to optimize the user experience. What follows is a detailed description of the project implementation devided by packages.
The Model package is composed mainly by five parts: the Table, the Player, the Cards (normal and leader), the Effects, the Actions. The Table does not have a lot of game-logic, instead it works as a container of other classes such as the Players, the Bans and the Positions. In particular, to develop different kind of Positions (Tower, Market, Council, Yield and Product), every position inherits from an abstract class called Position, that may have a Familiar for example, and adds some of its specific infromation (e.g. the TowerPosition has a Card), as you can see from the picture. The Player obviously represents a player of Lorenzo il Magnifico so it has four Familiars, a StaticList (list limited to a maximum size) of Cards for each color, a List of Leader Cards, a List of Request to handle the game-flow of the Cards and some State variables to handle some special effects (e.g. the can positioning everywhere effect ofthe Leader Card Ludovico Ariosto ). The Card class represents a generic game Card, so it is mainly composed by a name (to identify it), a List of possible Requirements, a List of possible Costs and three Lists of Effects (Immediate: enabled when the Card is taken, Permanent: enabled during all the game, Final: enabled at the end of the match). In addition, a Card contains all the logic for the payment, effects and requests management. Instead, the Leader Cards class represents a simpler version of a Card: it has only a LeaderRequirement (that handles the logic of LeaderCards requirements) and three possible Effects: the OnceARound effect, the Permanent one and the OnDiscard effect. The Effects of the Game have been implemented using a Strategy Pattern, thus every effect inherits from the abstract class Effect and must implements the enableEffect(Player p) method that enables the effect on the Player; thanks to this pattern we can easely add new type of effects. In this hierarchy falls every type of effect: the Card related, the Leader Card related, the Position related and the Ban related.