Have the elements of spectral dust in the receptacles affect the element weighting for the resulting spell book

This commit is contained in:
Electroblob77
2020-09-21 16:43:51 +01:00
parent 93d2100546
commit 2c95793293
10 changed files with 293 additions and 24 deletions
@@ -259,7 +259,14 @@ public class TileEntityImbuementAltar extends TileEntity implements ITickable {
if(fullLootGen){
LootTable table = world.getLootTableManager().getLootTableFromLocation(WizardryLoot.RUINED_SPELL_BOOK_LOOT_TABLE);
// Pick a random element out of the receptacles and use its loot table
// This is an elegant way of having the dust elements affect the spell outcome without hardcoding
// any actual numbers, thus allowing packmakers as much control as possible over the weighting
// The probabilities are a little complicated but work out quite nicely at 57% chance with 4 of the
// same element of spectral dust
Element element = receptacleElements[world.rand.nextInt(receptacleElements.length)];
LootTable table = world.getLootTableManager().getLootTableFromLocation(
WizardryLoot.RUINED_SPELL_BOOK_LOOT_TABLES[element.ordinal() - 1]);
LootContext context = new LootContext.Builder((WorldServer)world).withPlayer(lastUser)
.withLuck(lastUser == null ? 0 : lastUser.getLuck()).build();