[ebd3538] | 1 | package main;
|
---|
| 2 |
|
---|
| 3 | public class Effect
|
---|
| 4 | {
|
---|
| 5 | public String getDesc() {
|
---|
| 6 | return "";
|
---|
| 7 | }
|
---|
| 8 |
|
---|
| 9 | public void apply(final Player p) {
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | public void unapply(final Player p) {
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | public static class AttackSpeed extends Effect
|
---|
| 16 | {
|
---|
| 17 | private double percent;
|
---|
| 18 |
|
---|
| 19 | public AttackSpeed(final Double percent) {
|
---|
| 20 | this.percent = percent;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | public double getPercent() {
|
---|
| 24 | return this.percent;
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | @Override
|
---|
| 28 | public String getDesc() {
|
---|
| 29 | if (this.getPercent() >= 1.0) {
|
---|
| 30 | return "Increases attack speed by " + Math.round(100.0 * (this.getPercent() - 1.0)) + "%";
|
---|
| 31 | }
|
---|
| 32 | return "Decreases attack speed by " + Math.round(100.0 * (1.0 - this.getPercent())) + "%";
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | @Override
|
---|
| 36 | public void apply(final Player p) {
|
---|
| 37 | p.attackSpeedMod *= this.percent;
|
---|
| 38 | Direction[] values;
|
---|
| 39 | for (int length = (values = Direction.values()).length, i = 0; i < length; ++i) {
|
---|
| 40 | final Direction dir = values[i];
|
---|
| 41 | p.getModel().getAnimation(dir, Action.Attacking).drawInterval = (int)(p.getBaseAttackSpeed() * p.getAttackSpeed());
|
---|
| 42 | }
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | @Override
|
---|
| 46 | public void unapply(final Player p) {
|
---|
| 47 | p.attackSpeedMod /= this.percent;
|
---|
| 48 | Direction[] values;
|
---|
| 49 | for (int length = (values = Direction.values()).length, i = 0; i < length; ++i) {
|
---|
| 50 | final Direction dir = values[i];
|
---|
| 51 | p.getModel().getAnimation(dir, Action.Attacking).drawInterval = (int)(p.getBaseAttackSpeed() * p.getAttackSpeed());
|
---|
| 52 | }
|
---|
| 53 | }
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | public static class MoveSpeed extends Effect
|
---|
| 57 | {
|
---|
| 58 | private double percent;
|
---|
| 59 |
|
---|
| 60 | public MoveSpeed(final Double percent) {
|
---|
| 61 | this.percent = percent;
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | public double getPercent() {
|
---|
| 65 | return this.percent;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | @Override
|
---|
| 69 | public String getDesc() {
|
---|
| 70 | if (this.getPercent() >= 1.0) {
|
---|
| 71 | return "Increases move speed by " + Math.round(100.0 * (this.getPercent() - 1.0)) + "%";
|
---|
| 72 | }
|
---|
| 73 | return "Decreases move speed by " + Math.round(100.0 * (1.0 - this.getPercent())) + "%";
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | @Override
|
---|
| 77 | public void apply(final Player p) {
|
---|
| 78 | p.moveSpeedMod *= this.percent;
|
---|
| 79 | Direction[] values;
|
---|
| 80 | for (int length = (values = Direction.values()).length, i = 0; i < length; ++i) {
|
---|
| 81 | final Direction dir = values[i];
|
---|
| 82 | p.getModel().getAnimation(dir, Action.Walking).drawInterval = (int)(p.getBaseMoveSpeed() / p.moveSpeedMod);
|
---|
| 83 | }
|
---|
| 84 | p.speed = (int)(p.getBasePixelSpeed() * p.moveSpeedMod);
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | @Override
|
---|
| 88 | public void unapply(final Player p) {
|
---|
| 89 | p.moveSpeedMod /= this.percent;
|
---|
| 90 | Direction[] values;
|
---|
| 91 | for (int length = (values = Direction.values()).length, i = 0; i < length; ++i) {
|
---|
| 92 | final Direction dir = values[i];
|
---|
| 93 | p.getModel().getAnimation(dir, Action.Walking).drawInterval = (int)(p.getBaseMoveSpeed() / p.moveSpeedMod);
|
---|
| 94 | }
|
---|
| 95 | p.speed = (int)(p.getBasePixelSpeed() * p.moveSpeedMod);
|
---|
| 96 | }
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | public static class Damage extends Effect
|
---|
| 100 | {
|
---|
| 101 | private int damage;
|
---|
| 102 |
|
---|
| 103 | public Damage(final int damage) {
|
---|
| 104 | this.damage = damage;
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | public int getDamage() {
|
---|
| 108 | return this.damage;
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | @Override
|
---|
| 112 | public String getDesc() {
|
---|
| 113 | if (this.getDamage() > 0) {
|
---|
| 114 | return "Increases damage by " + this.getDamage();
|
---|
| 115 | }
|
---|
| 116 | return "Decreases damage by " + Math.abs(this.getDamage());
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | @Override
|
---|
| 120 | public void apply(final Player p) {
|
---|
| 121 | p.damageMod += this.damage;
|
---|
| 122 | }
|
---|
| 123 |
|
---|
| 124 | @Override
|
---|
| 125 | public void unapply(final Player p) {
|
---|
| 126 | p.damageMod -= this.damage;
|
---|
| 127 | }
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | public static class Hitpoints extends Effect
|
---|
| 131 | {
|
---|
| 132 | private int mod;
|
---|
| 133 |
|
---|
| 134 | public Hitpoints(final int mod) {
|
---|
| 135 | this.mod = mod;
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | public int getMod() {
|
---|
| 139 | return this.mod;
|
---|
| 140 | }
|
---|
| 141 |
|
---|
| 142 | @Override
|
---|
| 143 | public String getDesc() {
|
---|
| 144 | if (this.getMod() > 0) {
|
---|
| 145 | return "Increases hitpoints by " + this.getMod();
|
---|
| 146 | }
|
---|
| 147 | return "Decreases hitpoints by " + Math.abs(this.getMod());
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 | @Override
|
---|
| 151 | public void apply(final Player p) {
|
---|
| 152 | p.hpMod += this.mod;
|
---|
| 153 | p.propagateStatChanges();
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | @Override
|
---|
| 157 | public void unapply(final Player p) {
|
---|
| 158 | p.hpMod -= this.mod;
|
---|
| 159 | p.propagateStatChanges();
|
---|
| 160 | }
|
---|
| 161 | }
|
---|
| 162 |
|
---|
| 163 | public static class Manapoints extends Effect
|
---|
| 164 | {
|
---|
| 165 | private int mod;
|
---|
| 166 |
|
---|
| 167 | public Manapoints(final int mod) {
|
---|
| 168 | this.mod = mod;
|
---|
| 169 | }
|
---|
| 170 |
|
---|
| 171 | public int getMod() {
|
---|
| 172 | return this.mod;
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | @Override
|
---|
| 176 | public String getDesc() {
|
---|
| 177 | if (this.getMod() > 0) {
|
---|
| 178 | return "Increases manapoints by " + this.getMod();
|
---|
| 179 | }
|
---|
| 180 | return "Decreases manapoints by " + Math.abs(this.getMod());
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | @Override
|
---|
| 184 | public void apply(final Player p) {
|
---|
| 185 | p.mpMod += this.mod;
|
---|
| 186 | p.propagateStatChanges();
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 | @Override
|
---|
| 190 | public void unapply(final Player p) {
|
---|
| 191 | p.mpMod -= this.mod;
|
---|
| 192 | p.propagateStatChanges();
|
---|
| 193 | }
|
---|
| 194 | }
|
---|
| 195 | }
|
---|