source: lost-haven/main/Damage.java@ 8edd04e

Last change on this file since 8edd04e 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: 761 bytes
RevLine 
[8edd04e]1package main;
2
3public class Damage extends Effect {
4
5 private int damage;
6
7 public Damage(int damage, TargetType target) {
8 super(EffectType.Damage, target);
9 this.damage = damage;
10 }
11
12 public Damage(Damage e) {
13 super(e);
14 this.damage = e.damage;
15 }
16
17 public Damage copy() {
18 return new Damage(this);
19 }
20
21 public int getDamage() {
22 return this.damage;
23 }
24
25 public void setDamage(int damage) {
26 this.damage = damage;
27 }
28
29 public void applyEffect(Object o) {
30 Creature cr = (Creature)o;
31 cr.setHitpoints(cr.getHitpoints() - this.damage);
32 if (cr.getHitpoints() > cr.getMaxHitpoints()) {
33 cr.setHitpoints(cr.getMaxHitpoints());
34 }
35 }
36
37 public String toString() {
38 return Integer.toString(this.damage);
39 }
40}
Note: See TracBrowser for help on using the repository browser.