diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index 46f499f70..846c2bdb9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -32,8 +32,10 @@ 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.AntiEntropy; +import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Corrosion; import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Displacement; import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Metabolism; +import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Multiplicity; import com.shatteredpixel.shatteredpixeldungeon.items.armor.curses.Stench; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Affection; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic; @@ -425,7 +427,7 @@ public class Armor extends EquipableItem { 2, 2, 2 }; private static final Class[] curses = new Class[]{ - AntiEntropy.class, Displacement.class, Metabolism.class, Stench.class + AntiEntropy.class, Corrosion.class, Displacement.class, Metabolism.class, Multiplicity.class, Stench.class }; public abstract int proc( Armor armor, Char attacker, Char defender, int damage ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Corrosion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Corrosion.java new file mode 100644 index 000000000..7d548068c --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Corrosion.java @@ -0,0 +1,61 @@ +/* + * 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.armor.curses; + +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze; +import com.shatteredpixel.shatteredpixeldungeon.effects.Splash; +import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.watabou.utils.Random; + +public class Corrosion 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(10) == 0){ + int pos = defender.pos; + for (int i : Level.NEIGHBOURS9){ + Splash.at(pos+i, 0x000000, 5); + if (Actor.findChar(pos+i) != null) + Buff.affect(Actor.findChar(pos+i), Ooze.class); + } + } + + return damage; + } + + @Override + public ItemSprite.Glowing glowing() { + return BLACK; + } + + @Override + public boolean curse() { + return true; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Multiplicity.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Multiplicity.java new file mode 100644 index 000000000..85bde39c1 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Multiplicity.java @@ -0,0 +1,101 @@ +/* + * 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.armor.curses; + +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage; +import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.watabou.utils.Bundle; +import com.watabou.utils.Random; + +import java.util.ArrayList; + +public class Multiplicity 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(20) == 0){ + ArrayList spawnPoints = new ArrayList<>(); + + for (int i = 0; i < Level.NEIGHBOURS8.length; i++) { + int p = defender.pos + Level.NEIGHBOURS8[i]; + if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) { + spawnPoints.add( p ); + } + } + + if (spawnPoints.size() > 0) { + + Mob m = null; + if (Random.Int(2) == 0 && defender instanceof Hero){ + m = new MirrorImage(); + ((MirrorImage)m).duplicate( (Hero)defender ); + + } else { + if (attacker.properties().contains(Char.Property.BOSS) || attacker.properties().contains(Char.Property.MINIBOSS)){ + m = Bestiary.mutable(Dungeon.depth % 5 == 0 ? Dungeon.depth - 1 : Dungeon.depth); + } else { + try { + m = (Mob)defender.getClass().newInstance(); + Bundle store = new Bundle(); + defender.storeInBundle(store); + m.restoreFromBundle(store); + m.HP = m.HT; + } catch (Exception e) { + m = null; + } + } + + } + + if (m != null) { + GameScene.add(m); + ScrollOfTeleportation.appear(m, Random.element(spawnPoints)); + } + + } + } + + return damage; + } + + @Override + public ItemSprite.Glowing glowing() { + return BLACK; + } + + @Override + public boolean curse() { + return true; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 54d59ec01..c62a1fcdc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -32,8 +32,10 @@ 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.Annoying; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Displacing; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Exhausting; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Fragile; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Sacrificial; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Wayward; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Chilling; @@ -294,7 +296,7 @@ abstract public class Weapon extends KindOfWeapon { 2, 2, 2 }; private static final Class[] curses = new Class[]{ - Annoying.class, Exhausting.class, Fragile.class, Wayward.class + Annoying.class, Displacing.class, Exhausting.class, Fragile.class, Sacrificial.class, Wayward.class }; public abstract int proc( Weapon weapon, Char attacker, Char defender, int damage ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java new file mode 100644 index 000000000..1d6a09eb1 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java @@ -0,0 +1,74 @@ +/* + * 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.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.watabou.utils.Random; + +public class Displacing extends Weapon.Enchantment { + + private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 ); + + @Override + public int proc(Weapon weapon, Char attacker, Char defender, int damage ) { + + if (Random.Int(12) == 0 && !defender.properties().contains(Char.Property.IMMOVABLE)){ + int count = 10; + int newPos; + do { + newPos = Dungeon.level.randomRespawnCell(); + if (count-- <= 0) { + break; + } + } while (newPos == -1); + + if (newPos != -1 && !Dungeon.bossLevel()) { + + if (Dungeon.visible[defender.pos]) { + CellEmitter.get( defender.pos ).start( Speck.factory( Speck.LIGHT ), 0.2f, 3 ); + } + + defender.pos = newPos; + defender.sprite.place( defender.pos ); + defender.sprite.visible = Dungeon.visible[defender.pos]; + + } + } + + return damage; + } + + @Override + public boolean curse() { + return true; + } + + @Override + public ItemSprite.Glowing glowing() { + return BLACK; + } + +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Sacrificial.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Sacrificial.java new file mode 100644 index 000000000..df325cb09 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Sacrificial.java @@ -0,0 +1,54 @@ +/* + * 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.actors.buffs.Bleeding; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.watabou.utils.Random; + +public class Sacrificial extends Weapon.Enchantment { + + private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 ); + + @Override + public int proc(Weapon weapon, Char attacker, Char defender, int damage ) { + + if (Random.Int(10) == 0){ + Buff.affect(attacker, Bleeding.class).set(Math.max(1, attacker.HP/4)); + } + + return damage; + } + + @Override + public boolean curse() { + return true; + } + + @Override + public ItemSprite.Glowing glowing() { + return BLACK; + } + +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index b3afe94fc..dff19a7d1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -2,17 +2,22 @@ items.armor.curses.antientropy.name=%s of anti-entropy items.armor.curses.antientropy.desc=Anti-entropy curse works against the forces of the universe, pulling energy away from the attacker and into the wearer. This briefly freezes the attacker, but sets the wearer on fire! +items.armor.curses.corrosion.name=%s of corrosion +items.armor.curses.corrosion.desc=Armor of corrosion is capable of bursting with corrosive fluid, coating everything in the area with sticky acidic ooze. + items.armor.curses.displacement.name=%s of displacement items.armor.curses.displacement.desc=The curse of displacement attempts to move the wearer to safety when they are attacked. It is a bit too effective however, randomly teleporting the user around the level. items.armor.curses.metabolism.name=%s of metabolism -items.armor.curses.metabolism.desc=The metabolism curse directly converts satiety into health when the wearer is injured, quickly causing starvation. +items.armor.curses.metabolism.desc=The metabolism curse directly converts satiety into health when the wearer is injured, providing a boost of healing, but quickly causing starvation. + +items.armor.curses.multiplicity.name=%s of multiplicity +items.armor.curses.multiplicity.desc=Armor cursed with multiplicity contains dangerous duplication magic. It will sometimes create a mirror image of the wearer, but is equally likely to duplicate the attacker! items.armor.curses.stench.name=%s of stench items.armor.curses.stench.desc=Armor cursed with stench will release clouds of noxious gas, which is hazardous to everything caught in the cloud. - ###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. @@ -32,10 +37,6 @@ items.armor.glyphs.entanglement.desc=This glyph grows earthroot around the weare items.armor.glyphs.flow.name=%s of flow items.armor.glyphs.flow.desc=This glyph manipulates the flow of water around the wearer, making them much faster when moving through it. -items.armor.glyphs.multiplicity.name=%s of multiplicity -items.armor.glyphs.multiplicity.rankings_desc=Killed by: glyph of multiplicity -items.armor.glyphs.multiplicity.desc= - items.armor.glyphs.obfuscation.name=%s of obfuscation items.armor.glyphs.obfuscation.desc=This glyph makes the wearer more difficult to detect, at the cost of defense. @@ -620,14 +621,13 @@ 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.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 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. This scroll is even able to sometimes dispel curse effects, though it is not as potent as a scroll of remove curse. ###wands items.wands.cursedwand.ondeath=You were killed by your own %s. items.wands.cursedwand.nothing=Nothing happens. -items.wands.cursedwand.cursed=Your worn equipment becomes cursed! items.wands.cursedwand.grass=Grass erupts around you! items.wands.cursedwand.fire=You smell burning... items.wands.cursedwand.transmogrify=Your wand transmogrifies into a different item! @@ -706,11 +706,17 @@ items.weapon.curses.annoying.msg_4=ARE WE AT THE BOSS YET!? items.weapon.curses.annoying.msg_5=OUCH, DON'T SWING ME SO HARD! items.weapon.curses.annoying.desc=Annoying weapons just want to help. unfortunately that help comes in the form of a loud voice which attracts enemies. +items.weapon.curses.displacing.name=displacing %s +items.weapon.curses.displacing.desc=Displacing weapons are infused with chaotic teleportation magic, possessing the ability to warp enemies around the floor randomly. + items.weapon.curses.exhausting.name=exhausting %s items.weapon.curses.exhausting.desc=Exhausting weapons take great effort to use, and will periodically weaken the wearer as a result. items.weapon.curses.fragile.name=fragile %s -items.weapon.curses.fragile.desc=Fragile weapons start out just as strong as their uncursed counterparts, but rapidly decrease in effectiveness as they are used. +items.weapon.curses.fragile.desc=Fragile weapons start out just as strong as their normal counterparts, but rapidly decrease in effectiveness as they are used. + +items.weapon.curses.sacrificial.name=sacrificial %s +items.weapon.curses.sacrificial.desc=Sacrificial weapons will demand blood from you in return for attacking foes. The more healthy you are, they more they will take. items.weapon.curses.wayward.name=wayward %s items.weapon.curses.wayward.desc=A wayward weapon has a very hard time finding its mark, making it extremely inaccurate unless the attack is guaranteed to succeed. diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java index ac8eb3180..544d1a6f9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Fadeleaf.java @@ -61,7 +61,7 @@ public class Fadeleaf extends Plant { ch.pos = newPos; ch.sprite.place( ch.pos ); - ch.sprite.visible = Dungeon.visible[pos]; + ch.sprite.visible = Dungeon.visible[ch.pos]; }