From b9263ee1741244b8c9c3f51b31ef92a30db51b37 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Tue, 18 Mar 2014 21:50:57 -0400 Subject: [PATCH] Quick update --- .../AlchemicalWizardry.java | 8 +- .../common/AlchemicalWizardryEventHooks.java | 2 +- .../rituals/RitualEffectAutoAlchemy.java | 387 ++++++++++++++++++ .../rituals/RitualEffectEnhancedAlchemy.java | 86 ++++ .../common/rituals/Rituals.java | 11 + .../complex/effect/SpellEffectEarth.java | 22 +- .../spell/complex/effect/SpellEffectFire.java | 44 +- .../spell/complex/effect/SpellEffectWind.java | 23 +- .../ExtrapolatedMeleeEntityEffect.java | 4 +- .../impactEffects/fire/MeleeDefaultFire.java | 30 ++ .../fire/MeleeDefensiveFire.java | 49 +++ .../fire/MeleeEnvironmentalFire.java | 34 ++ .../fire/MeleeOffensiveFire.java | 32 ++ .../impactEffects/fire/SelfOffensiveFire.java | 2 +- .../impactEffects/ice/MeleeDefaultIce.java | 3 +- .../ice/MeleeEnvironmentalIce.java | 3 +- .../impactEffects/ice/MeleeOffensiveIce.java | 3 +- .../wind/MeleeOffensiveWind.java | 40 ++ .../wind/SelfEnvironmentalWind.java | 45 ++ .../common/tileEntity/TEWritingTable.java | 111 ++++- 20 files changed, 866 insertions(+), 73 deletions(-) create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEnhancedAlchemy.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeDefaultFire.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeDefensiveFire.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeEnvironmentalFire.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/MeleeOffensiveFire.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeOffensiveWind.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfEnvironmentalWind.java diff --git a/BM_src/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/BM_src/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index 65f52adb..5a52c97f 100644 --- a/BM_src/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/BM_src/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -109,7 +109,7 @@ import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; -@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v0.7.3e") +@Mod(modid = "AWWayofTime", name = "AlchemicalWizardry", version = "v1.0.0") @NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = {"BloodAltar", "particle", "SetLifeEssence", "GetLifeEssence", "Ritual", "GetAltarEssence", "TESocket", "TEWritingTable", "CustomParticle", "SetPlayerVel", "SetPlayerPos", "TEPedestal", "TEPlinth", "TETeleposer", "InfiniteLPPath", "TEOrientor"}, packetHandler = PacketHandler.class) public class AlchemicalWizardry @@ -962,6 +962,7 @@ public class AlchemicalWizardry ItemStack offenseCoreStack = new ItemStack(ModItems.baseItems,1,19); ItemStack defensiveCoreStack = new ItemStack(ModItems.baseItems,1,20); ItemStack environmentalCoreStack = new ItemStack(ModItems.baseItems,1,21); + ItemStack powerCoreStack = new ItemStack(ModItems.baseItems,1,22); ItemStack magicalesCraftedCableStack = new ItemStack(ModItems.baseItems,5,2); ItemStack crackedRunicPlateStackCrafted = new ItemStack(ModItems.baseItems,2,15); @@ -975,7 +976,7 @@ public class AlchemicalWizardry GameRegistry.addRecipe(projectileCoreStack, "mbm","aca","mom",'c', emptyCoreStack,'b',weakBloodShardStack,'m', magicalesStack,'o', magicianBloodOrbStack,'a',new ItemStack(Item.arrow)); GameRegistry.addRecipe(selfCoreStack,"sbs","ncn","sos",'c', emptyCoreStack, 's',sanctusStack,'b', weakBloodShardStack,'o', magicianBloodOrbStack,'n',glowstoneDustStack); - GameRegistry.addRecipe(meleeCoreStack,"sbs","ncn","sos",'c', emptyCoreStack, 's',incendiumStack,'b', weakBloodShardStack,'o', magicianBloodOrbStack,'n',new ItemStack(Item.flintAndSteel)); + GameRegistry.addRecipe(meleeCoreStack,"sbs","ncn","sos",'c', emptyCoreStack, 's',incendiumStack,'b', weakBloodShardStack,'o', magicianBloodOrbStack,'n',new ItemStack(Item.fireballCharge)); GameRegistry.addRecipe(paradigmBackPlateStack,"isi","rgr","isi",'i',ironIngotStack,'r',stoneStack,'g',goldIngotStack,'s',reinforcedSlateStack); GameRegistry.addRecipe(outputCableStack, " si","s c"," si",'s',stoneStack,'i',ironIngotStack,'c',simpleCatalystStack); @@ -1011,7 +1012,7 @@ public class AlchemicalWizardry GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellModifier,1,2),"bgb","ico","bgb",'c',defensiveCoreStack,'i',inputCableStack,'o',outputCableStack,'b',stoneBraceStack,'g',ironIngotStack); GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellModifier,1,3),"bgb","ico","bgb",'c',environmentalCoreStack,'i',inputCableStack,'o',outputCableStack,'b',stoneBraceStack,'g',ironIngotStack); - GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,0),"bpb","ico","bpb",'c', emptyCoreStack,'b',woodBraceStack,'p',crackedRunicPlateStack,'i',inputCableStack,'o',outputCableStack); + GameRegistry.addRecipe(new ItemStack(ModBlocks.blockSpellEnhancement,1,0),"bpb","ico","bpb",'c', powerCoreStack,'b',woodBraceStack,'p',crackedRunicPlateStack,'i',inputCableStack,'o',outputCableStack); GameRegistry.addShapelessRecipe(new ItemStack(Item.dyePowder,5,15),fracturedBoneStack); @@ -1044,6 +1045,7 @@ public class AlchemicalWizardry LanguageRegistry.addName(crackedRunicPlateStack,"Cracked Runic Plate"); LanguageRegistry.addName(runicPlateStack,"Runic Plate"); LanguageRegistry.addName(imbuedRunicPlateStack,"Imbued Runic Plate"); + } @EventHandler diff --git a/BM_src/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java b/BM_src/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java index 66512d4c..e9c7d252 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java @@ -305,7 +305,7 @@ public class AlchemicalWizardryEventHooks entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0); int r = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getAmplifier(); - int radius = r+1; + float radius = 0.5f*r+0.5f; if(entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFireFuse).getDuration()<=2) { diff --git a/BM_src/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java b/BM_src/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java new file mode 100644 index 00000000..64d1495c --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/rituals/RitualEffectAutoAlchemy.java @@ -0,0 +1,387 @@ +package WayofTime.alchemicalWizardry.common.rituals; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork; +import WayofTime.alchemicalWizardry.common.alchemy.AlchemyRecipeRegistry; +import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; +import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; + +public class RitualEffectAutoAlchemy extends RitualEffect +{ + @Override + public void performEffect(TEMasterStone ritualStone) + { + String owner = ritualStone.getOwner(); + World worldSave = MinecraftServer.getServer().worldServers[0]; + LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner); + + if (data == null) + { + data = new LifeEssenceNetwork(owner); + worldSave.setItemData(owner, data); + } + + int currentEssence = data.currentEssence; + World world = ritualStone.worldObj; + int x = ritualStone.xCoord; + int y = ritualStone.yCoord; + int z = ritualStone.zCoord; + + if (currentEssence < this.getCostPerRefresh()*6) + { + EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner); + + if (entityOwner == null) + { + return; + } + + entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); + } else + { + int flag = 0; + + TileEntity topEntity = world.getBlockTileEntity(x, y+1, z); + if(!(topEntity instanceof TEAltar)) + { + return; + } + + TEAltar tileAltar = (TEAltar)topEntity; + ItemStack targetStack = tileAltar.getStackInSlot(0); + if(targetStack == null) + { + return; + } + + ItemStack[] recipe = AlchemyRecipeRegistry.getRecipeForItemStack(targetStack); + if(recipe!=null) + { + TEWritingTable alchemyEntity; + IInventory outputInv = null; + IInventory inputInv1 = null; + IInventory inputInv2 = null; + + TileEntity northEntity = world.getBlockTileEntity(x,y,z-1); + TileEntity southEntity = world.getBlockTileEntity(x,y,z+1); + TileEntity eastEntity = world.getBlockTileEntity(x+1,y,z); + TileEntity westEntity = world.getBlockTileEntity(x-1,y,z); + + if(northEntity instanceof TEWritingTable) + { + alchemyEntity = (TEWritingTable)northEntity; + if(southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable)) + { + outputInv = (IInventory)southEntity; + } + if(eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable)) + { + inputInv1 = (IInventory)eastEntity; + } + if(westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable)) + { + inputInv2 = (IInventory)westEntity; + } + }else if(southEntity instanceof TEWritingTable) + { + alchemyEntity = (TEWritingTable)southEntity; + if(northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable)) + { + outputInv = (IInventory)northEntity; + } + if(eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable)) + { + inputInv1 = (IInventory)eastEntity; + } + if(westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable)) + { + inputInv2 = (IInventory)westEntity; + } + }else if(eastEntity instanceof TEWritingTable) + { + alchemyEntity = (TEWritingTable)eastEntity; + if(westEntity instanceof IInventory && !(westEntity instanceof TEWritingTable)) + { + outputInv = (IInventory)westEntity; + } + if(northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable)) + { + inputInv1 = (IInventory)northEntity; + } + if(southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable)) + { + inputInv2 = (IInventory)southEntity; + } + }else if(westEntity instanceof TEWritingTable) + { + alchemyEntity = (TEWritingTable)westEntity; + if(eastEntity instanceof IInventory && !(eastEntity instanceof TEWritingTable)) + { + outputInv = (IInventory)eastEntity; + } + if(northEntity instanceof IInventory && !(northEntity instanceof TEWritingTable)) + { + inputInv1 = (IInventory)northEntity; + } + if(southEntity instanceof IInventory && !(southEntity instanceof TEWritingTable)) + { + inputInv2 = (IInventory)southEntity; + } + }else + { + return; + } + + if(outputInv!=null) + { + ItemStack outputStack = alchemyEntity.getStackInSlot(6); + if(outputStack!=null) + { + for(int i=0; i=alchStack.getMaxStackSize())) + { + continue; + } + + for(int j=0;j=alchStack.getMaxStackSize())) + { + continue; + } + + for(int j=0;j0) + { + world.markBlockForUpdate(x, y, z+1); + world.markBlockForUpdate(x, y, z-1); + world.markBlockForUpdate(x+1, y, z); + world.markBlockForUpdate(x-1, y, z); + data.currentEssence = currentEssence - this.getCostPerRefresh()*flag; + data.markDirty(); + } + } + } + + @Override + public int getCostPerRefresh() + { + return 10; + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEnhancedAlchemy.java b/BM_src/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEnhancedAlchemy.java new file mode 100644 index 00000000..a8b06009 --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/rituals/RitualEffectEnhancedAlchemy.java @@ -0,0 +1,86 @@ +package WayofTime.alchemicalWizardry.common.rituals; + +import WayofTime.alchemicalWizardry.common.LifeEssenceNetwork; +import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; +import cpw.mods.fml.common.network.PacketDispatcher; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; + +public class RitualEffectEnhancedAlchemy extends RitualEffect +{ + @Override + public void performEffect(TEMasterStone ritualStone) + { + String owner = ritualStone.getOwner(); + World worldSave = MinecraftServer.getServer().worldServers[0]; + LifeEssenceNetwork data = (LifeEssenceNetwork) worldSave.loadItemData(LifeEssenceNetwork.class, owner); + + if (data == null) + { + data = new LifeEssenceNetwork(owner); + worldSave.setItemData(owner, data); + } + + int currentEssence = data.currentEssence; + World world = ritualStone.worldObj; + int x = ritualStone.xCoord; + int y = ritualStone.yCoord; + int z = ritualStone.zCoord; + + if (currentEssence < this.getCostPerRefresh()) + { + EntityPlayer entityOwner = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(owner); + + if (entityOwner == null) + { + return; + } + + entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); + } else + { + if (world.getWorldTime() % 20 != 0) + { + return; + } + + boolean flag = false; + + for (int i = -1; i <= 1; i++) + { + for (int j = -1; j <= 1; j++) + { + int id = world.getBlockId(x + i, y + 2, z + j); + Block block = Block.blocksList[id]; + + if (block instanceof IPlantable) + { + { + PacketDispatcher.sendPacketToAllPlayers(TEAltar.getParticlePacket(x + i, y + 2, z + j, (short) 3)); + block.updateTick(world, x + i, y + 2, z + j, world.rand); + flag = true; + } + } + } + } + + if (flag) + { + data.currentEssence = currentEssence - this.getCostPerRefresh(); + data.markDirty(); + } + } + } + + @Override + public int getCostPerRefresh() + { + return 0; + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/rituals/Rituals.java b/BM_src/WayofTime/alchemicalWizardry/common/rituals/Rituals.java index e434f776..056e85f2 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/rituals/Rituals.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/rituals/Rituals.java @@ -879,6 +879,16 @@ public class Rituals apiaryRitual.add(new RitualComponent(-1,0,0, RitualComponent.DUSK)); apiaryRitual.add(new RitualComponent(0,0,-1, RitualComponent.DUSK)); apiaryRitual.add(new RitualComponent(0,0,1, RitualComponent.DUSK)); + + ArrayList autoAlchemyRitual = new ArrayList(); + autoAlchemyRitual.add(new RitualComponent(1,0,1, RitualComponent.DUSK)); + autoAlchemyRitual.add(new RitualComponent(1,0,-1, RitualComponent.DUSK)); + autoAlchemyRitual.add(new RitualComponent(-1,0,-1, RitualComponent.DUSK)); + autoAlchemyRitual.add(new RitualComponent(-1,0,1, RitualComponent.DUSK)); + autoAlchemyRitual.add(new RitualComponent(2,0,2, RitualComponent.WATER)); + autoAlchemyRitual.add(new RitualComponent(2,0,-2, RitualComponent.WATER)); + autoAlchemyRitual.add(new RitualComponent(-2,0,-2, RitualComponent.WATER)); + autoAlchemyRitual.add(new RitualComponent(-2,0,2, RitualComponent.WATER)); ritualList.add(new Rituals(waterRitual, 1, 500, new RitualEffectWater(), "Ritual of the Full Spring")); @@ -900,6 +910,7 @@ public class Rituals ritualList.add(new Rituals(biomeChangerRitual, 2, 1000000, new RitualEffectBiomeChanger(), "Ritual of Gaia's Transformation")); ritualList.add(new Rituals(flightRitual, 2, 1000000, new RitualEffectFlight(), "Reverence of the Condor")); ritualList.add(new Rituals(meteorRitual, 2, 1000000, new RitualEffectSummonMeteor(), "Mark of the Falling Tower")); + ritualList.add(new Rituals(autoAlchemyRitual,1,20000,new RitualEffectAutoAlchemy(),"Ballad of Alchemy")); //ritualList.add(new Rituals(apiaryRitual,1,100,new RitualEffectApiaryOverclock(),"Apiary Overclock")); } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectEarth.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectEarth.java index 030abd06..d958617b 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectEarth.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectEarth.java @@ -93,44 +93,44 @@ public class SpellEffectEarth extends SpellEffect @Override protected int getCostForDefaultProjectile() { - return (int)(10*Math.pow((0.5*(this.powerEnhancement)+1)*2 + 1,3)*Math.pow(0.8, costEnhancement)); + return (int)(10*Math.pow((0.5*(this.powerEnhancement)+1)*2 + 1,3)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForOffenseProjectile() { - return (int)(10*(1.5*this.potencyEnhancement+1)*(Math.pow(1*this.powerEnhancement+1,2))*Math.pow(0.8, costEnhancement)); + return (int)(10*(1.5*this.potencyEnhancement+1)*(Math.pow(1*this.powerEnhancement+1,2))*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForDefenseProjectile() { - return (int)(3*Math.pow((this.powerEnhancement*2+1),2)*(this.potencyEnhancement*2+1)*Math.pow(0.8, costEnhancement)); + return (int)(3*Math.pow((this.powerEnhancement*2+1),2)*(this.potencyEnhancement*2+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForEnvironmentProjectile() { - return (int)(10*2*(0.1d*(this.potencyEnhancement+1))*Math.pow(3.47,this.potencyEnhancement)*Math.pow(0.8, costEnhancement)); + return (int)(10*2*(0.1d*(this.potencyEnhancement+1))*Math.pow(3.47,this.potencyEnhancement)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForDefaultSelf() { - return (int)(20*Math.pow(1.5*powerEnhancement+1,2)*(2*this.potencyEnhancement+1)*Math.pow(0.8, costEnhancement)); + return (int)(20*Math.pow(1.5*powerEnhancement+1,2)*(2*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForOffenseSelf() { - return (int)(10*Math.pow(2*this.powerEnhancement+1,2)*(this.potencyEnhancement+1)); + return (int)(10*Math.pow(2*this.powerEnhancement+1,2)*(this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForDefenseSelf() { - return (int)(750*(1.1*this.powerEnhancement+1)*(0.5*this.potencyEnhancement+1)*Math.pow(0.8, costEnhancement)); + return (int)(750*(1.1*this.powerEnhancement+1)*(0.5*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override @@ -143,24 +143,24 @@ public class SpellEffectEarth extends SpellEffect @Override protected int getCostForDefaultMelee() { - return (int)(50*Math.pow(1.5*this.potencyEnhancement + 1,3)*(0.5*this.powerEnhancement + 1)*Math.pow(0.8, costEnhancement)); + return (int)(50*Math.pow(1.5*this.potencyEnhancement + 1,3)*(0.5*this.powerEnhancement + 1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForOffenseMelee() { - return (int)(20*Math.pow(1.5*this.powerEnhancement+1,3)*(0.25*this.powerEnhancement+1)); + return (int)(20*Math.pow(1.5*this.powerEnhancement+1,3)*(0.25*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForDefenseMelee() { - return (int)(5*(1.2*this.powerEnhancement+1)*(1.0f/3.0f*Math.pow(this.potencyEnhancement,2)+2+1.0f/2.0f*this.potencyEnhancement)*Math.pow(0.8, costEnhancement)); + return (int)(5*(1.2*this.powerEnhancement+1)*(1.0f/3.0f*Math.pow(this.potencyEnhancement,2)+2+1.0f/2.0f*this.potencyEnhancement)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForEnvironmentMelee() { - return (int)(500*Math.pow(2*this.potencyEnhancement+1, 3)*(0.25*this.powerEnhancement+1)*Math.pow(0.8, costEnhancement)); + return (int)(500*Math.pow(2*this.potencyEnhancement+1, 3)*(0.25*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement)); } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectFire.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectFire.java index 4800871f..edba6b15 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectFire.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectFire.java @@ -3,6 +3,10 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeDefaultFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeDefensiveFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeEnvironmentalFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.MeleeOffensiveFire; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileDefaultFire; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileDefensiveFire; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileEnvironmentalFire; @@ -66,104 +70,96 @@ public class SpellEffectFire extends SpellEffect @Override public void defaultModificationMelee(SpellParadigmMelee parad) { - // TODO Auto-generated method stub - + parad.addEntityEffect(new MeleeDefaultFire(this.powerEnhancement, this.potencyEnhancement, this.costEnhancement)); } @Override public void offensiveModificationMelee(SpellParadigmMelee parad) { - // TODO Auto-generated method stub - + parad.addEntityEffect(new MeleeOffensiveFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement)); } @Override public void defensiveModificationMelee(SpellParadigmMelee parad) { - // TODO Auto-generated method stub - + parad.addWorldEffect(new MeleeDefensiveFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement)); } @Override public void environmentalModificationMelee(SpellParadigmMelee parad) { - // TODO Auto-generated method stub - + parad.addWorldEffect(new MeleeEnvironmentalFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement)); } @Override protected int getCostForDefaultProjectile() { - return (int)((5*Math.pow(1.5*this.powerEnhancement+1, 2)*(1.5*this.potencyEnhancement+1)+this.potencyEnhancement*15)*Math.pow(0.8, costEnhancement)); + return (int)((5*Math.pow(1.5*this.powerEnhancement+1, 2)*(1.5*this.potencyEnhancement+1)+this.potencyEnhancement*15)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForOffenseProjectile() { - return (int)(10*Math.pow((this.powerEnhancement)*1.3+1,2)*((1.5*this.potencyEnhancement+1))*Math.pow(0.8, costEnhancement)); + return (int)(10*Math.pow((this.powerEnhancement)*1.3+1,2)*((1.5*this.potencyEnhancement+1))*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForDefenseProjectile() { - return (int)(25*Math.pow(1*this.powerEnhancement+1,2)*(1*this.potencyEnhancement+1)*Math.pow(0.8, costEnhancement)); + return (int)(25*Math.pow(1*this.powerEnhancement+1,2)*(1*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForEnvironmentProjectile() { - return (int)(75*(0.5*this.powerEnhancement+1)*(0.5*this.potencyEnhancement+1)*Math.pow(0.8, costEnhancement)); + return (int)(75*(0.5*this.powerEnhancement+1)*(0.5*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForDefaultSelf() { - return 10*(int)(10*Math.pow(1.5, this.powerEnhancement+1.5*this.potencyEnhancement)*Math.pow(0.8, costEnhancement)); + return 10*(int)(10*Math.pow(1.5, this.powerEnhancement+1.5*this.potencyEnhancement)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForOffenseSelf() { - return 500*(int)((this.powerEnhancement+1)*Math.pow(2, potencyEnhancement)*Math.pow(0.8, costEnhancement)); + return (int)(300*(3*powerEnhancement+1)*(2*potencyEnhancement + 1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForDefenseSelf() { - return (int)(25*(3*this.potencyEnhancement+1)*(2*this.powerEnhancement+1)*Math.pow(0.8, costEnhancement)); + return (int)(25*(3*this.potencyEnhancement+1)*(2*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForEnvironmentSelf() { - return (int) ((15*Math.pow(1.7, powerEnhancement)+10*Math.pow(potencyEnhancement,1.8))*Math.pow(0.8, costEnhancement)); + return (int)((15*Math.pow(1.7, powerEnhancement)+10*Math.pow(potencyEnhancement,1.8))*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForDefaultMelee() { - // TODO Auto-generated method stub - return 0; + return (int)(25*(1.2*this.potencyEnhancement+1)*(2.5*this.powerEnhancement+2)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForOffenseMelee() { - // TODO Auto-generated method stub - return 0; + return (int)(500*(1+this.potencyEnhancement)*(this.powerEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForDefenseMelee() { - // TODO Auto-generated method stub - return 0; + return (int)(30*(1.5*potencyEnhancement+1)*(3*powerEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForEnvironmentMelee() { - // TODO Auto-generated method stub - return 0; + return (int)(25*Math.pow(1.5*this.powerEnhancement+1,3)*(0.25*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement)); } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectWind.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectWind.java index 0edb3596..67b3bb8c 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectWind.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectWind.java @@ -3,9 +3,11 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.MeleeOffensiveWind; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ProjectileDefaultWind; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ProjectileEnvironmentalWind; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.ProjectileOffensiveWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind.SelfEnvironmentalWind; public class SpellEffectWind extends SpellEffect { @@ -57,8 +59,7 @@ public class SpellEffectWind extends SpellEffect @Override public void environmentalModificationSelf(SpellParadigmSelf parad) { - // TODO Auto-generated method stub - + parad.addSelfSpellEffect(new SelfEnvironmentalWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement)); } @Override @@ -71,8 +72,7 @@ public class SpellEffectWind extends SpellEffect @Override public void offensiveModificationMelee(SpellParadigmMelee parad) { - // TODO Auto-generated method stub - + parad.addEntityEffect(new MeleeOffensiveWind(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement)); } @Override @@ -92,26 +92,25 @@ public class SpellEffectWind extends SpellEffect @Override protected int getCostForDefaultProjectile() { - return (int)(100*(this.potencyEnhancement+1)*Math.pow(0.8, costEnhancement)); + return (int)(100*(this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForOffenseProjectile() { - return (int)(100*(0.5*this.potencyEnhancement+1)*(this.powerEnhancement+1)*Math.pow(0.8, costEnhancement)); + return (int)(100*(0.5*this.potencyEnhancement+1)*(this.powerEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override protected int getCostForDefenseProjectile() { - // TODO Auto-generated method stub - return 0; + return (int)(100*(this.potencyEnhancement+1)); } @Override protected int getCostForEnvironmentProjectile() { - return (int)(50*(this.powerEnhancement+1)*(this.potencyEnhancement+1)*Math.pow(0.8, costEnhancement)); + return (int)(50*(this.powerEnhancement+1)*(this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override @@ -138,8 +137,7 @@ public class SpellEffectWind extends SpellEffect @Override protected int getCostForEnvironmentSelf() { - // TODO Auto-generated method stub - return 0; + return (int)(500*(0.7d*this.powerEnhancement+1)*(0.2*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override @@ -152,8 +150,7 @@ public class SpellEffectWind extends SpellEffect @Override protected int getCostForOffenseMelee() { - // TODO Auto-generated method stub - return 0; + return (int)(250*(1.0*this.potencyEnhancement+1)*(0.7*this.powerEnhancement+1)*Math.pow(0.85, costEnhancement)); } @Override diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ExtrapolatedMeleeEntityEffect.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ExtrapolatedMeleeEntityEffect.java index aca6b077..7e48b5a8 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ExtrapolatedMeleeEntityEffect.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ExtrapolatedMeleeEntityEffect.java @@ -45,7 +45,7 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity { if(hit0) { diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeEnvironmentalIce.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeEnvironmentalIce.java index 1399084f..985a1a68 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeEnvironmentalIce.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeEnvironmentalIce.java @@ -1,6 +1,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntitySnowball; import net.minecraft.world.World; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect; @@ -16,7 +17,7 @@ public class MeleeEnvironmentalIce extends ExtrapolatedMeleeEntityEffect } @Override - protected boolean entityEffect(World world, Entity entity) + protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) { for(int i=0;i<=this.powerUpgrades;i++) { diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeOffensiveIce.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeOffensiveIce.java index 83a64f35..ebbf87ad 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeOffensiveIce.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/MeleeOffensiveIce.java @@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.i import net.minecraft.block.Block; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Vec3; import net.minecraft.world.World; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; @@ -18,7 +19,7 @@ public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect } @Override - protected boolean entityEffect(World world, Entity entity) + protected boolean entityEffect(World world, Entity entity, EntityPlayer entityPlayer) { Vec3 blockVector = SpellHelper.getEntityBlockVector(entity); diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeOffensiveWind.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeOffensiveWind.java new file mode 100644 index 00000000..dd283246 --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/MeleeOffensiveWind.java @@ -0,0 +1,40 @@ +package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect; + +public class MeleeOffensiveWind extends ExtrapolatedMeleeEntityEffect +{ + public MeleeOffensiveWind(int power, int potency, int cost) + { + super(power, potency, cost); + this.setRange(3+0.3f*potency); + this.setRadius(2+0.3f*potency); + this.setMaxNumberHit(potency+1); + } + + @Override + protected boolean entityEffect(World world, Entity entity, EntityPlayer player) + { + double wantedVel = 1.0d+1.0d*this.powerUpgrades; + + if(entity instanceof EntityLiving) + { + double dist = Math.sqrt(entity.getDistanceToEntity(player)); + double xVel = wantedVel*(entity.posX - player.posX)/dist; + double yVel = wantedVel*(entity.posY - player.posY+0.5f)/dist; + double zVel = wantedVel*(entity.posZ - player.posZ)/dist; + + entity.motionX = xVel; + entity.motionY = yVel; + entity.motionZ = zVel; + + return true; + } + + return false; + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfEnvironmentalWind.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfEnvironmentalWind.java new file mode 100644 index 00000000..3ea0f86b --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/wind/SelfEnvironmentalWind.java @@ -0,0 +1,45 @@ +package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.wind; + +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect; + +public class SelfEnvironmentalWind extends SelfSpellEffect +{ + public SelfEnvironmentalWind(int power, int potency, int cost) + { + super(power, potency, cost); + } + + @Override + public void onSelfUse(World world, EntityPlayer player) + { + double radius = 1.5d*this.potencyUpgrades+1; + double posX = player.posX; + double posY = player.posY-0.7d; + double posZ = player.posZ; + double wantedVel = 0.7d+0.7d*this.powerUpgrades; + + List entities = SpellHelper.getEntitiesInRange(world, posX, posY, posZ, radius, radius); + + for(Entity entity: entities) + { + if((!entity.equals(player))&&entity instanceof EntityLiving) + { + double dist = Math.sqrt(entity.getDistanceToEntity(player)); + double xVel = wantedVel*(entity.posX - posX)/dist; + double yVel = wantedVel*(entity.posY - posY)/dist; + double zVel = wantedVel*(entity.posZ - posZ)/dist; + + entity.motionX = xVel; + entity.motionY = yVel; + entity.motionZ = zVel; + } + } + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java b/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java index 2a2a1429..9b8696c3 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java @@ -1,14 +1,11 @@ package WayofTime.alchemicalWizardry.common.tileEntity; -import WayofTime.alchemicalWizardry.ModItems; -import WayofTime.alchemicalWizardry.common.*; -import WayofTime.alchemicalWizardry.common.alchemy.AlchemicalPotionCreationHandler; -import WayofTime.alchemicalWizardry.common.alchemy.AlchemyRecipeRegistry; -import WayofTime.alchemicalWizardry.common.items.EnergyItems; -import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask; -import cpw.mods.fml.common.network.PacketDispatcher; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; + import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -16,12 +13,20 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.ForgeDirection; +import WayofTime.alchemicalWizardry.ModItems; +import WayofTime.alchemicalWizardry.common.IBindingAgent; +import WayofTime.alchemicalWizardry.common.ICatalyst; +import WayofTime.alchemicalWizardry.common.IFillingAgent; +import WayofTime.alchemicalWizardry.common.PacketHandler; +import WayofTime.alchemicalWizardry.common.alchemy.AlchemicalPotionCreationHandler; +import WayofTime.alchemicalWizardry.common.alchemy.AlchemyRecipeRegistry; +import WayofTime.alchemicalWizardry.common.items.EnergyBattery; +import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask; +import cpw.mods.fml.common.network.PacketDispatcher; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; - -public class TEWritingTable extends TileEntity implements IInventory +public class TEWritingTable extends TileEntity implements ISidedInventory { private ItemStack[] inv; private int progress; @@ -79,6 +84,37 @@ public class TEWritingTable extends TileEntity implements IInventory return stack; } + + public ItemStack decrStackSizeLeaveContainer(int slot, int amt) + { + ItemStack stack = getStackInSlot(slot); + + if (stack != null) + { + ItemStack containedStack = stack.getItem().getContainerItemStack(stack); + if(containedStack!=null) + { + setInventorySlotContents(slot,containedStack); + } + else + { + if (stack.stackSize <= amt) + { + setInventorySlotContents(slot, null); + } else + { + stack = stack.splitStack(amt); + + if (stack.stackSize == 0) + { + setInventorySlotContents(slot, null); + } + } + } + } + + return stack; + } @Override public ItemStack getStackInSlotOnClosing(int slot) @@ -716,7 +752,7 @@ public class TEWritingTable extends TileEntity implements IInventory for (int i = 0; i < 5; i++) { - this.decrStackSize(i + 1, 1); + this.decrStackSizeLeaveContainer(i + 1, 1); } if (worldObj != null) @@ -747,7 +783,7 @@ public class TEWritingTable extends TileEntity implements IInventory for (int i = 0; i < 5; i++) { - this.decrStackSize(i + 1, 1); + this.decrStackSizeLeaveContainer(i + 1, 1); } if (worldObj != null) @@ -760,4 +796,49 @@ public class TEWritingTable extends TileEntity implements IInventory //worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } + + @Override + public int[] getAccessibleSlotsFromSide(int var1) + { + ForgeDirection dir = ForgeDirection.getOrientation(var1); + + switch(dir) + { + case DOWN: + return new int[]{0}; + case UP: + return new int[]{6}; + case NORTH: + case SOUTH: + case EAST: + case WEST: + return new int[]{1,2,3,4,5}; + default: + return new int[]{}; + } + } + + @Override + public boolean canInsertItem(int i, ItemStack itemStack, int j) + { + ForgeDirection dir = ForgeDirection.getOrientation(j); + + if(itemStack == null) + { + return false; + } + + if(dir.equals(ForgeDirection.DOWN) && !(itemStack.getItem() instanceof EnergyBattery)) + { + return false; + } + + return true; + } + + @Override + public boolean canExtractItem(int i, ItemStack itemstack, int j) + { + return true; + } } \ No newline at end of file