2015-01-10 12:23:41 -05:00
|
|
|
package WayofTime.alchemicalWizardry.common.rituals;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2015-01-11 21:05:28 -05:00
|
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
2015-01-10 12:23:41 -05:00
|
|
|
import net.minecraft.world.World;
|
2015-04-04 16:35:42 -04:00
|
|
|
import WayofTime.alchemicalWizardry.api.Int3;
|
2015-01-12 17:04:44 -05:00
|
|
|
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
2015-01-10 14:31:24 -05:00
|
|
|
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
|
2015-01-10 12:23:41 -05:00
|
|
|
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
|
|
|
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
|
|
|
|
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
|
|
|
|
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
2015-01-11 21:05:28 -05:00
|
|
|
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
|
|
|
|
import WayofTime.alchemicalWizardry.common.NewPacketHandler;
|
2015-01-10 12:23:41 -05:00
|
|
|
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
|
2015-01-11 21:05:28 -05:00
|
|
|
import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry;
|
2015-04-04 16:35:42 -04:00
|
|
|
import WayofTime.alchemicalWizardry.common.omega.OmegaStructureHandler;
|
|
|
|
import WayofTime.alchemicalWizardry.common.omega.OmegaStructureParameters;
|
2015-01-10 12:23:41 -05:00
|
|
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
|
|
|
|
|
|
|
public class RitualEffectOmegaTest extends RitualEffect
|
|
|
|
{
|
2015-01-11 21:05:28 -05:00
|
|
|
public static final int tickDuration = 1 * 60 * 20;
|
2015-01-10 12:23:41 -05:00
|
|
|
@Override
|
|
|
|
public void performEffect(IMasterRitualStone ritualStone)
|
|
|
|
{
|
|
|
|
String owner = ritualStone.getOwner();
|
|
|
|
|
|
|
|
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
|
|
|
|
World world = ritualStone.getWorld();
|
|
|
|
int x = ritualStone.getXCoord();
|
|
|
|
int y = ritualStone.getYCoord();
|
|
|
|
int z = ritualStone.getZCoord();
|
|
|
|
|
2015-04-04 16:35:42 -04:00
|
|
|
if (world.getWorldTime() % 200 != 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-04-08 09:52:51 -04:00
|
|
|
OmegaStructureParameters param = OmegaStructureHandler.getStructureStabilityFactor(world, x, y, z, 5, new Int3(0,1,0));
|
2015-04-04 16:35:42 -04:00
|
|
|
int stab = param.stability;
|
2015-04-08 09:52:51 -04:00
|
|
|
int enchantability = param.enchantability;
|
2015-04-04 16:35:42 -04:00
|
|
|
|
|
|
|
System.out.println("Stability: " + stab);
|
|
|
|
|
|
|
|
double range = 0.5;
|
2015-01-10 12:23:41 -05:00
|
|
|
|
2015-04-04 16:35:42 -04:00
|
|
|
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 1.5, z + 0.5, range, range);
|
2015-01-10 12:23:41 -05:00
|
|
|
|
|
|
|
for(EntityPlayer player : playerList)
|
2015-01-13 21:02:11 -05:00
|
|
|
{
|
2015-04-08 09:52:51 -04:00
|
|
|
Reagent reagent = ReagentRegistry.aetherReagent;
|
2015-01-12 17:04:44 -05:00
|
|
|
|
2015-04-04 16:35:42 -04:00
|
|
|
int affinity = 0;
|
2015-01-11 21:05:28 -05:00
|
|
|
|
2015-04-04 16:35:42 -04:00
|
|
|
OmegaParadigm waterParadigm = OmegaRegistry.getParadigmForReagent(reagent);
|
2015-04-08 09:52:51 -04:00
|
|
|
if(waterParadigm != null && waterParadigm.convertPlayerArmour(player, x, y, z, stab, affinity, enchantability))
|
2015-04-04 16:35:42 -04:00
|
|
|
{
|
|
|
|
APISpellHelper.setPlayerCurrentReagentAmount(player, tickDuration);
|
|
|
|
APISpellHelper.setPlayerMaxReagentAmount(player, tickDuration);
|
|
|
|
APISpellHelper.setPlayerReagentType(player, reagent);
|
|
|
|
APISpellHelper.setCurrentAdditionalMaxHP(player, waterParadigm.getMaxAdditionalHealth());
|
|
|
|
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getReagentBarPacket(reagent, APISpellHelper.getPlayerCurrentReagentAmount(player), APISpellHelper.getPlayerMaxReagentAmount(player)), (EntityPlayerMP)player);
|
|
|
|
}
|
2015-01-10 12:23:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getCostPerRefresh()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<RitualComponent> getRitualComponentList()
|
|
|
|
{
|
|
|
|
ArrayList<RitualComponent> animalGrowthRitual = new ArrayList();
|
|
|
|
animalGrowthRitual.add(new RitualComponent(0, 0, 2, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(2, 0, 0, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(0, 0, -2, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(-2, 0, 0, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(0, 0, 1, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(1, 0, 0, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(0, 0, -1, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(-1, 0, 0, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(1, 0, 2, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(-1, 0, 2, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(1, 0, -2, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(-1, 0, -2, RitualComponent.WATER));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(2, 0, 1, RitualComponent.AIR));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(2, 0, -1, RitualComponent.AIR));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(-2, 0, 1, RitualComponent.AIR));
|
|
|
|
animalGrowthRitual.add(new RitualComponent(-2, 0, -1, RitualComponent.AIR));
|
|
|
|
return animalGrowthRitual;
|
|
|
|
}
|
2015-04-04 16:35:42 -04:00
|
|
|
|
|
|
|
public Int3 getJarLocation(int i)
|
|
|
|
{
|
|
|
|
switch(i)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
return new Int3(-3,1,0);
|
|
|
|
case 1:
|
|
|
|
return new Int3(3,1,0);
|
|
|
|
case 2:
|
|
|
|
return new Int3(0,1,-3);
|
|
|
|
case 3:
|
|
|
|
return new Int3(0,1,3);
|
|
|
|
default:
|
|
|
|
return new Int3(0,0,0);
|
|
|
|
}
|
|
|
|
}
|
2015-01-10 12:23:41 -05:00
|
|
|
}
|