Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

juste faire belek à pas inclure le cmakelists mais oklm

Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ if(WIN32)
"${QT_ROOT_DIR}/plugins/platforms/qwindows.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/platforms/"
)
endif()
endif()
Empty file added generateAllHexFantome()
Empty file.
9 changes: 5 additions & 4 deletions include/Cite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <memory>
#include <string>
#include <unordered_set>
#include <array>


class Tuile;
Expand All @@ -25,7 +26,7 @@ class Cite {



virtual uint32_t compterPoints( int niveau_difficulte=0) const = 0;
virtual uint32_t compterPoints( int niveau_difficulte=0, std::array<int, 5> variantes = {}) const = 0;

virtual void afficher() const =0;
void QTDraw() const;
Expand All @@ -47,7 +48,6 @@ class Cite {
protected:

std::vector<const Tuile*> tuiles;

static void print_hex(Hexagone*hex, int x, int y, strCalc& calc);
static void increase_calc_size_H(strCalc& calc, uint32_t size);
static void increase_calc_size_V(strCalc& calc, uint32_t size);
Expand All @@ -70,18 +70,19 @@ class CiteJoueur : public Cite {
~CiteJoueur()=default;

bool placerTuileFromHexRef(Hexagone* hex) override;
uint32_t compterPoints( int niveau_difficulte=0) const override;
uint32_t compterPoints( int niveau_difficulte=0, std::array<int, 5> variantes = {}) const override;
void afficher()const override;
void addTuile(Tuile* t);


};

class CiteIllu : public Cite{


public:
CiteIllu(const Tuile* tuileDeDepart):Cite(tuileDeDepart){};
uint32_t compterPoints( int niveau_difficulte=0) const override;
uint32_t compterPoints( int niveau_difficulte=0, std::array<int, 5> variantes = {}) const override;
bool placerTuileFromHexRef(Hexagone* hex)override{return false; };
void afficher()const override;
private:
Expand Down
30 changes: 18 additions & 12 deletions include/Jeu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ class Pioche;
enum class ModeDeJeu {
Multi,
Solo,
PasCommence
};
enum class Duree {
Courte,
Longue
};

class Jeu {

public:
Expand All @@ -32,17 +36,16 @@ class Jeu {

void afficherTuiles() const;
void afficherHexagones() const;
void tourJoueur(Joueur* joueur);
void tourIllu(Illu* illu);


// FONCTIONNES AFFICHAGE PARTIE EN MODE CONSOLE
void StartMenuC();


void tourJoueur(Joueur* joueur);
void tourIllu(Illu* illu);
void AffFinDePartieC();
// FONCTIONS APPELLES PAR QT ET CONSOLE:
void InitialiserPartie(const std::vector<std::string>& names, uint32_t difficultyLevel);

void InitialiserPartie(const std::vector<std::string>& names, uint32_t difficultyLevel, std::array<int, 5>variantes={}, Duree d=Duree::Courte);
Joueur* gagnant();
//void setDifficultyLevel(uint32_t level) { difficultyLevel = level; }
//uint32_t getDifficultyLevel() const { return difficultyLevel; }

Expand All @@ -61,10 +64,10 @@ class Jeu {
Tuile* choisirTuileDuChantier(Joueur* joueur);
Tuile* choisirTuileDuChantier(Illu* illu);

inline ModeDeJeu getModeDeJeu() const {return mode; }; // A voir si utile, mode solo ?
//void setGameMode(ModeDeJeu mdj) { mode = mdj; }
inline ModeDeJeu getModeDeJeu() const {return mode; };

uint32_t getNbPlayers() const { return joueurs.size(); }
int getnombreTuilesPioche()const{return nombreTuilesPioche; }
void setMaxPlayers(uint32_t n) { joueurs.reserve(n); maxPlayers = n; }
uint32_t getMaxPlayers() const { return maxPlayers; }
void addJoueur(Joueur* j) { joueurs.push_back(j); }
Expand All @@ -87,7 +90,8 @@ class Jeu {
Jeu();

static Jeu* instance;
ModeDeJeu mode; // A voir pendant développement mode solo, initialiser Jeu avec mode solo
ModeDeJeu mode;
Duree duree;
std::vector<Hexagone*> hexs;
std::vector<TuileDepart *> tuilesDepart;
std::vector<Joueur *> joueurs;
Expand All @@ -98,9 +102,11 @@ class Jeu {

bool QtDisplay = true;
int nombreTuilesChantier;
int niveauDeDifficulte;
int niveauDeDifficulte;
std::array<int, 5> variantes;
int nombreTuilesPioche;


};

#endif //JEU_H
#endif //JEU_H
14 changes: 11 additions & 3 deletions include/UI/StartMenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
#include "UI/GamePushButton.hpp"
#include <QLineEdit>
#include <QComboBox>
#include <array>
#include "Jeu.hpp"



class StartMenu : public QWidget {
Q_OBJECT
public:
StartMenu(QWidget* parent = nullptr);
~StartMenu() override;
signals:
void playerSelectionConfirmed(std::vector<std::string> players, uint32_t difficultyLevel);
void playerSelectionConfirmed(std::vector<std::string> players, uint32_t difficultyLevel, std::array<int,5>variantes, Duree d);

private slots:
void onConfirmClicked();
Expand All @@ -28,8 +32,12 @@ private slots:

QComboBox* dificultyComboBox;


QVBoxLayout* variantesLayout;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


QHBoxLayout* longueurLayout;
uint32_t playerCount;
uint32_t dificultyLevel;
std::array<int,5> variantes;
Duree duree;
std::vector<QLineEdit*> playerButtons;
};
};
57 changes: 48 additions & 9 deletions src/Cite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ bool CiteJoueur::placerTuileFromHexRef(Hexagone *hex)
// updateFantomeOfTuile(tl);
}

uint32_t CiteJoueur::compterPoints( int niveau_difficulte) const
uint32_t CiteJoueur::compterPoints( int niveau_difficulte, std::array<int,5>variantes) const
{
uint32_t nb_place_bleue = 0;
uint32_t nb_place_rouge = 0;
Expand Down Expand Up @@ -635,6 +635,7 @@ uint32_t CiteJoueur::compterPoints( int niveau_difficulte) const
{
const std::array<Hexagone *, 6> voisins = h->getVoisins3D();
bool cond = true;
int var = 1;
for (int i = 0; i < 6; i++)
{

Expand All @@ -646,8 +647,20 @@ uint32_t CiteJoueur::compterPoints( int niveau_difficulte) const
}
}
}
if (cond == true)
points_jaune += 1 * niveau;
//variante si on a une place jaune, on double les points
if(variantes[0]==1){
for (int i = 0; i < 6; i++){
if (voisins[i] != nullptr){
if (voisins[i]->getCouleur() == Couleur::Jaune && voisins[i]->getType() == Type::Place){
var=2;
}
}
}
}
if (cond == true) points_jaune += 1 * niveau * var;



}
// calcul points jardins : +1 pt pour chaque jardin
if (h->getCouleur() == Couleur::Vert)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajouter algo détection de lac pour les quartier vert
J'ai déjà traité un problème similaire pour l'ajout des hexagones fantomes, n'hésite pas si tu n'as pas d'idée de comment le faire

Expand All @@ -659,6 +672,7 @@ uint32_t CiteJoueur::compterPoints( int niveau_difficulte) const
{

const std::array<Hexagone *, 6> &voisins = h->getVoisins3D();
int var =1;

// on vérifie si entierment entouré au niveau 0
bool cond = true;
Expand All @@ -674,8 +688,12 @@ uint32_t CiteJoueur::compterPoints( int niveau_difficulte) const
cond = false;
}
}
if (cond)
points_violet += 1 * niveau;
if(variantes[2]==1){
if(niveau>1){
var = 2;
}
if (cond) points_violet += 1 * niveau * var;
}
}
// calcul habitation: on doit calculer les groupes d'habitations
if (h->getCouleur() == Couleur::Bleu)
Expand Down Expand Up @@ -718,7 +736,7 @@ uint32_t CiteJoueur::compterPoints( int niveau_difficulte) const
{
bool cond = false;
const std::array<Hexagone *, 6> &voisins = h->getVoisins3D();

int var = 1;
for (int i = 0; i < 6; i++)
{
if (voisins[i] != nullptr)
Expand All @@ -731,8 +749,24 @@ uint32_t CiteJoueur::compterPoints( int niveau_difficulte) const
cond = true;
}
}
if (cond)
points_rouge += 1 * niveau;
if(variantes[4]==1){
int cases_vides = 0;
for (int i = 0; i < 6; i++){
if (voisins[i] != nullptr){
if (voisins[i]->getType() == Type::Fantome)
cases_vides++;
}
else
{
cases_vides++;
}

}
if(cases_vides>=3){
var = 2;
}
}
if (cond) points_rouge += 1 * niveau * var;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

carré

}
}
}
Expand All @@ -748,6 +782,11 @@ uint32_t CiteJoueur::compterPoints( int niveau_difficulte) const
if (!habitations_visitees.empty())
{
points_bleu = *std::max_element(points_hab.begin(), points_hab.end());
if(variantes[3]==1){
if(points_bleu>=10){
points_bleu=points_bleu*2;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

}
}
}

//std::cout << "printing points : " << points_bleu * nb_place_bleue * 1 << " . " << points_jaune * nb_place_jaune * 2 << " . " << points_rouge * nb_place_rouge * 2 << " . " << points_vert * nb_place_verte * 3 << " . " << points_violet * nb_place_violet * 2 << std::endl;
Expand Down Expand Up @@ -869,7 +908,7 @@ void Cite::release_hex_fantome()
}
hexs_fantome.clear();
};
uint32_t CiteIllu::compterPoints( int niveau_difficulte) const {
uint32_t CiteIllu::compterPoints( int niveau_difficulte, std::array<int,5> variantes) const {

uint32_t nb_carriere = 0;

Expand Down
Loading