v0.4.3a: reworked glyph of brimstone

This commit is contained in:
Evan Debenham 2016-10-19 15:53:58 -04:00
parent a5d835f2f4
commit 0ca487094d
3 changed files with 88 additions and 7 deletions

View File

@ -87,12 +87,7 @@ public class Burning extends Buff implements Hero.Doom {
if (hero.belongings.armor != null && hero.belongings.armor.hasGlyph(Brimstone.class)){
float heal = hero.belongings.armor.level()/5f;
if (Random.Float() < heal % 1) heal++;
if (heal >= 1 && hero.HP < hero.HT) {
hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), (int)heal);
hero.HP = Math.min(hero.HT, hero.HP + (int)heal);
}
Buff.affect(target, Brimstone.BrimstoneShield.class);
} else {
@ -138,6 +133,11 @@ public class Burning extends Buff implements Hero.Doom {
}
} else {
Brimstone.BrimstoneShield brimShield = target.buff(Brimstone.BrimstoneShield.class);
if (brimShield != null)
brimShield.startDecay();
detach();
}

View File

@ -21,8 +21,12 @@
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.utils.Bundle;
public class Brimstone extends Armor.Glyph {
@ -39,4 +43,81 @@ public class Brimstone extends Armor.Glyph {
return ORANGE;
}
public static class BrimstoneShield extends Buff {
private int shieldAdded;
private int lastShield = -1;
@Override
public boolean act() {
Hero hero = (Hero)target;
//make sure any shielding lost through combat is accounted for
if (lastShield != -1 && lastShield > hero.SHLD)
shieldAdded = Math.max(0, shieldAdded - (lastShield - hero.SHLD));
lastShield = hero.SHLD;
if (hero.belongings.armor == null || !hero.belongings.armor.hasGlyph(Brimstone.class)) {
hero.SHLD -= shieldAdded;
detach();
return true;
}
int level = hero.belongings.armor.level();
if (hero.buff(Burning.class) != null){
//max shielding equal to the armors level (this does mean no shield at lvl 0)
if (hero.SHLD < level) {
shieldAdded++;
hero.SHLD++;
lastShield++;
//generates 0.2 + 0.1*lvl shield per turn
spend( 10f / (2f + level));
} else {
//if shield is maxed, don't wait longer than 1 turn to try again
spend( Math.min( TICK, 10f / (2f + level)));
}
} else if (hero.buff(Burning.class) == null){
if (shieldAdded > 0 && hero.SHLD > 0){
shieldAdded--;
hero.SHLD--;
lastShield--;
//shield decays at a rate of 1 per turn.
spend(TICK);
} else {
detach();
}
}
return true;
}
public void startDecay(){
//sets the buff to start acting next turn. Invoked by Burning when it expires.
spend(-cooldown()+2);
}
private static String ADDED = "added";
private static String LAST = "last";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put( ADDED, shieldAdded );
bundle.put( LAST, lastShield );
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
shieldAdded = bundle.getInt( ADDED );
lastShield = bundle.getInt( LAST );
}
}
}

View File

@ -26,7 +26,7 @@ items.armor.glyphs.antimagic.name=%s of anti-magic
items.armor.glyphs.antimagic.desc=This powerful glyph allows armor to apply its defense to most magical attacks as well as physical ones.
items.armor.glyphs.brimstone.name=%s of brimstone
items.armor.glyphs.brimstone.desc=This glyph protects the wearer and their belongings from fire, with upgrades it even converts the heat into health.
items.armor.glyphs.brimstone.desc=This glyph protects the wearer and their belongings from fire, with upgrades it even converts the heat into temporary shielding.
items.armor.glyphs.camouflage.name=%s of camouflage
items.armor.glyphs.camouflage.desc=This glyph allows the wearer to blend into tall grass, granting them temporary invisibility.