v0.9.1: cleaned up shield buff code a bit

This commit is contained in:
Evan Debenham 2020-11-18 13:05:37 -05:00
parent fea825d2ee
commit 157b2cab44
2 changed files with 15 additions and 18 deletions

View File

@ -34,7 +34,19 @@ public class Barrier extends ShieldBuff {
}
float partialLostShield;
@Override
public void incShield(int amt) {
super.incShield(amt);
partialLostShield = 0;
}
@Override
public void setShield(int shield) {
super.setShield(shield);
if (shielding() == shield) partialLostShield = 0;
}
@Override
public boolean act() {

View File

@ -49,41 +49,26 @@ public abstract class ShieldBuff extends Buff {
}
public void setShield( int shield ) {
setShield(shield, 0);
}
public void setShield( int shield, float delay ) {
if (this.shielding <= shield) this.shielding = shield;
if (target != null) target.needsShieldUpdate = true;
spend(delay);
}
public void incShield(){
incShield(1);
}
public void incShield( int amt ){
incShield(amt, 0);
}
public void incShield( int amt, float delay ){
public void incShield( int amt ){
shielding += amt;
if (target != null) target.needsShieldUpdate = true;
spend(delay);
}
public void decShield(){
decShield(1);
}
public void decShield( int amt ){
decShield(amt, 0);
}
public void decShield( int amt, float delay ){
public void decShield( int amt ){
shielding -= amt;
if (target != null) target.needsShieldUpdate = true;
spend(delay);
}
//returns the amount of damage leftover