25 lines
1.1 KiB
Java
25 lines
1.1 KiB
Java
package com.atsuishio.superbwarfare.perk.ammo;
|
|
|
|
import com.atsuishio.superbwarfare.data.gun.GunData;
|
|
import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
|
import com.atsuishio.superbwarfare.perk.Perk;
|
|
import com.atsuishio.superbwarfare.perk.PerkInstance;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.entity.LivingEntity;
|
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
public class JHPBullet extends AmmoPerk {
|
|
|
|
public JHPBullet() {
|
|
super(new AmmoPerk.Builder("jhp_bullet", Perk.Type.AMMO).bypassArmorRate(-0.2f).damageRate(1.1f).speedRate(0.95f).slug(true).rgb(230, 131, 65));
|
|
}
|
|
|
|
@Override
|
|
public float getModifiedDamage(float damage, GunData data, PerkInstance instance, @Nullable LivingEntity target, DamageSource source) {
|
|
if (target != null) {
|
|
return damage * (1.0f + 0.12f * instance.level()) * ((float) (10 / (target.getAttributeValue(Attributes.ARMOR) + 10)) + 0.25f);
|
|
}
|
|
return super.getModifiedDamage(damage, data, instance, null, source);
|
|
}
|
|
}
|