mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Equipping a new spell will no longer discard what you had equipped before
This commit is contained in:
parent
22ada528fd
commit
700f2a50e4
1 changed files with 10 additions and 1 deletions
|
@ -44,10 +44,19 @@ public class GemstoneItem extends Item {
|
|||
PlayerCharmTracker charms = Pony.of(user).getCharms();
|
||||
|
||||
TypedActionResult<CustomisedSpellType<?>> spell = consumeSpell(stack, user, ((Predicate<CustomisedSpellType<?>>)charms.getEquippedSpell(hand)::equals).negate());
|
||||
|
||||
CustomisedSpellType<?> existing = charms.getEquippedSpell(hand);
|
||||
|
||||
if (existing != null) {
|
||||
stack = existing.traits().applyTo(enchant(stack, existing.type()));
|
||||
}
|
||||
|
||||
if (spell.getResult().isAccepted()) {
|
||||
charms.equipSpell(hand, spell.getValue());
|
||||
return TypedActionResult.success(stack, true);
|
||||
} else {
|
||||
charms.equipSpell(hand, SpellType.EMPTY_KEY.withTraits());
|
||||
}
|
||||
return TypedActionResult.success(stack, true);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue