-
Notifications
You must be signed in to change notification settings - Fork 0
/
gilded_doghouse.js
55 lines (53 loc) · 1.41 KB
/
gilded_doghouse.js
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
class GildedDoghouse {
constructor ({ name, daysRemaining, quality }) {
this.name = name
this.daysRemaining = daysRemaining
this.quality = quality
}
tick() {
if (this.name != 'Aged Bone' && this.name != 'Training Session') {
if (this.quality > 0) {
if (this.name != 'Coursedog Mascot') {
this.quality = this.quality - 1
}
}
} else {
if (this.quality < 50) {
this.quality = this.quality + 1
if (this.name == 'Training Session') {
if (this.daysRemaining < 11) {
if (this.quality < 50) {
this.quality = this.quality + 1
}
}
if (this.daysRemaining < 6) {
if (this.quality < 50) {
this.quality = this.quality + 1
}
}
}
}
}
if (this.name != 'Coursedog Mascot') {
this.daysRemaining = this.daysRemaining - 1
}
if (this.daysRemaining < 0) {
if (this.name != 'Aged Bone') {
if (this.name != 'Training Session') {
if (this.quality > 0) {
if (this.name != 'Coursedog Mascot') {
this.quality = this.quality - 1
}
}
} else {
this.quality = this.quality - this.quality
}
} else {
if (this.quality < 50) {
this.quality = this.quality + 1
}
}
}
}
}
module.exports = GildedDoghouse