Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chapitre9_exercice2.js #21

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
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
14 changes: 3 additions & 11 deletions chapitre9_exercice2.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ class Personnage {
cible.sante = 0;
const bonusXP = 10;
console.log(
`${this.nom} a tué ${
cible.nom
} et gagne ${bonusXP} points d'expérience, ${
cible.inventaire.or
} pièces d'or et ${cible.inventaire.cles} clé(s)`
`${this.nom} a tué ${cible.nom} et gagne ${bonusXP} points d'expérience, ${cible.inventaire.or} pièces d'or et ${cible.inventaire.cles} clé(s)`
);
this.xp += bonusXP;
// L'inventaire de la victime est transféré à son vainqueur
Expand All @@ -41,17 +37,13 @@ class Personnage {
}
} else {
console.log(
`${this.nom} n'a plus de points de vie et ne pas pas attaquer`
`${this.nom} n'a plus de points de vie et ne peut pas attaquer`
);
}
}
// Renvoie la description du personnage
decrire() {
return `${this.nom} a ${this.sante} points de vie, ${
this.force
} en force et ${this.xp} points d'expérience, ${
this.inventaire.or
} pièces d'or et ${this.inventaire.cles} clé(s)`;
return `${this.nom} a ${this.sante} points de vie, ${this.force} en force et ${this.xp} points d'expérience, ${this.inventaire.or} pièces d'or et ${this.inventaire.cles} clé(s)`;
}
}

Expand Down