mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-24 05:47:59 +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();
|
PlayerCharmTracker charms = Pony.of(user).getCharms();
|
||||||
|
|
||||||
TypedActionResult<CustomisedSpellType<?>> spell = consumeSpell(stack, user, ((Predicate<CustomisedSpellType<?>>)charms.getEquippedSpell(hand)::equals).negate());
|
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()) {
|
if (spell.getResult().isAccepted()) {
|
||||||
charms.equipSpell(hand, spell.getValue());
|
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;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue