source: lost-haven/main/AreaOfEffect.java

Last change on this file was 8edd04e, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 4 years ago

Make the decompiled game code compile successfully

  • Property mode set to 100644
File size: 1.0 KB
Line 
1package main;
2
3import java.util.Iterator;
4
5public class AreaOfEffect extends Effect {
6
7 private Effect effect;
8 private int range;
9
10 public AreaOfEffect(Effect effect, int range, TargetType target) {
11 super(EffectType.AreaOfEffect, target);
12 this.effect = effect;
13 this.range = range;
14 }
15
16 public AreaOfEffect(AreaOfEffect e) {
17 super(e);
18 this.effect = e.effect.copy();
19 this.range = e.range;
20 }
21
22 public AreaOfEffect copy() {
23 return new AreaOfEffect(this);
24 }
25
26 public Effect getEffect() {
27 return this.effect;
28 }
29
30 public void applyEffect(Object o) {
31 Creature cr = (Creature)o;
32 Map map = LostHavenRPG.map;
33 for (int x = 0; x < map.getLength(); x++) {
34 for (int y = 0; y < map.getHeight(); y++) {
35 Iterator<Creature> iter = map.getLoc(x, y).getCreatures().iterator();
36 while (iter.hasNext()) {
37 Creature temp = iter.next();
38 if (Point.dist(temp.getLoc(), cr.getLoc()) <= this.range)
39 this.effect.applyEffect(temp);
40 }
41 }
42 }
43 }
44}
Note: See TracBrowser for help on using the repository browser.