diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 40adaaece..0e077f908 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -142,12 +142,25 @@ public class ShatteredPixelDungeon extends Game { com.watabou.utils.Bundle.addAlias( com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Chilling.class, "com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Slow" ); + com.watabou.utils.Bundle.addAlias( com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Repulsion.class, "com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Bounce" ); com.watabou.utils.Bundle.addAlias( com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Repulsion.class, "com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Displacement" ); + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential.class, + "com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiEntropy" ); + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Entanglement.class, + "com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Metabolism" ); + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Entanglement.class, + "com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Multiplicity" ); + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Repulsion.class, + "com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Stench" ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 7028eb303..f5e9fb763 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -278,7 +278,6 @@ public class Item implements Bundlable { public Item upgrade() { cursed = false; - cursedKnown = true; this.level++; updateQuickslot(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index 945909d5f..7c756bb87 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -27,9 +27,11 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal; import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Stench; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Affection; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone; @@ -222,9 +224,19 @@ public class Armor extends EquipableItem { public Item upgrade( boolean inscribe ) { if (glyph != null) { - if (!inscribe && Random.Float() > Math.pow(0.9, level())) { - GLog.w( Messages.get(Armor.class, "incompatible") ); + if (inscribe && glyph.curse()){ + inscribe( Glyph.random() ); + } else if (!inscribe && Random.Float() > Math.pow(0.9, level())) { + if (!glyph.curse()) + GLog.w( Messages.get(Armor.class, "incompatible") ); + else if (cursedKnown) { + GLog.p(Messages.get(Item.class, "remove_curse")); + Dungeon.hero.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 ); + } inscribe( null ); + } else if (!inscribe && glyph.curse() && cursed && cursedKnown){ + GLog.p( Messages.get(Item.class, "weaken_curse") ); + Dungeon.hero.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 ); } } else { if (inscribe) { @@ -258,7 +270,7 @@ public class Armor extends EquipableItem { @Override public String name() { - return glyph == null ? super.name() : glyph.name( super.name() ); + return glyph != null && (cursedKnown || !glyph.curse()) ? glyph.name( super.name() ) : super.name(); } @Override @@ -281,7 +293,7 @@ public class Armor extends EquipableItem { } } - if (glyph != null) { + if (glyph != null && (cursedKnown || !glyph.curse())) { info += "\n\n" + Messages.get(Armor.class, "inscribed", glyph.name()); info += " " + glyph.desc(); } @@ -309,26 +321,26 @@ public class Armor extends EquipableItem { @Override public Item random() { - if (Random.Float() < 0.4) { - int n = 1; - if (Random.Int( 3 ) == 0) { - n++; - if (Random.Int( 5 ) == 0) { - n++; - } - } - if (Random.Int( 2 ) == 0) { - upgrade( n ); - } else { - degrade( n ); - cursed = true; - } + float roll = Random.Float(); + if (roll < 0.3f){ + //30% chance to be level 0 and cursed + inscribe(Glyph.randomCurse()); + cursed = true; + return this; + } else if (roll < 0.75f){ + //45% chance to be level 0 + } else if (roll < 0.95f){ + //15% chance to be +1 + upgrade(0); + } else { + //5% chance to be +2 + upgrade(2); } - - if (Random.Int( 10 ) == 0) { + + //if not cursed, 16.67% chance to be inscribed (11.67% overall) + if (Random.Int(6) == 0) inscribe(); - } - + return this; } @@ -395,7 +407,7 @@ public class Armor extends EquipableItem { @Override public ItemSprite.Glowing glowing() { - return glyph != null ? glyph.glowing() : null; + return glyph != null && (cursedKnown || !glyph.curse()) ? glyph.glowing() : null; } public static abstract class Glyph implements Bundlable { @@ -404,16 +416,22 @@ public class Armor extends EquipableItem { Obfuscation.class, Swiftness.class, Stone.class, Potential.class, Brimstone.class, Viscosity.class, Entanglement.class, Repulsion.class, Camouflage.class, Flow.class, Affection.class, AntiMagic.class, Thorns.class }; - private static final float[] chances= new float[]{ 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, 2, 2, 2 }; + + private static final Class[] curses = new Class[]{ + Stench.class + }; public abstract int proc( Armor armor, Char attacker, Char defender, int damage ); public String name() { - return name( Messages.get(this, "glyph") ); + if (!curse()) + return name( Messages.get(this, "glyph") ); + else + return name( Messages.get(Item.class, "curse")); } public String name( String armorName ) { @@ -423,6 +441,10 @@ public class Armor extends EquipableItem { public String desc() { return Messages.get(this, "desc"); } + + public boolean curse() { + return false; + } @Override public void restoreFromBundle( Bundle bundle ) { @@ -455,7 +477,7 @@ public class Armor extends EquipableItem { return false; } } - + @SuppressWarnings("unchecked") public static Glyph random() { try { @@ -464,6 +486,15 @@ public class Armor extends EquipableItem { return null; } } + + @SuppressWarnings("unchecked") + public static Glyph randomCurse(){ + try { + return ((Class)Random.oneOf(curses)).newInstance(); + } catch (Exception e) { + return null; + } + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stench.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Stench.java similarity index 63% rename from src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stench.java rename to src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Stench.java index bf4043700..30e9da02c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stench.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Stench.java @@ -18,40 +18,39 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see */ -package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs; +package com.shatteredpixel.shatteredpixeldungeon.items.armor.curses; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; -import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph; -import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing; import com.watabou.utils.Random; -public class Stench extends Glyph { - - private static ItemSprite.Glowing GREEN = new ItemSprite.Glowing( 0x22CC44 ); - - @Override - public int proc( Armor armor, Char attacker, Char defender, int damage) { +public class Stench extends Armor.Glyph { + + private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 ); + + @Override + public int proc(Armor armor, Char attacker, Char defender, int damage) { + + if ( Random.Int( 6 ) == 0) { + + GameScene.add( Blob.seed( attacker.pos, 250, ToxicGas.class ) ); - int level = Math.max( 0, armor.level() ); - - if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5 ) >= 4) { - - GameScene.add( Blob.seed( attacker.pos, 20, ToxicGas.class ) ); - } - + return damage; } - + @Override - public Glowing glowing() { - return GREEN; + public ItemSprite.Glowing glowing() { + return BLACK; } + @Override + public boolean curse() { + return true; + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java index c3e7ea0e7..697aed626 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler; import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc; @@ -128,6 +129,11 @@ public class Ring extends KindofMisc { @Override public Item upgrade() { + + if (cursed && cursedKnown) { + GLog.p( Messages.get(Item.class, "weaken_curse") ); + Dungeon.hero.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 ); + } super.upgrade(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java index 8cb29a8ca..7f9775a23 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java @@ -43,7 +43,6 @@ public class ScrollOfMagicalInfusion extends InventoryScroll { @Override protected void onItemSelected( Item item ) { - ScrollOfRemoveCurse.uncurse(Dungeon.hero, item); if (item instanceof Weapon) ((Weapon)item).upgrade(true); else diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java index cfcb98934..07ad661c9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java @@ -27,7 +27,9 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.Flare; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; @@ -73,6 +75,22 @@ public class ScrollOfRemoveCurse extends Scroll { item.cursed = false; procced = true; } + if (item instanceof Weapon){ + Weapon w = (Weapon) item; + if (w.enchantment != null && w.enchantment.curse()){ + w.enchant(null); + w.cursed = false; + procced = true; + } + } + if (item instanceof Armor){ + Armor a = (Armor) item; + if (a.glyph != null && a.glyph.curse()){ + a.inscribe(null); + a.cursed = false; + procced = true; + } + } if (item instanceof Bag){ for (Item bagItem : ((Bag)item).items){ if (bagItem != null && bagItem.cursed) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java index 706d31b95..4346d41f3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfUpgrade.java @@ -21,7 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.items.scrolls; import com.shatteredpixel.shatteredpixeldungeon.Badges; -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.Item; @@ -41,7 +40,6 @@ public class ScrollOfUpgrade extends InventoryScroll { @Override protected void onItemSelected( Item item ) { - ScrollOfRemoveCurse.uncurse( Dungeon.hero, item ); item.upgrade(); upgrade( curUser ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index 40a2d6adb..b905e64f1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; @@ -185,6 +186,11 @@ public abstract class Wand extends Item { @Override public Item upgrade() { + if (cursed && cursedKnown) { + GLog.p( Messages.get(Item.class, "remove_curse") ); + Dungeon.hero.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 ); + } + super.upgrade(); updateLevel(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 544d55813..c3f684947 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -21,14 +21,18 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon; import com.shatteredpixel.shatteredpixeldungeon.Badges; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Fragile; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Wayward; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Chilling; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Dazzling; @@ -115,12 +119,12 @@ abstract public class Weapon extends KindOfWeapon { int encumbrance = STRReq() - hero.STR(); + if (enchantment instanceof Wayward) + encumbrance = Math.max(3, encumbrance+3); + float ACC = this.ACC; if (this instanceof MissileWeapon) { - if (hero.heroClass == HeroClass.HUNTRESS) { - encumbrance -= 2; - } int bonus = 0; for (Buff buff : hero.buffs(RingOfSharpshooting.Aim.class)) { bonus += ((RingOfSharpshooting.Aim)buff).level; @@ -180,9 +184,19 @@ abstract public class Weapon extends KindOfWeapon { public Item upgrade( boolean enchant ) { if (enchantment != null) { - if (!enchant && Random.Float() > Math.pow(0.9, level())) { - GLog.w( Messages.get(Weapon.class, "incompatible") ); + if (enchant && enchantment.curse()){ + enchant( Enchantment.random() ); + } else if (!enchant && Random.Float() > Math.pow(0.9, level())) { + if (!enchantment.curse()) + GLog.w( Messages.get(Weapon.class, "incompatible") ); + else { + GLog.p(Messages.get(Item.class, "remove_curse")); + Dungeon.hero.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 ); + } enchant( null ); + } else if (!enchant && enchantment.curse() && cursed && cursedKnown){ + GLog.p( Messages.get(Item.class, "weaken_curse") ); + Dungeon.hero.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 ); } } else { if (enchant) { @@ -195,26 +209,31 @@ abstract public class Weapon extends KindOfWeapon { @Override public String name() { - return enchantment == null ? super.name() : enchantment.name( super.name() ); + return enchantment != null && (cursedKnown || !enchantment.curse()) ? enchantment.name( super.name() ) : super.name; } @Override public Item random() { - if (Random.Float() < 0.4) { - int n = 1; - if (Random.Int( 3 ) == 0) { - n++; - if (Random.Int( 5 ) == 0) { - n++; - } - } - if (Random.Int( 2 ) == 0) { - upgrade( n ); - } else { - degrade( n ); - cursed = true; - } + float roll = Random.Float(); + if (roll < 0.3f){ + //30% chance to be level 0 and cursed + enchant(Enchantment.randomCurse()); + cursed = true; + return this; + } else if (roll < 0.75f){ + //45% chance to be level 0 + } else if (roll < 0.95f){ + //15% chance to be +1 + upgrade(0); + } else { + //5% chance to be +2 + upgrade(2); } + + //if not cursed, 10% chance to be enchanted (7% overall) + if (Random.Int(10) == 0) + enchant(); + return this; } @@ -240,7 +259,7 @@ abstract public class Weapon extends KindOfWeapon { @Override public ItemSprite.Glowing glowing() { - return enchantment != null ? enchantment.glowing() : null; + return enchantment != null && (cursedKnown || !enchantment.curse()) ? enchantment.glowing() : null; } public static abstract class Enchantment implements Bundlable { @@ -253,11 +272,18 @@ abstract public class Weapon extends KindOfWeapon { 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, 2, 2, 2 }; + + private static final Class[] curses = new Class[]{ + Fragile.class, Wayward.class + }; public abstract int proc( Weapon weapon, Char attacker, Char defender, int damage ); public String name() { - return name( Messages.get(this, "enchant")); + if (!curse()) + return name( Messages.get(this, "enchant")); + else + return name( Messages.get(Item.class, "curse")); } public String name( String weaponName ) { @@ -268,6 +294,10 @@ abstract public class Weapon extends KindOfWeapon { return Messages.get(this, "desc"); } + public boolean curse() { + return false; + } + @Override public void restoreFromBundle( Bundle bundle ) { } @@ -286,6 +316,15 @@ abstract public class Weapon extends KindOfWeapon { return null; } } + + @SuppressWarnings("unchecked") + public static Enchantment randomCurse(){ + try { + return ((Class)Random.oneOf(curses)).newInstance(); + } catch (Exception e) { + return null; + } + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Fragile.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Fragile.java new file mode 100644 index 000000000..b49c28047 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Fragile.java @@ -0,0 +1,63 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2016 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses; + +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.watabou.utils.Bundle; + +public class Fragile extends Weapon.Enchantment { + + private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 ); + private int hits = 0; + + @Override + public int proc( Weapon weapon, Char attacker, Char defender, int damage ) { + //degrades from 100% to 25% damage over 150 hits + damage *= (1f - hits*0.005f); + if (hits < 150) hits++; + return damage; + } + + @Override + public boolean curse() { + return true; + } + + @Override + public ItemSprite.Glowing glowing() { + return BLACK; + } + + private static final String HITS = "hits"; + + @Override + public void restoreFromBundle( Bundle bundle ) { + hits = bundle.getInt(HITS); + } + + @Override + public void storeInBundle( Bundle bundle ) { + bundle.put(HITS, hits); + } + +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Wayward.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Wayward.java new file mode 100644 index 000000000..2b0433e51 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Wayward.java @@ -0,0 +1,47 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2016 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses; + +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; + +public class Wayward extends Weapon.Enchantment { + + private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 ); + + @Override + public int proc( Weapon weapon, Char attacker, Char defender, int damage ) { + //no proc effect, see weapon.accuracyFactor for effect + return damage; + } + + @Override + public boolean curse() { + return true; + } + + @Override + public ItemSprite.Glowing glowing() { + return BLACK; + } + +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index 8a8dd8ebb..2d7ddb423 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -91,7 +91,7 @@ public class MeleeWeapon extends Weapon { case NONE: } - if (enchantment != null){ + if (enchantment != null && (cursedKnown || !enchantment.curse())){ info += "\n\n" + Messages.get(Weapon.class, "enchanted", enchantment.name()); info += " " + Messages.get(enchantment, "desc"); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index df00d6ca4..7374d57b9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -153,7 +153,7 @@ abstract public class MissileWeapon extends Weapon { info += " " + Messages.get(Weapon.class, "excess_str", Dungeon.hero.STR() - STRReq()); } - if (enchantment != null){ + if (enchantment != null && (cursedKnown || !enchantment.curse())){ info += "\n\n" + Messages.get(Weapon.class, "enchanted", enchantment.name()); info += " " + Messages.get(enchantment, "desc"); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index e3cd88e8d..226bd080e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -1,3 +1,9 @@ +###armor curses +items.armor.curses.stench.name=%s of stench +items.armor.curses.stench.desc= + + + ###glyphs items.armor.glyphs.affection.name=%s of affection items.armor.glyphs.affection.desc=This powerful glyph manipulates the mind of attackers, charming them temporarily. @@ -37,9 +43,6 @@ items.armor.glyphs.potential.desc=This glyph releases energy when struck. This i items.armor.glyphs.repulsion.name=%s of repulsion items.armor.glyphs.repulsion.desc=This glyph rebounds force against attackers, sending them flying back. -items.armor.glyphs.stench.name=%s of stench -items.armor.glyphs.stench.desc= - items.armor.glyphs.stone.name=%s of stone items.armor.glyphs.stone.desc=This glyph increases both the weight and defensive strength of armor it is attached to. @@ -612,7 +615,7 @@ items.scrolls.scrollofterror.desc=A flash of red light will overwhelm all creatu items.scrolls.scrollofupgrade.name=scroll of upgrade items.scrolls.scrollofupgrade.inv_title=Select an item to upgrade -items.scrolls.scrollofupgrade.looks_better=your %s certainly looks better now +items.scrolls.scrollofupgrade.looks_better=Your %s certainly looks better now items.scrolls.scrollofupgrade.desc=This scroll will upgrade a single item, improving its quality. A wand will increase in power and in number of charges; a weapon will inflict more damage; a suit of armor will better absorb damage; the effect of a ring on its wearer will intensify. Weapons and armor will also require less strength to use, and any curses on the item will be lifted. @@ -690,6 +693,22 @@ items.wands.wandofvenom.desc=This wand has a purple body which opens to a brilli +###weapon curses +items.weapon.curses.annoying.name=annoying %s +items.weapon.curses.annoying.msg_1= +items.weapon.curses.annoying.msg_2= +items.weapon.curses.annoying.msg_3= +items.weapon.curses.annoying.msg_4= +items.weapon.curses.annoying.msg_5= +items.weapon.curses.annoying.desc= + +items.weapon.curses.fragile.name=fragile %s +items.weapon.curses.fragile.desc= + +items.weapon.curses.wayward.name=wayward %s +items.weapon.curses.wayward.desc= + + ###enchantments items.weapon.enchantments.blazing.name=blazing %s items.weapon.enchantments.blazing.desc=This enchantment causes flames to spit forth from a weapon, burning enemies and terrain alike. @@ -964,6 +983,9 @@ items.item.prompt=Choose direction of throw items.item.ac_drop=DROP items.item.ac_throw=THROW items.item.rankings_desc=Killed by: %s +items.item.curse=curse +items.item.weaken_curse=The curse on your item has been weakened. +items.item.remove_curse=The curse on your item has been erased! items.kindofmisc.unequip_title=Unequip one item items.kindofmisc.unequip_message=You can only wear two misc items at a time.