Increased the chance of growing a plant each processing tick for the Green Grove ritual when supplied with Vengeful Will

This commit is contained in:
WayofTime 2016-08-11 16:32:46 -04:00
parent 35ca516f63
commit 3a6e09f1e4

View file

@ -40,11 +40,14 @@ public class RitualGreenGrove extends Ritual
public static double corrosiveWillDrain = 0.2; public static double corrosiveWillDrain = 0.2;
public static double rawWillDrain = 0.05; public static double rawWillDrain = 0.05;
public static double vengefulWillDrain = 0.05;
public static double steadfastWillDrain = 0.05; public static double steadfastWillDrain = 0.05;
public int refreshTime = 20; public int refreshTime = 20;
public static int defaultRefreshTime = 20; public static int defaultRefreshTime = 20;
public static double defaultGrowthChance = 0.3;
public static IBlockState farmlandState = Blocks.FARMLAND.getDefaultState().withProperty(BlockFarmland.MOISTURE, 7); public static IBlockState farmlandState = Blocks.FARMLAND.getDefaultState().withProperty(BlockFarmland.MOISTURE, 7);
public RitualGreenGrove() public RitualGreenGrove()
@ -80,12 +83,16 @@ public class RitualGreenGrove extends Ritual
double corrosiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.CORROSIVE, willConfig); double corrosiveWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.CORROSIVE, willConfig);
double rawWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DEFAULT, willConfig); double rawWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.DEFAULT, willConfig);
double steadfastWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.STEADFAST, willConfig); double steadfastWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.STEADFAST, willConfig);
double vengefulWill = this.getWillRespectingConfig(world, pos, EnumDemonWillType.VENGEFUL, willConfig);
refreshTime = getRefreshTimeForRawWill(rawWill); refreshTime = getRefreshTimeForRawWill(rawWill);
double growthChance = getPlantGrowthChanceForWill(vengefulWill);
boolean consumeRawWill = rawWill >= rawWillDrain && refreshTime != defaultRefreshTime; boolean consumeRawWill = rawWill >= rawWillDrain && refreshTime != defaultRefreshTime;
boolean consumeVengefulWill = vengefulWill >= vengefulWillDrain && growthChance != defaultGrowthChance;
double rawDrain = 0; double rawDrain = 0;
double vengefulDrain = 0;
AreaDescriptor growingRange = getBlockRange(GROW_RANGE); AreaDescriptor growingRange = getBlockRange(GROW_RANGE);
@ -98,7 +105,7 @@ public class RitualGreenGrove extends Ritual
{ {
if (block instanceof IPlantable || block instanceof IGrowable) if (block instanceof IPlantable || block instanceof IGrowable)
{ {
if (world.rand.nextDouble() < 0.3) if (world.rand.nextDouble() < growthChance)
{ {
block.updateTick(world, newPos, state, new Random()); block.updateTick(world, newPos, state, new Random());
IBlockState newState = world.getBlockState(newPos); IBlockState newState = world.getBlockState(newPos);
@ -110,12 +117,18 @@ public class RitualGreenGrove extends Ritual
rawWill -= rawWillDrain; rawWill -= rawWillDrain;
rawDrain += rawWillDrain; rawDrain += rawWillDrain;
} }
if (consumeVengefulWill)
{
vengefulWill -= vengefulWillDrain;
vengefulDrain += vengefulWillDrain;
}
} }
} }
} }
} }
if (totalGrowths >= maxGrowths || (consumeRawWill && rawWill < rawWillDrain)) if (totalGrowths >= maxGrowths || (consumeRawWill && rawWill < rawWillDrain) || (consumeVengefulWill && vengefulWill < vengefulWillDrain))
{ {
break; break;
} }
@ -126,6 +139,11 @@ public class RitualGreenGrove extends Ritual
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawDrain, true); WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.DEFAULT, rawDrain, true);
} }
if (vengefulDrain > 0)
{
WorldDemonWillHandler.drainWill(world, pos, EnumDemonWillType.VENGEFUL, vengefulDrain, true);
}
AreaDescriptor hydrateRange = getBlockRange(HYDRATE_RANGE); AreaDescriptor hydrateRange = getBlockRange(HYDRATE_RANGE);
double steadfastDrain = 0; double steadfastDrain = 0;
@ -211,6 +229,16 @@ public class RitualGreenGrove extends Ritual
network.syphon(totalGrowths * getRefreshCost()); network.syphon(totalGrowths * getRefreshCost());
} }
public double getPlantGrowthChanceForWill(double will)
{
if (will > 0)
{
return 0.5;
}
return defaultGrowthChance;
}
public int getRefreshTimeForRawWill(double rawWill) public int getRefreshTimeForRawWill(double rawWill)
{ {
if (rawWill > 0) if (rawWill > 0)