diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/MixinDamageSource.java b/src/main/java/com/minelittlepony/unicopia/mixin/MixinDamageSource.java index d16cd37d..638ca8cb 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/MixinDamageSource.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/MixinDamageSource.java @@ -6,6 +6,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import com.minelittlepony.unicopia.entity.Equine; +import com.minelittlepony.unicopia.entity.player.Pony; + import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; @@ -26,5 +28,13 @@ abstract class MixinDamageSource { info.setReturnValue(Text.translatable("death.attack." + self.getName() + ".player", entity.getDisplayName(), attacker.asEntity().getDisplayName())); }); + + DamageSource self = (DamageSource)(Object)this; + + Pony.of(entity).filter(e -> e.getSpecies().canFly()).ifPresent(pony -> { + if (pony.getPhysics().isFlying()) { + info.setReturnValue(Text.translatable("death.attack.generic.whilst_flying", info.getReturnValue())); + } + }); } } diff --git a/src/main/java/com/minelittlepony/unicopia/util/MagicalDamageSource.java b/src/main/java/com/minelittlepony/unicopia/util/MagicalDamageSource.java index afa5d461..3b248d5e 100644 --- a/src/main/java/com/minelittlepony/unicopia/util/MagicalDamageSource.java +++ b/src/main/java/com/minelittlepony/unicopia/util/MagicalDamageSource.java @@ -5,6 +5,7 @@ import java.util.*; import org.jetbrains.annotations.Nullable; import com.minelittlepony.unicopia.ability.magic.Caster; +import com.minelittlepony.unicopia.entity.player.Pony; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; @@ -99,6 +100,13 @@ public class MagicalDamageSource extends EntityDamageSource { params.add(attacker.getDisplayName()); } - return Text.translatable(basic, params.toArray()); + Text message = Text.translatable(basic, params.toArray()); + return Pony.of(target).filter(e -> e.getSpecies().canFly()).map(pony -> { + + if (pony.getPhysics().isFlying()) { + return Text.translatable("death.attack.generic.whilst_flying", message); + } + return message; + }).orElse(message); } } diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index a2847498..960fd759 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -492,6 +492,7 @@ "unicopia.race.bat.alt": "Bat Ponies", "death.attack.generic.and_also": "%1$s and %2$s", + "death.attack.generic.whilst_flying": "%1$s whilst flying", "death.attack.tribe_swap": "%1$s was reborn into a different tribe", "death.attack.sun": "%1$s stared into the sun", "death.attack.sun.player": "%1$s stared into the sun whilst fighting %2$s", @@ -525,6 +526,10 @@ "death.attack.black_hole.player": "%1$s got sucked into %2$s's black hole", "death.attack.kick": "%1$s was kicked really hard", "death.attack.kick.player": "%2$s kicked %1$s really hard", + "death.attack.fall.pegasus": "%1$s forgot they could fly", + "death.attack.fall.pegasus.player": "%1$s forgot they could fly and hit the ground too hard whilst trying to escape %2$s", + "death.attack.stalagmite.pegasus": "%1$s tried to perch on a stalagmite", + "death.attack.stalagmite.pegasus.player": "%1$s flew into a stalagmite whilst fighting %2$s", "unicopia.subtitle.flap_wings": "Wing flaps", "unicopia.subtitle.dash": "Pony Dashes",