Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2023-01-11 09:23:29 -05:00
39 changed files with 57 additions and 9 deletions

View File

@@ -1597,7 +1597,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
public boolean collision(Bullet other){
boolean wasDead = health <= 0;
damage(other.team, other.damage() * other.type().buildingDamageMultiplier);
float damage = other.damage() * other.type().buildingDamageMultiplier;
if(!other.type.pierceArmor){
damage = Damage.applyArmor(damage, block.armor);
}
damage(other.team, damage);
Events.fire(bulletDamageEvent.set(self(), other));
if(health <= 0 && !wasDead){
@@ -1853,7 +1858,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
if(Mathf.zero(dm)){
damage = health + 1;
}else{
damage = Damage.applyArmor(damage, block.armor) / dm;
damage /= dm;
}
//TODO handle this better on the client.

View File

@@ -589,7 +589,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
float power = item().charge * Mathf.pow(stack().amount, 1.11f) * 160f;
if(!spawnedByCore){
Damage.dynamicExplosion(x, y, flammability, explosiveness, power, (bounds() + type.legLength/1.7f) / 2f, state.rules.damageExplosions && state.rules.unitCrashDamage, item().flammability > 1, team, type.deathExplosionEffect);
Damage.dynamicExplosion(x, y, flammability, explosiveness, power, (bounds() + type.legLength/1.7f) / 2f, state.rules.damageExplosions && state.rules.unitCrashDamage(team) > 0, item().flammability > 1, team, type.deathExplosionEffect);
}else{
type.deathExplosionEffect.at(x, y, bounds() / 2f / 8f);
}
@@ -617,8 +617,8 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
}
//if this unit crash landed (was flying), damage stuff in a radius
if(type.flying && !spawnedByCore && type.createWreck && state.rules.unitCrashDamage){
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f * state.rules.unitDamage(team), true, false, true);
if(type.flying && !spawnedByCore && type.createWreck && state.rules.unitCrashDamage(team) > 0){
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f * state.rules.unitCrashDamage(team), true, false, true);
}
if(!headless && type.createScorch){

View File

@@ -51,8 +51,6 @@ public class Rules{
public boolean damageExplosions = true;
/** Whether fire (and neoplasm spread) is enabled. */
public boolean fire = true;
/** Whether unit crash damage is enabled. */
public boolean unitCrashDamage = true;
/** Whether units use and require ammo. */
public boolean unitAmmo = false;
/** EXPERIMENTAL! If true, blocks will update in units and share power. */
@@ -67,8 +65,10 @@ public class Rules{
public float unitBuildSpeedMultiplier = 1f;
/** Multiplier of resources that units take to build. */
public float unitCostMultiplier = 1f;
/** How much damage any other units deal. */
/** How much damage units deal. */
public float unitDamageMultiplier = 1f;
/** How much damage unit crash damage deals. (Compounds with unitDamageMultiplier) */
public float unitCrashDamageMultiplier = 1f;
/** If true, ghost blocks will appear upon destruction, letting builder blocks/units rebuild them. */
public boolean ghostBlocks = true;
/** Whether to allow units to build with logic. */
@@ -224,6 +224,10 @@ public class Rules{
return unitDamageMultiplier * teams.get(team).unitDamageMultiplier;
}
public float unitCrashDamage(Team team){
return unitDamage(team) * unitCrashDamageMultiplier * teams.get(team).unitCrashDamageMultiplier;
}
public float blockHealth(Team team){
return blockHealthMultiplier * teams.get(team).blockHealthMultiplier;
}
@@ -266,8 +270,10 @@ public class Rules{
/** How fast unit factories build units. */
public float unitBuildSpeedMultiplier = 1f;
/** How much damage any other units deal. */
/** How much damage units deal. */
public float unitDamageMultiplier = 1f;
/** How much damage unit crash damage deals. (Compounds with unitDamageMultiplier) */
public float unitCrashDamageMultiplier = 1f;
/** Multiplier of resources that units take to build. */
public float unitCostMultiplier = 1f;
/** How much health blocks start with. */

View File

@@ -196,6 +196,7 @@ public class CustomRulesDialog extends BaseDialog{
check("@rules.unitcapvariable", b -> rules.unitCapVariable = b, () -> rules.unitCapVariable);
numberi("@rules.unitcap", f -> rules.unitCap = f, () -> rules.unitCap, -999, 999);
number("@rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier);
number("@rules.unitcrashdamagemultiplier", f -> rules.unitCrashDamageMultiplier = f, () -> rules.unitCrashDamageMultiplier);
number("@rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier, 0f, 50f);
number("@rules.unitcostmultiplier", f -> rules.unitCostMultiplier = f, () -> rules.unitCostMultiplier);
@@ -298,6 +299,7 @@ public class CustomRulesDialog extends BaseDialog{
number("@rules.buildspeedmultiplier", f -> teams.buildSpeedMultiplier = f, () -> teams.buildSpeedMultiplier, 0.001f, 50f);
number("@rules.unitdamagemultiplier", f -> teams.unitDamageMultiplier = f, () -> teams.unitDamageMultiplier);
number("@rules.unitcrashdamagemultiplier", f -> teams.unitCrashDamageMultiplier = f, () -> teams.unitCrashDamageMultiplier);
number("@rules.unitbuildspeedmultiplier", f -> teams.unitBuildSpeedMultiplier = f, () -> teams.unitBuildSpeedMultiplier, 0.001f, 50f);
number("@rules.unitcostmultiplier", f -> teams.unitCostMultiplier = f, () -> teams.unitCostMultiplier);