v0.2.3: quickslot refactoring for artifacts

This commit is contained in:
Evan Debenham 2014-12-09 16:40:36 -05:00
parent 8dba48813d
commit b851be162e
6 changed files with 94 additions and 76 deletions

View File

@ -57,7 +57,10 @@ public class CloakOfShadows extends Artifact {
if (action.equals( AC_STEALTH )) {
if (!stealthed){
if (cooldown <= 0 && charge >= 2 && isEquipped(hero)) {
if (!isEquipped(hero)) GLog.i("You need to equip your cloak to do that.");
else if (cooldown > 0) GLog.i("Your cloak needs " + cooldown + " more rounds to re-energize.");
else if (charge <= 1) GLog.i("Your cloak hasn't recharged enough to be usable yet.");
else {
stealthed = true;
hero.spend( 1f );
hero.busy();
@ -71,12 +74,6 @@ public class CloakOfShadows extends Artifact {
}
hero.sprite.operate(hero.pos);
GLog.i("Your cloak blends you into the shadows.");
} else if (!isEquipped(hero)) {
GLog.i("You need to equip your cloak to do that.");
} else if (cooldown > 0) {
GLog.i("Your cloak needs " + cooldown + " more rounds to re-energize.");
} else if (charge <= 1){
GLog.i("Your cloak hasn't recharged enough to be usable yet.");
}
} else {
stealthed = false;

View File

@ -9,16 +9,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.GhostSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.WraithSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndQuest;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
@ -59,6 +56,9 @@ public class DriedRose extends Artifact {
public void execute( Hero hero, String action ) {
if (action.equals(AC_SUMMON)) {
if (!isEquipped( hero )) GLog.i("You need to equip your rose to do that.");
else if (charge != chargeCap) GLog.i("Your rose isn't fully charged yet.");
else {
ArrayList<Integer> spawnPoints = new ArrayList<Integer>();
for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
int p = hero.pos + Level.NEIGHBOURS8[i];
@ -80,6 +80,7 @@ public class DriedRose extends Artifact {
hero.sprite.operate(hero.pos);
}
}
} else{
super.execute(hero, action);

View File

@ -34,6 +34,8 @@ public class HornOfPlenty extends Artifact {
levelCap = 30;
charge = 0;
chargeCap = 10;
defaultAction = AC_EAT;
}
private static final float TIME_TO_EAT = 3f;
@ -63,6 +65,10 @@ public class HornOfPlenty extends Artifact {
super.execute(hero, action);
if (action.equals(AC_EAT)){
if (!isEquipped(hero)) GLog.i("You need to equip your horn to do that.");
else if (charge == 0) GLog.i("Your horn has no food in it to eat!");
else {
((Hunger) hero.buff(Hunger.class)).satisfy(energy * charge);
//if you get at least 100 food energy from the horn
@ -98,6 +104,7 @@ public class HornOfPlenty extends Artifact {
Badges.validateFoodEaten();
image = ItemSpriteSheet.ARTIFACT_HORN1;
}
} else if (action.equals(AC_STORE)){

View File

@ -32,6 +32,8 @@ public class SandalsOfNature extends Artifact {
levelCap = 3;
charge = 0;
//partialcharge, chargeCap and exp are unused
defaultAction = AC_ROOT;
}
public static final String[] NAMES = {"Sandals of Nature", "Shoes of Nature",
@ -60,8 +62,11 @@ public class SandalsOfNature extends Artifact {
super.execute(hero, action);
if (action.equals(AC_FEED)){
GameScene.selectItem(itemSelector, mode, inventoryTitle);
} else if (action.equals(AC_ROOT)){
if (charge > 0){
} else if (action.equals(AC_ROOT) && level > 0){
if (!isEquipped( hero )) GLog.i("You need to equip them to do that.");
else if (charge == 0) GLog.i("They have no energy right now.");
else {
Buff.prolong(hero, Roots.class, 5);
Buff.affect(hero, Earthroot.Armor.class).level(charge);
CellEmitter.bottom(hero.pos).start(EarthParticle.FACTORY, 0.05f, 8);

View File

@ -30,6 +30,8 @@ public class TalismanOfForesight extends Artifact {
exp = 0;
partialCharge = 0;
chargeCap = 100;
defaultAction = AC_SCRY;
}
public static final String AC_SCRY = "SCRY";
@ -46,6 +48,10 @@ public class TalismanOfForesight extends Artifact {
public void execute( Hero hero, String action ) {
super.execute(hero, action);
if (action.equals(AC_SCRY)){
if (!isEquipped(hero)) GLog.i("You need to equip your talisman to do that.");
else if (charge != chargeCap) GLog.i("Your talisman isn't full charged yet.");
else {
hero.sprite.operate(hero.pos);
hero.busy();
Sample.INSTANCE.play(Assets.SND_BEACON);
@ -67,7 +73,7 @@ public class TalismanOfForesight extends Artifact {
Buff.affect(hero, Awareness.class, Awareness.DURATION);
Dungeon.observe();
}
}
}

View File

@ -75,6 +75,8 @@ public class UnstableSpellbook extends Artifact {
if (action.equals( AC_READ )) {
if (hero.buff( Blindness.class ) != null) GLog.w("You cannot read from the book while blinded.");
else if (!isEquipped( hero )) GLog.i("You need to equip your spellbook to do that.");
else if (charge == 0) GLog.i("Your spellbook is out of energy for now.");
else {
charge--;