diff --git a/src/main/java/com/minelittlepony/unicopia/ability/UnicornCastingAbility.java b/src/main/java/com/minelittlepony/unicopia/ability/UnicornCastingAbility.java index 44b957b9..a32942de 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/UnicornCastingAbility.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/UnicornCastingAbility.java @@ -48,21 +48,7 @@ public class UnicornCastingAbility implements Ability { @Override @Nullable public Hit tryActivate(Pony player) { - float manaLevel = player.getMagicalReserves().getMana().get(); - - TypedActionResult amulet = getAmulet(player); - - if (amulet.getResult().isAccepted()) { - return Hit.of(manaLevel > 0 && ((AmuletItem)amulet.getValue().getItem()).canCharge(amulet.getValue())); - } - - ActionResult spell = player.getCharms().getSpellInHand(Hand.MAIN_HAND).getResult(); - - if (spell != ActionResult.PASS) { - return Hit.of(spell != ActionResult.FAIL && manaLevel > 4F); - } - - return Hit.of(manaLevel > (player.getSpellSlot().isPresent() ? 2F : 4F)); + return Hit.of(player.getMagicalReserves().getMana().get() >= getCostEstimate(player)); } @Override @@ -80,15 +66,9 @@ public class UnicornCastingAbility implements Ability { return Math.min(manaLevel, ((AmuletItem)amulet.getValue().getItem()).getChargeRemainder(amulet.getValue())); } - if (player.getCharms().getSpellInHand(Hand.MAIN_HAND).getResult() == ActionResult.CONSUME) { - return 4F; - } + TypedActionResult> spell = player.getCharms().getSpellInHand(Hand.MAIN_HAND); - if (player.getSpellSlot().isPresent()) { - return 2F; - } - - return 4F; + return !spell.getResult().isAccepted() || spell.getValue().isOn(player) ? 2 : 4; } @Override diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/SpellContainer.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/SpellContainer.java index 0b96ed53..8ed89ab0 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/SpellContainer.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/SpellContainer.java @@ -57,16 +57,6 @@ public interface SpellContainer { return get(null, update); } - /** - * Returns true if this caster has an active effect attached to it. - * - * @deprecated To be removed - */ - @Deprecated - default boolean isPresent() { - return contains((SpellPredicate)null); - } - /** * Gets the active effect for this caster updating it if needed. */