... | @@ -122,152 +122,288 @@ Quand le joueur perds tout ces pokemons, il se retrouve face à l'écran de Game |
... | @@ -122,152 +122,288 @@ Quand le joueur perds tout ces pokemons, il se retrouve face à l'écran de Game |
|
left to right direction
|
|
left to right direction
|
|
|
|
|
|
class Game {
|
|
class Game {
|
|
|
|
- Model *model
|
|
|
|
- GUI *gui
|
|
- Player *player
|
|
- Player *player
|
|
- QTimer *waitFight
|
|
- Battle *battle
|
|
|
|
- Pokemon *selectedNewPokemon
|
|
+ Game(Model *model, GUI *gui, QWidget *parent = nullptr)
|
|
+ Game(Model *model, GUI *gui, QWidget *parent = nullptr)
|
|
+ ~Game()
|
|
+ ~Game()
|
|
+ <<slots>> updateView(): void
|
|
+ setScene(QGraphicsScene *scene): void
|
|
+ <<slots>> showFight(): void
|
|
+ changePokemon(Pokemon *pokemon): void
|
|
+ <<slots>> fight(): void
|
|
+ updateView(): void
|
|
+ <<slots>> continuefight(): void
|
|
+ showFight(): void
|
|
# keyPresEvent(QKeyEvent * event): void
|
|
+ showBossFight(): void
|
|
|
|
+ showOldMenSpeach(): void
|
|
|
|
+ continuefight(): void
|
|
|
|
+ endFight(bool playerWon): void
|
|
|
|
+ run(): void
|
|
|
|
+ generateNewOpponent(): void
|
|
|
|
+ showMoves(): void
|
|
|
|
+ switchPokemon(): void
|
|
|
|
+ onMoveButtonClicked(QAbstractButton *moveButton): void
|
|
|
|
+ showFightMenu(): void
|
|
|
|
+ offerPokemonSwitch(): void
|
|
|
|
+ onNewPokemonSelected(Pokemon* newPokemon): void
|
|
|
|
+ onOldPokemonSelected(Pokemon* oldPokemon): void
|
|
|
|
# keyPressEvent(QKeyEvent * event): void
|
|
# mousePressEvent(QMouseEvent *event): void
|
|
# mousePressEvent(QMouseEvent *event): void
|
|
# mouseDoubleClickEvent(QMouseEvent *event): void
|
|
# mouseDoubleClickEvent(QMouseEvent *event): void
|
|
|
|
# focusOutEvent(QFocusEvent *event): void
|
|
|
|
# focusInEvent(QFocusEvent *event): void
|
|
}
|
|
}
|
|
|
|
|
|
class Player {
|
|
class Player {
|
|
- scale: float
|
|
- scale: float
|
|
- *movementTimer: QTimer
|
|
- QTimer *movementTimer
|
|
- currentKey: int
|
|
- std::vector<Pokemon*> itsTeam
|
|
- checkCollision(QPointF newPos): bool
|
|
- QSet<int> activeKeys
|
|
|
|
- float itsLevel
|
|
|
|
- int winCount
|
|
+ Player(QGraphicsItem *parent = nullptr)
|
|
+ Player(QGraphicsItem *parent = nullptr)
|
|
+ ~Player()
|
|
+ ~Player()
|
|
+ getTeam(): vector<Pokemon*>
|
|
+ getTeam() const: std::vector<Pokemon*>
|
|
|
|
+ setTeam(vector<Pokemon*>): void
|
|
+ keyPressEvent(QKayEvent *event): void
|
|
+ keyPressEvent(QKayEvent *event): void
|
|
# keyReleaseEvent(QKeyEvent *event): void
|
|
|
|
+ «slot» move(): void
|
|
|
|
- startMoving(int key): void
|
|
|
|
+ stopMoving(): void
|
|
+ stopMoving(): void
|
|
|
|
+ addPokemon(Pokemon *pokemon): void
|
|
|
|
+ removePokemon(Pokemon *pokemon): void
|
|
|
|
+ incrementWinCount(): void
|
|
|
|
+ float getItsLevel() const: float
|
|
|
|
+ setItsLevel(float newItsLevel): void
|
|
|
|
+ int getWinCount() const: int
|
|
|
|
+ setWinCount(int newWinCount): void
|
|
|
|
- checkCollision(QPointF newPos): bool
|
|
|
|
- startMoving(): void
|
|
|
|
- updateSprite(const QString &direction): void
|
|
|
|
+ «slot» move(): void
|
|
+ «signal» startEncounterCombat(): void
|
|
+ «signal» startEncounterCombat(): void
|
|
|
|
+ «signal» startEncouterBoss(): void
|
|
|
|
+ «signal» startEncouterOldMen(): void
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
class Pokemon {
|
|
class Pokemon {
|
|
- id_pk: int
|
|
- int id_pk
|
|
- itsName: String
|
|
- string itsName
|
|
- itsType: PKTYPE
|
|
- PKTYPE itsType
|
|
- itsHealth: int
|
|
- int itsHealth
|
|
- itsMaxHealth: int
|
|
- int itsMaxHealth
|
|
- itsSpeed: int
|
|
- int itsSpeed
|
|
- itsAtk: int
|
|
- int itsAtk
|
|
- itsSpAtk: int
|
|
- int itsSpAtk
|
|
- itsDef: int
|
|
- int itsDef
|
|
- itsSpDef: int
|
|
- int itsSpDef
|
|
- itsLevel: int
|
|
- int itsLevel
|
|
|
|
- QList<Move*> itsMoves
|
|
+ Pokemon(int id_pk, string itsName, PKTYPE itsType, int itsHealth, int itsSpeed, int itsAtk, int itsSpAtk, int itsDef, int itsSpDef, int itsLevel)
|
|
+ Pokemon(int id_pk, string itsName, PKTYPE itsType, int itsHealth, int itsSpeed, int itsAtk, int itsSpAtk, int itsDef, int itsSpDef, int itsLevel)
|
|
+ ~Pokemon()
|
|
|
|
+ isDead(Pokemon &target): bool
|
|
+ isDead(Pokemon &target): bool
|
|
+ takeDamage(: intint damage)
|
|
+ takeDamage(int damage): void
|
|
+ attack(Pokemomn &target, Move move): void
|
|
+ int getId() const: int
|
|
+ getLvl() const: int
|
|
+ int getLvl() const: int
|
|
+ getHealth() const: int
|
|
+ int getHealth() const: int
|
|
+ getItsMaxHealth() const: int
|
|
+ int getSpeed() const: int
|
|
+ getSpeed() const: int
|
|
+ int getAtk() const: int
|
|
+ getAtk() const: int
|
|
+ int getSpAtk() const: int
|
|
+ getSpAtk() const: int
|
|
+ int getDef() const: int
|
|
+ getDef() const: int
|
|
+ int getSpDef() const: int
|
|
+ getSpDef() const: int
|
|
+ string getItsName() const: string
|
|
+ getId() const: int
|
|
+ int getItsMaxHealth() const: int
|
|
+ getItsName() const: string
|
|
+ QList<Move*> getItsMoves() const: QList<Move*>
|
|
+ getItsMoves() const: QList<Move>
|
|
+ void setItsMoves(const QList<Move*> &newItsMoves): void
|
|
+ setItsMoves(const QList<Move> &newItsMoves): void
|
|
+ PKTYPE getItsType() const: PKTYPE
|
|
}
|
|
|
|
|
|
|
|
enum PKTYPE {
|
|
|
|
Plante
|
|
|
|
Feu
|
|
|
|
Eau
|
|
|
|
Electrique
|
|
|
|
Glace
|
|
|
|
Vol
|
|
|
|
}
|
|
|
|
|
|
|
|
enum MOVENATURE {
|
|
|
|
Physical
|
|
|
|
Special
|
|
|
|
}
|
|
}
|
|
|
|
|
|
class Move {
|
|
class Move {
|
|
- itsName: string
|
|
- string itsName
|
|
- itsPower: int
|
|
- int itsPower
|
|
- itsAccuracy: int
|
|
- int itsAccuracy
|
|
- itsType: MOVENATURE
|
|
- MOVENATURE itsNature
|
|
+ Move(string itsName, int itsPower, int itsAccuracy, MOVENATURE itsType)
|
|
- PKTYPE itsType
|
|
|
|
+ Move(string itsName, int itsPower, int itsAccuracy, MOVENATURE itsNature, PKTYPE itsType)
|
|
+ getItsName() const: string
|
|
+ getItsName() const: string
|
|
+ getItsPower() const: int
|
|
+ getItsPower() const: int
|
|
+ getItsAccuracy() const: int
|
|
+ getItsAccuracy() const: int
|
|
|
|
+ getItsNature() const: MOVENATURE
|
|
|
|
+ getItsType() const: PKTYPE
|
|
+ calculateDamage(int lvl, int atk, int def, bool crit) const: int
|
|
+ calculateDamage(int lvl, int atk, int def, bool crit) const: int
|
|
+ getItsType() const: MOVENATURE
|
|
+ string getItsTextType(int type) const: string
|
|
}
|
|
}
|
|
|
|
|
|
class Battle {
|
|
class Battle {
|
|
+ Battle(Player *itsPlayer1, Pokemon *opponent1, BattleHUD *battleHUD1)
|
|
- Pokemon *itsOpponent1
|
|
|
|
- Pokemon *itsOpponent2
|
|
|
|
- BattleHUD *itsBattleHUD1
|
|
|
|
- std::mt19937 gen
|
|
|
|
- std::vector<Pokemon*> itsBossTeam
|
|
|
|
+ Battle(Pokemon *opponent1, Pokemon *opponent2, BattleHUD *battleHUD1)
|
|
|
|
+ ~Battle()
|
|
+ attack(Move *move, Pokemon *target): void
|
|
+ attack(Move *move, Pokemon *target): void
|
|
|
|
+ std::vector<Pokemon*> getBossTeam() const: std::vector<Pokemon*>
|
|
|
|
+ void setBossTeam(std::vector<Pokemon*> team): void
|
|
|
|
+ BattleHUD* getBattleHUD(): BattleHUD*
|
|
}
|
|
}
|
|
|
|
|
|
class BattleHUD {
|
|
class BattleHUD {
|
|
|
|
- QPushButton *attackButton
|
|
|
|
- QPushButton *pokemonButton
|
|
|
|
- QPushButton *runButton
|
|
|
|
- Pokemon *pokemon1
|
|
|
|
- Pokemon *pokemon2
|
|
|
|
- QGraphicsPixmapItem *pokemon1Item
|
|
|
|
- QGraphicsPixmapItem *pokemon2Item
|
|
|
|
- QGraphicsPixmapItem *bossItem
|
|
|
|
- QGraphicsTextItem *health1
|
|
|
|
- QGraphicsTextItem *health2
|
|
|
|
- QGraphicsTextItem *menuText
|
|
|
|
- QGraphicsTextItem *attackText
|
|
|
|
- QGraphicsPixmapItem *dialogueBox
|
|
|
|
- QButtonGroup *moveButtonsGroup
|
|
|
|
- QPushButton *backButton
|
|
+ BattleHUD(QObject *parent = nullptr)
|
|
+ BattleHUD(QObject *parent = nullptr)
|
|
+ *getAttackButton(): QPushButton
|
|
+ ~BattleHUD()
|
|
|
|
+ getAttackButton(): QPushButton*
|
|
|
|
+ getPokemonButton(): QPushButton*
|
|
|
|
+ getRunButton(): QPushButton*
|
|
+ setPokemon(Pokemon *pk1, Pokemon *pk2): void
|
|
+ setPokemon(Pokemon *pk1, Pokemon *pk2): void
|
|
- *attackButton: QPushButton
|
|
+ shakePokemon(Pokemon *pk): void
|
|
- *pokemon1: Pokemon
|
|
+ frontDashPokemon(Pokemon *pk): void
|
|
- *pokemon2: Pokemon
|
|
+ Pokemon* getPokemon1() const: Pokemon*
|
|
- *pokemon1Item: QGraphicsPixmapItem
|
|
+ Pokemon* getPokemon2() const: Pokemon*
|
|
- *pokemon2Item: QGraphicsPixmapItem
|
|
+ displayMoves(): void
|
|
- *health1: QGraphicsTextItem
|
|
+ menuFight(): void
|
|
- *health2: QGraphicsTextItem
|
|
+ QButtonGroup* getMoveGroup() const: QButtonGroup*
|
|
|
|
+ QPushButton* getBackButton() const: QPushButton*
|
|
|
|
+ setText(QString text): void
|
|
}
|
|
}
|
|
|
|
|
|
class Data {
|
|
class Data {
|
|
- db: QSqlDatabase
|
|
- QSqlDatabase db
|
|
+ Data()
|
|
+ Data()
|
|
+ ~Data()
|
|
+ ~Data()
|
|
+ *randompokemon(): Pokemon
|
|
+ Pokemon* randompokemon()
|
|
+ getMoves(int pokemon_id): QList<Move>
|
|
+ QList<Move*> getMoves(int pokemon_id)
|
|
|
|
+ QSqlDatabase getDb()
|
|
}
|
|
}
|
|
|
|
|
|
class GameOverHUD {
|
|
class GameOverHUD {
|
|
+ gameOverHUD(QObject *parent = nullptr)
|
|
+ GameOverHUD(QObject *parent = nullptr)
|
|
}
|
|
}
|
|
|
|
|
|
class Gui {
|
|
class Gui {
|
|
|
|
- Model *model
|
|
|
|
- GameOverHUD *gameOverHUD
|
|
|
|
- MapHUD *mapHUD
|
|
|
|
- MainHUD *mainHUD
|
|
|
|
- BattleHUD *battleHUD
|
|
|
|
- PlayerHUD *playerHUD
|
|
+ GUI(Model *model)
|
|
+ GUI(Model *model)
|
|
+ *mainMenu(): MainHUD
|
|
+ ~GUI()
|
|
+ *gameOver(): gameOverHUD
|
|
+ MainHUD* mainMenu(): MainHUD*
|
|
+ *map(): MapHUD
|
|
+ GameOverHUD* gameOver(): GameOverHUD*
|
|
+ *battle(Pokemon *pk1, Pokemon *pk2): BattlHUD
|
|
+ MapHUD* map(): MapHUD*
|
|
+ *battle(): BattlHUD
|
|
+ BattleHUD* battle(Pokemon *pk1, Pokemon *pk2): BattleHUD*
|
|
|
|
+ BattleHUD* battle(): BattleHUD*
|
|
|
|
+ PlayerHUD* playerTeam(vector<Pokemon *> pokemons, int itsLevel): PlayerHUD*
|
|
|
|
+ PlayerHUD* team(): PlayerHUD*
|
|
|
|
+ PlayerHUD* selectPokemon(vector<Pokemon *> pokemons): PlayerHUD*
|
|
}
|
|
}
|
|
|
|
|
|
class MainHUD {
|
|
class MainHUD {
|
|
+ MainHUD(QObject *parent = nullptr)
|
|
+ MainHUD(QObject *parent = nullptr)
|
|
|
|
+ displayMainMenu(): void
|
|
}
|
|
}
|
|
|
|
|
|
class MapHUD {
|
|
class MapHUD {
|
|
|
|
- Model *model
|
|
|
|
- Player *player
|
|
|
|
- std::mt19937 gen
|
|
|
|
- std::uniform_int_distribution<> encounterDist
|
|
|
|
- QGraphicsPixmapItem *bossItem
|
|
|
|
- QGraphicsPixmapItem *oldMenItem
|
|
+ MapHUD(Model *model, QObject *parent = nullptr)
|
|
+ MapHUD(Model *model, QObject *parent = nullptr)
|
|
+ ~MapHUD()
|
|
+ ~MapHUD()
|
|
+ drawMap(): void
|
|
+ drawMap(): void
|
|
|
|
+ Player* getPlayer(): Player*
|
|
|
|
- drawGrassLayer(const std::vector<std::vector<int>>& map): void
|
|
|
|
- drawDecorativeElements(const std::vector<std::vector<int>>& map): void
|
|
|
|
- initializePlayer(): void
|
|
|
|
- handleTileInteraction(int tileType): void
|
|
|
|
- handleRandomEncounter(): void
|
|
# keyPressEvent(QKeyEvent *event): void
|
|
# keyPressEvent(QKeyEvent *event): void
|
|
+ *getPlayer(): Player
|
|
- enteringBoat(Player *player, const std::string &direction): void
|
|
|
|
- enteringBossZone(Player *player): void
|
|
|
|
- enteringOldMenZone(Player *player): void
|
|
}
|
|
}
|
|
|
|
|
|
class Model {
|
|
class Model {
|
|
- map: std::vector<std::vector<char>>
|
|
- std::vector<std::vector<int>> map
|
|
|
|
- Data *data
|
|
+ Model()
|
|
+ Model()
|
|
|
|
+ ~Model()
|
|
+ loadMap(const QString& filename): void
|
|
+ loadMap(const QString& filename): void
|
|
+ getMap() const: const vector<vector<char>>&
|
|
+ const std::vector<std::vector<int>>& getMap() const: const std::vector<std::vector<int>>&
|
|
+ *getData(): Data
|
|
+ Data* getData(): Data*
|
|
|
|
+ const vector<Pokemon*>& getFirstTeam() const: const vector<Pokemon*>&
|
|
|
|
}
|
|
|
|
|
|
|
|
class PlayerHUD {
|
|
|
|
- std::vector<Pokemon*> pokemons
|
|
|
|
- QList<QGraphicsPixmapItem*> characterItems
|
|
|
|
- QList<QGraphicsTextItem*> healthTextItems
|
|
|
|
- QList<QGraphicsProxyWidget*> healthBars
|
|
|
|
- QGraphicsPixmapItem *selectionArrow
|
|
|
|
- QGraphicsTextItem *pokemonLabel
|
|
|
|
- bool selectionMode
|
|
|
|
- int selectedIndex
|
|
|
|
- int itsLevelPlayer
|
|
|
|
+ PlayerHUD(QObject *parent = nullptr)
|
|
|
|
+ setPokemons(const std::vector<Pokemon*>& pokemons, int itsLevelPlayer): void
|
|
|
|
+ setSelectionMode(bool selectionMode): void
|
|
|
|
+ updateHUD(): void
|
|
|
|
+ QGraphicsTextItem* getPokemonLabel() const: QGraphicsTextItem*
|
|
|
|
+ setPokemonLabel(QGraphicsTextItem *newPokemonLabel): void
|
|
|
|
# keyPressEvent(QKeyEvent *event): void
|
|
|
|
- addCharacter(const QPixmap &characterImage, int currentHealth, int maxHealth, int xPos, int yPos): void
|
|
|
|
- updateSelectionArrow(): void
|
|
|
|
+ «signal» pokemonSelected(Pokemon *pokemon): void
|
|
|
|
}
|
|
|
|
|
|
|
|
class PKTYPE {
|
|
|
|
+ PKTYPE()
|
|
|
|
}
|
|
|
|
|
|
|
|
class HoverButton : public QPushButton {
|
|
|
|
- QIcon normalIcon
|
|
|
|
- QIcon hoverIcon
|
|
|
|
+ HoverButton(const QPixmap &normalIconPath, const QPixmap &hoverIconPath, QWidget *parent = nullptr)
|
|
|
|
+ void enterEvent(QEnterEvent *event): void
|
|
|
|
+ void leaveEvent(QEvent *event): void
|
|
|
|
}
|
|
|
|
|
|
|
|
enum PKTYPE {
|
|
|
|
Grass,
|
|
|
|
Poison,
|
|
|
|
Normal,
|
|
|
|
Bug,
|
|
|
|
Psychic,
|
|
|
|
Ghost,
|
|
|
|
Ground,
|
|
|
|
Dragon,
|
|
|
|
Fairy,
|
|
|
|
Fire,
|
|
|
|
Fighting,
|
|
|
|
Dark,
|
|
|
|
Electric,
|
|
|
|
Flying,
|
|
|
|
Rock,
|
|
|
|
Steel,
|
|
|
|
Water,
|
|
|
|
Ice
|
|
|
|
}
|
|
|
|
|
|
|
|
enum MOVENATURE {
|
|
|
|
Physical,
|
|
|
|
Special
|
|
}
|
|
}
|
|
|
|
|
|
Battle --> Player: *itsPlayer1
|
|
Battle --> Player: *itsPlayer1
|
... | @@ -326,5 +462,4 @@ Player -up-> Pokemon: - itsTeam vector<Pokemon*> |
... | @@ -326,5 +462,4 @@ Player -up-> Pokemon: - itsTeam vector<Pokemon*> |
|
Pokemon -down-> Move: - itsMoves QList<Move>
|
|
Pokemon -down-> Move: - itsMoves QList<Move>
|
|
Pokemon -down-> PKTYPE
|
|
Pokemon -down-> PKTYPE
|
|
Pokemon -down-> QList
|
|
Pokemon -down-> QList
|
|
|
|
|
|
``` |
|
``` |
|
\ No newline at end of file |
|
|