mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Casting and projecting will now cost you mana
This commit is contained in:
parent
06bfc6d760
commit
d337087447
2 changed files with 7 additions and 2 deletions
|
@ -3,6 +3,7 @@ package com.minelittlepony.unicopia.ability;
|
||||||
import com.google.common.collect.Streams;
|
import com.google.common.collect.Streams;
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
import com.minelittlepony.unicopia.ability.data.Hit;
|
import com.minelittlepony.unicopia.ability.data.Hit;
|
||||||
|
import com.minelittlepony.unicopia.ability.magic.Spell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.ShieldSpell;
|
import com.minelittlepony.unicopia.ability.magic.spell.ShieldSpell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.SpellRegistry;
|
import com.minelittlepony.unicopia.ability.magic.spell.SpellRegistry;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
|
@ -44,14 +45,17 @@ public class UnicornCastingAbility implements Ability<Hit> {
|
||||||
|
|
||||||
if (player.hasSpell()) {
|
if (player.hasSpell()) {
|
||||||
String current = player.getSpell(true).getName();
|
String current = player.getSpell(true).getName();
|
||||||
player.setSpell(Streams.stream(player.getMaster().getItemsHand())
|
Spell spell = Streams.stream(player.getMaster().getItemsHand())
|
||||||
.map(SpellRegistry::getKeyFromStack)
|
.map(SpellRegistry::getKeyFromStack)
|
||||||
.filter(i -> i != null && !current.equals(i))
|
.filter(i -> i != null && !current.equals(i))
|
||||||
.map(SpellRegistry.instance()::getSpellFromName)
|
.map(SpellRegistry.instance()::getSpellFromName)
|
||||||
.filter(i -> i != null)
|
.filter(i -> i != null)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null));
|
.orElse(null);
|
||||||
|
player.subtractEnergyCost(spell == null ? 2 : 4);
|
||||||
|
player.setSpell(spell);
|
||||||
} else {
|
} else {
|
||||||
|
player.subtractEnergyCost(4);
|
||||||
player.setSpell(Streams.stream(player.getMaster().getItemsHand())
|
player.setSpell(Streams.stream(player.getMaster().getItemsHand())
|
||||||
.map(SpellRegistry.instance()::getSpellFrom)
|
.map(SpellRegistry.instance()::getSpellFrom)
|
||||||
.filter(i -> i != null)
|
.filter(i -> i != null)
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class UnicornProjectileAbility implements Ability<Hit> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Pony player, Hit data) {
|
public void apply(Pony player, Hit data) {
|
||||||
|
player.subtractEnergyCost(7);
|
||||||
getThrown(player).orElseGet(AttractiveSpell::new).toss(player);
|
getThrown(player).orElseGet(AttractiveSpell::new).toss(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue