-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDummyDebuff.java
More file actions
82 lines (75 loc) · 1.94 KB
/
DummyDebuff.java
File metadata and controls
82 lines (75 loc) · 1.94 KB
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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Dummy debuffs, the debuffs that show up on enimies when the user clicks on them
*
* @author James Lu
* @version 1.0
*/
public class DummyDebuff extends DummyImage
{
private int id;
private int level;
private int duration;
private int maxDuration;
public DummyDebuff(int id){
this.id = id;
if (id == 0){ //stun
bg = new GreenfootImage ("Debuff/stunned.png");
}
else if (id == 1){
bg = new GreenfootImage ("Debuff/lightning.png");
}
else if (id == 2){
bg = new GreenfootImage ("Debuff/freeze.png");
}
else if (id == 3){
bg = new GreenfootImage ("Debuff/burning.png");
}
else if (id == 4){
bg = new GreenfootImage ("Debuff/stone.png");
}
this.setImage (bg);
maxDuration = Data.debuffDuration [0][id];
duration = 0;
}
public void act(){
if (selected){
selected = false;
if (hoverCounter >= 50){
map.hm.setData (this);
int[] co = setCo();
map.addObject (map.hm, co[0], co[1]);
}
}
updateImg();
this.setImage (bg);
}
private void updateImg(){
bg.setTransparency (Math.round ( (float)duration / maxDuration * 255));
}
/**
* Sets the duration of the debuff
*/
public void setDuration (int d){
duration = d;
}
/**
* Sets the level of the debuff
*/
public void setLevel (int lv){
level = lv;
maxDuration = Data.debuffDuration [lv][id];
}
/**
* Returns the duration of the debuff
*/
public int getDuration(){
return duration;
}
/**
* Returns the Id of the debuff
*/
public int getId(){
return id;
}
}