-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcompetitor.class.js
More file actions
26 lines (25 loc) · 824 Bytes
/
competitor.class.js
File metadata and controls
26 lines (25 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const chalk = require("chalk")
module.exports = class Competitor {
constructor(name) {
this.name = name
this.life = 100
}
giveACordeALinge(target) {
console.log(`${chalk.green.bold(this.name)} donne une corde a linge à ${chalk.red.bold(target)}`)
return 20 // Is the damage of this method
}
giveAMandale(target) {
console.log(`${chalk.green.bold(this.name)} donne une mandale à ${chalk.red.bold(target)}`);
return 15 // Is the damage of this method
}
takeDamage(dmg){
this.life -= dmg
console.log(`${this.name}: ${chalk.red(this.life)} HP`);
return this.life
}
smokeWeed() {
this.life += 10
console.log(chalk.bgGreen(`${this.name} smoke weed ! HP: ${this.life}`));
return this.life
}
}