Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rudahee committed Apr 13, 2023
2 parents b47adaf + 57a7583 commit 58c0eba
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,8 @@ public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity sour
stack.setTag(generateTags(stack));
}


if ((target instanceof Player) && (source instanceof Player)){


target.getCapability(ModBlocksRegister.InvestedCapabilityRegister.PLAYER_CAP).ifPresent(targetData -> {

boolean hasAllomanticPower = targetData.hasAllomanticPower(MetalTagEnum.getMetal(stack.getTag().getInt("metal_spike")));
Expand All @@ -208,6 +206,8 @@ public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity sour
Level world = target.level;
BlockPos pos = new BlockPos(target.position());



//DAR PODER
if (stack.getTag().getBoolean("allomantic_power")){
if (!targetData.hasAllomanticPower(localMetal)){
Expand All @@ -224,8 +224,8 @@ public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity sour
} else if (hasPlayerBothPowers(localMetal, targetData)) {
//SI EL OBJETIVO TIENE AMBOS PODERES
if (isAllomantic) {
if (Math.random()>0.50){
if (Math.random()<0.75){
if (couldStealPower){
if (couldRemovePower){
targetData.removeAllomanticPower(localMetal);

target.addEffect(new MobEffectInstance(MobEffects.GLOWING, 40, 1, true, true, false));
Expand All @@ -237,8 +237,8 @@ public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity sour
addItemToPlayer((Player) source, stack);
}
} else {
if (Math.random()>0.50){
if (Math.random()<0.75){
if (couldStealPower){
if (couldRemovePower){
targetData.removeFeruchemicPower(localMetal);

target.addEffect(new MobEffectInstance(MobEffects.GLOWING, 40, 1, true, true, false));
Expand All @@ -251,8 +251,8 @@ public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity sour
}
}
} else if (hasAllomanticPower){
if (Math.random()>0.50){
if (Math.random()<0.75){
if (couldStealPower){
if (couldRemovePower){
targetData.removeAllomanticPower(localMetal);

target.addEffect(new MobEffectInstance(MobEffects.GLOWING, 40, 1, true, true, false));
Expand All @@ -264,21 +264,19 @@ public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity sour
addItemToPlayer((Player) source, stack);
}
} else if (hasFeruchemicPower){
if (Math.random()>0.50){
if (Math.random()<0.75) {

if (couldStealPower){
if (couldRemovePower) {

targetData.removeFeruchemicPower(localMetal);

target.addEffect(new MobEffectInstance(MobEffects.GLOWING, 40, 1, true, true, false));

target.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 20, 1, true, true, false));

}
stack.getTag().putBoolean("feruchemic_power",true);
addItemToPlayer((Player) source, stack);
}
}
((Player) source).getInventory().removeItem(stack);
ModNetwork.sync(targetData,(Player) target);
});
}
Expand Down

0 comments on commit 58c0eba

Please sign in to comment.