mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-05-11 15:01:24 -07:00
Merge 927b037a52 into 54443b9517
This commit is contained in:
commit
ceffa45383
2 changed files with 11 additions and 2 deletions
|
|
@ -498,6 +498,11 @@ public class Damage{
|
|||
|
||||
/** Damages all entities and blocks in a radius that are enemies of the team. */
|
||||
public static void damage(Team team, float x, float y, float radius, float damage, boolean complete, boolean air, boolean ground, boolean scaled, @Nullable Bullet source){
|
||||
damage(team, x, y, radius, damage, complete, air, ground, scaled, source, 1);
|
||||
}
|
||||
|
||||
/** Damages all entities and blocks in a radius that are enemies of the team. */
|
||||
public static void damage(Team team, float x, float y, float radius, float damage, boolean complete, boolean air, boolean ground, boolean scaled, @Nullable Bullet source, float armorMult){
|
||||
Cons<Unit> cons = unit -> {
|
||||
if(unit.team == team || !unit.checkTarget(air, ground) || !unit.hittable() || !unit.within(x, y, radius + (scaled ? unit.hitSize / 2f : 0f))){
|
||||
return;
|
||||
|
|
@ -506,7 +511,11 @@ public class Damage{
|
|||
boolean dead = unit.dead;
|
||||
|
||||
float amount = calculateDamage(scaled ? Math.max(0, unit.dst(x, y) - unit.type.hitSize/2) : unit.dst(x, y), radius, damage);
|
||||
unit.damage(amount);
|
||||
if(armorMult != 1){
|
||||
unit.damageArmorMult(amount, armorMult);
|
||||
}else{
|
||||
unit.damage(amount);
|
||||
}
|
||||
|
||||
if(source != null){
|
||||
Events.fire(bulletDamageEvent.set(unit, source));
|
||||
|
|
|
|||
|
|
@ -592,7 +592,7 @@ public class BulletType extends Content implements Cloneable{
|
|||
|
||||
public void createSplashDamage(Bullet b, float x, float y){
|
||||
if(splashDamageRadius > 0 && !b.absorbed){
|
||||
Damage.damage(b.team, x, y, splashDamageRadius, splashDamage * b.damageMultiplier(), splashDamagePierce, collidesAir, collidesGround, scaledSplashDamage, b);
|
||||
Damage.damage(b.team, x, y, splashDamageRadius, splashDamage * b.damageMultiplier(), splashDamagePierce, collidesAir, collidesGround, scaledSplashDamage, b, armorMultiplier);
|
||||
|
||||
if(status != StatusEffects.none){
|
||||
Damage.status(b.team, x, y, splashDamageRadius, status, statusDuration, collidesAir, collidesGround);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue