Personnage.h #ifndef DEF_PERSONNAGE #define DEF_PERSONNAGE #include #include #include "Arme.h" class Personnage { public: Personnage(); Personnage(std::string nomArme, int degatsArme); ~Personnage(); void recevoirDegats(int nbDegats); void attaquer(Personnage &attaqueur, Personnage &cible); void boirePotionDeVie(int quantitePotion); void changerArme(std::string nomNouvelleArme, int degatsNouvelleArme); bool estVivant(); void afficherEtat(); private: int m_vie; int m_mana; Arme m_arme; }; #endif Personnage.cpp #include "Personnage.h" using namespace std; Personnage::Personnage() : m_vie(100), m_mana(100) { } Personnage::Personnage(string nomArme, int degatsArme) : m_vie(100), m_mana(100), m_arme(nomArme, degatsArme) { } Personnage::~Personnage() { } void Personnage::recevoirDegats(int nbDegats) { m_vie -= nbDegats; if (m_vie < 0) { m_vie = 0; } } void Personnage::attaquer(Personnage &attaquant, Personnage &cible) { int *attaqueur(0); attaqueur = &attaquant; int *ciblé(0); ciblé = &cible; cible.recevoirDegats(m_arme.getDegats()); cout << *attaqueur << " attaque " << *ciblé << endl << endl; Erreur 1 error C2440: '=' : impossible de convertir de 'Personnage *' en 'int *' c:\users\0932854\desktop\exercices c++\rpg\rpg\personnage.cpp 36 1 } void Personnage::boirePotionDeVie(int quantiteViePotion) { m_vie += quantiteViePotion; if (m_vie > 100) { m_vie = 100; } } void Personnage::changerArme(string nomNouvelleArme, int degatsNouvelleArme) { m_arme.changer(nomNouvelleArme, degatsNouvelleArme); } bool Personnage::estVivant() { if (m_vie > 0) { return true; } else { return false; } } void Personnage::afficherEtat() { cout << "Vie : " << m_vie << endl; cout << "Mana : " << m_mana << endl; m_arme.afficher(); }