From 4cf03f452fe1515b0a5e45556e9a934f6cb96b26 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 8 Oct 2022 15:45:22 +0200 Subject: [PATCH] Added an ability for pegasi to instantly start and stop flying --- .../unicopia/ability/Abilities.java | 1 + .../ability/PegasusFlightToggleAbility.java | 79 ++++++++++++++++++ .../resources/assets/unicopia/lang/en_us.json | 15 ++-- .../gui/ability/toggle_flight_land.png | Bin 0 -> 2593 bytes .../gui/ability/toggle_flight_takeoff.png | Bin 0 -> 3943 bytes 5 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/minelittlepony/unicopia/ability/PegasusFlightToggleAbility.java create mode 100644 src/main/resources/assets/unicopia/textures/gui/ability/toggle_flight_land.png create mode 100644 src/main/resources/assets/unicopia/textures/gui/ability/toggle_flight_takeoff.png diff --git a/src/main/java/com/minelittlepony/unicopia/ability/Abilities.java b/src/main/java/com/minelittlepony/unicopia/ability/Abilities.java index 54db7c8f..666173d3 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/Abilities.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/Abilities.java @@ -43,6 +43,7 @@ public interface Abilities { // pegasus / bat / alicorn / changeling Ability CARRY = register(new CarryAbility(), "carry", AbilitySlot.PASSIVE); + Ability TOGGLE_SLIGHT = register(new PegasusFlightToggleAbility(), "toggle_flight", AbilitySlot.TERTIARY); // changeling Ability DISGUISE = register(new ChangelingDisguiseAbility(), "disguise", AbilitySlot.SECONDARY); diff --git a/src/main/java/com/minelittlepony/unicopia/ability/PegasusFlightToggleAbility.java b/src/main/java/com/minelittlepony/unicopia/ability/PegasusFlightToggleAbility.java new file mode 100644 index 00000000..60646c3f --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/ability/PegasusFlightToggleAbility.java @@ -0,0 +1,79 @@ +package com.minelittlepony.unicopia.ability; + +import org.jetbrains.annotations.Nullable; + +import com.minelittlepony.unicopia.Race; +import com.minelittlepony.unicopia.ability.data.Hit; +import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation; +import com.minelittlepony.unicopia.entity.Living; +import com.minelittlepony.unicopia.entity.player.Pony; + +import net.minecraft.util.Identifier; + +public class PegasusFlightToggleAbility implements Ability { + + @Override + public int getWarmupTime(Pony player) { + return 0; + } + + @Override + public int getCooldownTime(Pony player) { + return 0; + } + + @Override + public boolean canUse(Race race) { + return race.canFly(); + } + + @Nullable + @Override + public Hit tryActivate(Pony player) { + return player.getMaster().isCreative() ? null : Hit.INSTANCE; + } + + @Override + public Hit.Serializer getSerializer() { + return Hit.SERIALIZER; + } + + @Override + public Identifier getIcon(Pony player, boolean swap) { + Identifier id = Abilities.REGISTRY.getId(this); + return new Identifier(id.getNamespace(), "textures/gui/ability/" + id.getPath() + (player.getPhysics().isFlying() ? "_land" : "_takeoff") + ".png"); + } + + @Override + public double getCostEstimate(Pony player) { + return 0; + } + + @Override + public void apply(Pony player, Hit data) { + if (player.getMaster().isCreative()) { + return; + } + + player.subtractEnergyCost(1); + + if (!player.getPhysics().isFlying()) { + player.getEntity().addVelocity(0, player.getPhysics().getGravitySignum() * 0.7F, 0); + Living.updateVelocity(player.getEntity()); + player.getPhysics().startFlying(true); + } else { + player.getPhysics().cancelFlight(true); + } + player.setDirty(); + player.setAnimation(Animation.SPREAD_WINGS); + } + + @Override + public void preApply(Pony player, AbilitySlot slot) { + player.getMagicalReserves().getExertion().add(6); + } + + @Override + public void postApply(Pony player, AbilitySlot slot) { + } +} diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index 2f6ff76a..19f24da1 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -286,17 +286,18 @@ "ability.unicopia.cast": "Cast Spell", "ability.unicopia.dispell": "Dispell Magic", "ability.unicopia.teleport": "Teleport", - "ability.unicopia.teleport_group": "Teleport (Group)", - "ability.unicopia.grow": "Earthly Nourishment", + "ability.unicopia.teleport_group": "Group Teleport", + "ability.unicopia.grow": "Nourish Earth", "ability.unicopia.stomp": "Ground Pound", "ability.unicopia.kick": "Crushing Blow", - "ability.unicopia.pummel": "Crushing Blow", + "ability.unicopia.pummel": "Devestating Smash", "ability.unicopia.carry": "Pickup/Drop Passenger", + "ability.unicopia.toggle_flight": "Take-off/Land", "ability.unicopia.hang": "Cling to Ceiling", - "ability.unicopia.eee": "Deafening Screech", - "ability.unicopia.feed": "Collect Love", - "ability.unicopia.capture_cloud": "Cloudbust", - "ability.unicopia.disguise": "Shapeshift", + "ability.unicopia.eee": "Screech", + "ability.unicopia.feed": "Siphon Love", + "ability.unicopia.capture_cloud": "Bust Cloud", + "ability.unicopia.disguise": "Change Form", "ability.unicopia.rainboom": "Sonic Rainboom", "gui.unicopia": "Unicopia...", diff --git a/src/main/resources/assets/unicopia/textures/gui/ability/toggle_flight_land.png b/src/main/resources/assets/unicopia/textures/gui/ability/toggle_flight_land.png new file mode 100644 index 0000000000000000000000000000000000000000..55bdb8aa576a8d8fa9f91828f810fecfa769e19e GIT binary patch literal 2593 zcmV++3f}dJP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+U=J~k{rDah4(y#kB}TdkjLQ|;T!n){=lrR9@U}N zuZ0(`3@O=64j|sc1L)R&{=MD5_=TduCDD>=&KJK_Qw@zqxn6(k@vhgkt)2MiAASBg z%DZi z_MT;PW@n>QOBw&<$Dv-1a#{@RI3}KHnMe62wDmldr?Aa%K3($~SLYeN`rzZWee%;c zzx_Jz;RhzBu!8aqVT5@4O4Lxph*$J6xtL<|J7}zN#u7suVZ}&qc-rF6zV&Q3d|~71 z85ul_d1jo)y)^#m^W{Q&4|9>{^e?``t`H0cZ(fY{KcfJ|?-w4)aq!FY@dvOhk{D%f zE*!93{a&Jrf8|zm2k6K^;hpZuIv)$*BK8)H@eu^B?4$VXFAYJx$BzYk8kUFXQs_Y7 zMZ(0&kYdb$Q-bZy9Q9{xkZ^YsLI5E#M+KT18(5_zDZ8Ypz@a8ll89tcD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4 z)M}=c9DKg!AUUAiSA@{3qm~ew^eN^SlylsaM%lS8zAY%U%{mtJpVf78AWgKCPgb5; z0zY-ax-3D=iPvtVLb*P^<09)EDBOx^w_;OFo|wq#2OKk=tizVeWQsRA>X6CW<6dHO zN3~VDUao?6Bk-lqu>|^3LlC6t0Xp(Ktls(EOU)bod}OktvT9DcTAd&s6Q!?36+$4j zpk1f{`9?{Emiw8RcMuYHc`QdWrtj}1_mQ^etigna!#cu;q5#a^#pCs(dx*W=-?{ev zf1yv%SxEdBews6KU8j zu(r3*Kd`bg{s4ahd;y7#v9UAJ#>Ti1mBf(nm}9XEtibXx3eoIICVO{gGUv?9nR|f{ zAwq=sZ|F1{)LL^PmA(3epf4O{OEE+?6d39(^&X$BEtF{djfLSgB zBB)swNK!;3XkD2^e1Cq&Od^A|gN=UY8-TQL(rv33R?9~)OQrt5Wx*^K5hOw;k#Fzs z0I3m!T@eoh{qHT{)ByZ^WS{^wPCz=59!(AaHSfDM&;XZ=L^YdrPr<6EIgl5`Fa zNiQEcmgUBP8wZ$BrcFXh6q2zdj7W6&s!jy8e7^=+jPwsn~00000NkvXXu0mjf DKez|U literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/unicopia/textures/gui/ability/toggle_flight_takeoff.png b/src/main/resources/assets/unicopia/textures/gui/ability/toggle_flight_takeoff.png new file mode 100644 index 0000000000000000000000000000000000000000..11fcb2ca5548b6c21436e9c51778119d548295e2 GIT binary patch literal 3943 zcmV-t518 zaB^>EX>4U6ba`-PAZ2)IW&i+q+U1yAmgBk&MgKX93_*N=B!EKdX9Qs+s+do|6KF$ zQQrM@<8|hFe|J4_j2z>A@x5NOiQ*3r+!uz_{pOBnkex8;kv|YTtB|* z$7kJeGMEKEio9Z{=ODb`9s#HCeCo9$tO$@!CH5 z>6_nvo#XHW6H{2Ba13FDc&^o0f`$>V=wos*#pHJ=QR9p?hB(5Ck*ncti$Ck?S#J2s z!qYP{cqa2aao+BA^54F{ooH|Kt@rHy&_#c1D*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