v0.4.2: fixed a bug with multiplicity and removed the unused pre-0.4.0 version of multiplicity
This commit is contained in:
parent
1da1ae73c9
commit
078e416b1a
|
@ -68,9 +68,9 @@ public class Multiplicity extends Armor.Glyph {
|
||||||
m = Bestiary.mutable(Dungeon.depth % 5 == 0 ? Dungeon.depth - 1 : Dungeon.depth);
|
m = Bestiary.mutable(Dungeon.depth % 5 == 0 ? Dungeon.depth - 1 : Dungeon.depth);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
m = (Mob)defender.getClass().newInstance();
|
m = (Mob)attacker.getClass().newInstance();
|
||||||
Bundle store = new Bundle();
|
Bundle store = new Bundle();
|
||||||
defender.storeInBundle(store);
|
attacker.storeInBundle(store);
|
||||||
m.restoreFromBundle(store);
|
m.restoreFromBundle(store);
|
||||||
m.HP = m.HT;
|
m.HP = m.HT;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.glyphs;
|
|
||||||
|
|
||||||
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.npcs.MirrorImage;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
|
||||||
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.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
|
||||||
import com.watabou.utils.PathFinder;
|
|
||||||
import com.watabou.utils.Random;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class Multiplicity extends Glyph {
|
|
||||||
|
|
||||||
private static ItemSprite.Glowing PINK = new ItemSprite.Glowing( 0xCCAA88 );
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int proc( Armor armor, Char attacker, Char defender, int damage) {
|
|
||||||
|
|
||||||
int level = Math.max( 0, armor.level() );
|
|
||||||
|
|
||||||
if (Random.Int( level / 2 + 6 ) >= 5) {
|
|
||||||
|
|
||||||
ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
|
|
||||||
|
|
||||||
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
|
|
||||||
int p = defender.pos + PathFinder.NEIGHBOURS8[i];
|
|
||||||
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
|
|
||||||
respawnPoints.add( p );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (respawnPoints.size() > 0) {
|
|
||||||
MirrorImage mob = new MirrorImage();
|
|
||||||
mob.duplicate( (Hero)defender );
|
|
||||||
GameScene.add( mob );
|
|
||||||
ScrollOfTeleportation.appear( mob, Random.element( respawnPoints ) );
|
|
||||||
|
|
||||||
defender.damage( Random.IntRange( 1, defender.HT / 6 ), this );
|
|
||||||
checkOwner( defender );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Glowing glowing() {
|
|
||||||
return PINK;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user