|
发表于 2022-3-1 12:28:19
|
显示全部楼层
stats.getBallisticAmmoRegenMult().modifyMult(id, 1 + ReloadRate*0.001f );
stats.getEnergyAmmoRegenMult().modifyMult(id, 1 + ReloadRate*0.001f );
stats.getMissileAmmoRegenMult().modifyMult(id, 1 + ReloadRate*0.001f );
0.95下无效
public void advanceInCombat(ShipAPI ship, float amount) {
if (!ship.isAlive()) return;
if (ship.getFullTimeDeployed() >= 0.5f) return;
Map<String, Object> customCombatData = Global.getCombatEngine().getCustomData();
String id = ship.getId();
if (customCombatData.get("ExpandedMagazines" + id) instanceof Boolean) return;
MutableShipStatsAPI stats = ship.getMutableStats();
for (WeaponAPI w : ship.getAllWeapons()) {
float reloadRate = w.getAmmoPerSecond();
float ammoRegen = 1;
if (w.isBeam()) ammoRegen *= stats.getDynamic().getStat("BALLISTIC_AMMO_REGEN").getModifiedValue();
if (w.getType() == WeaponType.ENERGY && w.usesAmmo() && reloadRate > 0) {
ammoRegen *= stats.getDynamic().getStat("ENERGY_AMMO_REGEN").getModifiedValue();
w.getAmmoTracker().setAmmoPerSecond(w.getAmmoTracker().getAmmoPerSecond() * ammoRegen);
} else if (w.getType() == WeaponType.BALLISTIC && w.usesAmmo() && reloadRate > 0){
ammoRegen *= stats.getDynamic().getStat("BALLISTIC_AMMO_REGEN").getModifiedValue();
w.getAmmoTracker().setAmmoPerSecond(w.getAmmoTracker().getAmmoPerSecond() * ammoRegen);
}
}
customCombatData.put("ExpandedMagazines" + id, true);
}
在战斗中检索武器是否有弹药及是否自动恢复弹药,都是的话通过设置每秒恢复弹药量来改变恢复时间 |
|