use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue in project shattered-pixel-dungeon-gdx by 00-Evan.
the class StatueRoom method paint.
public void paint(Level level) {
Painter.fill(level, this, Terrain.WALL);
Painter.fill(level, this, 1, Terrain.EMPTY);
Point c = center();
int cx = c.x;
int cy = c.y;
Door door = entrance();
door.set(Door.Type.LOCKED);
level.addItemToSpawn(new IronKey(Dungeon.depth));
if (door.x == left) {
Painter.fill(level, right - 1, top + 1, 1, height() - 2, Terrain.STATUE);
cx = right - 2;
} else if (door.x == right) {
Painter.fill(level, left + 1, top + 1, 1, height() - 2, Terrain.STATUE);
cx = left + 2;
} else if (door.y == top) {
Painter.fill(level, left + 1, bottom - 1, width() - 2, 1, Terrain.STATUE);
cy = bottom - 2;
} else if (door.y == bottom) {
Painter.fill(level, left + 1, top + 1, width() - 2, 1, Terrain.STATUE);
cy = top + 2;
}
Statue statue = new Statue();
statue.pos = cx + cy * level.width();
level.mobs.add(statue);
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Multiplicity method proc.
@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 < PathFinder.NEIGHBOURS8.length; i++) {
int p = defender.pos + PathFinder.NEIGHBOURS8[i];
if (Actor.findChar(p) == null && (Dungeon.level.passable[p] || Dungeon.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 {
// FIXME should probably have a mob property for this
if (attacker.properties().contains(Char.Property.BOSS) || attacker.properties().contains(Char.Property.MINIBOSS) || attacker instanceof Mimic || attacker instanceof Statue) {
m = Dungeon.level.createMob();
} else {
try {
Actor.fixTime();
m = (Mob) attacker.getClass().newInstance();
Bundle store = new Bundle();
attacker.storeInBundle(store);
m.restoreFromBundle(store);
m.HP = m.HT;
// If a thief has stolen an item, that item is not duplicated.
if (m instanceof Thief) {
((Thief) m).item = null;
}
} catch (Exception e) {
ShatteredPixelDungeon.reportException(e);
m = null;
}
}
}
if (m != null) {
GameScene.add(m);
ScrollOfTeleportation.appear(m, Random.element(spawnPoints));
}
}
}
return damage;
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfCorruption method onZap.
@Override
protected void onZap(Ballistica bolt) {
Char ch = Actor.findChar(bolt.collisionPos);
if (ch != null) {
if (!(ch instanceof Mob)) {
return;
}
Mob enemy = (Mob) ch;
float corruptingPower = 2 + level();
// base enemy resistance is usually based on their exp, but in special cases it is based on other criteria
float enemyResist = 1 + enemy.EXP;
if (ch instanceof Mimic || ch instanceof Statue) {
enemyResist = 1 + Dungeon.depth;
} else if (ch instanceof Piranha || ch instanceof Bee) {
enemyResist = 1 + Dungeon.depth / 2f;
} else if (ch instanceof Wraith) {
// this is so low because wraiths are always at max hp
enemyResist = 0.5f + Dungeon.depth / 8f;
} else if (ch instanceof Yog.BurningFist || ch instanceof Yog.RottingFist) {
enemyResist = 1 + 30;
} else if (ch instanceof Yog.Larva || ch instanceof King.Undead) {
enemyResist = 1 + 5;
} else if (ch instanceof Swarm) {
// child swarms don't give exp, so we force this here.
enemyResist = 1 + 3;
}
// 100% health: 3x resist 75%: 2.1x resist 50%: 1.5x resist 25%: 1.1x resist
enemyResist *= 1 + 2 * Math.pow(enemy.HP / (float) enemy.HT, 2);
// debuffs placed on the enemy reduce their resistance
for (Buff buff : enemy.buffs()) {
if (MAJOR_DEBUFFS.containsKey(buff.getClass()))
enemyResist *= MAJOR_DEBUFF_WEAKEN;
else if (MINOR_DEBUFFS.containsKey(buff.getClass()))
enemyResist *= MINOR_DEBUFF_WEAKEN;
else if (buff.type == Buff.buffType.NEGATIVE)
enemyResist *= MINOR_DEBUFF_WEAKEN;
}
// cannot re-corrupt or doom an enemy, so give them a major debuff instead
if (enemy.buff(Corruption.class) != null || enemy.buff(Doom.class) != null) {
enemyResist = corruptingPower * .99f;
}
if (corruptingPower > enemyResist) {
corruptEnemy(enemy);
} else {
float debuffChance = corruptingPower / enemyResist;
if (Random.Float() < debuffChance) {
debuffEnemy(enemy, MAJOR_DEBUFFS);
} else {
debuffEnemy(enemy, MINOR_DEBUFFS);
}
}
processSoulMark(ch, chargesPerCast());
} else {
Dungeon.level.press(bolt.collisionPos, null, true);
}
}
Aggregations