V0.2.0: cleaned artifact class structure, improved cloak.
This commit is contained in:
parent
fdfae8e215
commit
2f6f42c946
|
@ -20,9 +20,15 @@ public class Artifact extends KindofMisc {
|
|||
protected Buff passiveBuff;
|
||||
protected Buff activeBuff;
|
||||
|
||||
//level is used internally to track upgrades to artifacts, size/logic varies per artifact.
|
||||
protected int level = 1;
|
||||
//the current artifact charge
|
||||
protected int charge = 0;
|
||||
protected int chargeCap;
|
||||
//the % towards next charge, should roll over at a value of 1 or higher.
|
||||
//better to keep charge as an int and use a separate float than casting.
|
||||
protected float partialCharge = 0;
|
||||
//the maximum charge, varies per artifact, not all artifacts use this.
|
||||
protected int chargeCap = 0;
|
||||
|
||||
|
||||
public Artifact(){
|
||||
|
@ -119,12 +125,16 @@ public class Artifact extends KindofMisc {
|
|||
public void storeInBundle( Bundle bundle ) {
|
||||
bundle.put( "level", level );
|
||||
bundle.put( "charge", charge );
|
||||
bundle.put( "partialcharge", partialCharge);
|
||||
bundle.put( "chargecap", chargeCap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
level = bundle.getInt("level");
|
||||
charge = bundle.getInt("charge");
|
||||
partialCharge = bundle.getFloat("partialcharge");
|
||||
chargeCap = bundle.getInt("chargecap");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
|
|||
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
@ -18,9 +19,9 @@ import java.util.ArrayList;
|
|||
* Created by debenhame on 25/08/2014.
|
||||
*/
|
||||
public class CloakOfShadows extends Artifact {
|
||||
//TODO: refine requirements for entering stealth, finish bundle support, add polish
|
||||
//TODO: testing, add polish
|
||||
|
||||
//TODO: known bugs: first tick of stealth sometimes too quick.
|
||||
//TODO: known bugs: first tick of stealth sometimes too quick, test current fix.
|
||||
|
||||
{
|
||||
name = "Cloak of Shadows";
|
||||
|
@ -119,7 +120,6 @@ public class CloakOfShadows extends Artifact {
|
|||
}
|
||||
|
||||
public class cloakRecharge extends ArtifactBuff{
|
||||
double partialCharge = 0;
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (charge < chargeCap) {
|
||||
|
@ -204,13 +204,22 @@ public class CloakOfShadows extends Artifact {
|
|||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle(bundle);
|
||||
//bundle.put("stealthed", stealthed);
|
||||
bundle.put("stealthed", stealthed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
chargeCap = level+4;
|
||||
//stealthed = bundle.getBoolean("stealthed");
|
||||
stealthed = bundle.getBoolean("stealthed");
|
||||
if (stealthed) {
|
||||
Hero hero = Dungeon.hero;
|
||||
activeBuff = activeBuff();
|
||||
activeBuff.attachTo(hero);
|
||||
if (hero.sprite.parent != null) {
|
||||
hero.sprite.parent.add(new AlphaTweener(hero.sprite, 0.4f, 0.4f));
|
||||
} else {
|
||||
hero.sprite.alpha(0.4f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user