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
@@ -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,28 +48,32 @@ public class TalismanOfForesight extends Artifact {
public void execute( Hero hero, String action ) {
super.execute(hero, action);
if (action.equals(AC_SCRY)){
hero.sprite.operate( hero.pos );
hero.busy();
Sample.INSTANCE.play( Assets.SND_BEACON );
charge = 0;
for (int i=0; i < Level.LENGTH; i++) {
int terr = Dungeon.level.map[i];
if ((Terrain.flags[terr] & Terrain.SECRET) != 0) {
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);
charge = 0;
for (int i = 0; i < Level.LENGTH; i++) {
GameScene.updateMap( i );
int terr = Dungeon.level.map[i];
if ((Terrain.flags[terr] & Terrain.SECRET) != 0) {
if (Dungeon.visible[i]) {
GameScene.discoverTile( i, terr );
GameScene.updateMap(i);
if (Dungeon.visible[i]) {
GameScene.discoverTile(i, terr);
}
}
}
GLog.p("The Talisman floods your mind with knowledge about the current floor.");
Buff.affect(hero, Awareness.class, Awareness.DURATION);
Dungeon.observe();
}
GLog.p ("The Talisman floods your mind with knowledge about the current floor.");
Buff.affect(hero, Awareness.class, Awareness.DURATION);
Dungeon.observe();
}
}