diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index 3c91794..180cbd1 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -157,7 +157,6 @@ import common.packet.HPacketHandshake; import common.packet.CPacketAction.Action; import common.potion.Potion; import common.potion.PotionEffect; -import common.potion.PotionHelper; import common.properties.IProperty; import common.rng.Random; import common.sound.EventType; @@ -937,7 +936,7 @@ public class Client implements IThreadListener { for(PotionEffect effect : this.player.getEffects()) { Potion potion = effect.getPotion(); int color = potion.getColor(); - String name = (potion.isBadEffect() ? TextColor.ORANGE : TextColor.ACID) + potion.getDisplay() + PotionHelper.getPotionPotency(effect.getAmplifier()); + String name = (potion.isBadEffect() ? TextColor.ORANGE : TextColor.ACID) + effect.getEffectName(); String desc = TextColor.NEON + effect.getDurationString(); // Drawing.drawRectColor(x, y, 250, Font.DEFAULT.yglyph + 2, color | 0xff000000); Drawing.drawRectBorder(x, y, 250, Font.YGLYPH + 4, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f); diff --git a/common/src/main/java/common/entity/npc/EntityFlyingNPC.java b/common/src/main/java/common/entity/npc/EntityFlyingNPC.java index 9934394..01d180b 100755 --- a/common/src/main/java/common/entity/npc/EntityFlyingNPC.java +++ b/common/src/main/java/common/entity/npc/EntityFlyingNPC.java @@ -129,9 +129,9 @@ public abstract class EntityFlyingNPC extends EntityNPC return false; } - public boolean isPotionApplicable(Potion potion) + public boolean isPotionApplicable(Potion potion, int amplifier) { - return potion != Potion.FLYING && super.isPotionApplicable(potion); + return (potion != Potion.FLYING || amplifier > 0) && super.isPotionApplicable(potion, amplifier); } static class AILookAround extends EntityAIBase diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index 55c98d1..d0ab4de 100755 --- a/common/src/main/java/common/entity/npc/EntityNPC.java +++ b/common/src/main/java/common/entity/npc/EntityNPC.java @@ -3960,7 +3960,7 @@ public abstract class EntityNPC extends EntityLiving { double d3 = this.motionY; float f = this.jumpMovement; - this.jumpMovement = this.landMovement * (this.canFlyFullSpeed() ? 0.5f : 0.2f) * (float)(this.isSprinting() ? 2 : 1); + this.jumpMovement = this.landMovement * (this.canFlyFullSpeed() ? 0.5f : 0.2f) * (this.isSprinting() ? (this.canFlyFullSpeed() ? 2.0f : 1.3f) : 1.0f); super.moveEntityWithHeading(strafe, forward); this.motionY = d3 * 0.6D; this.jumpMovement = f; @@ -4369,7 +4369,7 @@ public abstract class EntityNPC extends EntityLiving } public boolean canFlyFullSpeed() { - return this.flying; + return this.hasEffect(Potion.FLYING) && this.getEffect(Potion.FLYING).getAmplifier() > 0; } public int getEnergy(Energy type) { // TODO diff --git a/common/src/main/java/common/entity/projectile/EntityPotion.java b/common/src/main/java/common/entity/projectile/EntityPotion.java index 031b3b2..bcee549 100755 --- a/common/src/main/java/common/entity/projectile/EntityPotion.java +++ b/common/src/main/java/common/entity/projectile/EntityPotion.java @@ -125,7 +125,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData for (PotionEffect potioneffect : list) { Potion i = potioneffect.getPotion(); - if(!entitylivingbase.isPotionApplicable(i)) + if(!entitylivingbase.isPotionApplicable(i, potioneffect.getAmplifier())) continue; if (i.isInstant()) diff --git a/common/src/main/java/common/entity/types/EntityLiving.java b/common/src/main/java/common/entity/types/EntityLiving.java index cd01dfb..c482140 100755 --- a/common/src/main/java/common/entity/types/EntityLiving.java +++ b/common/src/main/java/common/entity/types/EntityLiving.java @@ -813,7 +813,7 @@ public abstract class EntityLiving extends Entity */ public void addEffect(PotionEffect potioneffectIn) { - if (!potioneffectIn.getPotion().isInstant() && this.isPotionApplicable(potioneffectIn.getPotion())) + if (!potioneffectIn.getPotion().isInstant() && this.isPotionApplicable(potioneffectIn.getPotion(), potioneffectIn.getAmplifier())) { if (this.effects.containsKey(potioneffectIn.getPotion())) { @@ -828,7 +828,7 @@ public abstract class EntityLiving extends Entity } } - public boolean isPotionApplicable(Potion potion) + public boolean isPotionApplicable(Potion potion, int amplifier) { // if (this.getCreatureType() == CreatureType.UNDEAD) // { diff --git a/common/src/main/java/common/item/ItemPotion.java b/common/src/main/java/common/item/ItemPotion.java index e9c17ad..ed6ad8b 100755 --- a/common/src/main/java/common/item/ItemPotion.java +++ b/common/src/main/java/common/item/ItemPotion.java @@ -228,7 +228,7 @@ public class ItemPotion extends Item if (list != null && !list.isEmpty()) { - String s2 = ((PotionEffect)list.get(0)).getPotionName(); + String s2 = list.get(0).getPotionName(); // s2 = s2 + ".postfix"; return s + s2.trim(); } @@ -272,7 +272,6 @@ public class ItemPotion extends Item } } - s1 = s1 + PotionHelper.getPotionPotency(potioneffect.getAmplifier()); // if (potioneffect.getAmplifier() >= 1 && potioneffect.getAmplifier() <= 9) // { // s1 = s1 + " " + Strs.get("potion.potency." + potioneffect.getAmplifier()).trim(); diff --git a/common/src/main/java/common/potion/Potion.java b/common/src/main/java/common/potion/Potion.java index c2eab2f..68850f0 100755 --- a/common/src/main/java/common/potion/Potion.java +++ b/common/src/main/java/common/potion/Potion.java @@ -94,7 +94,15 @@ public enum Potion { entity.healMana(1); } }, - FLYING("flying", "Schweben", "Trank des Schwebens", false, 8356754), + FLYING("flying", null, null, false, 8356754) { + public String getDisplay(int amplifier) { + return amplifier <= 0 ? "Schweben" : "Flugkraft"; + } + + public String getPotionDisplay(int amplifier) { + return amplifier <= 0 ? "Trank des Schwebens" : "Trank der Flugkraft"; + } + }, BLINDNESS("blindness", "Blindheit", "Trank der Blindheit", true, 2039587) { public double getEffectiveness() { return 0.25; @@ -195,11 +203,11 @@ public enum Potion { return this.name; } - public String getDisplay() { - return this.effectDisplay; + public String getDisplay(int amplifier) { + return this.effectDisplay + PotionHelper.getPotionPotency(amplifier); } - public String getPotionDisplay() { + public String getPotionDisplay(int amplifier) { return this.potionDisplay; } diff --git a/common/src/main/java/common/potion/PotionEffect.java b/common/src/main/java/common/potion/PotionEffect.java index 8e55822..861e034 100755 --- a/common/src/main/java/common/potion/PotionEffect.java +++ b/common/src/main/java/common/potion/PotionEffect.java @@ -105,11 +105,11 @@ public class PotionEffect { } public String getEffectName() { - return this.potion.getDisplay(); + return this.potion.getDisplay(this.amplifier); } public String getPotionName() { - return this.potion.getPotionDisplay(); + return this.potion.getPotionDisplay(this.amplifier); } public String getDurationString() { diff --git a/server/src/main/java/server/command/commands/CommandMilk.java b/server/src/main/java/server/command/commands/CommandMilk.java index 9ebb7f3..5b0f64a 100644 --- a/server/src/main/java/server/command/commands/CommandMilk.java +++ b/server/src/main/java/server/command/commands/CommandMilk.java @@ -29,8 +29,9 @@ public class CommandMilk extends Command { int done = 0; for(EntityLiving entity : entities) { if(type != null && entity.hasEffect(type)) { + int amplifier = entity.getEffect(type).getAmplifier(); entity.removeEffect(type); - exec.logConsole("%s von %s entfernt", type.getDisplay(), entity.getCommandName()); + exec.logConsole("%s von %s entfernt", type.getDisplay(amplifier), entity.getCommandName()); done++; } else if(type == null && !entity.getEffects().isEmpty()) { diff --git a/server/src/main/java/server/command/commands/CommandPotion.java b/server/src/main/java/server/command/commands/CommandPotion.java index b814346..baa05eb 100644 --- a/server/src/main/java/server/command/commands/CommandPotion.java +++ b/server/src/main/java/server/command/commands/CommandPotion.java @@ -27,7 +27,7 @@ public class CommandPotion extends Command { public Object exec(CommandEnvironment env, Executor exec, List entities, Potion type, int duration, int strength, boolean particles, boolean ambient, boolean keep) { int done = 0; for(EntityLiving entity : entities) { - if(entity.isPotionApplicable(type)) { + if(entity.isPotionApplicable(type, strength - 1)) { if(type.isInstant()) { type.onImpact(null, null, entity, strength - 1, 1.0); } @@ -38,9 +38,9 @@ public class CommandPotion extends Command { entity.addEffect(effect); } if(type.isInstant() || duration == 0) - exec.logConsole("%d * %s an %s gegeben", strength, type.getDisplay(), entity.getCommandName()); + exec.logConsole("%s an %s gegeben", type.getDisplay(strength - 1), entity.getCommandName()); else - exec.logConsole("%d * %s für %d Sekunden an %s gegeben", strength, type.getDisplay(), duration, entity.getCommandName()); + exec.logConsole("%s für %d Sekunden an %s gegeben", type.getDisplay(strength - 1), duration, entity.getCommandName()); done++; } } diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index 2e526a1..338ecd6 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -2763,7 +2763,7 @@ public class Player extends NetHandler implements ICrafting, Executor, IPlayer this.entity.addEffect(new PotionEffect(Potion.HASTE, Integer.MAX_VALUE, 255, false, false)); this.entity.addEffect(new PotionEffect(Potion.RESISTANCE, Integer.MAX_VALUE, 255, false, false)); this.entity.addEffect(new PotionEffect(Potion.FIRE_RESISTANCE, Integer.MAX_VALUE, 0, false, false)); - this.entity.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 0, false, false)); + this.entity.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 1, false, false)); this.entity.addEffect(new PotionEffect(Potion.MANA, Integer.MAX_VALUE, 255, false, false)); this.addFeed(TextColor.GREEN + "Statuseffekte wurden hinzugefügt"); }