v2.5.0: improved logic for cancelling new upgrade window
This commit is contained in:
committed by
Evan Debenham
parent
5381809f55
commit
e4085fe445
@@ -1206,7 +1206,7 @@ items.spells.spell.no_magic=You can't cast spells while magic immune.
|
|||||||
items.spells.magicalinfusion.name=magical infusion
|
items.spells.magicalinfusion.name=magical infusion
|
||||||
items.spells.magicalinfusion.inv_title=Infuse an item
|
items.spells.magicalinfusion.inv_title=Infuse an item
|
||||||
items.spells.magicalinfusion.infuse=Your item is infused with arcane energy!
|
items.spells.magicalinfusion.infuse=Your item is infused with arcane energy!
|
||||||
items.spells.magicalinfusion.desc=This spell possesses the same magical power as a scroll of upgrade, but in a more stable form.\n\nIn addition to upgrading an item as normal it will never erase an enchantment on a weapon or a glyph on armor, including curses.
|
items.spells.magicalinfusion.desc=This spell possesses the same magical power as a scroll of upgrade, but in a more stable form.\n\nIn addition to upgrading an item as normal it will never erase an enchantment, glyph, or curse.
|
||||||
|
|
||||||
items.spells.magicalporter.name=magical porter
|
items.spells.magicalporter.name=magical porter
|
||||||
items.spells.magicalporter.inv_title=Port an item
|
items.spells.magicalporter.inv_title=Port an item
|
||||||
|
|||||||
+3
-2
@@ -111,12 +111,13 @@ public abstract class InventoryScroll extends Scroll {
|
|||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
|
|
||||||
if (!identifiedByUse) {
|
//SoU opens a separate window that can be cancelled
|
||||||
|
//so we don't do a lot of logic here
|
||||||
|
if (!identifiedByUse && !(curItem instanceof ScrollOfUpgrade)) {
|
||||||
curItem = detach(curUser.belongings.backpack);
|
curItem = detach(curUser.belongings.backpack);
|
||||||
}
|
}
|
||||||
((InventoryScroll)curItem).onItemSelected( item );
|
((InventoryScroll)curItem).onItemSelected( item );
|
||||||
|
|
||||||
//SoU still does these things, but after the upgrade window
|
|
||||||
if (!(curItem instanceof ScrollOfUpgrade)) {
|
if (!(curItem instanceof ScrollOfUpgrade)) {
|
||||||
((InventoryScroll) curItem).readAnimation();
|
((InventoryScroll) curItem).readAnimation();
|
||||||
Sample.INSTANCE.play(Assets.Sounds.READ);
|
Sample.INSTANCE.play(Assets.Sounds.READ);
|
||||||
|
|||||||
+4
-1
@@ -81,10 +81,13 @@ public abstract class InventorySpell extends Spell {
|
|||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
|
|
||||||
|
//Infusion opens a separate window that can be cancelled
|
||||||
|
//so we don't do a lot of logic here
|
||||||
|
if (!(curItem instanceof MagicalInfusion)) {
|
||||||
curItem = detach(curUser.belongings.backpack);
|
curItem = detach(curUser.belongings.backpack);
|
||||||
|
}
|
||||||
|
|
||||||
((InventorySpell)curItem).onItemSelected( item );
|
((InventorySpell)curItem).onItemSelected( item );
|
||||||
//Magical Infusion still does these things, but after the upgrade window
|
|
||||||
if (!(curItem instanceof MagicalInfusion)) {
|
if (!(curItem instanceof MagicalInfusion)) {
|
||||||
curUser.spend(1f);
|
curUser.spend(1f);
|
||||||
curUser.busy();
|
curUser.busy();
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ public class WndUpgrade extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Various ring stats (varies by ring)
|
//Various ring stats (varies by ring)
|
||||||
|
//TODO cursed ring stats?
|
||||||
if (toUpgrade instanceof Ring){
|
if (toUpgrade instanceof Ring){
|
||||||
if (((Ring) toUpgrade).upgradeStat1(levelFrom) != null){
|
if (((Ring) toUpgrade).upgradeStat1(levelFrom) != null){
|
||||||
bottom = fillFields(Messages.get(toUpgrade, "upgrade_stat_name_1"),
|
bottom = fillFields(Messages.get(toUpgrade, "upgrade_stat_name_1"),
|
||||||
@@ -369,6 +370,7 @@ public class WndUpgrade extends Window {
|
|||||||
upgraded = ((MagicalInfusion) upgrader).upgradeItem(toUpgrade);
|
upgraded = ((MagicalInfusion) upgrader).upgradeItem(toUpgrade);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!force) upgrader.detach(Dungeon.hero.belongings.backpack);
|
||||||
Item moreUpgradeItem = Dungeon.hero.belongings.getItem(upgrader.getClass());
|
Item moreUpgradeItem = Dungeon.hero.belongings.getItem(upgrader.getClass());
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
@@ -429,9 +431,7 @@ public class WndUpgrade extends Window {
|
|||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
//don't let this window be closed if
|
//don't let this window be closed if
|
||||||
//TODO currently never closes, as the Sou/magic infusion is consumed as it is shown
|
if (!force) super.onBackPressed();
|
||||||
//we might want to only have it be pre-consumed when force = true
|
|
||||||
//as atm quitting the game with the window open will eat the scroll/infuse when force=false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private float fillFields(String title, String msg1, String msg2, float bottom){
|
private float fillFields(String title, String msg1, String msg2, float bottom){
|
||||||
|
|||||||
Reference in New Issue
Block a user