-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheffect.js
33 lines (29 loc) · 937 Bytes
/
effect.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
Game.Effect = function(duration = 10, name = "unknown"){
this._duration = duration;
this._name = name;
this._color = this.getEffectColor(name);
}
Game.Effect.prototype.getName = function(){
return this._name;
}
Game.Effect.prototype.isDone = function() {
return (this._duration < 1);
}
Game.Effect.prototype.update = function() {
this._duration = this._duration - 1;
}
Game.Effect.prototype.getEffectColor = function(name) {
if (name === 'poisoned'){
return Game.Colors.poisonColor;
} else if (name === 'burning'){
return Game.Colors.burningColor;
} else if (name === 'blind' || name === 'paralyzed'){
return Game.Colors.blindColor;
} else if (name === 'vulnerable' || name === 'slowed'){
return Game.Colors.lichColor;
} else if (name === 'invisible'){
return Game.Colors.invisibleColor;
} else {
return Game.Colors.effectDefault;
}
}