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

@ -35,6 +35,18 @@ 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,13 +49,8 @@ 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(){
@ -63,13 +58,8 @@ public abstract class ShieldBuff extends Buff {
}
public void incShield( int amt ){
incShield(amt, 0);
}
public void incShield( int amt, float delay ){
shielding += amt;
if (target != null) target.needsShieldUpdate = true;
spend(delay);
}
public void decShield(){
@ -77,13 +67,8 @@ public abstract class ShieldBuff extends Buff {
}
public void decShield( int amt ){
decShield(amt, 0);
}
public void decShield( int amt, float delay ){
shielding -= amt;
if (target != null) target.needsShieldUpdate = true;
spend(delay);
}
//returns the amount of damage leftover