Skip to content

Commit

Permalink
Remove the resizing for perfect dodge and add a 10% chance to dodge p…
Browse files Browse the repository at this point in the history
…rojectiles instead
  • Loading branch information
bonii-xx committed Nov 16, 2014
1 parent 7f87fea commit 08bdb07
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 33 deletions.
33 changes: 0 additions & 33 deletions src/main/java/tconstruct/armor/ArmorAbilities.java
Expand Up @@ -21,11 +21,6 @@

public class ArmorAbilities
{
//Abilities
boolean morphed;
boolean morphLoaded = Loader.isModLoaded("Morph");
boolean smartmoveLoaded = Loader.isModLoaded("SmartMoving");

public static List<String> stepBoostedPlayers = new ArrayList();
//ItemStack prevFeet;
double prevMotionY;
Expand Down Expand Up @@ -91,34 +86,6 @@ else if (stepBoosted && (feet == null || !(feet.getItem() instanceof TravelGear)
{
stack.getItem().onUpdate(stack, player.worldObj, player, 8, true);
}*/

if (morphLoaded)
{
if (morph.api.Api.hasMorph(player.getCommandSenderName(), event.side.isClient()))
{
morphed = true;
}
}

if (!player.isPlayerSleeping() && !smartmoveLoaded)
{
ItemStack chest = player.getCurrentArmor(2);
if (chest == null || !(chest.getItem() instanceof IModifyable))
{
if (!(morphLoaded && morphed))
PlayerAbilityHelper.setEntitySize(player, 0.6F, 1.8F);
}
else
{
NBTTagCompound tag = chest.getTagCompound().getCompoundTag(((IModifyable) chest.getItem()).getBaseTagName());
int dodge = tag.getInteger("Perfect Dodge");
if (dodge > 0)
{
if (!(morphLoaded && morphed))
PlayerAbilityHelper.setEntitySize(player, Math.max(0.15F, 0.6F - (dodge * 0.09f)), 1.8F - (dodge * 0.04f));
}
}
}
}


Expand Down
22 changes: 22 additions & 0 deletions src/main/java/tconstruct/armor/TinkerArmorEvents.java
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.entity.boss.*;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.event.entity.living.*;
Expand Down Expand Up @@ -103,4 +104,25 @@ public void slimefall (LivingFallEvent event)
}
}
}

@SubscribeEvent
public void perfectDodge(LivingAttackEvent event)
{
if(!event.source.isProjectile())
return;

// perfect dodge?
if(!(event.entityLiving instanceof EntityPlayer))
return;

EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack chest = player.getCurrentArmor(2);
if(chest == null || !(chest.getItem() instanceof IModifyable) || !chest.hasTagCompound())
return;

NBTTagCompound tags = chest.getTagCompound().getCompoundTag(((IModifyable) chest.getItem()).getBaseTagName());
int dodge = tags.getInteger("Perfect Dodge");
if(dodge > TConstruct.random.nextInt(10))
event.setCanceled(true);
}
}

0 comments on commit 08bdb07

Please sign in to comment.