v0.2.3: quickslot refactoring for artifacts
This commit is contained in:
parent
8dba48813d
commit
b851be162e
|
@ -57,7 +57,10 @@ public class CloakOfShadows extends Artifact {
|
||||||
if (action.equals( AC_STEALTH )) {
|
if (action.equals( AC_STEALTH )) {
|
||||||
|
|
||||||
if (!stealthed){
|
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;
|
stealthed = true;
|
||||||
hero.spend( 1f );
|
hero.spend( 1f );
|
||||||
hero.busy();
|
hero.busy();
|
||||||
|
@ -71,12 +74,6 @@ public class CloakOfShadows extends Artifact {
|
||||||
}
|
}
|
||||||
hero.sprite.operate(hero.pos);
|
hero.sprite.operate(hero.pos);
|
||||||
GLog.i("Your cloak blends you into the shadows.");
|
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 {
|
} else {
|
||||||
stealthed = false;
|
stealthed = false;
|
||||||
|
|
|
@ -9,16 +9,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.GhostSprite;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.WraithSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.WraithSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndQuest;
|
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
@ -59,6 +56,9 @@ public class DriedRose extends Artifact {
|
||||||
public void execute( Hero hero, String action ) {
|
public void execute( Hero hero, String action ) {
|
||||||
if (action.equals(AC_SUMMON)) {
|
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>();
|
ArrayList<Integer> spawnPoints = new ArrayList<Integer>();
|
||||||
for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
|
for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
|
||||||
int p = hero.pos + Level.NEIGHBOURS8[i];
|
int p = hero.pos + Level.NEIGHBOURS8[i];
|
||||||
|
@ -80,6 +80,7 @@ public class DriedRose extends Artifact {
|
||||||
hero.sprite.operate(hero.pos);
|
hero.sprite.operate(hero.pos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
super.execute(hero, action);
|
super.execute(hero, action);
|
||||||
|
|
|
@ -34,6 +34,8 @@ public class HornOfPlenty extends Artifact {
|
||||||
levelCap = 30;
|
levelCap = 30;
|
||||||
charge = 0;
|
charge = 0;
|
||||||
chargeCap = 10;
|
chargeCap = 10;
|
||||||
|
|
||||||
|
defaultAction = AC_EAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final float TIME_TO_EAT = 3f;
|
private static final float TIME_TO_EAT = 3f;
|
||||||
|
@ -63,6 +65,10 @@ public class HornOfPlenty extends Artifact {
|
||||||
super.execute(hero, action);
|
super.execute(hero, action);
|
||||||
|
|
||||||
if (action.equals(AC_EAT)){
|
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);
|
((Hunger) hero.buff(Hunger.class)).satisfy(energy * charge);
|
||||||
|
|
||||||
//if you get at least 100 food energy from the horn
|
//if you get at least 100 food energy from the horn
|
||||||
|
@ -98,6 +104,7 @@ public class HornOfPlenty extends Artifact {
|
||||||
Badges.validateFoodEaten();
|
Badges.validateFoodEaten();
|
||||||
|
|
||||||
image = ItemSpriteSheet.ARTIFACT_HORN1;
|
image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (action.equals(AC_STORE)){
|
} else if (action.equals(AC_STORE)){
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ public class SandalsOfNature extends Artifact {
|
||||||
levelCap = 3;
|
levelCap = 3;
|
||||||
charge = 0;
|
charge = 0;
|
||||||
//partialcharge, chargeCap and exp are unused
|
//partialcharge, chargeCap and exp are unused
|
||||||
|
|
||||||
|
defaultAction = AC_ROOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String[] NAMES = {"Sandals of Nature", "Shoes of Nature",
|
public static final String[] NAMES = {"Sandals of Nature", "Shoes of Nature",
|
||||||
|
@ -60,8 +62,11 @@ public class SandalsOfNature extends Artifact {
|
||||||
super.execute(hero, action);
|
super.execute(hero, action);
|
||||||
if (action.equals(AC_FEED)){
|
if (action.equals(AC_FEED)){
|
||||||
GameScene.selectItem(itemSelector, mode, inventoryTitle);
|
GameScene.selectItem(itemSelector, mode, inventoryTitle);
|
||||||
} else if (action.equals(AC_ROOT)){
|
} else if (action.equals(AC_ROOT) && level > 0){
|
||||||
if (charge > 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.prolong(hero, Roots.class, 5);
|
||||||
Buff.affect(hero, Earthroot.Armor.class).level(charge);
|
Buff.affect(hero, Earthroot.Armor.class).level(charge);
|
||||||
CellEmitter.bottom(hero.pos).start(EarthParticle.FACTORY, 0.05f, 8);
|
CellEmitter.bottom(hero.pos).start(EarthParticle.FACTORY, 0.05f, 8);
|
||||||
|
|
|
@ -30,6 +30,8 @@ public class TalismanOfForesight extends Artifact {
|
||||||
exp = 0;
|
exp = 0;
|
||||||
partialCharge = 0;
|
partialCharge = 0;
|
||||||
chargeCap = 100;
|
chargeCap = 100;
|
||||||
|
|
||||||
|
defaultAction = AC_SCRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String AC_SCRY = "SCRY";
|
public static final String AC_SCRY = "SCRY";
|
||||||
|
@ -46,6 +48,10 @@ public class TalismanOfForesight extends Artifact {
|
||||||
public void execute( Hero hero, String action ) {
|
public void execute( Hero hero, String action ) {
|
||||||
super.execute(hero, action);
|
super.execute(hero, action);
|
||||||
if (action.equals(AC_SCRY)){
|
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.sprite.operate(hero.pos);
|
||||||
hero.busy();
|
hero.busy();
|
||||||
Sample.INSTANCE.play(Assets.SND_BEACON);
|
Sample.INSTANCE.play(Assets.SND_BEACON);
|
||||||
|
@ -67,7 +73,7 @@ public class TalismanOfForesight extends Artifact {
|
||||||
|
|
||||||
Buff.affect(hero, Awareness.class, Awareness.DURATION);
|
Buff.affect(hero, Awareness.class, Awareness.DURATION);
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,8 @@ public class UnstableSpellbook extends Artifact {
|
||||||
if (action.equals( AC_READ )) {
|
if (action.equals( AC_READ )) {
|
||||||
|
|
||||||
if (hero.buff( Blindness.class ) != null) GLog.w("You cannot read from the book while blinded.");
|
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 {
|
else {
|
||||||
charge--;
|
charge--;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user