Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -46,6 +46,8 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
public boolean pierceBuilding;
|
public boolean pierceBuilding;
|
||||||
/** Maximum # of pierced objects. */
|
/** Maximum # of pierced objects. */
|
||||||
public int pierceCap = -1;
|
public int pierceCap = -1;
|
||||||
|
/** Multiplier of damage decreased per health pierced. */
|
||||||
|
public float pierceDamageFactor = 0f;
|
||||||
/** If false, this bullet isn't removed after pierceCap is exceeded. Expert usage only. */
|
/** If false, this bullet isn't removed after pierceCap is exceeded. Expert usage only. */
|
||||||
public boolean removeAfterPierce = true;
|
public boolean removeAfterPierce = true;
|
||||||
/** For piercing lasers, setting this to true makes it get absorbed by plastanium walls. */
|
/** For piercing lasers, setting this to true makes it get absorbed by plastanium walls. */
|
||||||
@@ -360,6 +362,8 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
}else if(build.team != b.team && direct){
|
}else if(build.team != b.team && direct){
|
||||||
hit(b);
|
hit(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlePierce(b, initialHealth, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hitEntity(Bullet b, Hitboxc entity, float health){
|
public void hitEntity(Bullet b, Hitboxc entity, float health){
|
||||||
@@ -385,6 +389,19 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
if(!wasDead && entity instanceof Unit unit && unit.dead){
|
if(!wasDead && entity instanceof Unit unit && unit.dead){
|
||||||
Events.fire(new UnitBulletDestroyEvent(unit, b));
|
Events.fire(new UnitBulletDestroyEvent(unit, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlePierce(b, health, entity.x(), entity.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handlePierce(Bullet b, float initialHealth, float x, float y){
|
||||||
|
float sub = Math.max(initialHealth*pierceDamageFactor, 0);
|
||||||
|
//subtract health from each consecutive pierce
|
||||||
|
b.damage -= Math.min(b.damage, sub);
|
||||||
|
|
||||||
|
if(removeAfterPierce && b.damage <= 0){
|
||||||
|
b.hit = true;
|
||||||
|
b.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float damageMultiplier(Bullet b){
|
public float damageMultiplier(Bullet b){
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ public class RailBulletType extends BulletType{
|
|||||||
|
|
||||||
public Effect pierceEffect = Fx.hitBulletSmall, pointEffect = Fx.none, lineEffect = Fx.none;
|
public Effect pierceEffect = Fx.hitBulletSmall, pointEffect = Fx.none, lineEffect = Fx.none;
|
||||||
public Effect endEffect = Fx.none;
|
public Effect endEffect = Fx.none;
|
||||||
/** Multiplier of damage decreased per health pierced. */
|
|
||||||
public float pierceDamageFactor = 1f;
|
|
||||||
|
|
||||||
public float length = 100f;
|
public float length = 100f;
|
||||||
|
|
||||||
@@ -37,8 +35,9 @@ public class RailBulletType extends BulletType{
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle(Bullet b, float initialHealth, float x, float y){
|
@Override
|
||||||
float sub = Math.max(initialHealth*pierceDamageFactor, 0);
|
public void handlePierce(Bullet b, float initialHealth, float x, float y){
|
||||||
|
float sub = Math.max(initialHealth * pierceDamageFactor, 0);
|
||||||
|
|
||||||
if(b.damage <= 0){
|
if(b.damage <= 0){
|
||||||
b.fdata = Math.min(b.fdata, b.dst(x, y));
|
b.fdata = Math.min(b.fdata, b.dst(x, y));
|
||||||
@@ -93,14 +92,8 @@ public class RailBulletType extends BulletType{
|
|||||||
return bullet.team != tile.team;
|
return bullet.team != tile.team;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void hitEntity(Bullet b, Hitboxc entity, float health){
|
|
||||||
super.hitEntity(b, entity, health);
|
|
||||||
handle(b, health, entity.getX(), entity.getY());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hitTile(Bullet b, Building build, float x, float y, float initialHealth, boolean direct){
|
public void hitTile(Bullet b, Building build, float x, float y, float initialHealth, boolean direct){
|
||||||
handle(b, initialHealth, x, y);
|
handlePierce(b, initialHealth, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ public class SettingsMenuDialog extends BaseDialog{
|
|||||||
|
|
||||||
int[] lastUiScale = {settings.getInt("uiscale", 100)};
|
int[] lastUiScale = {settings.getInt("uiscale", 100)};
|
||||||
|
|
||||||
graphics.sliderPref("uiscale", 100, 25, 300, 25, s -> {
|
graphics.sliderPref("uiscale", 100, 5, 300, 5, s -> {
|
||||||
//if the user changed their UI scale, but then put it back, don't consider it 'changed'
|
//if the user changed their UI scale, but then put it back, don't consider it 'changed'
|
||||||
Core.settings.put("uiscalechanged", s != lastUiScale[0]);
|
Core.settings.put("uiscalechanged", s != lastUiScale[0]);
|
||||||
return s + "%";
|
return s + "%";
|
||||||
|
|||||||
Reference in New Issue
Block a user