Add archivist's eyeglass and spectral tether, plus some improvements to teleportation
This commit is contained in:
@@ -5,9 +5,11 @@ import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.data.WizardData;
|
||||
import electroblob.wizardry.item.ItemArtefact;
|
||||
import electroblob.wizardry.item.ItemScroll;
|
||||
import electroblob.wizardry.item.ItemSpellBook;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryItems;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.SpellProperties;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -150,8 +152,12 @@ public class RandomSpell extends LootFunction {
|
||||
possibleSpells.removeIf(s -> s.getElement() != element);
|
||||
if(possibleSpells.isEmpty()) return Spells.none; // If it fails anywhere, it'll most likely be here
|
||||
|
||||
float bias = undiscoveredBias;
|
||||
// Archivist's eyeglass increases undiscovered bias by 0.4 up to a maximum of 0.9
|
||||
if(ItemArtefact.isArtefactActive(player, WizardryItems.charm_spell_discovery)) bias = Math.min(bias + 0.4f, 0.9f);
|
||||
|
||||
// Remove either the undiscovered spells or the discovered ones, depending on the bias
|
||||
if(undiscoveredBias > 0 && player != null){
|
||||
if(bias > 0 && player != null){
|
||||
|
||||
WizardData data = WizardData.get(player);
|
||||
|
||||
@@ -159,7 +165,7 @@ public class RandomSpell extends LootFunction {
|
||||
// If none have been discovered or they've all been discovered, don't bother!
|
||||
if(discoveredCount > 0 && discoveredCount < possibleSpells.size()){
|
||||
// Kinda unintuitive but it's very neat!
|
||||
boolean keepDiscovered = random.nextFloat() < 0.5f + 0.5f * undiscoveredBias;
|
||||
boolean keepDiscovered = random.nextFloat() < 0.5f + 0.5f * bias;
|
||||
possibleSpells.removeIf(s -> keepDiscovered != data.hasSpellBeenDiscovered(s));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user