improve berserk stuff

This commit is contained in:
Sunskimmer822 2022-08-02 15:49:12 -07:00
parent 6bd79f8aa3
commit 15a4b57643
2 changed files with 10 additions and 4 deletions

View File

@ -24,8 +24,9 @@ public class berserkEffect extends StatusEffect{
@Override
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
if (entity instanceof PlayerEntity) {
((PlayerEntity) entity).damage(DamageSource.MAGIC, (0.25f));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 2, amplifier*2, true, false, false));
((PlayerEntity) entity).damage(DamageSource.MAGIC, (0.5f));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 2, amplifier*2, false, false, false));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.HASTE, 2, amplifier*2, false, false, false));
}
}

View File

@ -20,12 +20,17 @@ public class berserkerTotem extends Item{
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity playerEntity, Hand hand) {
int rand = new Random().nextInt(5);
int rand2 = new Random().nextInt(3);
ItemStack itemStack = playerEntity.getStackInHand(hand);
if (rand == 0) {
rand++;
playerEntity.addStatusEffect(new StatusEffectInstance(Shitmod.BERSERK, 400, rand));
playerEntity.addStatusEffect(new StatusEffectInstance(Shitmod.BERSERK, 400*(rand2++), rand));
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, playerEntity.getStackInHand(hand));
}
playerEntity.addStatusEffect(new StatusEffectInstance(Shitmod.BERSERK, 400, rand));
playerEntity.addStatusEffect(new StatusEffectInstance(Shitmod.BERSERK, 400*(rand2++), rand));
if (!playerEntity.isCreative()){
itemStack.damage(1, playerEntity, (entity) -> entity.sendToolBreakStatus(hand));
}
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, playerEntity.getStackInHand(hand));