diff options
Diffstat (limited to 'src/com/fourisland')
6 files changed, 32 insertions, 61 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java index aa2c3b3..e9482f9 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/AbstractEvent.java | |||
@@ -218,15 +218,4 @@ public abstract class AbstractEvent implements Event { | |||
218 | { | 218 | { |
219 | return moveSpeed; | 219 | return moveSpeed; |
220 | } | 220 | } |
221 | |||
222 | private MoveFrequency freq; | ||
223 | public void setFrequency(MoveFrequency freq) | ||
224 | { | ||
225 | this.freq = freq; | ||
226 | } | ||
227 | |||
228 | public MoveFrequency getFrequency() | ||
229 | { | ||
230 | return freq; | ||
231 | } | ||
232 | } | 221 | } |
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java index 936394b..0cda403 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java | |||
@@ -51,7 +51,4 @@ public interface Event { | |||
51 | 51 | ||
52 | public void setMoveSpeed(MoveSpeed moveSpeed); | 52 | public void setMoveSpeed(MoveSpeed moveSpeed); |
53 | public MoveSpeed getMoveSpeed(); | 53 | public MoveSpeed getMoveSpeed(); |
54 | |||
55 | public void setFrequency(MoveFrequency freq); | ||
56 | public MoveFrequency getFrequency(); | ||
57 | } | 54 | } |
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java index 1df6c1d..5db87a0 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java | |||
@@ -25,7 +25,6 @@ public class HeroEvent extends AbstractEvent implements Event { | |||
25 | { | 25 | { |
26 | setLocation(new Point()); | 26 | setLocation(new Point()); |
27 | setMoveSpeed(MoveSpeed.Faster); | 27 | setMoveSpeed(MoveSpeed.Faster); |
28 | setFrequency(MoveFrequency.EIGHT); | ||
29 | } | 28 | } |
30 | 29 | ||
31 | public String getLabel() | 30 | public String getLabel() |
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java index afaf923..49721a7 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java | |||
@@ -103,7 +103,7 @@ public class LayerEvent extends AbstractEvent implements Event { | |||
103 | { | 103 | { |
104 | if (pt.isElapsed()) | 104 | if (pt.isElapsed()) |
105 | { | 105 | { |
106 | pt.setTimer(getFrequency().getFrequency()-1); | 106 | pt.setTimer(getFrequency()-1); |
107 | 107 | ||
108 | Direction toMove = getPossibleEvent().getMovement().nextMovement(new ImmutableEvent(this)); | 108 | Direction toMove = getPossibleEvent().getMovement().nextMovement(new ImmutableEvent(this)); |
109 | 109 | ||
@@ -176,14 +176,12 @@ public class LayerEvent extends AbstractEvent implements Event { | |||
176 | return getPossibleEvent().getMoveSpeed(); | 176 | return getPossibleEvent().getMoveSpeed(); |
177 | } | 177 | } |
178 | 178 | ||
179 | @Override | 179 | public void setFrequency(int freq) |
180 | public void setFrequency(MoveFrequency freq) | ||
181 | { | 180 | { |
182 | getPossibleEvent().setFrequency(freq); | 181 | getPossibleEvent().setFrequency(freq); |
183 | } | 182 | } |
184 | 183 | ||
185 | @Override | 184 | public int getFrequency() |
186 | public MoveFrequency getFrequency() | ||
187 | { | 185 | { |
188 | return getPossibleEvent().getFrequency(); | 186 | return getPossibleEvent().getFrequency(); |
189 | } | 187 | } |
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/MoveFrequency.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/MoveFrequency.java deleted file mode 100644 index 3e3cc0e..0000000 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/MoveFrequency.java +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.fourpuzzle.gamestate.mapview.event; | ||
7 | |||
8 | /** | ||
9 | * | ||
10 | * @author hatkirby | ||
11 | */ | ||
12 | public enum MoveFrequency { | ||
13 | |||
14 | EIGHT(1), | ||
15 | SEVEN(2), | ||
16 | SIX(3), | ||
17 | FIVE(4), | ||
18 | FOUR(5), | ||
19 | THREE(6), | ||
20 | TWO(7), | ||
21 | ONE(8); | ||
22 | |||
23 | private int freq; | ||
24 | private MoveFrequency(int freq) | ||
25 | { | ||
26 | this.freq = freq; | ||
27 | } | ||
28 | |||
29 | public int getFrequency() | ||
30 | { | ||
31 | return freq; | ||
32 | } | ||
33 | |||
34 | } | ||
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java index 3f35943..2d8a141 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java | |||
@@ -25,7 +25,7 @@ public class PossibleEvent { | |||
25 | private AnimationType animation; | 25 | private AnimationType animation; |
26 | private MovementType movement; | 26 | private MovementType movement; |
27 | private MoveSpeed moveSpeed; | 27 | private MoveSpeed moveSpeed; |
28 | private MoveFrequency freq; | 28 | private int freq; |
29 | private EventCallTime calltime; | 29 | private EventCallTime calltime; |
30 | private EventCall callback; | 30 | private EventCall callback; |
31 | 31 | ||
@@ -45,16 +45,26 @@ public class PossibleEvent { | |||
45 | private AnimationType animation = AnimationType.CommonWithoutStepping; | 45 | private AnimationType animation = AnimationType.CommonWithoutStepping; |
46 | private MovementType movement = new StayStillMovementType(); | 46 | private MovementType movement = new StayStillMovementType(); |
47 | private MoveSpeed moveSpeed = MoveSpeed.Normal; | 47 | private MoveSpeed moveSpeed = MoveSpeed.Normal; |
48 | private MoveFrequency freq = MoveFrequency.EIGHT; | 48 | private int freq = 1; |
49 | private EventCallTime calltime = EventCallTime.PushKey; | 49 | private EventCallTime calltime = EventCallTime.PushKey; |
50 | private EventCall callback = EventCall.getEmptyEventCall(); | 50 | private EventCall callback = EventCall.getEmptyEventCall(); |
51 | 51 | ||
52 | /** | ||
53 | * Set the graphic that this event will display | ||
54 | * | ||
55 | * @param graphic The graphic this event will display | ||
56 | */ | ||
52 | public Builder graphic(EventGraphic graphic) | 57 | public Builder graphic(EventGraphic graphic) |
53 | { | 58 | { |
54 | this.graphic = graphic; | 59 | this.graphic = graphic; |
55 | return this; | 60 | return this; |
56 | } | 61 | } |
57 | 62 | ||
63 | /** | ||
64 | * Set the layer that this event will be on | ||
65 | * | ||
66 | * @param layer The layer (Above, Middle, Below) this event will be on | ||
67 | */ | ||
58 | public Builder layer(Layer layer) | 68 | public Builder layer(Layer layer) |
59 | { | 69 | { |
60 | this.layer = layer; | 70 | this.layer = layer; |
@@ -79,7 +89,14 @@ public class PossibleEvent { | |||
79 | return this; | 89 | return this; |
80 | } | 90 | } |
81 | 91 | ||
82 | public Builder freq(MoveFrequency freq) | 92 | /** |
93 | * Set how often this event will initiate movement | ||
94 | * | ||
95 | * @param freq How many ticks, minus one, that the event must wait | ||
96 | * before it can start moving. This number must be greater than or equal | ||
97 | * to one. For no pause, use 1. | ||
98 | */ | ||
99 | public Builder freq(int freq) | ||
83 | { | 100 | { |
84 | this.freq = freq; | 101 | this.freq = freq; |
85 | return this; | 102 | return this; |
@@ -109,8 +126,8 @@ public class PossibleEvent { | |||
109 | layer = builder.layer; | 126 | layer = builder.layer; |
110 | animation = builder.animation; | 127 | animation = builder.animation; |
111 | movement = builder.movement; | 128 | movement = builder.movement; |
112 | moveSpeed = builder.moveSpeed; | 129 | setMoveSpeed(builder.moveSpeed); |
113 | freq = builder.freq; | 130 | setFrequency(builder.freq); |
114 | calltime = builder.calltime; | 131 | calltime = builder.calltime; |
115 | callback = builder.callback; | 132 | callback = builder.callback; |
116 | } | 133 | } |
@@ -165,12 +182,17 @@ public class PossibleEvent { | |||
165 | return moveSpeed; | 182 | return moveSpeed; |
166 | } | 183 | } |
167 | 184 | ||
168 | void setFrequency(MoveFrequency freq) | 185 | void setFrequency(int freq) |
169 | { | 186 | { |
187 | if (freq < 1) | ||
188 | { | ||
189 | throw new IllegalArgumentException("Frequency must be greater than or equal to one"); | ||
190 | } | ||
191 | |||
170 | this.freq = freq; | 192 | this.freq = freq; |
171 | } | 193 | } |
172 | 194 | ||
173 | public MoveFrequency getFrequency() | 195 | public int getFrequency() |
174 | { | 196 | { |
175 | return freq; | 197 | return freq; |
176 | } | 198 | } |