コード例 #1
0
ファイル: action.cpp プロジェクト: martiall99/Pro3600-RPG-
Magie::eff(Personnage& Cible, Personnage& Lanceur)
{
    if(Lanceur.utiliserPa(a_pa) && Lanceur.utiliserMana(a_mana)) {
        Cible.recevoirSoins(a_regeneration, a_regeneration);
        Cible.recevoirDegatsMagiques(a_degats, a_degats);
    }
}
コード例 #2
0
ファイル: main.cpp プロジェクト: SelimJB/Projet-mancho
/*void etat(Personnage const& a)
{
a.afficherEtat();
}
*/
void etat(Personnage const& a, Personnage const& b)
{
cout << "votre Etat :\n";
a.afficherEtat();
cout << "celui de votre adversaire :\n";
b.afficherEtat();
}
コード例 #3
0
ファイル: action.cpp プロジェクト: martiall99/Pro3600-RPG-
bool MagieGenerique::enleverPAMana()
{
	if (!stableEtCible())
		return false;
	else
	{
		Personnage *moi = parent->moi;
		return(moi->utiliserPa(coutPa) && moi->utiliserMana(coutMana));
	}
}
コード例 #4
0
ファイル: action.cpp プロジェクト: martiall99/Pro3600-RPG-
bool AttaqueGenerique::peutEff()
{
	if (!stableEtCible())
		return false;
	else
	{
		Personnage *moi = parent->moi;
		return (moi->aPA(coutPa));
	}
}
コード例 #5
0
int main()
{

  Personnage* guerrier = new Guerrier();
  cout << guerrier->toString();
  Joueur* Pierre = new Joueur("Pierre", *guerrier,"test.txt");
  cout << Pierre->getDeck()->tirerCarte().toString() << endl;
  Pierre->getPersonnage().setCP(new ComportementPouvoirGuerrier());
  cout << Pierre->getPersonnage().utiliserPouvoir() << endl;
 

  return 0;
}
コード例 #6
0
ファイル: action.cpp プロジェクト: martiall99/Pro3600-RPG-
bool AttaqueGenerique::eff()
{
	if (!stableEtCible())
		return false;
	else
	{
		Personnage *moi = parent->moi;
		Personnage *adv = parent->moi->cible;
		bool a = moi->utiliserPa(coutPa);
		if (a)
			adv->recevoirDegats(minD, maxD, *moi);
		return a;
	}
}
コード例 #7
0
ファイル: EndRoom.cpp プロジェクト: dralagen/labyrinth
int EndRoom::action(Personnage &perso) {
	if (m_boss.action(perso) == RC_CLEAN_MONSTER) {
		std::cout << "Congratulation " COLOR_PLAYER << perso.getNom() << "\033[31m !! \033[33mYOU \033[32mW\033[34mI\033[36mN \033[35m!!" << std::endl;
		return RC_NOTHING;
	}
	return RC_UNDO;
}
コード例 #8
0
ファイル: TreasureArme.cpp プロジェクト: dralagen/labyrinth
void TreasureArme::open(Personnage &p) {
	Random *r = Random::getInstance();
	ItemFactory *f = getFactory(r->getRand());
	Arme *a;

	switch (r->getRand()%3) {
		case 1:
			a = f->GetEpee();
			break;
		case 2:
			a = f->GetDague();
			break;
		default:
			a = f->GetHache();
	}

	for (int i = 0; i < m_lvl; ++i) {
		switch (r->getRand()%6) {
			case 0:
				a = new DArmeD(a);
				break;
			case 1:
				a = new DArmeC(a);
				break;
			case 2:
				a = new DArmeF(a);
				break;
			case 3:
				a = new DArmeV(a);
				break;
		}
	}
	delete f;
	p.trouverArme(a);
}
コード例 #9
0
ファイル: action.cpp プロジェクト: martiall99/Pro3600-RPG-
bool MagieAttaqueGenerique::eff()
{
	if (!stableEtCible())
		return false;
	else
	{
		Personnage *moi = parent->moi;
		Personnage *adv = parent->moi->cible;
		bool a = peutEff();
		if (a)
		{
			enleverPAMana();
			adv->recevoirDegatsMagiques(minD, maxD, *moi);
		}
		return a;
	}
}
コード例 #10
0
ファイル: action.cpp プロジェクト: martiall99/Pro3600-RPG-
bool PotionSoinGenerique::eff()
{
	if (!stableEtCible())
		return false;
	else
	{
		Personnage *moi = parent->moi;
		bool a = enlever1potion();
		if (a)
		{
			moi->recevoirSoins(healMin, healMax);
			return true;
		}
		else
		{
			return false;
		}
	}
}
コード例 #11
0
ファイル: Elements_lib.cpp プロジェクト: NegatIV38/Elements
string elements::setAdvName(Personnage& adv){
	string name = "Elementaire";
	switch (adv.getType1())
	{
	case(1) :
		name += " de Feu";
		break;
	case(2) :
		name += " d'Eau";
		break;
	case(3) :
		name += " de Terre";
		break;
	case(4) :
		name += " de Plante";
		break;
	case(5) :
		name += " de Foudre";
		break;
	default:
		break;
	}
	switch (adv.getType2())
	{
	case(0) :
		break;
	case(6) :
		name += " Tenebreux";
		break;
	case(7) :
		name += " Lumineux";
		break;
	default:
		break;
	}
	return name;
}
コード例 #12
0
ファイル: Personnage.cpp プロジェクト: RPGValin/Game-Project
bool Personnage::utiliserSort(Personnage& cible)
{
	unsigned int degats = m_sort(&m_mana);

	cible.recevoirDegats(degats);

	if(degats > 0)
	{
		return true;
	}
	else
	{
		return false;
	}
}
コード例 #13
0
ファイル: Personnage.cpp プロジェクト: RPGValin/Game-Project
bool Personnage::attaquer(Personnage& cible)
{
	unsigned int degats = rand()%(m_degats+m_arme->getDegats()-1) + m_arme->getDegats(); //aleatoire entre arme.getDegats() et arme.getDegats()+m_degats
	bool coupCritique;

	if(rand()%7 == 0)
	{
		degats += rand()%46 - 10;

		coupCritique = true;
	}
	else
	{
		coupCritique = false;
	}

	cible.recevoirDegats(degats);

	return coupCritique;
}
コード例 #14
0
/**
 * Méthode principale de l'écran
 *
 * @Param sf::RenderWindow &fenetre
 * @Param Personnage &perso1
 * @Param Personnage &perso2
 * @Param Affichage &affichage
 * @Param Carte &carteJeu
 * @Son &son
 *
 * @Return int
 */
int EcranMenuMulti::run(sf::RenderWindow &fenetre, Personnage &perso1, Personnage &perso2, Affichage &affichage, Carte &carteJeu, Son &son)
{
	sf::Event monEvent;
	bool running = true;
	int i = 0;
	int j = 0;
	int k = 0;
	int l = 0;

    //Chargement de l'image de fond du menu multijoueur
    if (!ImageMulti.LoadFromFile("tilesets/MenuMulti.png"))
		std::cout << "Erreur chargement image du menu multi" << std::endl;

    //Chargement du tile pour le choix des personnages
    if (!ImagePerso.LoadFromFile("tilesets/Tile_perso.jpg"))
		std::cout << "Erreur chargement image du menu multi (tile perso)" << std::endl;

    //Chargement du tile pour le choix de la map
    if (!ImageMap.LoadFromFile("tilesets/Tile_Map.png"))
		std::cout << "Erreur chargement image du menu multi (tile map)" << std::endl;

    //Chargement de l'image flèche droite
    if (!ImageFlecheDroite.LoadFromFile("tilesets/FlecheDroite.png"))
		std::cout << "Erreur chargement image du menu multi (fleche droite) '" << std::endl;

    //Chargement de l'image flèche droite
    if (!ImageFlecheGauche.LoadFromFile("tilesets/FlecheGauche.png"))
		std::cout << "Erreur chargement image du menu multi (fleche gauche)" << std::endl;

    //Chargement de l'image pour le nombre de manches gagnantes
    if (!ImageNombreManches.LoadFromFile("tilesets/Tile_NombreManches.png"))
		std::cout << "Erreur chargement image du menu multi (tile nombre de manches)" << std::endl;


    //Chargement des images dans les sprites
    SpriteMulti.SetImage(ImageMulti);
    SpriteFlecheDroite1.SetImage(ImageFlecheDroite);
    SpriteFlecheDroite2.SetImage(ImageFlecheDroite);
    SpriteFlecheDroite3.SetImage(ImageFlecheDroite);
    SpriteFlecheDroite4.SetImage(ImageFlecheDroite);

    //Position des différents sprites
    SpriteFlecheDroite1.SetPosition(230, 450);
    SpriteFlecheDroite2.SetPosition(230, 620);
    SpriteFlecheDroite3.SetPosition(630, 390);
    SpriteFlecheDroite4.SetPosition(590, 587);

    SpriteFlecheGauche1.SetImage(ImageFlecheGauche);
    SpriteFlecheGauche2.SetImage(ImageFlecheGauche);
    SpriteFlecheGauche3.SetImage(ImageFlecheGauche);
    SpriteFlecheGauche4.SetImage(ImageFlecheGauche);
    SpriteFlecheGauche5.SetImage(ImageFlecheGauche);
    SpriteFlecheGauche1.SetPosition(50, 450);
    SpriteFlecheGauche2.SetPosition(50, 620);
    SpriteFlecheGauche3.SetPosition(420, 390);
    SpriteFlecheGauche4.SetPosition(5, 695);
    SpriteFlecheGauche5.SetPosition(455, 587);

    SpritePerso1.SetImage(ImagePerso);
    SpritePerso1.SetSubRect(sf::IntRect(0, 0, TAILLEIMAGEPERSO, TAILLEIMAGEPERSO));
    SpritePerso2.SetImage(ImagePerso);
    SpritePerso2.SetSubRect(sf::IntRect(0, 0, TAILLEIMAGEPERSO, TAILLEIMAGEPERSO));
    SpriteMap.SetImage(ImageMap);
    SpriteMap.SetSubRect(sf::IntRect(0, 0, TAILLEIMAGEMAP, TAILLEIMAGEMAP));
    SpriteNombreManches.SetImage(ImageNombreManches);
    SpriteNombreManches.SetSubRect(sf::IntRect(0, 0, TAILLEIMAGEMANCHES, TAILLEIMAGEMANCHES));
    SpritePerso1.SetPosition(115, 425);
    SpritePerso2.SetPosition(115, 595);
    SpriteMap.SetPosition(485, 350);
    SpriteNombreManches.SetPosition(520, 585);


    while(running)
	{
	    //Tant que la fenêtre contient des évènements
        while(fenetre.GetEvent(monEvent))
		{
			if (monEvent.Type == sf::Event::Closed)
				return (ECRAN_QUITTER); // On quitte le jeu

            if((monEvent.Type == sf::Event::MouseButtonPressed) && (monEvent.MouseButton.Button == sf::Mouse::Left))
            {
                //Cas ou on clique sur la fleche précédant
                if(monEvent.MouseButton.X > SpriteFlecheGauche4.GetPosition().x && monEvent.MouseButton.X < SpriteFlecheGauche4.GetPosition().x + TAILLEFLECHE)
                {
                    if(monEvent.MouseButton.Y > SpriteFlecheGauche4.GetPosition().y && monEvent.MouseButton.Y < SpriteFlecheGauche4.GetPosition().y + TAILLEFLECHE)
                    {
                        //On affiche le Menu Principal
                        return (ECRAN_MENU_PRINCIPAL);
                    }
                }
                if(monEvent.MouseButton.X > SpriteFlecheGauche1.GetPosition().x && monEvent.MouseButton.X < SpriteFlecheGauche1.GetPosition().x + TAILLEFLECHE)
                {
                    //Cas ou on clique sur la fleche précédant pour le choix du Perso 1
                    if(monEvent.MouseButton.Y > SpriteFlecheGauche1.GetPosition().y && monEvent.MouseButton.Y < SpriteFlecheGauche1.GetPosition().y + TAILLEFLECHE)
                    {
                        i = i - TAILLEIMAGEPERSO;
                        if(i < 0)
                        {
                            i = TAILLETILEPERSO - TAILLEIMAGEPERSO;
                        }

                        SpritePerso1.SetSubRect(sf::IntRect(i, 0, i + TAILLEIMAGEPERSO, TAILLEIMAGEPERSO));
                    }
                    //Cas ou on clique sur la fleche précédant pour le choix du Perso 2
                    if(monEvent.MouseButton.Y > SpriteFlecheGauche2.GetPosition().y && monEvent.MouseButton.Y < SpriteFlecheGauche2.GetPosition().y + TAILLEFLECHE)
                    {
                        j = j - TAILLEIMAGEPERSO;
                        if(j < 0)
                        {
                            j = TAILLETILEPERSO - TAILLEIMAGEPERSO;
                        }
                        SpritePerso2.SetSubRect(sf::IntRect(j, 0, j + TAILLEIMAGEPERSO, TAILLEIMAGEPERSO));
                    }
                }

                if(monEvent.MouseButton.X > SpriteFlecheDroite1.GetPosition().x && monEvent.MouseButton.X < SpriteFlecheDroite1.GetPosition().x + TAILLEFLECHE)
                {
                    //Cas ou on clique sur la fleche suivant pour le choix du Perso 1
                    if(monEvent.MouseButton.Y > SpriteFlecheDroite1.GetPosition().y && monEvent.MouseButton.Y < SpriteFlecheDroite1.GetPosition().y + TAILLEFLECHE)
                    {
                        i = i + TAILLEIMAGEPERSO;
                        if(i >= TAILLETILEPERSO)
                        {
                            i = 0;
                        }
                        SpritePerso1.SetSubRect(sf::IntRect(i, 0, i + TAILLEIMAGEPERSO, TAILLEIMAGEPERSO));
                    }
                    //Cas ou on clique sur la fleche suivant pour le choix du Perso 2
                    if(monEvent.MouseButton.Y > SpriteFlecheDroite2.GetPosition().y && monEvent.MouseButton.Y < SpriteFlecheDroite2.GetPosition().y + TAILLEFLECHE)
                    {
                        j = j + TAILLEIMAGEPERSO;
                        if(j >= TAILLETILEPERSO)
                        {
                            j = 0;
                        }
                        SpritePerso2.SetSubRect(sf::IntRect(j, 0, j + TAILLEIMAGEPERSO, TAILLEIMAGEPERSO));
                    }
                }

                if(monEvent.MouseButton.Y > SpriteFlecheDroite3.GetPosition().y && monEvent.MouseButton.Y < SpriteFlecheDroite3.GetPosition().y + TAILLEFLECHE)
                {
                    //Cas ou on clique sur la fleche précédant pour le choix de la map
                    if(monEvent.MouseButton.X > SpriteFlecheGauche3.GetPosition().x && monEvent.MouseButton.X < SpriteFlecheGauche3.GetPosition().x + TAILLEFLECHE)
                    {
                        k = k - TAILLEIMAGEMAP;
                        if(k < 0)
                        {
                            k = TAILLETILEMAP - TAILLEIMAGEMAP;
                        }
                        SpriteMap.SetSubRect(sf::IntRect(k, 0, k + TAILLEIMAGEMAP, TAILLEIMAGEMAP));
                    }
                    //Cas ou on clique sur la fleche suivant pour le choix de la map
                    if(monEvent.MouseButton.X > SpriteFlecheDroite3.GetPosition().x && monEvent.MouseButton.X < SpriteFlecheDroite3.GetPosition().x + TAILLEFLECHE)
                    {
                        k = k + TAILLEIMAGEMAP;
                        if(k >= TAILLETILEMAP)
                        {
                            k = 0;
                        }
                        SpriteMap.SetSubRect(sf::IntRect(k, 0, k + TAILLEIMAGEMAP, TAILLEIMAGEMAP));
                    }
                }


                if(monEvent.MouseButton.Y > SpriteFlecheDroite4.GetPosition().y && monEvent.MouseButton.Y < SpriteFlecheDroite4.GetPosition().y + TAILLEFLECHE)
                {
                    //Cas ou on clique sur la fleche précédant pour le choix du nombre de manches gagnantes
                    if(monEvent.MouseButton.X > SpriteFlecheGauche5.GetPosition().x && monEvent.MouseButton.X < SpriteFlecheGauche5.GetPosition().x + TAILLEFLECHE)
                    {
                        l = l - TAILLEIMAGEMANCHES;
                        if(l < 0)
                        {
                            l = TAILLETILEMANCHES - TAILLEIMAGEMANCHES;
                        }
                        SpriteNombreManches.SetSubRect(sf::IntRect(l, 0, l + TAILLEIMAGEMANCHES, TAILLEIMAGEMANCHES));
                    }

                    //Cas ou on clique sur la fleche suivant pour le choix du nombre de manches gagnantes
                    if(monEvent.MouseButton.X > SpriteFlecheDroite4.GetPosition().x && monEvent.MouseButton.X < SpriteFlecheDroite4.GetPosition().x + TAILLEFLECHE)
                    {
                        l = l + TAILLEIMAGEMANCHES;
                        if(l >= TAILLETILEMANCHES)
                        {
                            l = 0;
                        }
                        SpriteNombreManches.SetSubRect(sf::IntRect(l, 0, l + TAILLEIMAGEMANCHES, TAILLEIMAGEMANCHES));
                    }
                }

                //Cas ou on clique sur Commencer
                if(monEvent.MouseButton.X > 530 && monEvent.MouseButton.X < 710)
                {
                    if(monEvent.MouseButton.Y > 660 && monEvent.MouseButton.Y < 710)
                        {
                            //Switch sur i pour savoir quel perso a choisi le joueur 1
                            switch(i)
                            {
                                case 0*TAILLEIMAGEPERSO:
                                joueur1 = "zelda";
                                break;

                                case 1*TAILLEIMAGEPERSO:
                                joueur1 = "mario";
                                break;

                            }

                            //Switch sur j pour savoir quel perso a choisi le joueur 2
                            switch(j)
                            {
                                case 0*TAILLEIMAGEPERSO:
                                joueur2 = "zelda";
                                break;

                                case 1*TAILLEIMAGEPERSO:
                                joueur2 = "mario";
                                break;

                            }

                            //Switch sur k pour savoir quel map ont choisi les joueurs
                            switch(k)
                            {
                                case 0*TAILLEIMAGEMAP:
                                map = "zelda";
                                break;

                                case 1*TAILLEIMAGEMAP:
                                map = "mario";
                                break;

                            }

                            //On initialise le nombre de parties gagnantes
							perso1.setNombreDeManchesGagnantes((int)(l / TAILLEIMAGEMANCHES) + 1);
							perso2.setNombreDeManchesGagnantes((int)(l / TAILLEIMAGEMANCHES) + 1);

							perso1.setThemePersonnage(joueur1);
                            perso2.setThemePersonnage(joueur2);
                            affichage.setThemeCarte(map);
                            return (ECRAN_JEU); // On rentre dans l'écran du jeu
                        }
                }
            }
		}

		fenetre.Clear();
		fenetre.Draw(SpriteMulti);

		fenetre.Draw(SpriteFlecheDroite1);
		fenetre.Draw(SpriteFlecheDroite2);
		fenetre.Draw(SpriteFlecheDroite3);
		fenetre.Draw(SpriteFlecheDroite4);
		fenetre.Draw(SpriteFlecheGauche1);
		fenetre.Draw(SpriteFlecheGauche2);
		fenetre.Draw(SpriteFlecheGauche3);
		fenetre.Draw(SpriteFlecheGauche4);
		fenetre.Draw(SpriteFlecheGauche5);

		fenetre.Draw(SpritePerso1);
		fenetre.Draw(SpritePerso2);
		fenetre.Draw(SpriteMap);
		fenetre.Draw(SpriteNombreManches);
		fenetre.Display();
	}
	return (ECRAN_QUITTER);
}
コード例 #15
0
ファイル: EmptyRoom.cpp プロジェクト: dralagen/labyrinth
int EmptyRoom::action(Personnage &perso) {
	perso.modifierVie(3);
	return RC_NOTHING;
}
コード例 #16
0
/**
 * Méthode principale de l'écran
 *
 * @Param sf::RenderWindow &fenetre
 * @Param Personnage &perso1
 * @Param Personnage &perso2
 * @Param Affichage &affichage
 * @Param Carte &carteJeu
 * @Son &son
 *
 * @Return int
 */
int EcranMancheFinie::run(sf::RenderWindow &fenetre, Personnage &perso1, Personnage &perso2, Affichage &affichage, Carte &carteJeu, Son &son)
{
	sf::Event monEvent;
	bool running = true;

	// On joue le son de victoire
	son.playWin();

	// Boucle du menu principal
	while(running)
	{
		while(fenetre.GetEvent(monEvent))
		{
		    if (monEvent.Type == sf::Event::Closed)
		    {
		        //On stoppe la musique
                son.stopMusic();
				return (ECRAN_MENU_PRINCIPAL); // On quitte le jeu
		    }

			if ((monEvent.Type == sf::Event::KeyPressed) && (monEvent.Key.Code == sf::Key::Return))
            {
				// On relance le jeu à nouveau
				return (ECRAN_JEU);
			}
			if ((monEvent.Type == sf::Event::KeyPressed) && (monEvent.Key.Code == sf::Key::Escape))
            {
                son.stopMusic();
				// On relance le jeu à nouveau
				return (ECRAN_MENU_PRINCIPAL);
			}

		}
		// On affiche le contenu de l'écran
        fenetre.Clear();
        affichage.displayFond(fenetre);
        affichage.displayMap(fenetre);

		// On affiches les sprites de fin de manche
		if(perso1.isVivant() && !perso2.isVivant())
		{
			affichage.displayFinManche(fenetre, "1", 100, 250);
		}
		else if(perso2.isVivant() && !perso1.isVivant())
		{
			affichage.displayFinManche(fenetre, "2", 100, 250);
		}
		else if(!perso1.isVivant() && !perso2.isVivant())
		{
		    affichage.displayFinMancheEgal(fenetre, 100, 250);
        }

		affichage.displayPersoFini(&perso1, fenetre);
		affichage.displayPersoFini(&perso2, fenetre);

		// On affiche les scores
		affichage.displayScore(fenetre,perso1,90);
        affichage.displayScore(fenetre,perso2,400);
        // On affiche le contenu de la fenetre
		affichage.displayAvatar(fenetre);
		fenetre.Display();
	}
	// Normalement on atteint jamais cet endroit, si jamais ça arrive on quitte le jeu.
	return (ECRAN_QUITTER);
}
コード例 #17
0
ファイル: action.cpp プロジェクト: martiall99/Pro3600-RPG-
void PotionVie::eff(Personnage& Perso)
{
    Perso.recevoirSoins(a_regeneration,a_regeneration);
}
コード例 #18
0
ファイル: action.cpp プロジェクト: martiall99/Pro3600-RPG-
void Bouclier::eff(Personnage& Cible, Personnage& Lanceur)
{
    if(Lanceur.utiliserPa(3))
        Cible.changerArmure(5,10);
}
コード例 #19
0
ファイル: action.cpp プロジェクト: martiall99/Pro3600-RPG-
void AttaquePuissante::eff(Personnage& Cible, Personnage& Lanceur)
{
    if(Lanceur.utiliserPa(4))
        Cible.recevoirDegats(20,25);
}
コード例 #20
0
ファイル: action.cpp プロジェクト: martiall99/Pro3600-RPG-
void AttaqueSimple::eff(Personnage& Cible, Personnage& Lanceur)
{
    if(Lanceur.utiliserPa(2))
        Cible.recevoirDegats(10,15);
}
コード例 #21
0
ファイル: TableauDeBord.cpp プロジェクト: rems4e/Projet2MIC
void TableauDeBord::dessiner() {
	Affichage::ajouterOpacite(220);
	_fond.afficher(glm::vec2(0, 0));
	Affichage::supprimerOpacite();
	
	size_t lBarre = 200, hBarre = 30;

	glm::vec2 const positionVie(50, 100);

	for(index_t i = 0; i != hBarre; ++i) {
		Affichage::afficherRectangle(Rectangle(positionVie.x * Ecran::echelle().x, (positionVie.y + i) * Ecran::echelle().y, lBarre * Ecran::echelle().x, 1 * Ecran::echelle().y), Couleur(255 - 6 * std::abs(15 - i), 80, 80));
		Affichage::afficherRectangle(Rectangle(positionVie.x * Ecran::echelle().x, (positionVie.y + i) * Ecran::echelle().y, _joueur->vieActuelle() * lBarre / _joueur->vieTotale() * Ecran::echelle().x, 1 * Ecran::echelle().y), Couleur(230 - 8 * std::abs(15 - i), 0, 0));
	}
	 
	Texte chiffres(TRAD("tabBord vie %1/%2", _joueur->vieActuelle(), _joueur->vieTotale()), POLICE_GRANDE, 16 * Ecran::echelleMin(), Couleur::blanc);
	chiffres.afficher(glm::vec2(positionVie.x * Ecran::echelle().x, positionVie.y * Ecran::echelle().y) + (glm::vec2(lBarre * Ecran::echelle().x, hBarre * Ecran::echelle().y) - chiffres.dimensions()) / 2.0f);
	
	glm::vec2 const positionXp(Ecran::largeur() / Ecran::echelle().x - 50 - lBarre , positionVie.y);
	for(index_t i = 0; i != hBarre; ++i) {
		Affichage::afficherRectangle(Rectangle(positionXp.x * Ecran::echelle().x, (positionXp.y + i) * Ecran::echelle().y, lBarre * Ecran::echelle().x, 1 * Ecran::echelle().y), Couleur(12 * std::abs(15 - i), 12 * std::abs(15 - i), 12 * std::abs(15 - i)));
		Affichage::afficherRectangle(Rectangle(positionXp.x * Ecran::echelle().x, (positionXp.y + i) * Ecran::echelle().y, _joueur->xp() * lBarre / _joueur->xpTotale() * Ecran::echelle().x, 1 * Ecran::echelle().y), Couleur(6 * std::abs(15 - i), 6 * std::abs(15 - i), 6 * std::abs(15 - i)));
	}
	
	chiffres.definir(TRAD("tabBord Niveau %1 - %2/%3", _joueur->niveauXp(), _joueur->xp(), _joueur->xpTotale()));
	chiffres.afficher(glm::vec2(positionXp.x * Ecran::echelle().x,  positionXp.y * Ecran::echelle().y) + (glm::vec2(lBarre * Ecran::echelle().x, hBarre * Ecran::echelle().y) - chiffres.dimensions()) / 2.0f);

	Unichar txt;
	switch(_joueur->interaction()) {
		case Joueur::ij_attaquer: {
			Personnage *p = _joueur->attaque();
			txt = TRAD("tabBord Attaquer l'ennemi (%1/%2 vie)", p->vieActuelle(), p->vieTotale());
			break;
		}
		case Joueur::ij_commerce:
			txt = TRAD("tabBord Acheter/vendre des objets");
			break;
		case Joueur::ij_ramasser: {
			std::pair<size_t, size_t> nbObjets = _joueur->nombreObjets();
			if(nbObjets.first == 1 && nbObjets.second == 0)
				txt = TRAD("tabBord Ramasser 1 objet");
			else if(nbObjets.first > 1 && nbObjets.second == 0)
				txt = TRAD("tabBord Ramasser %1 objets", nbObjets.first);
			else if(nbObjets.first == 1 && nbObjets.second == 1)
				txt = TRAD("tabBord Ramasser 1 objet et 1 or");
			else if(nbObjets.first > 1 && nbObjets.second == 1)
				txt = TRAD("tabBord Ramasser %1 objets et 1 or", nbObjets.first);
			else if(nbObjets.first == 0 && nbObjets.second == 1)
				txt = TRAD("tabBord Ramasser 1 or");
			else if(nbObjets.first == 1 && nbObjets.second > 1)
				txt = TRAD("tabBord Ramasser 1 objet et %1 or", nbObjets.second);
			else if(nbObjets.first > 1 && nbObjets.second > 1)
				txt = TRAD("tabBord Ramasser %1 objets et %2 or", nbObjets.first, nbObjets.second);
			else if(nbObjets.first == 0 && nbObjets.second > 1)
				txt = TRAD("tabBord Ramasser %1 or", nbObjets.second);
			break;
		}
		case Joueur::ij_finirNiveau:
			txt = TRAD("Terminer le niveau");
		case Joueur::ij_aucune:
			break;
	}
	
	_interactionJoueur.definir(12 * Ecran::echelleMin());
	_interactionJoueur.definir(txt);
	_interactionJoueur.afficher(glm::vec2((Ecran::largeur() - _interactionJoueur.dimensions().x) / 2, (positionVie.y + hBarre / 2) * Ecran::echelle().y - _interactionJoueur.dimensions().y / 2));
}
コード例 #22
0
ファイル: Personnage.cpp プロジェクト: skan/training_c--
void Personnage::attaquer(Personnage &cible)
{
    cible.recevoirDegats(m_arme.getDegats());
   //On inflige à la cible les dégâts que cause notre arme
}
コード例 #23
0
void Personnage::attaquer (Personnage &cible) {
        if (estVivant())
                cible.recevoirDegats (m_arme->getAttaque() + m_attaque);
}
コード例 #24
0
void Personnage::attaquer(Personnage &cible)
{
    //On inflige à la cible les dégâts que cause notre arme
    cible.recevoirDegats(m_arme.getDegats());
    cout << m_nom << " attaque " << cible.m_nom << endl;
}
コード例 #25
0
void Personnage::attaquer(Personnage &cible)
{
    cible.recevoirDegats(m_arme->getDegats());
}
コード例 #26
0
ファイル: Personnage.cpp プロジェクト: skan/training_c--
void Personnage::coupDePoing(Personnage &cible) const
{
    cible.recevoirDegats(10);
}
コード例 #27
0
ファイル: class.cpp プロジェクト: chocopaille/cpp
void	Personnage::attack(Personnage &cible)
{
	cible.take_damage(m_damage_weapon);
}
コード例 #28
0
ファイル: Gnome.cpp プロジェクト: HiiroSakaki/Cpp
void Gnome::confusion(Personnage &perso2){    //la confusion pousse l'adversaire a s'attaquer lui meme!!
    cout<< name + " a reussi a embrouiller "+ perso2.getnom()+" !!! "<<endl;
    nbmana=nbmana-10;
    perso2.fight(perso2);

        }