mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-24 05:47:59 +01:00
Re-add corruption accumulation
This commit is contained in:
parent
e6b11a4cf7
commit
c44dad30f4
1 changed files with 11 additions and 7 deletions
|
@ -149,15 +149,12 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
||||||
|
|
||||||
Living<?> living = Living.living(entity);
|
Living<?> living = Living.living(entity);
|
||||||
|
|
||||||
if (living == null) {
|
if (living == null || !living.getArmour().contains(this)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!living.getArmour().contains(this)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long attachedTicks = living.getArmour().getTicks(this);
|
long attachedTicks = living.getArmour().getTicks(this);
|
||||||
|
boolean fullSecond = attachedTicks % ItemTracker.SECONDS == 0;
|
||||||
|
|
||||||
if (entity instanceof PlayerEntity player) {
|
if (entity instanceof PlayerEntity player) {
|
||||||
// healing effect
|
// healing effect
|
||||||
|
@ -169,7 +166,9 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
||||||
player.removeStatusEffect(StatusEffects.NAUSEA);
|
player.removeStatusEffect(StatusEffects.NAUSEA);
|
||||||
}
|
}
|
||||||
|
|
||||||
MagicReserves reserves = ((Pony)living).getMagicalReserves();
|
Pony pony = (Pony)living;
|
||||||
|
|
||||||
|
MagicReserves reserves = pony.getMagicalReserves();
|
||||||
|
|
||||||
// constantly increase exertion
|
// constantly increase exertion
|
||||||
if (reserves.getExertion().get() < reserves.getExertion().getMax()) {
|
if (reserves.getExertion().get() < reserves.getExertion().getMax()) {
|
||||||
|
@ -179,10 +178,15 @@ public class AlicornAmuletItem extends AmuletItem implements ItemTracker.Trackab
|
||||||
if (reserves.getEnergy().get() < reserves.getEnergy().getMax()) {
|
if (reserves.getEnergy().get() < reserves.getEnergy().getMax()) {
|
||||||
reserves.getEnergy().add(2);
|
reserves.getEnergy().add(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fullSecond && world.random.nextInt(12) == 0) {
|
||||||
|
player.world.playSound(null, player.getBlockPos(), USounds.ITEM_ALICORN_AMULET_HALLUCINATION, SoundCategory.PLAYERS, 3, 1);
|
||||||
|
pony.getCorruption().add((int)MathHelper.clamp(attachedTicks / ItemTracker.HOURS, 1, pony.getCorruption().getMax()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// every 1 second, update modifiers
|
// every 1 second, update modifiers
|
||||||
if (attachedTicks % ItemTracker.SECONDS == 0) {
|
if (fullSecond) {
|
||||||
EFFECT_SCALES.entrySet().forEach(attribute -> {
|
EFFECT_SCALES.entrySet().forEach(attribute -> {
|
||||||
float seconds = (float)attachedTicks / ItemTracker.SECONDS;
|
float seconds = (float)attachedTicks / ItemTracker.SECONDS;
|
||||||
EntityAttributeInstance instance = living.getMaster().getAttributeInstance(attribute.getKey());
|
EntityAttributeInstance instance = living.getMaster().getAttributeInstance(attribute.getKey());
|
||||||
|
|
Loading…
Reference in a new issue