forked from myclouet/DevMultiSupport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpersonnage.ts
106 lines (80 loc) · 1.93 KB
/
personnage.ts
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
class Character {
// attributs de la classe personnage
private _id: string;
private name: string;
private avatar: string;
private strength: number;
private luck: number;
private endurance: number;
private items: Array<number>;
// private dead: boolean = false;
// constructeur de la classe personnage
constructor(id: string, name: string, avatar: string, strength: number, luck: number, endurance: number) {
this._id = id;
this.name = name;
this.avatar = avatar;
this.strength = strength;
this.luck = luck;
this.endurance = endurance;
}
// Liste des getters et setters
public getId() {
return this._id;
}
public getName() {
return this.name;
}
public getAvatar() {
return this.avatar;
}
public getStrength() {
return this.strength;
}
public getLuck() {
return this.luck;
}
public getEndurance() {
return this.endurance;
}
public getItems() {
return this.items;
}
public setStrength(strength: number) {
this.strength = strength;
}
public setLuck(luck: number) {
this.luck = luck;
}
public setEndurance(endurance: number) {
this.endurance = endurance
}
//Méthodes diverses
public die() {
// this.dead = true;
console.log('Vous êtes mort');
}
}
class Hero extends Character {
public chooseScene(myScene) {
}
public winGame() {
console.log('Vous avez gagné !');
}
public looseGame() {
console.log('Vous avez perdu !');
}
public rollDice() : number {
let res = Math.floor(Math.random() * 6) + 1;
return res;
}
public fight() {
}
public escape() {
}
public addObject(item: number) {
}
public useObject(myObj: number) {
}
public removeObj(myObj: number) {
}
}