From 30bb83bb6c4038c2d9d579665c8beaa46a897a83 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 15 Jun 2017 01:28:47 -0400 Subject: [PATCH] v0.6.1: changes to curse/upgrade mechanics for rings and wands: - wands and rings now sometimes become uncursed when upgraded - rings now have an invisible +1 and start 1 level lower - cursed rings are no longer degraded - cursed rings now have an invisible -2, and cap at effective +0 --- .../shatteredpixeldungeon/items/Item.java | 1 - .../items/armor/Armor.java | 2 ++ .../items/rings/Ring.java | 28 ++++++++++++++----- .../items/scrolls/ScrollOfUpgrade.java | 15 +--------- .../items/wands/Wand.java | 3 +- .../items/weapon/Weapon.java | 9 +++++- .../items/weapon/melee/MeleeWeapon.java | 10 ------- .../items/weapon/missiles/Boomerang.java | 5 ---- .../messages/items/items.properties | 20 ++++++------- 9 files changed, 44 insertions(+), 49 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 3f39f03ee..5c6291be2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -282,7 +282,6 @@ public class Item implements Bundlable { public Item upgrade() { - cursed = false; this.level++; updateQuickslot(); 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 d23326187..8a6dd2fe6 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 @@ -251,6 +251,8 @@ public class Armor extends EquipableItem { } else if (!inscribe && Random.Float() > Math.pow(0.9, level())){ inscribe(null); } + + cursed = false; if (seal != null && seal.level() == 0) seal.upgrade(); 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 cc0315379..c8c00cdcd 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 @@ -167,6 +167,17 @@ public class Ring extends KindofMisc { return desc; } + @Override + public Item upgrade() { + super.upgrade(); + + if (Random.Float() > Math.pow(0.8, level())) { + cursed = false; + } + + return this; + } + @Override public boolean isIdentified() { return super.isIdentified() && isKnown(); @@ -180,20 +191,19 @@ public class Ring extends KindofMisc { @Override public Item random() { - int n = 1; + int n = 0; if (Random.Int(3) == 0) { n++; if (Random.Int(5) == 0){ n++; } } - + + level(n); if (Random.Float() < 0.3f) { - level(-n); cursed = true; - } else - level(n); - + } + return this; } @@ -277,7 +287,11 @@ public class Ring extends KindofMisc { } public int level(){ - return Ring.this.level(); + if (Ring.this.cursed){ + return Math.min( 0, Ring.this.level()-2 ); + } else { + return Ring.this.level()+1; + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java index 7623aee3e..4f03acb1e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java @@ -85,7 +85,7 @@ public class ScrollOfUpgrade extends InventoryScroll { GLog.w( Messages.get(Armor.class, "incompatible") ); } - } else if (item instanceof Wand) { + } else if (item instanceof Wand || item instanceof Ring) { boolean wasCursed = item.cursed; item.upgrade(); @@ -94,19 +94,6 @@ public class ScrollOfUpgrade extends InventoryScroll { removeCurse( Dungeon.hero ); } - } else if (item instanceof Ring) { - boolean wasCursed = item.cursed; - - item.upgrade(); - - if (wasCursed && !item.cursed){ - if (item.level() < 1){ - weakenCurse( Dungeon.hero ); - } else { - removeCurse( Dungeon.hero ); - } - } - } else { item.upgrade(); } 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 5b2df3c16..91ec601e6 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 @@ -201,8 +201,9 @@ public abstract class Wand extends Item { super.upgrade(); - if (Random.Float() > Math.pow(0.9, level())) + if (Random.Float() > Math.pow(0.8, level())) { cursed = false; + } updateLevel(); curCharges = Math.min( curCharges + 1, maxCharges ); 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 c0b76df3c..d1e5dc3c9 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 @@ -194,7 +194,12 @@ abstract public class Weapon extends KindOfWeapon { public abstract int STRReq(int lvl); - public Item upgrade( boolean enchant ) { + @Override + public Item upgrade() { + return upgrade(false); + } + + public Item upgrade(boolean enchant ) { if (enchant && (enchantment == null || enchantment.curse())){ enchant( Enchantment.random() ); @@ -202,6 +207,8 @@ abstract public class Weapon extends KindOfWeapon { enchant(null); } + cursed = false; + return super.upgrade(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index 4fa0b8655..ac8eab1c6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -22,7 +22,6 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -42,15 +41,6 @@ public class MeleeWeapon extends Weapon { lvl*(tier+1); //level scaling } - @Override - public Item upgrade() { - return upgrade( false ); - } - - public Item safeUpgrade() { - return upgrade( enchantment != null ); - } - public int STRReq(int lvl){ lvl = Math.max(0, lvl); //strength req decreases at +1,+3,+6,+10,etc. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java index afb0b267f..ea7236b5b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java @@ -74,11 +74,6 @@ public class Boomerang extends MissileWeapon { return true; } - @Override - public Item upgrade() { - return upgrade( false ); - } - @Override public Item upgrade( boolean enchant ) { super.upgrade( enchant ); 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 dae964302..f37a899b5 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 @@ -509,39 +509,39 @@ items.rings.ring.cursed_worn=Because this ring is cursed, you are powerless to r items.rings.ring.curse_known=You can feel a malevolent magic lurking within this ring. items.rings.ringofaccuracy.name=ring of accuracy -items.rings.ringofaccuracy.desc=This ring increases your focus, reducing your enemy's ability to dodge your attacks. A degraded ring will instead make it easier for enemies to evade your attacks. +items.rings.ringofaccuracy.desc=This ring increases your focus, reducing your enemy's ability to dodge your attacks. A cursed ring will instead make it easier for enemies to evade your attacks. items.rings.ringofelements.name=ring of elements items.rings.ringofelements.desc=This ring provides resistance to different elements, such as fire, electricity, gases etc. Also it decreases duration of negative effects. items.rings.ringofevasion.name=ring of evasion -items.rings.ringofevasion.desc=This ring obfuscates the true position of the wearer, making them harder to detect and attack. A degraded ring will instead make the user easier to detect and strike. +items.rings.ringofevasion.desc=This ring obfuscates the true position of the wearer, making them harder to detect and attack. A cursed ring will instead make the user easier to detect and strike. items.rings.ringofforce.name=ring of force items.rings.ringofforce.avg_dmg=When unarmed, at your current strength, this ring will deal _%1$d-%2$d damage._ items.rings.ringofforce.typical_avg_dmg=When unarmed, at your current strength, typically this ring will deal _%1$d-%2$d damage._ -items.rings.ringofforce.desc=This ring enhances the force of the wearer's blows. This extra power is fairly weak when wielding weapons, but an unarmed attack will be made much stronger. A degraded ring will instead weaken the wearer's blows. +items.rings.ringofforce.desc=This ring enhances the force of the wearer's blows. This extra power is fairly weak when wielding weapons, but an unarmed attack will be made much stronger. A cursed ring will instead weaken the wearer's blows. items.rings.ringoffuror.name=ring of furor -items.rings.ringoffuror.desc=This ring grants the wearer an inner fury, allowing them to attack more rapidly. This fury works best in large bursts, so slow weapons benefit far more than fast ones. A degraded ring will instead slow the wearer's speed of attack. +items.rings.ringoffuror.desc=This ring grants the wearer an inner fury, allowing them to attack more rapidly. This fury works best in large bursts, so slow weapons benefit far more than fast ones. A cursed ring will instead slow the wearer's speed of attack. items.rings.ringofhaste.name=ring of haste -items.rings.ringofhaste.desc=This ring reduces the stress of movement on the wearer, allowing them to run at superhuman speeds. A degraded ring will instead weigh the wearer down. +items.rings.ringofhaste.desc=This ring reduces the stress of movement on the wearer, allowing them to run at superhuman speeds. A cursed ring will instead weigh the wearer down. items.rings.ringofmagic.name=ring of magic -items.rings.ringofmagic.desc=Your wands will become more powerful in the arcane field that radiates from this ring. Degraded rings of magic will instead weaken your wands. +items.rings.ringofmagic.desc=Your wands will become more powerful in the arcane field that radiates from this ring. Cursed rings of magic will instead weaken your wands. items.rings.ringofmight.name=ring of might -items.rings.ringofmight.desc=This ring enhances the physical traits of the wearer, granting them greater physical strength and constitution. A degraded ring will weaken the wearer. +items.rings.ringofmight.desc=This ring enhances the physical traits of the wearer, granting them greater physical strength and constitution. A cursed ring will weaken the wearer. items.rings.ringofsharpshooting.name=ring of sharpshooting -items.rings.ringofsharpshooting.desc=This ring enhances the wearer's precision and aim, which will make all projectile weapons more accurate and durable. A degraded ring will have the opposite effect. +items.rings.ringofsharpshooting.desc=This ring enhances the wearer's precision and aim, which will make all projectile weapons more accurate and durable. A cursed ring will have the opposite effect. items.rings.ringoftenacity.name=ring of tenacity -items.rings.ringoftenacity.desc=When worn, this ring will allow the wearer to resist normally mortal strikes. The more injured the user is, the more resistant they will be to damage. A degraded ring will instead make it easier for enemies to execute the wearer. +items.rings.ringoftenacity.desc=When worn, this ring will allow the wearer to resist normally mortal strikes. The more injured the user is, the more resistant they will be to damage. A cursed ring will instead make it easier for enemies to execute the wearer. items.rings.ringofwealth.name=ring of wealth -items.rings.ringofwealth.desc=It's not clear what this ring does exactly, good luck may influence the life of an adventurer in many subtle ways. Naturally a degraded ring would give bad luck. +items.rings.ringofwealth.desc=It's not clear what this ring does exactly, good luck may influence the life of an adventurer in many subtle ways. Naturally a cursed ring would give bad luck.