v0.4.0: implemented new curses
This commit is contained in:
committed by
Evan Debenham
parent
e94d2b4874
commit
8ec81a0c33
@@ -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 );
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
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<Integer> 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;
|
||||
}
|
||||
}
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user