Fixing fractional vis costs

Should address #50
This commit is contained in:
Jeremy Diamond committed 2015-02-25 20:38:39 -08:00
1 parent 4e110ddd01
commit b4bf64ebd0
5 files changed
+41 -27

No files matched your search

@@ -27,17 +27,19 @@ public class BloodStaffUpdate implements IWandRodOnUpdate {
int cost;
if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("alchemical"))
cost = 900;
cost = 9;
else
cost = 1000;
cost = 10;
for(int x = 0;x < primals.length;x++)
{
if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack))
int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
if(deficit > 0)
{
deficit = Math.min(deficit, 100);
if(player.capabilities.isCreativeMode)
((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
else if(SoulNetworkHandler.syphonFromNetwork(itemstack, cost) > 0)
else if(SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0)
((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
else if(syphonHealth(player))
{
@@ -23,17 +23,19 @@ public class BloodWandUpdate implements IWandRodOnUpdate {
int cost;
if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("alchemical"))
cost = 900;
cost = 9;
else
cost = 1000;
cost = 10;
for(int x = 0;x < primals.length;x++)
{
if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack))
int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
if(deficit > 0)
{
deficit = Math.min(deficit, 100);
if(player.capabilities.isCreativeMode)
((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
else if(SoulNetworkHandler.syphonFromNetwork(itemstack, cost) > 0)
else if(SoulNetworkHandler.syphonFromNetwork(itemstack, cost * deficit) > 0)
((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
else if(syphonHealth(player))
{
@@ -1,11 +1,14 @@
package fox.spiteful.forbidden.items.wands;
import am2.api.ArsMagicaApi;
import am2.api.IExtendedProperties;
import fox.spiteful.forbidden.Config;
import fox.spiteful.forbidden.compat.Compat;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.wands.IWandRodOnUpdate;
import thaumcraft.common.items.wands.ItemWandCasting;
public class ManaStaffUpdate implements IWandRodOnUpdate {
@@ -16,30 +19,31 @@ public class ManaStaffUpdate implements IWandRodOnUpdate {
{
if(player.ticksExisted % 40 == 0){
//TODO: Readd ArsMagica Support
try
{
/* IExtendedProperties prop = ArsMagicaApi.instance.getExtendedProperties(player);
IExtendedProperties prop = ArsMagicaApi.instance.getExtendedProperties(player);
float cost;
if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("vinteum"))
cost = 50.0F;
cost = 0.5F;
else
cost = 100.0F;
cost = 1.0F;
if(prop == null || prop.getCurrentMana() <= 0)
return;
for(int x = 0;x < primals.length;x++){
if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack)) {
if(prop.getCurrentMana() > cost)
{
prop.setCurrentMana(prop.getCurrentMana() - cost);
int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
if(deficit > 0) {
deficit = Math.min(deficit, 100);
if(prop.getCurrentMana() > cost * deficit)
{
prop.setCurrentMana(prop.getCurrentMana() - cost * deficit);
((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
}
}
}*/
}
}
catch(Throwable e){}
}
@@ -26,19 +26,21 @@ public class ManaWandUpdate implements IWandRodOnUpdate {
float cost;
if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("vinteum"))
cost = 80.0F;
cost = 0.8F;
else
cost = 140.0F;
cost = 1.4F;
if(prop == null || prop.getCurrentMana() <= 0)
return;
for(int x = 0;x < primals.length;x++){
if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack)) {
if(prop.getCurrentMana() > cost)
int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
if(deficit > 0) {
deficit = Math.min(deficit, 100);
if(prop.getCurrentMana() > cost * deficit)
{
prop.setCurrentMana(prop.getCurrentMana() - cost);
prop.setCurrentMana(prop.getCurrentMana() - cost * deficit);
((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
}
}
@@ -1,8 +1,10 @@
package fox.spiteful.forbidden.items.wands;
import fox.spiteful.forbidden.Config;
import fox.spiteful.forbidden.LogHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import org.apache.logging.log4j.Level;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.wands.IWandRodOnUpdate;
import thaumcraft.common.items.wands.ItemWandCasting;
@@ -23,15 +25,17 @@ public class YandereWandUpdate implements IWandRodOnUpdate {
int cost;
if(((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("manasteel")
||((ItemWandCasting)itemstack.getItem()).getCap(itemstack).getTag().equals("elementium"))
cost = 900;
cost = 9;
else
cost = 1100;
cost = 11;
for(int x = 0;x < primals.length;x++)
{
if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack))
int deficit = ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) - ((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]);
if(deficit > 0)
{
if(ManaItemHandler.requestManaExact(itemstack, player, cost, true))
deficit = Math.min(deficit, 100);
if(ManaItemHandler.requestManaExact(itemstack, player, cost * deficit, true))
((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
}
}