v2.5.0: final behaviour improvements to new upgrade window

This commit is contained in:
Evan Debenham
2024-06-23 12:34:23 -04:00
parent 5138e0ac0a
commit c861f8cef8
5 changed files with 26 additions and 25 deletions

View File

@@ -1100,7 +1100,7 @@ items.scrolls.scrollofupgrade.name=scroll of upgrade
items.scrolls.scrollofupgrade.inv_title=Upgrade an item
items.scrolls.scrollofupgrade.weaken_curse=The scroll of upgrade weakens the curse on your item.
items.scrolls.scrollofupgrade.remove_curse=The scroll of upgrade cleanses the curse on your item!
items.scrolls.scrollofupgrade.desc=This scroll will upgrade a single item. Wands will increase in power and number of charges, weapons and armor will deal and block more damage, and the effects of rings will intensify. It can even weaken or sometimes totally dispel curses, though it is not as potent as a scroll of remove curse.\n\nUnfortunately, The upgrading magic can also erase enchantments or glyphs on higher level gear. The chance for this begins when upgrading from +4, and will be guaranteed at +8 or higher. If the item is hardened, this is increased to +6 and +10, and the hardening will be lost before the enchantment or glyph.
items.scrolls.scrollofupgrade.desc=This scroll will upgrade a single item. Wands will increase in power and number of charges, weapons and armor will deal and block more damage, and the effects of rings will intensify.\n\nIt can even weaken or sometimes totally dispel curses, though it is not as potent as a scroll of remove curse. Unfortunately, The upgrading magic can also erase enchantments or glyphs on higher level gear.

View File

@@ -366,7 +366,7 @@ windows.wndupgrade.ward_damage=Ward Damage
windows.wndupgrade.charges=Max Charges
windows.wndupgrade.ring_boost=Ring Boost
windows.wndupgrade.upgrade=Upgrade
windows.wndupgrade.cancel=Cancel
windows.wndupgrade.back=Back
windows.wndwandmaker.dust=Oh, I see you have the dust! Don't worry about the wraiths, I can deal with them. As I promised, you can choose one of my high quality wands.
windows.wndwandmaker.ember=Oh, I see you have the embers! I do hope the fire elemental wasn't too much trouble. As I promised, you can choose one of my high quality wands.

View File

@@ -64,6 +64,11 @@ public class ScrollOfUpgrade extends InventoryScroll {
}
public void reShowSelector(boolean force){
identifiedByUse = force;
GameScene.selectItem(itemSelector);
}
public Item upgradeItem( Item item ){
upgrade( curUser );

View File

@@ -63,6 +63,10 @@ public class MagicalInfusion extends InventorySpell {
}
public void reShowSelector(){
GameScene.selectItem(itemSelector);
}
public void useAnimation(){
curUser.spend(1f);
curUser.busy();

View File

@@ -27,7 +27,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.InventoryScroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.spells.MagicalInfusion;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
@@ -64,6 +63,7 @@ public class WndUpgrade extends Window {
private static final int GAP = 2;
private static final int ITEMSLOT_SIZE = 18;
private Item upgrader;
private boolean force;
private RedButton btnUpgrade;
@@ -71,6 +71,7 @@ public class WndUpgrade extends Window {
public WndUpgrade( Item upgrader, Item toUpgrade, boolean force){
this.upgrader = upgrader;
this.force = force;
IconTitle title = new IconTitle( new ItemSprite(upgrader), Messages.get(this, "title") );
@@ -399,7 +400,6 @@ public class WndUpgrade extends Window {
hide();
if (moreUpgradeItem != null && toUpgrade.isIdentified()){
moreUpgradeItem = moreUpgradeItem.detach(Dungeon.hero.belongings.backpack);
GameScene.show(new WndUpgrade(moreUpgradeItem, upgraded, false));
}
}
@@ -407,27 +407,15 @@ public class WndUpgrade extends Window {
btnUpgrade.setRect(0, bottom+2*GAP, WIDTH/2f, 16);
add(btnUpgrade);
btnCancel = new RedButton(Messages.get(this, "cancel")){
btnCancel = new RedButton(Messages.get(this, "back")){
@Override
protected void onClick() {
super.onClick();
if (!force) {
upgrader.collect();
hide();
} else {
GameScene.show( new WndOptions(new ItemSprite(upgrader),
Messages.titleCase(upgrader.name()),
Messages.get(InventoryScroll.class, "warning"),
Messages.get(InventoryScroll.class, "yes"),
Messages.get(InventoryScroll.class, "no") ) {
@Override
protected void onSelect( int index ) {
if (index == 0){
WndUpgrade.this.hide();
}
}
public void onBackPressed() {}
} );
hide();
if (upgrader instanceof ScrollOfUpgrade) {
((ScrollOfUpgrade) upgrader).reShowSelector(force);
} else if (upgrader instanceof MagicalInfusion){
((MagicalInfusion)upgrader).reShowSelector();
}
}
@@ -438,7 +426,7 @@ public class WndUpgrade extends Window {
btnUpgrade.enable(Dungeon.hero.ready);
btnUpgrade.icon(new ItemSprite(upgrader));
btnCancel.icon(Icons.CLOSE.get());
btnCancel.icon(Icons.EXIT.get());
bottom = (int)btnCancel.bottom();
@@ -456,8 +444,12 @@ public class WndUpgrade extends Window {
@Override
public void onBackPressed() {
//don't let this window be closed if
if (!force) super.onBackPressed();
super.onBackPressed();
if (upgrader instanceof ScrollOfUpgrade) {
((ScrollOfUpgrade) upgrader).reShowSelector(force);
} else if (upgrader instanceof MagicalInfusion){
((MagicalInfusion)upgrader).reShowSelector();
}
}
private float fillFields(String title, String msg1, String msg2, float bottom){