2013-02-09 14:12:43 -08:00
|
|
|
package thaumicbees.bees;
|
2012-12-24 15:12:37 -08:00
|
|
|
|
|
|
|
|
import forestry.api.apiculture.*;
|
|
|
|
|
import forestry.api.genetics.IAllele;
|
|
|
|
|
import forestry.api.genetics.IGenome;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
2013-02-09 14:12:43 -08:00
|
|
|
import cpw.mods.fml.common.FMLLog;
|
|
|
|
|
|
2013-01-26 13:42:39 -08:00
|
|
|
import thaumcraft.api.AuraNode;
|
|
|
|
|
import thaumcraft.api.EnumNodeType;
|
|
|
|
|
import thaumcraft.api.ThaumcraftApi;
|
2013-02-09 14:12:43 -08:00
|
|
|
import thaumicbees.main.ThaumicBees;
|
2013-02-05 01:16:01 -08:00
|
|
|
import thaumicbees.main.utils.MoonPhase;
|
2013-04-11 02:40:25 -07:00
|
|
|
import thaumicbees.main.utils.compat.EquivalentExchangeHelper;
|
|
|
|
|
import thaumicbees.main.utils.compat.ExtraBeesHelper;
|
|
|
|
|
import thaumicbees.main.utils.compat.ThaumcraftHelper;
|
2013-01-26 13:42:39 -08:00
|
|
|
|
2012-12-24 15:12:37 -08:00
|
|
|
public class BeeMutation implements IBeeMutation
|
|
|
|
|
{
|
2013-04-11 02:40:25 -07:00
|
|
|
private static BeeMutation Esoteric;
|
|
|
|
|
private static BeeMutation Esoteric1;
|
|
|
|
|
private static BeeMutation Mysterious;
|
|
|
|
|
private static BeeMutation Mysterious1;
|
|
|
|
|
private static BeeMutation Arcane;
|
|
|
|
|
private static BeeMutation Charmed;
|
|
|
|
|
private static BeeMutation Enchanted;
|
|
|
|
|
private static BeeMutation Supernatural;
|
|
|
|
|
private static BeeMutation Stark;
|
|
|
|
|
private static BeeMutation Fire;
|
|
|
|
|
private static BeeMutation Water;
|
|
|
|
|
private static BeeMutation Pupil;
|
|
|
|
|
private static BeeMutation Scholarly;
|
|
|
|
|
private static BeeMutation Savant;
|
|
|
|
|
private static BeeMutation Aware;
|
|
|
|
|
private static BeeMutation Vis;
|
|
|
|
|
private static BeeMutation Vis1;
|
|
|
|
|
private static BeeMutation Pure;
|
|
|
|
|
private static BeeMutation Flux;
|
|
|
|
|
private static BeeMutation Node;
|
|
|
|
|
private static BeeMutation Node1;
|
|
|
|
|
private static BeeMutation Skulking;
|
|
|
|
|
private static BeeMutation Brainy;
|
|
|
|
|
private static BeeMutation Gossamer;
|
|
|
|
|
private static BeeMutation Wispy;
|
|
|
|
|
private static BeeMutation Batty;
|
|
|
|
|
private static BeeMutation Ghastly;
|
|
|
|
|
private static BeeMutation Timely;
|
|
|
|
|
private static BeeMutation Lordly;
|
|
|
|
|
private static BeeMutation Doctoral;
|
|
|
|
|
private static BeeMutation Spirit;
|
|
|
|
|
private static BeeMutation Spirit1;
|
|
|
|
|
private static BeeMutation Soul;
|
|
|
|
|
private static BeeMutation Minium;
|
|
|
|
|
private static BeeMutation Iron;
|
|
|
|
|
private static BeeMutation Gold;
|
|
|
|
|
private static BeeMutation Copper;
|
|
|
|
|
private static BeeMutation Tin;
|
|
|
|
|
private static BeeMutation Silver;
|
|
|
|
|
private static BeeMutation Lead;
|
|
|
|
|
private static BeeMutation Diamond;
|
|
|
|
|
private static BeeMutation Emerald;
|
|
|
|
|
private static BeeMutation Lead1;
|
|
|
|
|
private static BeeMutation Lead2;
|
|
|
|
|
private static BeeMutation Beef;
|
|
|
|
|
private static BeeMutation Chicken;
|
|
|
|
|
private static BeeMutation Pork;
|
|
|
|
|
private static BeeMutation Aura;
|
|
|
|
|
private static BeeMutation Aura1;
|
2013-02-09 14:12:43 -08:00
|
|
|
|
|
|
|
|
public static void setupMutations()
|
|
|
|
|
{
|
2013-04-11 02:40:25 -07:00
|
|
|
IAlleleBeeSpecies baseA, baseB;
|
|
|
|
|
|
2013-02-09 14:12:43 -08:00
|
|
|
BeeMutation.Esoteric = new BeeMutation(Allele.getBaseSpecies("Imperial"), Allele.getBaseSpecies("Demonic"), BeeSpecies.ESOTERIC, 10);
|
|
|
|
|
BeeMutation.Esoteric1 = new BeeMutation(Allele.getBaseSpecies("Heroic"), Allele.getBaseSpecies("Demonic"), BeeSpecies.ESOTERIC, 25);
|
2013-04-11 02:40:25 -07:00
|
|
|
BeeMutation.Mysterious = new BeeMutation(Allele.getBaseSpecies("Ended"), BeeSpecies.ESOTERIC, BeeSpecies.MYSTERIOUS, 15);
|
|
|
|
|
BeeMutation.Mysterious1 = new BeeMutation(Allele.getBaseSpecies("Demonic"), BeeSpecies.ESOTERIC, BeeSpecies.MYSTERIOUS, 4);
|
2013-02-09 14:12:43 -08:00
|
|
|
BeeMutation.Arcane = new BeeMutation(BeeSpecies.ESOTERIC, BeeSpecies.MYSTERIOUS, BeeSpecies.ARCANE, 8)
|
|
|
|
|
.setMoonPhaseBonus(MoonPhase.WANING_CRESCENT, MoonPhase.WAXING_CRESCENT, 1.5f);
|
|
|
|
|
BeeMutation.Charmed = new BeeMutation(Allele.getBaseSpecies("Diligent"), Allele.getBaseSpecies("Valiant"), BeeSpecies.CHARMED, 20);
|
|
|
|
|
BeeMutation.Enchanted = new BeeMutation(BeeSpecies.CHARMED, Allele.getBaseSpecies("Valiant"), BeeSpecies.ENCHANTED, 8);
|
|
|
|
|
BeeMutation.Supernatural = new BeeMutation(BeeSpecies.CHARMED, BeeSpecies.ENCHANTED, BeeSpecies.SUPERNATURAL, 10)
|
|
|
|
|
.setMoonPhaseBonus(MoonPhase.WAXING_GIBBOUS, MoonPhase.WANING_GIBBOUS, 1.5f);
|
|
|
|
|
BeeMutation.Pupil = new BeeMutation(BeeSpecies.ARCANE, BeeSpecies.ENCHANTED, BeeSpecies.PUPIL, 10);
|
|
|
|
|
BeeMutation.Stark = new BeeMutation(BeeSpecies.ARCANE, BeeSpecies.SUPERNATURAL, BeeSpecies.STARK, 8);
|
|
|
|
|
|
2013-04-11 02:40:25 -07:00
|
|
|
BeeMutation.Timely = new BeeMutation(Allele.getBaseSpecies("Industrious"), BeeSpecies.ENCHANTED, BeeSpecies.TIMELY, 10);
|
|
|
|
|
BeeMutation.Lordly = new BeeMutation(BeeSpecies.TIMELY, Allele.getBaseSpecies("Imperial"), BeeSpecies.LORDLY, 9);
|
|
|
|
|
BeeMutation.Doctoral = new BeeMutation(BeeSpecies.TIMELY, BeeSpecies.LORDLY, BeeSpecies.DOCTORAL, 7);
|
2013-02-09 14:12:43 -08:00
|
|
|
|
2013-04-11 02:40:25 -07:00
|
|
|
BeeMutation.Minium = new BeeMutation(Allele.getBaseSpecies("Sinister"), BeeSpecies.MYSTERIOUS, BeeSpecies.MINIUM, 11);
|
2013-02-09 14:12:43 -08:00
|
|
|
|
2013-04-11 02:40:25 -07:00
|
|
|
BeeMutation.Spirit = new BeeMutation(Allele.getBaseSpecies("Fiendish"), BeeSpecies.ENCHANTED, BeeSpecies.SPIRIT, 12);
|
|
|
|
|
BeeMutation.Spirit1 = new BeeMutation(Allele.getBaseSpecies("Fiendish"), Allele.getBaseSpecies("Ended"), BeeSpecies.SPIRIT, 20);
|
|
|
|
|
BeeMutation.Soul = new BeeMutation(Allele.getBaseSpecies("Fiendish"), BeeSpecies.SPIRIT, BeeSpecies.SOUL, 11);
|
|
|
|
|
|
|
|
|
|
BeeMutation.Iron = new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Diligent"), BeeSpecies.IRON, 10);
|
|
|
|
|
|
|
|
|
|
baseA = (BeeSpecies.MINIUM.isActive()) ? BeeSpecies.MINIUM : Allele.getBaseSpecies("Imperial");
|
|
|
|
|
baseB = (BeeSpecies.LEAD.isActive()) ? BeeSpecies.LEAD : BeeSpecies.IRON;
|
|
|
|
|
BeeMutation.Gold = new BeeMutation(baseA, baseB, BeeSpecies.GOLD, 8);
|
|
|
|
|
|
|
|
|
|
if (BeeSpecies.COPPER.isActive())
|
2013-02-09 14:12:43 -08:00
|
|
|
{
|
2013-04-11 02:40:25 -07:00
|
|
|
BeeMutation.Copper = new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Meadows"), BeeSpecies.COPPER, 12);
|
2013-02-09 14:12:43 -08:00
|
|
|
}
|
2013-04-11 02:40:25 -07:00
|
|
|
if (BeeSpecies.TIN.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Tin = new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Forest"), BeeSpecies.TIN, 12);
|
|
|
|
|
}
|
|
|
|
|
if (BeeSpecies.SILVER.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Silver = new BeeMutation(Allele.getBaseSpecies("Imperial"), Allele.getBaseSpecies("Modest"), BeeSpecies.SILVER, 10);
|
|
|
|
|
}
|
|
|
|
|
if (BeeSpecies.LEAD.isActive())
|
2013-02-09 14:12:43 -08:00
|
|
|
{
|
2013-04-11 02:40:25 -07:00
|
|
|
if (BeeSpecies.COPPER.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Lead = new BeeMutation(Allele.getBaseSpecies("Industrious"), BeeSpecies.COPPER, BeeSpecies.LEAD, 13);
|
|
|
|
|
}
|
|
|
|
|
if (BeeSpecies.TIN.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Lead1 = new BeeMutation(Allele.getBaseSpecies("Industrious"), BeeSpecies.TIN, BeeSpecies.LEAD, 13);
|
|
|
|
|
}
|
|
|
|
|
BeeMutation.Lead2 = new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Common"), BeeSpecies.LEAD, 9);
|
2013-02-09 14:12:43 -08:00
|
|
|
}
|
|
|
|
|
|
2013-04-11 02:40:25 -07:00
|
|
|
BeeMutation.Diamond = new BeeMutation(Allele.getBaseSpecies("Austere"), BeeSpecies.GOLD, BeeSpecies.DIAMOND, 6);
|
|
|
|
|
baseA = (BeeSpecies.SILVER.isActive()) ? BeeSpecies.SILVER : Allele.getBaseSpecies("Imperial");
|
|
|
|
|
BeeMutation.Emerald = new BeeMutation(Allele.getBaseSpecies("Austere"), baseA, BeeSpecies.EMERALD, 6);
|
|
|
|
|
|
|
|
|
|
if (BeeSpecies.BEEF.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Beef = new BeeMutation(Allele.getBaseSpecies("Common"), BeeSpecies.SKULKING, BeeSpecies.BEEF, 10);
|
|
|
|
|
}
|
|
|
|
|
if (BeeSpecies.CHICKEN.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Chicken = new BeeMutation(Allele.getBaseSpecies("Common"), BeeSpecies.SKULKING, BeeSpecies.CHICKEN, 10);
|
|
|
|
|
}
|
|
|
|
|
if (BeeSpecies.PORK.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Pork = new BeeMutation(Allele.getBaseSpecies("Common"), BeeSpecies.SKULKING, BeeSpecies.PORK, 10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Now we get into a little bit of branching...
|
|
|
|
|
if (ExtraBeesHelper.isActive())
|
2013-02-09 14:12:43 -08:00
|
|
|
{
|
|
|
|
|
BeeMutation.Skulking = new BeeMutation(BeeSpecies.MYSTERIOUS, Allele.getExtraSpecies("desolate"), BeeSpecies.SKULKING, 10);
|
|
|
|
|
BeeMutation.Ghastly = new BeeMutation(BeeSpecies.SKULKING, Allele.getExtraSpecies("creeper"), BeeSpecies.GHASTLY, 13);
|
|
|
|
|
}
|
2013-04-11 02:40:25 -07:00
|
|
|
else
|
2013-02-09 14:12:43 -08:00
|
|
|
{
|
2013-04-11 02:40:25 -07:00
|
|
|
BeeMutation.Skulking = new BeeMutation(BeeSpecies.MYSTERIOUS, Allele.getBaseSpecies("Modest"), BeeSpecies.SKULKING, 10);
|
|
|
|
|
BeeMutation.Ghastly = new BeeMutation(BeeSpecies.SKULKING, Allele.getBaseSpecies("Austere"), BeeSpecies.GHASTLY, 13);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ThaumcraftHelper.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Scholarly = new BeeMutation(BeeSpecies.PUPIL, BeeSpecies.ARCANE, BeeSpecies.SCHOLARLY, 8);
|
|
|
|
|
BeeMutation.Savant = new BeeMutation(BeeSpecies.PUPIL, BeeSpecies.SCHOLARLY, BeeSpecies.SAVANT, 6);
|
|
|
|
|
|
|
|
|
|
BeeMutation.Aware = new BeeMutation(Allele.getBaseSpecies("Demonic"), Allele.getBaseSpecies("Edenic"), BeeSpecies.AWARE, 12);
|
|
|
|
|
BeeMutation.Vis = new BeeMutation(BeeSpecies.AWARE, BeeSpecies.ARCANE, BeeSpecies.VIS, 9)
|
|
|
|
|
.setAuraNodeRequired(40);
|
|
|
|
|
BeeMutation.Vis1 = new BeeMutation(BeeSpecies.AWARE, BeeSpecies.STARK, BeeSpecies.VIS, 12)
|
|
|
|
|
.setAuraNodeRequired(80);
|
|
|
|
|
BeeMutation.Pure = new BeeMutation(BeeSpecies.VIS, Allele.getBaseSpecies("Edenic"), BeeSpecies.PURE, 7)
|
|
|
|
|
.setAuraNodeTypeRequired(5, EnumNodeType.PURE).setMoonPhaseBonus(MoonPhase.NEW, MoonPhase.NEW, 1.6f);
|
|
|
|
|
BeeMutation.Flux = new BeeMutation(BeeSpecies.VIS, Allele.getBaseSpecies("Edenic"), BeeSpecies.FLUX, 7)
|
|
|
|
|
.setAuraNodeTypeRequired(30, EnumNodeType.UNSTABLE).setMoonPhaseBonus(MoonPhase.FULL, MoonPhase.FULL, 1.6f);
|
|
|
|
|
|
|
|
|
|
BeeMutation.Node = new BeeMutation(BeeSpecies.PURE, BeeSpecies.FLUX, BeeSpecies.NODE, 2)
|
|
|
|
|
.setAuraNodeRequired(4).setMoonPhaseRestricted(MoonPhase.WANING_HALF, MoonPhase.WANING_HALF);
|
|
|
|
|
BeeMutation.Node1 = new BeeMutation(BeeSpecies.PURE, BeeSpecies.FLUX, BeeSpecies.NODE, 2)
|
|
|
|
|
.setAuraNodeRequired(4).setMoonPhaseRestricted(MoonPhase.WAXING_HALF, MoonPhase.WAXING_HALF);
|
2013-04-11 23:08:17 -07:00
|
|
|
|
2013-04-11 02:40:25 -07:00
|
|
|
if (ExtraBeesHelper.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Brainy = new BeeMutation(BeeSpecies.SKULKING, Allele.getExtraSpecies("rotten"), BeeSpecies.BRAINY, 12);
|
|
|
|
|
BeeMutation.Gossamer = new BeeMutation(BeeSpecies.SKULKING, Allele.getExtraSpecies("ancient"), BeeSpecies.GOSSAMER, 10);
|
|
|
|
|
BeeMutation.Batty = new BeeMutation(BeeSpecies.SKULKING, Allele.getExtraSpecies("rock"), BeeSpecies.BATTY, 14);
|
2013-04-11 23:08:17 -07:00
|
|
|
BeeMutation.Aura = new BeeMutation(BeeSpecies.VIS, Allele.getExtraSpecies("energetic"), BeeSpecies.REJUVENATING, 3);
|
|
|
|
|
BeeMutation.Aura1 = new BeeMutation(BeeSpecies.VIS, Allele.getExtraSpecies("energetic"), BeeSpecies.REJUVENATING, 3);
|
2013-04-11 02:40:25 -07:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Brainy = new BeeMutation(BeeSpecies.SKULKING, Allele.getBaseSpecies("Sinister"), BeeSpecies.BRAINY, 10);
|
|
|
|
|
BeeMutation.Gossamer = new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.SUPERNATURAL, BeeSpecies.GOSSAMER, 10);
|
|
|
|
|
BeeMutation.Batty = new BeeMutation(BeeSpecies.SKULKING, Allele.getBaseSpecies("Frugal"), BeeSpecies.BATTY, 11);
|
2013-04-11 23:08:17 -07:00
|
|
|
BeeMutation.Aura = new BeeMutation(BeeSpecies.VIS, Allele.getBaseSpecies("Industrious"), BeeSpecies.REJUVENATING, 3);
|
|
|
|
|
BeeMutation.Aura1 = new BeeMutation(BeeSpecies.VIS, Allele.getBaseSpecies("Industrious"), BeeSpecies.REJUVENATING, 3);
|
2013-04-11 02:40:25 -07:00
|
|
|
}
|
2013-04-11 23:08:17 -07:00
|
|
|
|
2013-04-11 02:40:25 -07:00
|
|
|
BeeMutation.Gossamer.setMoonPhaseRestricted(MoonPhase.FULL, MoonPhase.WANING_CRESCENT);
|
|
|
|
|
BeeMutation.Wispy = new BeeMutation(BeeSpecies.GOSSAMER, Allele.getBaseSpecies("Cultivated"), BeeSpecies.WISPY, 8);
|
2013-04-11 23:08:17 -07:00
|
|
|
BeeMutation.Aura.setMoonPhaseRestricted(MoonPhase.WANING_CRESCENT, MoonPhase.WANING_CRESCENT);
|
|
|
|
|
BeeMutation.Aura1.setMoonPhaseRestricted(MoonPhase.WAXING_CRESCENT, MoonPhase.WAXING_CRESCENT);
|
2013-04-11 02:40:25 -07:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Fire = new BeeMutation(BeeSpecies.STARK, Allele.getBaseSpecies("Fiendish"), BeeSpecies.FIRE, 10);
|
|
|
|
|
if (ExtraBeesHelper.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Water = new BeeMutation(BeeSpecies.STARK, Allele.getExtraSpecies("ocean"), BeeSpecies.WATER, 12);
|
|
|
|
|
BeeMutation.Water = new BeeMutation(BeeSpecies.STARK, Allele.getExtraSpecies("river"), BeeSpecies.WATER, 8);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Water = new BeeMutation(BeeSpecies.STARK, Allele.getBaseSpecies("Marshy"), BeeSpecies.WATER, 10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (EquivalentExchangeHelper.isActive())
|
|
|
|
|
{
|
|
|
|
|
BeeMutation.Minium = new BeeMutation(Allele.getBaseSpecies("Frugal"), BeeSpecies.PUPIL, BeeSpecies.MINIUM, 10);
|
2013-02-09 14:12:43 -08:00
|
|
|
}
|
|
|
|
|
}
|
2012-12-27 00:27:23 -08:00
|
|
|
|
2012-12-24 15:12:37 -08:00
|
|
|
private IAllele parent1;
|
|
|
|
|
private IAllele parent2;
|
|
|
|
|
private IAllele mutationTemplate[];
|
2012-12-27 00:27:23 -08:00
|
|
|
private int baseChance;
|
2012-12-24 15:12:37 -08:00
|
|
|
private boolean isSecret;
|
2013-01-19 03:29:47 -08:00
|
|
|
private boolean isMoonRestricted;
|
|
|
|
|
private MoonPhase moonPhaseStart;
|
|
|
|
|
private MoonPhase moonPhaseEnd;
|
|
|
|
|
private float moonPhaseMutationBonus;
|
2013-01-26 13:42:39 -08:00
|
|
|
private boolean nodeRequired;
|
|
|
|
|
private EnumNodeType nodeType;
|
|
|
|
|
private double nodeRange;
|
2012-12-24 15:12:37 -08:00
|
|
|
|
2013-01-19 03:29:47 -08:00
|
|
|
public BeeMutation(IAlleleBeeSpecies species0, IAlleleBeeSpecies species1, BeeSpecies resultSpecies, int percentChance)
|
2012-12-24 15:12:37 -08:00
|
|
|
{
|
2013-01-19 03:29:47 -08:00
|
|
|
this.parent1 = species0;
|
|
|
|
|
this.parent2 = species1;
|
|
|
|
|
this.mutationTemplate = resultSpecies.getGenome();
|
|
|
|
|
this.baseChance = percentChance;
|
|
|
|
|
this.isSecret = false;
|
|
|
|
|
this.isMoonRestricted = false;
|
|
|
|
|
this.moonPhaseMutationBonus = -1f;
|
2013-01-26 13:42:39 -08:00
|
|
|
this.nodeType = null;
|
2012-12-29 17:50:58 -08:00
|
|
|
|
2012-12-30 19:33:37 -08:00
|
|
|
BeeManager.breedingManager.registerBeeMutation(this);
|
2012-12-24 15:12:37 -08:00
|
|
|
}
|
|
|
|
|
|
2013-04-15 00:17:50 -07:00
|
|
|
public float getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1)
|
2012-12-24 15:12:37 -08:00
|
|
|
{
|
2013-04-15 00:17:50 -07:00
|
|
|
float finalChance = 0f;
|
2013-01-19 03:29:47 -08:00
|
|
|
float chance = this.baseChance * 1f;
|
2012-12-27 00:27:23 -08:00
|
|
|
|
2013-01-26 13:42:39 -08:00
|
|
|
if (this.arePartners(allele0, allele1))
|
2012-12-27 00:27:23 -08:00
|
|
|
{
|
|
|
|
|
// This mutation applies. Continue calculation.
|
2013-01-19 03:29:47 -08:00
|
|
|
if (this.moonPhaseStart != null && this.moonPhaseEnd != null)
|
|
|
|
|
{
|
|
|
|
|
// Only occurs during the phases.
|
|
|
|
|
if (this.isMoonRestricted && !MoonPhase.getMoonPhase(housing.getWorld()).isBetween(this.moonPhaseStart, this.moonPhaseEnd))
|
|
|
|
|
{
|
|
|
|
|
chance = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (this.moonPhaseMutationBonus != -1f)
|
|
|
|
|
{
|
|
|
|
|
// There is a bonus to this mutation during moon phases...
|
|
|
|
|
if (MoonPhase.getMoonPhase(housing.getWorld()).isBetween(this.moonPhaseStart, this.moonPhaseEnd))
|
|
|
|
|
{
|
|
|
|
|
chance = (int)(chance * this.moonPhaseMutationBonus);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-26 13:42:39 -08:00
|
|
|
if (this.nodeRequired)
|
|
|
|
|
{
|
|
|
|
|
int nodeId = ThaumcraftApi.getClosestAuraWithinRange(housing.getWorld(),
|
|
|
|
|
housing.getXCoord(), housing.getYCoord(), housing.getZCoord(), this.nodeRange);
|
2013-02-03 17:07:44 -08:00
|
|
|
if (nodeId >= 0)
|
2013-01-26 13:42:39 -08:00
|
|
|
{
|
2013-02-03 17:07:44 -08:00
|
|
|
if (this.nodeType != null)
|
2013-01-26 13:42:39 -08:00
|
|
|
{
|
2013-02-03 17:07:44 -08:00
|
|
|
// Needs a _specific_ variety of node
|
|
|
|
|
AuraNode node = ThaumcraftApi.getNodeCopy(nodeId);
|
|
|
|
|
if (node.type != this.nodeType)
|
|
|
|
|
{
|
|
|
|
|
chance = 0;
|
|
|
|
|
}
|
2013-01-26 13:42:39 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
chance = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-28 02:20:09 -08:00
|
|
|
finalChance = Math.round(chance
|
|
|
|
|
* housing.getMutationModifier((IBeeGenome) genome0,
|
2013-04-15 00:17:50 -07:00
|
|
|
(IBeeGenome) genome1, chance)
|
2013-01-28 02:20:09 -08:00
|
|
|
* BeeManager.breedingManager.getBeekeepingMode(housing.getWorld())
|
|
|
|
|
.getMutationModifier((IBeeGenome) genome0,
|
2013-04-15 00:17:50 -07:00
|
|
|
(IBeeGenome) genome1, chance));
|
2012-12-27 00:27:23 -08:00
|
|
|
}
|
|
|
|
|
|
2013-01-19 03:29:47 -08:00
|
|
|
return finalChance;
|
2012-12-24 15:12:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IAllele getAllele0()
|
|
|
|
|
{
|
|
|
|
|
return parent1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IAllele getAllele1()
|
|
|
|
|
{
|
|
|
|
|
return parent2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IAllele[] getTemplate()
|
|
|
|
|
{
|
|
|
|
|
return mutationTemplate;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-15 00:17:50 -07:00
|
|
|
public float getBaseChance()
|
2012-12-24 15:12:37 -08:00
|
|
|
{
|
2012-12-27 00:27:23 -08:00
|
|
|
return baseChance;
|
2012-12-24 15:12:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isPartner(IAllele allele)
|
|
|
|
|
{
|
|
|
|
|
return parent1.getUID().equals(allele.getUID()) || parent2.getUID().equals(allele.getUID());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IAllele getPartner(IAllele allele)
|
|
|
|
|
{
|
|
|
|
|
IAllele val = parent1;
|
|
|
|
|
if (val.getUID().equals(allele.getUID()))
|
|
|
|
|
val = parent2;
|
|
|
|
|
return val;
|
|
|
|
|
}
|
2013-01-19 03:29:47 -08:00
|
|
|
|
2013-01-26 13:42:39 -08:00
|
|
|
public boolean arePartners(IAllele alleleA, IAllele alleleB)
|
|
|
|
|
{
|
|
|
|
|
return (this.parent1.getUID().equals(alleleA.getUID())) && this.parent2.getUID().equals(alleleB.getUID()) ||
|
|
|
|
|
this.parent1.getUID().equals(alleleB.getUID()) && this.parent2.getUID().equals(alleleA.getUID());
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-19 03:29:47 -08:00
|
|
|
public BeeMutation setSecret()
|
|
|
|
|
{
|
|
|
|
|
this.isSecret = true;
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2012-12-24 15:12:37 -08:00
|
|
|
|
|
|
|
|
public boolean isSecret()
|
|
|
|
|
{
|
|
|
|
|
return isSecret;
|
|
|
|
|
}
|
2013-01-19 03:29:47 -08:00
|
|
|
|
|
|
|
|
public BeeMutation setMoonPhaseRestricted(MoonPhase begin, MoonPhase end)
|
|
|
|
|
{
|
|
|
|
|
this.isMoonRestricted = true;
|
|
|
|
|
this.moonPhaseStart = begin;
|
|
|
|
|
this.moonPhaseEnd = end;
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BeeMutation setMoonPhaseBonus(MoonPhase begin, MoonPhase end, float mutationBonus)
|
|
|
|
|
{
|
|
|
|
|
this.moonPhaseMutationBonus = mutationBonus;
|
|
|
|
|
this.moonPhaseStart = begin;
|
|
|
|
|
this.moonPhaseEnd = end;
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2013-01-26 13:42:39 -08:00
|
|
|
|
|
|
|
|
public BeeMutation setAuraNodeRequired(double range)
|
|
|
|
|
{
|
|
|
|
|
this.nodeRequired = true;
|
|
|
|
|
this.nodeRange = range;
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BeeMutation setAuraNodeTypeRequired(double range, EnumNodeType type)
|
|
|
|
|
{
|
|
|
|
|
this.nodeType = type;
|
|
|
|
|
|
|
|
|
|
return this.setAuraNodeRequired(range);
|
|
|
|
|
}
|
2012-12-24 15:12:37 -08:00
|
|
|
}
|