优化涡轮增压器perk

This commit is contained in:
17146 2025-05-07 15:05:38 +08:00 committed by Light_Quanta
parent 7a24ea05d1
commit f8767596d2
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
4 changed files with 30 additions and 3 deletions

View file

@ -677,9 +677,15 @@ public class ClientEventHandler {
burstFireAmount--; burstFireAmount--;
} }
for (Perk.Type type : Perk.Type.values()) {
var instance = data.perk.getInstance(type);
if (instance != null) {
customRpm = instance.perk().getModifiedCustomRPM(customRpm, data, instance);
}
}
if (stack.is(ModItems.DEVOTION.get())) { if (stack.is(ModItems.DEVOTION.get())) {
int perkLevel = data.perk.getLevel(ModPerks.TURBO_CHARGER); customRpm = Math.min(customRpm + 15, 500);
customRpm = Math.min(customRpm + 15 + ((perkLevel > 0 ? 5 : 0) + 3 * perkLevel), 500);
} }
if (stack.getItem() == ModItems.SENTINEL.get()) { if (stack.getItem() == ModItems.SENTINEL.get()) {

View file

@ -52,7 +52,7 @@ public class ModPerks {
public static final DeferredHolder<Perk, Perk> SUBSISTENCE = FUNC_PERKS.register("subsistence", Subsistence::new); public static final DeferredHolder<Perk, Perk> SUBSISTENCE = FUNC_PERKS.register("subsistence", Subsistence::new);
public static final DeferredHolder<Perk, Perk> FIELD_DOCTOR = FUNC_PERKS.register("field_doctor", FieldDoctor::new); public static final DeferredHolder<Perk, Perk> FIELD_DOCTOR = FUNC_PERKS.register("field_doctor", FieldDoctor::new);
public static final DeferredHolder<Perk, Perk> REGENERATION = FUNC_PERKS.register("regeneration", Regeneration::new); public static final DeferredHolder<Perk, Perk> REGENERATION = FUNC_PERKS.register("regeneration", Regeneration::new);
public static final DeferredHolder<Perk, Perk> TURBO_CHARGER = FUNC_PERKS.register("turbo_charger", () -> new Perk("turbo_charger", Perk.Type.FUNCTIONAL)); public static final DeferredHolder<Perk, Perk> TURBO_CHARGER = FUNC_PERKS.register("turbo_charger", TurboCharger::new);
public static final DeferredHolder<Perk, Perk> POWERFUL_ATTRACTION = FUNC_PERKS.register("powerful_attraction", PowerfulAttraction::new); public static final DeferredHolder<Perk, Perk> POWERFUL_ATTRACTION = FUNC_PERKS.register("powerful_attraction", PowerfulAttraction::new);
public static final DeferredHolder<Perk, Perk> INTELLIGENT_CHIP = FUNC_PERKS.register("intelligent_chip", () -> new Perk("intelligent_chip", Perk.Type.FUNCTIONAL)); public static final DeferredHolder<Perk, Perk> INTELLIGENT_CHIP = FUNC_PERKS.register("intelligent_chip", () -> new Perk("intelligent_chip", Perk.Type.FUNCTIONAL));

View file

@ -78,6 +78,10 @@ public class Perk {
return rpm; return rpm;
} }
public int getModifiedCustomRPM(int rpm, GunData data, PerkInstance instance) {
return rpm;
}
/** /**
* 在切换物品时触发 * 在切换物品时触发
*/ */

View file

@ -0,0 +1,17 @@
package com.atsuishio.superbwarfare.perk.functional;
import com.atsuishio.superbwarfare.item.gun.data.GunData;
import com.atsuishio.superbwarfare.perk.Perk;
import com.atsuishio.superbwarfare.perk.PerkInstance;
public class TurboCharger extends Perk {
public TurboCharger() {
super("turbo_charger", Perk.Type.FUNCTIONAL);
}
@Override
public int getModifiedCustomRPM(int rpm, GunData data, PerkInstance instance) {
return rpm + 5 + 3 * instance.level();
}
}