... | @@ -122,58 +122,75 @@ Quand le joueur perds tout ces pokemons, il se retrouve face à l'écran de Game |
... | @@ -122,58 +122,75 @@ 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 {
|
|
- itsPlayer: Player
|
|
- Player *player
|
|
- itsBattle: Battle
|
|
- QTimer *waitFight
|
|
- itsModel: Model
|
|
+ Game(Model *model, GUI *gui, QWidget *parent = nullptr)
|
|
- itsGUI: GUI
|
|
+ ~Game()
|
|
- itsSaveManager: SaveManager
|
|
+ <<slots>> updateView(): void
|
|
- itsSoundManager: SoundManager
|
|
+ <<slots>> showFight(): void
|
|
- itsGamepadController: GamepadController
|
|
+ <<slots>> fight(): void
|
|
+ startGame()
|
|
+ <<slots>> continuefight(): void
|
|
+ endGame()
|
|
# keyPresEvent(QKeyEvent * event): void
|
|
+ saveGame()
|
|
# mousePressEvent(QMouseEvent *event): void
|
|
+ loadGame()
|
|
# mouseDoubleClickEvent(QMouseEvent *event): void
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
class Player {
|
|
class Player {
|
|
- itsName: String
|
|
- scale: float
|
|
- itsLevel: float
|
|
- *movementTimer: QTimer
|
|
- itsDx: int
|
|
- currentKey: int
|
|
- itsDy: int
|
|
- checkCollision(QPointF newPos): bool
|
|
- itsX: int
|
|
+ Player(QGraphicsItem *parent = nullptr)
|
|
- itsY: int
|
|
+ ~Player()
|
|
- itsTeam: List<Pokemon>
|
|
+ getTeam(): vector<Pokemon*>
|
|
+ Player(x: int, y: int)
|
|
+ keyPressEvent(QKayEvent *event): void
|
|
+ move(dX: int, dY: int): void
|
|
# keyReleaseEvent(QKeyEvent *event): void
|
|
+ updateSprite(dX: int, dY: int): void
|
|
+ «slot» move(): void
|
|
+ addPokemon(pokemon: Pokemon): void
|
|
- startMoving(int key): void
|
|
+ removePokemon(pokemon: Pokemon): void
|
|
+ stopMoving(): void
|
|
|
|
+ «signal» startEncounterCombat(): void
|
|
}
|
|
}
|
|
|
|
|
|
class Boss {
|
|
|
|
- itsName: String
|
|
|
|
- itsTeam: List<Pokemon>
|
|
|
|
+ Boss(name: String)
|
|
|
|
+ startBattle(player: Player): void
|
|
|
|
}
|
|
|
|
|
|
|
|
class Pokemon {
|
|
class Pokemon {
|
|
|
|
- id_pk: int
|
|
- itsName: String
|
|
- itsName: String
|
|
- itsType: PKTYPE
|
|
- itsType: PKTYPE
|
|
- itsHealth: int
|
|
- itsHealth: int
|
|
|
|
- itsMaxHealth: int
|
|
- itsSpeed: int
|
|
- itsSpeed: int
|
|
- itsAtk: int
|
|
- itsAtk: int
|
|
- itsSpAtk: int
|
|
- itsSpAtk: int
|
|
- itsDef: int
|
|
- itsDef: int
|
|
- itsSpDef: int
|
|
- itsSpDef: int
|
|
- itsLevel: int
|
|
- itsLevel: int
|
|
- itsMoves: List<Move>
|
|
+ Pokemon(int id_pk, string itsName, PKTYPE itsType, int itsHealth, int itsSpeed, int itsAtk, int itsSpAtk, int itsDef, int itsSpDef, int itsLevel)
|
|
+ executeMove(target: Pokemon, move: Move)
|
|
+ ~Pokemon()
|
|
+ takeDamage(damage: int)
|
|
+ isDead(Pokemon &target): bool
|
|
+ death()
|
|
+ takeDamage(: intint damage)
|
|
|
|
+ attack(Pokemomn &target, Move move): void
|
|
|
|
+ getLvl() const: int
|
|
|
|
+ getHealth() const: int
|
|
|
|
+ getItsMaxHealth() const: int
|
|
|
|
+ getSpeed() const: int
|
|
|
|
+ getAtk() const: int
|
|
|
|
+ getSpAtk() const: int
|
|
|
|
+ getDef() const: int
|
|
|
|
+ getSpDef() const: int
|
|
|
|
+ getId() const: int
|
|
|
|
+ getItsName() const: string
|
|
|
|
+ getItsMoves() const: QList<Move>
|
|
|
|
+ setItsMoves(const QList<Move> &newItsMoves): void
|
|
}
|
|
}
|
|
|
|
|
|
enum PKTYPE {
|
|
enum PKTYPE {
|
|
|
|
Plante
|
|
|
|
Feu
|
|
|
|
Eau
|
|
|
|
Electrique
|
|
|
|
Glace
|
|
|
|
Vol
|
|
}
|
|
}
|
|
|
|
|
|
enum MOVENATURE {
|
|
enum MOVENATURE {
|
... | @@ -182,76 +199,132 @@ Special |
... | @@ -182,76 +199,132 @@ Special |
|
}
|
|
}
|
|
|
|
|
|
class Move {
|
|
class Move {
|
|
- itsName: String
|
|
- itsName: string
|
|
- itsPower: int
|
|
- itsPower: int
|
|
- itsType: PKTYPE
|
|
- itsAccuracy: int
|
|
- itsNature: MOVENATURE
|
|
- itsType: MOVENATURE
|
|
+ execute(target: Pokemon)
|
|
+ Move(string itsName, int itsPower, int itsAccuracy, MOVENATURE itsType)
|
|
|
|
+ getItsName() const: string
|
|
|
|
+ getItsPower() const: int
|
|
|
|
+ getItsAccuracy() const: int
|
|
|
|
+ calculateDamage(int lvl, int atk, int def, bool crit) const: int
|
|
|
|
+ getItsType() const: MOVENATURE
|
|
}
|
|
}
|
|
|
|
|
|
class Battle {
|
|
class Battle {
|
|
- itsPlayer: Player
|
|
+ Battle(Player *itsPlayer1, Pokemon *opponent1, BattleHUD *battleHUD1)
|
|
- itsOpponent: Pokemon
|
|
+ attack(Move *move, Pokemon *target): void
|
|
- isBossBattle: boolean
|
|
|
|
+ startBattle()
|
|
|
|
+ endBattle()
|
|
|
|
+ chooseMove(move: Move): void
|
|
|
|
}
|
|
}
|
|
|
|
|
|
class Screen {
|
|
class BattleHUD {
|
|
+ displayMainMenu()
|
|
+ BattleHUD(QObject *parent = nullptr)
|
|
+ displayBattleScreen()
|
|
+ *getAttackButton(): QPushButton
|
|
+ updateScreen()
|
|
+ setPokemon(Pokemon *pk1, Pokemon *pk2): void
|
|
|
|
- *attackButton: QPushButton
|
|
|
|
- *pokemon1: Pokemon
|
|
|
|
- *pokemon2: Pokemon
|
|
|
|
- *pokemon1Item: QGraphicsPixmapItem
|
|
|
|
- *pokemon2Item: QGraphicsPixmapItem
|
|
|
|
- *health1: QGraphicsTextItem
|
|
|
|
- *health2: QGraphicsTextItem
|
|
}
|
|
}
|
|
|
|
|
|
class Model {
|
|
class Data {
|
|
- data: Data
|
|
- db: QSqlDatabase
|
|
+ loadGame()
|
|
+ Data()
|
|
+ quitGame()
|
|
+ ~Data()
|
|
|
|
+ *randompokemon(): Pokemon
|
|
|
|
+ getMoves(int pokemon_id): QList<Move>
|
|
}
|
|
}
|
|
|
|
|
|
class Data {
|
|
class GameOverHUD {
|
|
+ getPokemonData(name: String): Pokemon
|
|
+ gameOverHUD(QObject *parent = nullptr)
|
|
+ getMoveData(name: String): Move
|
|
|
|
+ saveGameData(gameData: GameData)
|
|
|
|
+ loadGameData(): GameData
|
|
|
|
}
|
|
}
|
|
|
|
|
|
class GUI {
|
|
class Gui {
|
|
- itsScreen: Screen
|
|
+ GUI(Model *model)
|
|
- objects: List<Object>
|
|
+ *mainMenu(): MainHUD
|
|
- itsWidth: int
|
|
+ *gameOver(): gameOverHUD
|
|
- itsHeight: int
|
|
+ *map(): MapHUD
|
|
+ loadMap(file: String)
|
|
+ *battle(Pokemon *pk1, Pokemon *pk2): BattlHUD
|
|
+ updateGUI()
|
|
+ *battle(): BattlHUD
|
|
+ displayMainMenu()
|
|
|
|
+ displayHUD()
|
|
|
|
}
|
|
}
|
|
|
|
|
|
class BattleHUD {
|
|
class MainHUD {
|
|
- attackOptions: List<Move>
|
|
+ MainHUD(QObject *parent = nullptr)
|
|
+ displayOptions()
|
|
|
|
+ chooseOption(option: Move)
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class MapHUD {
|
|
|
|
+ MapHUD(Model *model, QObject *parent = nullptr)
|
|
|
|
+ ~MapHUD()
|
|
|
|
+ drawMap(): void
|
|
|
|
# keyPressEvent(QKeyEvent *event): void
|
|
|
|
+ *getPlayer(): Player
|
|
|
|
}
|
|
|
|
|
|
|
|
class Model {
|
|
|
|
- map: std::vector<std::vector<char>>
|
|
|
|
+ Model()
|
|
|
|
+ loadMap(const QString& filename): void
|
|
|
|
+ getMap() const: const vector<vector<char>>&
|
|
|
|
+ *getData(): Data
|
|
|
|
}
|
|
|
|
|
|
|
|
Battle --> Player: *itsPlayer1
|
|
|
|
Battle --> Pokemon: *itsOpponent1
|
|
|
|
Battle --> BattleHUD: itsBattleHUD
|
|
|
|
|
|
|
|
BattleHUD --|> QGraphicsScene
|
|
|
|
BattleHUD --> Pokemon
|
|
|
|
BattleHUD --> QPushButton
|
|
|
|
|
|
|
|
Data --> "QtSql/QSqlDatabase"
|
|
|
|
Data --> "QtSql/QSql"
|
|
|
|
Data --> "QtSql/QSqlQuery"
|
|
|
|
Data --> "QtSql/QSqlRecord"
|
|
|
|
Data --> "QSqlError"
|
|
|
|
Data --> Pokemon
|
|
|
|
|
|
|
|
Game --> QWidget
|
|
|
|
Game --> QGraphicsView
|
|
|
|
Game --> QKeyEvent
|
|
|
|
Game --> Battle: *battle
|
|
|
|
Game --> Model: *model
|
|
|
|
Game --> Gui: *gui
|
|
|
|
|
|
|
|
GameOverHUD --|> QGraphicsScene
|
|
|
|
|
|
|
|
Gui --> Model: *model
|
|
|
|
Gui --> GameOverHUD: *gameOverHUD
|
|
|
|
Gui --> MapHUD: *mapHUD
|
|
|
|
Gui --> MainHUD: *mainHUD
|
|
|
|
Gui --> BattleHUD: *battleHUD
|
|
|
|
Gui --> Pokemon
|
|
|
|
|
|
|
|
MainHUD --|> QGraphicsScene
|
|
|
|
|
|
|
|
MapHUD --|> QGraphicsScene
|
|
|
|
MapHUD --> QKeyEvent
|
|
|
|
MapHUD --> Player: *player
|
|
|
|
MapHUD --> Model: *model
|
|
|
|
|
|
|
|
Model --> QTextStream
|
|
|
|
Model --> QFile
|
|
|
|
Model --> Data: *data
|
|
|
|
|
|
|
|
Move --> string
|
|
|
|
Move --> MOVENATURE
|
|
|
|
|
|
|
|
Player -up-> QGraphicsPixmapItem
|
|
|
|
Player -up-> QGraphicsScene
|
|
|
|
Player -up-> QObject
|
|
|
|
Player -up-> QKeyEvent
|
|
|
|
Player -up-> vector
|
|
|
|
Player -up-> QTimer
|
|
|
|
Player -up-> Pokemon: - itsTeam vector<Pokemon*>
|
|
|
|
|
|
|
|
Pokemon -down-> Move: - itsMoves QList<Move>
|
|
|
|
Pokemon -down-> PKTYPE
|
|
|
|
Pokemon -down-> QList
|
|
|
|
|
|
Game <-- Player
|
|
|
|
Game <-- Battle
|
|
|
|
Game <-- GUI
|
|
|
|
Game <-- Model
|
|
|
|
Model <-- Data
|
|
|
|
Player <-- Pokemon
|
|
|
|
Boss <-- Pokemon
|
|
|
|
Battle <-- Boss
|
|
|
|
Battle <-- Pokemon
|
|
|
|
Pokemon <-- PKTYPE
|
|
|
|
Pokemon <-- Move
|
|
|
|
Move <-- PKTYPE
|
|
|
|
Move <-- MOVENATURE
|
|
|
|
GUI <-- Screen
|
|
|
|
Screen <-- BattleHUD
|
|
|
|
Battle <-- Move
|
|
|
|
BattleHUD <-- Battle
|
|
|
|
``` |
|
``` |
|
\ No newline at end of file |
|
|