V0.2.0: added safety checks for invisibility (fixes bug with new item).

This commit is contained in:
Evan Debenham 2014-08-26 09:58:14 -04:00
parent ac16a38c15
commit fdfae8e215
2 changed files with 10 additions and 4 deletions

View File

@ -38,7 +38,8 @@ public class Invisibility extends FlavourBuff {
@Override @Override
public void detach() { public void detach() {
target.invisible--; if (target.invisible > 0)
target.invisible--;
super.detach(); super.detach();
} }

View File

@ -129,6 +129,10 @@ public class CloakOfShadows extends Artifact {
if (partialCharge >= 1) { if (partialCharge >= 1) {
charge++; charge++;
partialCharge -= 1; partialCharge -= 1;
if (charge == chargeCap){
GLog.p("Your cloak is fully charged.");
partialCharge = 0;
}
} }
} else } else
partialCharge = 0; partialCharge = 0;
@ -153,6 +157,7 @@ public class CloakOfShadows extends Artifact {
public boolean attachTo( Char target ) { public boolean attachTo( Char target ) {
if (super.attachTo( target )) { if (super.attachTo( target )) {
target.invisible++; target.invisible++;
spend(TICK);
return true; return true;
} else { } else {
return false; return false;
@ -165,8 +170,7 @@ public class CloakOfShadows extends Artifact {
if (charge <= 0) { if (charge <= 0) {
detach(); detach();
GLog.w("Your cloak has run out of energy."); GLog.w("Your cloak has run out of energy.");
} else if (charge == 2) }
GLog.w("Your cloak is almost out of energy.");
exp += 10 + ((Hero)target).lvl; exp += 10 + ((Hero)target).lvl;
@ -189,7 +193,8 @@ public class CloakOfShadows extends Artifact {
@Override @Override
public void detach() { public void detach() {
target.invisible--; if (target.invisible > 0)
target.invisible--;
stealthed = false; stealthed = false;
cooldown = 18 - (level / 2); cooldown = 18 - (level / 2);
super.detach(); super.detach();