Method refactoring / Cleanup

This commit is contained in:
Anuken
2020-05-30 12:11:00 -04:00
parent 8d0486d425
commit d988b4b5c9
13 changed files with 41 additions and 23 deletions

View File

@@ -2,7 +2,6 @@ package mindustry.entities.comp;
import arc.math.*;
import arc.util.*;
import mindustry.*;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
@@ -53,7 +52,7 @@ abstract class HealthComp implements Entityc{
/** Damage and pierce armor. */
void damagePierce(float amount, boolean withEffect){
if(this instanceof Shieldc){
damage(amount / Math.max(1f - ((Shieldc)this).armor(), Vars.minArmorDamage), withEffect);
damage(amount + ((Shieldc)this).armor(), withEffect);
}else{
damage(amount, withEffect);
}

View File

@@ -12,6 +12,7 @@ import mindustry.annotations.Annotations.*;
import mindustry.core.*;
import mindustry.entities.units.*;
import mindustry.game.*;
import mindustry.game.EventType.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.net.Administration.*;
@@ -143,6 +144,8 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
unit.team(team);
unit.controller(this);
}
Events.fire(new UnitChangeEvent((Playerc)this, unit));
}
boolean dead(){

View File

@@ -23,7 +23,8 @@ abstract class ShieldComp implements Healthc, Posc{
@Override
public void damage(float amount){
//apply armor
amount *= Math.max(1f - armor, minArmorDamage);
//TODO balancing of armor stats & minArmorDamage
amount = Math.max(amount - armor, minArmorDamage * amount);
hitTime = 1f;