Last change
on this file was fb4fc67, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago |
Initial commit, code decompiled from a jar
|
-
Property mode
set to
100644
|
File size:
634 bytes
|
Rev | Line | |
---|
[fb4fc67] | 1 | package main;
|
---|
| 2 |
|
---|
| 3 | import gamegui.Animation;
|
---|
| 4 |
|
---|
| 5 | public class Unit extends Entity {
|
---|
| 6 | int hitpoints;
|
---|
| 7 | int maxHitpoints;
|
---|
| 8 |
|
---|
| 9 | public Unit(final String name, final Animation img, final int hitpoints) {
|
---|
| 10 | super(name, img);
|
---|
| 11 | this.hitpoints = hitpoints;
|
---|
| 12 | this.maxHitpoints = hitpoints;
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | public Unit(final Unit copy) {
|
---|
| 16 | super(copy);
|
---|
| 17 | this.maxHitpoints = copy.maxHitpoints;
|
---|
| 18 | this.hitpoints = this.maxHitpoints;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | public int getHitpoints() {
|
---|
| 22 | return this.hitpoints;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | public void takeDamage(final int damage) {
|
---|
| 26 | this.hitpoints -= damage;
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.