From d356f48c43472cfe9df576cda9f303e473000527 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 6 Mar 2019 22:56:49 -0500 Subject: [PATCH] v0.7.2: adjusted when enchants/glyphs are lost via upgrades also adjusted curse loss rate and rebalanced magical infusion --- .../shatteredpixeldungeon/items/Recipe.java | 4 ++-- .../items/armor/Armor.java | 2 +- .../items/rings/Ring.java | 2 +- .../items/spells/MagicalInfusion.java | 24 ++++++++----------- .../items/wands/Wand.java | 2 +- .../items/weapon/Weapon.java | 14 +++++++---- .../messages/items/items.properties | 4 ++-- 7 files changed, 27 insertions(+), 25 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java index f20601a06..8bfce5523 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Recipe.java @@ -179,6 +179,8 @@ public abstract class Recipe { new Blandfruit.CookFruit(), new TippedDart.TipDart(), new Bomb.EnhanceBomb(), + new AlchemicalCatalyst.Recipe(), + new ArcaneCatalyst.Recipe(), new ElixirOfAquaticRejuvenation.Recipe(), new ElixirOfDragonsBlood.Recipe(), new ElixirOfIcyTouch.Recipe(), @@ -199,8 +201,6 @@ public abstract class Recipe { new PhaseShift.Recipe(), new ReclaimTrap.Recipe(), new Recycle.Recipe(), - new AlchemicalCatalyst.Recipe(), - new ArcaneCatalyst.Recipe(), new StewedMeat.twoMeat() }; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index f20906556..f2824fc41 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -352,7 +352,7 @@ public class Armor extends EquipableItem { if (inscribe && (glyph == null || glyph.curse())){ inscribe( Glyph.random() ); - } else if (!inscribe && Random.Float() > Math.pow(0.9, level())){ + } else if (!inscribe && level() >= 4 && Random.Float(10) < Math.pow(2, level()-4)){ inscribe(null); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java index ab4f3e005..c67357a65 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java @@ -196,7 +196,7 @@ public class Ring extends KindofMisc { public Item upgrade() { super.upgrade(); - if (Random.Float() > Math.pow(0.8, level())) { + if (Random.Int(3) == 0) { cursed = false; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java index 034dc48c6..7e34c1b12 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/MagicalInfusion.java @@ -22,13 +22,11 @@ package com.shatteredpixel.shatteredpixeldungeon.items.spells; import com.shatteredpixel.shatteredpixeldungeon.Badges; -import com.shatteredpixel.shatteredpixeldungeon.effects.Enchanting; +import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; -import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -38,21 +36,19 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; public class MagicalInfusion extends InventorySpell { { - mode = WndBag.Mode.ENCHANTABLE; + mode = WndBag.Mode.UPGRADEABLE; image = ItemSpriteSheet.MAGIC_INFUSE; } @Override protected void onItemSelected( Item item ) { - if (item instanceof SpiritBow){ - if (((SpiritBow) item).enchantment == null){ - ((Weapon)item).enchant(); - } - } else if (item instanceof Weapon) { + if (item instanceof Weapon && ((Weapon) item).enchantment != null && !((Weapon) item).hasCurseEnchant()) { ((Weapon) item).upgrade(true); - } else { + } else if (item instanceof Armor && ((Armor) item).glyph != null && !((Armor) item).hasCurseGlyph()) { ((Armor) item).upgrade(true); + } else { + item.upgrade(); } GLog.p( Messages.get(this, "infuse", item.name()) ); @@ -60,22 +56,22 @@ public class MagicalInfusion extends InventorySpell { Badges.validateItemLevelAquired(item); curUser.sprite.emitter().start(Speck.factory(Speck.UP), 0.2f, 3); - Enchanting.show(curUser, item); + Statistics.upgradesUsed++; } @Override public int price() { //prices of ingredients, divided by output quantity - return Math.round(quantity * ((50 + 30) / 1f)); + return Math.round(quantity * ((50 + 40) / 1f)); } public static class Recipe extends com.shatteredpixel.shatteredpixeldungeon.items.Recipe.SimpleRecipe { { - inputs = new Class[]{ScrollOfUpgrade.class, StoneOfEnchantment.class}; + inputs = new Class[]{ScrollOfUpgrade.class, ArcaneCatalyst.class}; inQuantity = new int[]{1, 1}; - cost = 3; + cost = 4; output = MagicalInfusion.class; outQuantity = 1; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index 67e14f4ea..bd9fdc287 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -225,7 +225,7 @@ public abstract class Wand extends Item { super.upgrade(); - if (Random.Float() > Math.pow(0.8, level())) { + if (Random.Int(3) == 0) { cursed = false; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 6df06ee26..1ef5e7da6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -217,10 +217,16 @@ abstract public class Weapon extends KindOfWeapon { public Item upgrade(boolean enchant ) { - if (enchant && (enchantment == null || enchantment.curse())){ - enchant( Enchantment.random() ); - } else if (!enchant && Random.Float() > Math.pow(0.9, level())){ - enchant(null); + if (enchant){ + if (enchantment == null || hasCurseEnchant()){ + enchant(Enchantment.random()); + } + } else { + if (hasCurseEnchant()){ + if (Random.Int(3) == 0) enchant(null); + } else if (level() >= 4 && Random.Float(10) < Math.pow(2, level()-4)){ + enchant(null); + } } cursed = false; diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index ccfed7ac0..092d2b627 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -867,7 +867,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, improving its quality. A wand will increase in power and number of charges, weapons and armor will deal and block more damage, and the effects of rings will intensify. This scroll is even able to mitigate or sometimes totally dispel curse effects, though it is not as potent as a scroll of remove curse. +items.scrolls.scrollofupgrade.desc=This scroll will upgrade a single item, improving its quality. A wand 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\nThis scroll is even able to mitigate or sometimes totally dispel curse effects, though it is not as potent as a scroll of remove curse.\n\nThe magic of the scroll may also interfere with and erase enchantments on weapons and glyphs on armor. The chance for this begins when upgrading from +4, and will be guaranteed at +8 or higher. @@ -967,7 +967,7 @@ items.spells.spell.no_magic=You can't cast spells while magic immune. items.spells.magicalinfusion.name=magical infusion items.spells.magicalinfusion.inv_title=Infuse an item items.spells.magicalinfusion.infuse=Your %s is infused with arcane energy! -items.spells.magicalinfusion.desc=This spell will infuse a weapon or armor with powerful magical energy.\n\nIn addition to being upgraded, a weapon will gain a magical enchantment, or armor will be imbued with a magical glyph.\n\nIf the item already has an enchantment or glyph, it will not be erased by the upgrade. +items.spells.magicalinfusion.desc=This spell posses 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. items.spells.magicalporter.name=magical porter items.spells.magicalporter.inv_title=Port an item