mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Add broken wings status effect
This commit is contained in:
parent
e819678307
commit
80b885514f
7 changed files with 38 additions and 7 deletions
|
@ -7,7 +7,6 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.entity.duck.EntityDuck;
|
||||
import com.minelittlepony.unicopia.entity.effect.EffectUtils;
|
||||
import com.minelittlepony.unicopia.entity.effect.UEffects;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
|
||||
|
@ -31,7 +30,7 @@ public class HudEffects {
|
|||
|
||||
private static void apply(Pony pony, float tickDelta, boolean on) {
|
||||
if (on) {
|
||||
if (!pony.asEntity().hasStatusEffect(StatusEffects.HUNGER) && EffectUtils.getAmplifier(pony.asEntity(), UEffects.FOOD_POISONING) > 0) {
|
||||
if (!pony.asEntity().hasStatusEffect(StatusEffects.HUNGER) && pony.asEntity().hasStatusEffect(UEffects.FOOD_POISONING)) {
|
||||
addedHunger = true;
|
||||
pony.asEntity().addStatusEffect(new StatusEffectInstance(StatusEffects.HUNGER, 1, 1, false, false));
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.minelittlepony.unicopia.entity.behaviour.Guest;
|
|||
import com.minelittlepony.unicopia.entity.damage.MagicalDamageSource;
|
||||
import com.minelittlepony.unicopia.entity.duck.LivingEntityDuck;
|
||||
import com.minelittlepony.unicopia.entity.effect.CorruptInfluenceStatusEffect;
|
||||
import com.minelittlepony.unicopia.entity.effect.EffectUtils;
|
||||
import com.minelittlepony.unicopia.entity.effect.UEffects;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.minelittlepony.unicopia.input.Heuristic;
|
||||
|
@ -200,7 +199,7 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
|||
@Override
|
||||
public boolean beforeUpdate() {
|
||||
landEvent.beforeTick();
|
||||
if (EffectUtils.getAmplifier(entity, UEffects.PARALYSIS) > 1 && entity.getVelocity().horizontalLengthSquared() > 0) {
|
||||
if (entity.hasStatusEffect(UEffects.PARALYSIS) && entity.getVelocity().horizontalLengthSquared() > 0) {
|
||||
entity.setVelocity(entity.getVelocity().multiply(0, 1, 0));
|
||||
updateVelocity();
|
||||
}
|
||||
|
|
|
@ -6,11 +6,19 @@ import net.minecraft.entity.effect.StatusEffectInstance;
|
|||
|
||||
public interface EffectUtils {
|
||||
static boolean isPoisoned(LivingEntity entity) {
|
||||
return getAmplifier(entity, UEffects.FOOD_POISONING) > 2;
|
||||
return getAmplifier(entity, UEffects.FOOD_POISONING) > 1;
|
||||
}
|
||||
|
||||
static boolean hasABrokenWing(LivingEntity entity) {
|
||||
return entity.hasStatusEffect(UEffects.BROKEN_WINGS);
|
||||
}
|
||||
|
||||
static boolean hasBothBrokenWing(LivingEntity entity) {
|
||||
return getAmplifier(entity, UEffects.BROKEN_WINGS) > 1;
|
||||
}
|
||||
|
||||
static int getAmplifier(LivingEntity entity, StatusEffect effect) {
|
||||
return entity.hasStatusEffect(effect) ? entity.getStatusEffect(effect).getAmplifier() : 0;
|
||||
return entity.hasStatusEffect(effect) ? entity.getStatusEffect(effect).getAmplifier() + 1 : 0;
|
||||
}
|
||||
|
||||
static boolean isChangingRace(LivingEntity entity) {
|
||||
|
|
|
@ -17,6 +17,7 @@ public interface UEffects {
|
|||
StatusEffect CORRUPT_INFLUENCE = register("corrupt_influence", new CorruptInfluenceStatusEffect(0x00FF00));
|
||||
StatusEffect PARALYSIS = register("paralysis", new SimpleStatusEffect(StatusEffectCategory.HARMFUL, 0, false));
|
||||
StatusEffect FORTIFICATION = register("fortification", new SimpleStatusEffect(StatusEffectCategory.BENEFICIAL, 0x000077, false));
|
||||
StatusEffect BROKEN_WINGS = register("broken_wings", new SimpleStatusEffect(StatusEffectCategory.BENEFICIAL, 0xEEAA00, false));
|
||||
/**
|
||||
* Side-effect of wearing the alicorn amulet.
|
||||
* Causes the player to lose grip on whatever item they're holding.
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.minelittlepony.unicopia.compat.ad_astra.OxygenApi;
|
|||
import com.minelittlepony.unicopia.entity.*;
|
||||
import com.minelittlepony.unicopia.entity.damage.UDamageTypes;
|
||||
import com.minelittlepony.unicopia.entity.duck.LivingEntityDuck;
|
||||
import com.minelittlepony.unicopia.entity.effect.EffectUtils;
|
||||
import com.minelittlepony.unicopia.entity.player.MagicReserves.Bar;
|
||||
import com.minelittlepony.unicopia.input.Heuristic;
|
||||
import com.minelittlepony.unicopia.item.AmuletItem;
|
||||
|
@ -229,6 +230,10 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
if (wasFlying) {
|
||||
entity.calculateDimensions();
|
||||
}
|
||||
|
||||
if (!pony.isClient()) {
|
||||
pony.setDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public double getHorizontalMotion() {
|
||||
|
@ -285,6 +290,19 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
cancelFlight(false);
|
||||
}
|
||||
|
||||
if (!pony.isClient()) {
|
||||
System.out.println(ticksInAir + " " + type.canFly() + " " + isFlying() + " " + EffectUtils.hasBothBrokenWing(entity));
|
||||
if (type.canFly()
|
||||
&& isFlying()
|
||||
&& EffectUtils.hasBothBrokenWing(entity)
|
||||
&& ticksInAir > 90) {
|
||||
|
||||
entity.getWorld().playSoundFromEntity(null, entity, USounds.Vanilla.ENTITY_PLAYER_BIG_FALL, SoundCategory.PLAYERS, 2, 1F);
|
||||
entity.damage(entity.getDamageSources().generic(), 3);
|
||||
cancelFlight(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.isOnGround()) {
|
||||
isCancelled = false;
|
||||
}
|
||||
|
@ -441,7 +459,12 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
|
||||
entity.fallDistance = 0;
|
||||
|
||||
applyThrust(velocity);
|
||||
if (!EffectUtils.hasABrokenWing(entity) || entity.age % 50 < 25) {
|
||||
applyThrust(velocity);
|
||||
} else if (entity.getWorld().random.nextInt(40) == 0) {
|
||||
entity.getWorld().playSoundFromEntity(null, entity, USounds.Vanilla.ENTITY_PLAYER_BIG_FALL, SoundCategory.PLAYERS, 2, 1.5F);
|
||||
entity.damage(entity.getDamageSources().generic(), 0.5F);
|
||||
}
|
||||
|
||||
if (type.isAvian()) {
|
||||
if (pony.getObservedSpecies() != Race.BAT && entity.getWorld().random.nextInt(9000) == 0) {
|
||||
|
|
|
@ -407,6 +407,7 @@
|
|||
"effect.unicopia.paralysis": "Paralysis",
|
||||
"effect.unicopia.butter_fingers": "Butterfingers",
|
||||
"effect.unicopia.fortification": "Fortification",
|
||||
"effect.unicopia.broken_wings": "Broken Wings",
|
||||
|
||||
"effect.unicopia.change_race_earth": "Earth Pony Metamorphosis",
|
||||
"effect.unicopia.change_race_unicorn": "Unicorn Metamorphosis",
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
Loading…
Reference in a new issue