V0.2.0: Refined Cloak of Shadows implementation, almost done.
This commit is contained in:
parent
c8ffb41754
commit
92e664472b
|
@ -20,6 +20,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.*;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.*;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
@ -395,7 +396,7 @@ public abstract class Char extends Actor {
|
||||||
sprite.remove( CharSprite.State.BURNING );
|
sprite.remove( CharSprite.State.BURNING );
|
||||||
} else if (buff instanceof Levitation) {
|
} else if (buff instanceof Levitation) {
|
||||||
sprite.remove( CharSprite.State.LEVITATING );
|
sprite.remove( CharSprite.State.LEVITATING );
|
||||||
} else if (buff instanceof Invisibility && invisible <= 0) {
|
} else if (buff instanceof Invisibility || buff instanceof CloakOfShadows.cloakStealth && invisible <= 0) {
|
||||||
sprite.remove( CharSprite.State.INVISIBLE );
|
sprite.remove( CharSprite.State.INVISIBLE );
|
||||||
} else if (buff instanceof Paralysis) {
|
} else if (buff instanceof Paralysis) {
|
||||||
sprite.remove( CharSprite.State.PARALYSED );
|
sprite.remove( CharSprite.State.PARALYSED );
|
||||||
|
|
|
@ -19,7 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakofShadows;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
|
|
||||||
public class Invisibility extends FlavourBuff {
|
public class Invisibility extends FlavourBuff {
|
||||||
|
@ -57,8 +57,9 @@ public class Invisibility extends FlavourBuff {
|
||||||
if (buff != null && Dungeon.hero.visibleEnemies() > 0) {
|
if (buff != null && Dungeon.hero.visibleEnemies() > 0) {
|
||||||
buff.detach();
|
buff.detach();
|
||||||
}
|
}
|
||||||
CloakofShadows.cloakStealth cloakBuff = Dungeon.hero.buff( CloakofShadows.cloakStealth.class );
|
CloakOfShadows.cloakStealth cloakBuff = Dungeon.hero.buff( CloakOfShadows.cloakStealth.class );
|
||||||
if (cloakBuff != null && Dungeon.hero.visibleEnemies() > 0) {
|
if (cloakBuff != null && Dungeon.hero.visibleEnemies() > 0) {
|
||||||
|
cloakBuff.act();
|
||||||
cloakBuff.detach();
|
cloakBuff.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery;
|
import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
|
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
|
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfShadows;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfMagicMissile;
|
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfMagicMissile;
|
||||||
|
@ -140,7 +140,7 @@ public enum HeroClass {
|
||||||
private static void initRogue( Hero hero ) {
|
private static void initRogue( Hero hero ) {
|
||||||
(hero.belongings.weapon = new Dagger()).identify();
|
(hero.belongings.weapon = new Dagger()).identify();
|
||||||
(hero.belongings.armor = new ClothArmor()).identify();
|
(hero.belongings.armor = new ClothArmor()).identify();
|
||||||
(hero.belongings.misc1 = new RingOfShadows()).upgrade().identify();
|
hero.belongings.misc1 = new CloakOfShadows();
|
||||||
new Dart( 8 ).identify().collect();
|
new Dart( 8 ).identify().collect();
|
||||||
new Food().identify().collect();
|
new Food().identify().collect();
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
|
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
import com.watabou.utils.Bundle;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ public class Artifact extends KindofMisc {
|
||||||
protected Buff passiveBuff;
|
protected Buff passiveBuff;
|
||||||
protected Buff activeBuff;
|
protected Buff activeBuff;
|
||||||
|
|
||||||
protected int level = 0;
|
protected int level = 1;
|
||||||
protected int charge = 0;
|
protected int charge = 0;
|
||||||
protected int chargeCap;
|
protected int chargeCap;
|
||||||
|
|
||||||
|
@ -113,4 +114,19 @@ public class Artifact extends KindofMisc {
|
||||||
public class ArtifactBuff extends Buff {
|
public class ArtifactBuff extends Buff {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void storeInBundle( Bundle bundle ) {
|
||||||
|
bundle.put( "level", level );
|
||||||
|
bundle.put( "charge", charge );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
|
level = bundle.getInt("level");
|
||||||
|
charge = bundle.getInt("charge");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,28 +6,40 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
import com.watabou.noosa.tweeners.AlphaTweener;
|
||||||
|
import com.watabou.utils.Bundle;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by debenhame on 25/08/2014.
|
* Created by debenhame on 25/08/2014.
|
||||||
*/
|
*/
|
||||||
public class CloakofShadows extends Artifact {
|
public class CloakOfShadows extends Artifact {
|
||||||
//TODO: add requirements for entering stealth, add levelling mechanic, add bundle support, add polish
|
//TODO: refine requirements for entering stealth, finish bundle support, add polish
|
||||||
|
|
||||||
|
//TODO: known bugs: first tick of stealth sometimes too quick.
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "Cloak of Shadows";
|
name = "Cloak of Shadows";
|
||||||
image = ItemSpriteSheet.ARTIFACT_CLOAK;
|
image = ItemSpriteSheet.ARTIFACT_CLOAK;
|
||||||
|
level = 1;
|
||||||
|
charge = level+4;
|
||||||
|
chargeCap = level+4;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean stealthed = false;
|
private boolean stealthed = false;
|
||||||
|
|
||||||
|
private int exp = 0;
|
||||||
|
|
||||||
public static final String AC_STEALTH = "STEALTH";
|
public static final String AC_STEALTH = "STEALTH";
|
||||||
|
|
||||||
private static final String TXT_STATUS = "%d/%d";
|
private static final String TXT_STATUS = "%d/%d";
|
||||||
|
|
||||||
|
private int cooldown = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<String> actions( Hero hero ) {
|
public ArrayList<String> actions( Hero hero ) {
|
||||||
ArrayList<String> actions = super.actions( hero );
|
ArrayList<String> actions = super.actions( hero );
|
||||||
|
@ -41,21 +53,43 @@ public class CloakofShadows extends Artifact {
|
||||||
if (action.equals( AC_STEALTH )) {
|
if (action.equals( AC_STEALTH )) {
|
||||||
|
|
||||||
if (!stealthed){
|
if (!stealthed){
|
||||||
stealthed = true;
|
if (cooldown <= 0) {
|
||||||
Sample.INSTANCE.play( Assets.SND_MELD );
|
stealthed = true;
|
||||||
activeBuff = activeBuff();
|
Sample.INSTANCE.play(Assets.SND_MELD);
|
||||||
activeBuff.attachTo(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);
|
||||||
|
}
|
||||||
|
hero.sprite.operate(hero.pos);
|
||||||
|
GLog.i("Your cloak blends you into the shadows.");
|
||||||
|
} else {
|
||||||
|
GLog.i("Your cloak needs " + cooldown + " more rounds to re-energize.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
stealthed = false;
|
stealthed = false;
|
||||||
hero.remove(activeBuff);
|
activeBuff.detach();
|
||||||
activeBuff = null;
|
activeBuff = null;
|
||||||
|
hero.sprite.operate( hero.pos );
|
||||||
|
GLog.i("You return from behind your cloak.");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if (stealthed) {
|
||||||
|
stealthed = false;
|
||||||
|
activeBuff.detach();
|
||||||
|
activeBuff = null;
|
||||||
|
GLog.i("You return from behind your cloak.");
|
||||||
|
}
|
||||||
|
|
||||||
super.execute(hero, action);
|
super.execute(hero, action);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,12 +105,12 @@ public class CloakofShadows extends Artifact {
|
||||||
@Override
|
@Override
|
||||||
public String desc() {
|
public String desc() {
|
||||||
//TODO: add description
|
//TODO: add description
|
||||||
return "Need to add a description.";
|
return "Current CD = " + cooldown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String status() {
|
public String status() {
|
||||||
return Utils.format(TXT_STATUS, charge, level+4);
|
return Utils.format(TXT_STATUS, charge, chargeCap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -85,20 +119,23 @@ public class CloakofShadows extends Artifact {
|
||||||
}
|
}
|
||||||
|
|
||||||
public class cloakRecharge extends ArtifactBuff{
|
public class cloakRecharge extends ArtifactBuff{
|
||||||
int partialCharge = 0;
|
double partialCharge = 0;
|
||||||
@Override
|
@Override
|
||||||
public boolean act() {
|
public boolean act() {
|
||||||
if (charge < level+4) {
|
if (charge < chargeCap) {
|
||||||
if (!stealthed)
|
if (!stealthed)
|
||||||
partialCharge += (level + 4) / 300;
|
partialCharge += (chargeCap * 0.00334);
|
||||||
|
|
||||||
if (partialCharge >= 100) {
|
if (partialCharge >= 1) {
|
||||||
charge++;
|
charge++;
|
||||||
partialCharge -= 100;
|
partialCharge -= 1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
partialCharge = 0;
|
partialCharge = 0;
|
||||||
|
|
||||||
|
if (cooldown > 0)
|
||||||
|
cooldown --;
|
||||||
|
|
||||||
spend( TICK );
|
spend( TICK );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -125,8 +162,20 @@ public class CloakofShadows extends Artifact {
|
||||||
@Override
|
@Override
|
||||||
public boolean act(){
|
public boolean act(){
|
||||||
charge--;
|
charge--;
|
||||||
if (charge <= 0)
|
if (charge <= 0) {
|
||||||
detach();
|
detach();
|
||||||
|
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;
|
||||||
|
|
||||||
|
if (exp >= level*50 && level < 26) {
|
||||||
|
exp -= level*50;
|
||||||
|
GLog.p("Your Cloak Grows Stronger!");
|
||||||
|
level++;
|
||||||
|
chargeCap++;
|
||||||
|
}
|
||||||
|
|
||||||
spend( TICK );
|
spend( TICK );
|
||||||
|
|
||||||
|
@ -142,7 +191,21 @@ public class CloakofShadows extends Artifact {
|
||||||
public void detach() {
|
public void detach() {
|
||||||
target.invisible--;
|
target.invisible--;
|
||||||
stealthed = false;
|
stealthed = false;
|
||||||
|
cooldown = 18 - (level / 2);
|
||||||
super.detach();
|
super.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void storeInBundle( Bundle bundle ) {
|
||||||
|
super.storeInBundle(bundle);
|
||||||
|
//bundle.put("stealthed", stealthed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
|
super.restoreFromBundle(bundle);
|
||||||
|
chargeCap = level+4;
|
||||||
|
//stealthed = bundle.getBoolean("stealthed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user