|
Last change
on this file since a49176d was 8edd04e, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago |
|
Make the decompiled game code compile successfully
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | package main;
|
|---|
| 2 |
|
|---|
| 3 | public class MoveSpeed extends TimedEffect {
|
|---|
| 4 |
|
|---|
| 5 | private double speedChange;
|
|---|
| 6 | private int oldSpeed;
|
|---|
| 7 | private boolean frozen;
|
|---|
| 8 |
|
|---|
| 9 | public MoveSpeed(double speedChange, TargetType target, long duration) {
|
|---|
| 10 | super(EffectType.MoveSpeed, target, duration);
|
|---|
| 11 | this.speedChange = speedChange;
|
|---|
| 12 | this.frozen = (speedChange == 0.0D);
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | public MoveSpeed(MoveSpeed e) {
|
|---|
| 16 | super(e);
|
|---|
| 17 | this.speedChange = e.speedChange;
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | public MoveSpeed copy() {
|
|---|
| 21 | return new MoveSpeed(this);
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | public double getSpeedChange() {
|
|---|
| 25 | return this.speedChange;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | public void applyEffect(Object o) {
|
|---|
| 29 | Creature cr = (Creature)o;
|
|---|
| 30 | if (this.frozen) {
|
|---|
| 31 | this.oldSpeed = cr.getSpeed();
|
|---|
| 32 | }
|
|---|
| 33 | cr.setSpeed((int)(cr.getSpeed() * this.speedChange));
|
|---|
| 34 | cr.addEffect(this);
|
|---|
| 35 | cr.thorns++;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | public void cancelEffect(Object o) {
|
|---|
| 39 | Creature cr = (Creature)o;
|
|---|
| 40 | if (this.frozen) {
|
|---|
| 41 | cr.setSpeed(this.oldSpeed);
|
|---|
| 42 | } else {
|
|---|
| 43 | cr.setSpeed((int)(cr.getSpeed() / this.speedChange));
|
|---|
| 44 | }
|
|---|
| 45 | cr.thorns--;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | public String toString() {
|
|---|
| 49 | return Double.toString(this.speedChange);
|
|---|
| 50 | }
|
|---|
| 51 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.