v0.2.3: tweaks/polish to timekeeper's hourglass
This commit is contained in:
parent
c429e0e832
commit
c2b9718581
|
@ -60,29 +60,35 @@ public class TimekeepersHourglass extends Artifact {
|
||||||
@Override
|
@Override
|
||||||
public void execute( Hero hero, String action ) {
|
public void execute( Hero hero, String action ) {
|
||||||
if (action.equals(AC_ACTIVATE)){
|
if (action.equals(AC_ACTIVATE)){
|
||||||
GameScene.show(
|
|
||||||
new WndOptions(TXT_HGLASS, TXT_DESC, TXT_STASIS, TXT_FREEZE) {
|
|
||||||
@Override
|
|
||||||
protected void onSelect(int index) {
|
|
||||||
if (index == 0){
|
|
||||||
GLog.i("Everything seems to fly around you.");
|
|
||||||
GameScene.flash( 0xFFFFFF );
|
|
||||||
Sample.INSTANCE.play( Assets.SND_TELEPORT );
|
|
||||||
|
|
||||||
activeBuff = new timeStasis();
|
if (!isEquipped( hero )) GLog.i("You need to equip your hourglass to do that.");
|
||||||
activeBuff.attachTo(Dungeon.hero);
|
else if (activeBuff != null) GLog.i("Your hourglass is already in use.");
|
||||||
} else if (index == 1){
|
else if (charge <= 1) GLog.i("Your hourglass hasn't recharged enough to be usable yet.");
|
||||||
GLog.i("everything around you suddenly freezes.");
|
else GameScene.show(
|
||||||
GameScene.flash( 0xFFFFFF );
|
new WndOptions(TXT_HGLASS, TXT_DESC, TXT_STASIS, TXT_FREEZE) {
|
||||||
Sample.INSTANCE.play( Assets.SND_TELEPORT );
|
@Override
|
||||||
|
protected void onSelect(int index) {
|
||||||
|
if (index == 0) {
|
||||||
|
GLog.i("Everything seems to blur while moving around you.");
|
||||||
|
GameScene.flash(0xFFFFFF);
|
||||||
|
Sample.INSTANCE.play(Assets.SND_TELEPORT);
|
||||||
|
|
||||||
|
activeBuff = new timeStasis();
|
||||||
|
activeBuff.attachTo(Dungeon.hero);
|
||||||
|
} else if (index == 1) {
|
||||||
|
GLog.i("everything around you suddenly freezes.");
|
||||||
|
GameScene.flash(0xFFFFFF);
|
||||||
|
Sample.INSTANCE.play(Assets.SND_TELEPORT);
|
||||||
|
|
||||||
|
activeBuff = new timeFreeze();
|
||||||
|
activeBuff.attachTo(Dungeon.hero);
|
||||||
|
}
|
||||||
|
|
||||||
activeBuff = new timeFreeze();
|
|
||||||
activeBuff.attachTo(Dungeon.hero);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else
|
} else
|
||||||
super.execute(hero, action);
|
super.execute(hero, action);
|
||||||
}
|
}
|
||||||
|
@ -94,6 +100,18 @@ public class TimekeepersHourglass extends Artifact {
|
||||||
activeBuff.attachTo(ch);
|
activeBuff.attachTo(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doUnequip(Hero hero, boolean collect, boolean single) {
|
||||||
|
if (super.doUnequip(hero, collect, single)){
|
||||||
|
if (activeBuff != null){
|
||||||
|
activeBuff.detach();
|
||||||
|
activeBuff = null;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ArtifactBuff passiveBuff() {
|
protected ArtifactBuff passiveBuff() {
|
||||||
return new hourglassRecharge();
|
return new hourglassRecharge();
|
||||||
|
@ -126,7 +144,9 @@ public class TimekeepersHourglass extends Artifact {
|
||||||
super.storeInBundle(bundle);
|
super.storeInBundle(bundle);
|
||||||
bundle.put( CHARGECAP, chargeCap );
|
bundle.put( CHARGECAP, chargeCap );
|
||||||
bundle.put( SANDBAGS, sandBags );
|
bundle.put( SANDBAGS, sandBags );
|
||||||
bundle.put( BUFF , activeBuff );
|
|
||||||
|
if (activeBuff != null)
|
||||||
|
bundle.put( BUFF , activeBuff );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,7 +154,18 @@ public class TimekeepersHourglass extends Artifact {
|
||||||
super.restoreFromBundle(bundle);
|
super.restoreFromBundle(bundle);
|
||||||
chargeCap = bundle.getInt( CHARGECAP );
|
chargeCap = bundle.getInt( CHARGECAP );
|
||||||
sandBags = bundle.getInt( SANDBAGS );
|
sandBags = bundle.getInt( SANDBAGS );
|
||||||
activeBuff = (ArtifactBuff)bundle.get( BUFF );
|
|
||||||
|
//these buffs belong to hourglass, need to handle unbundling within the hourglass class.
|
||||||
|
if (bundle.contains( BUFF )){
|
||||||
|
Bundle buffBundle = bundle.getBundle( BUFF );
|
||||||
|
|
||||||
|
if (buffBundle.contains( timeFreeze.PARTIALTIME ))
|
||||||
|
activeBuff = new timeFreeze();
|
||||||
|
else
|
||||||
|
activeBuff = new timeStasis();
|
||||||
|
|
||||||
|
activeBuff.restoreFromBundle(buffBundle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class hourglassRecharge extends ArtifactBuff {
|
public class hourglassRecharge extends ArtifactBuff {
|
||||||
|
@ -162,8 +193,6 @@ public class TimekeepersHourglass extends Artifact {
|
||||||
}
|
}
|
||||||
|
|
||||||
public class timeStasis extends ArtifactBuff {
|
public class timeStasis extends ArtifactBuff {
|
||||||
//todo: add visuals
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean attachTo(Char target) {
|
public boolean attachTo(Char target) {
|
||||||
|
@ -181,6 +210,8 @@ public class TimekeepersHourglass extends Artifact {
|
||||||
|
|
||||||
QuickSlot.refresh();
|
QuickSlot.refresh();
|
||||||
|
|
||||||
|
Dungeon.observe();
|
||||||
|
|
||||||
return super.attachTo(target);
|
return super.attachTo(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user