use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ImpShopRoom method placeShopkeeper.
@Override
protected void placeShopkeeper(Level level) {
int pos = level.pointToCell(center());
Mob shopkeeper = new ImpShopkeeper();
shopkeeper.pos = pos;
level.mobs.add(shopkeeper);
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class FlashingTrap method activate.
@Override
public void activate() {
Char c = Actor.findChar(pos);
if (c != null) {
int damage = Math.max(0, (4 + Dungeon.depth) - c.drRoll());
Buff.affect(c, Bleeding.class).set(damage);
Buff.prolong(c, Blindness.class, 10f);
Buff.prolong(c, Cripple.class, 20f);
if (c instanceof Mob) {
if (((Mob) c).state == ((Mob) c).HUNTING)
((Mob) c).state = ((Mob) c).WANDERING;
((Mob) c).beckon(Dungeon.level.randomDestination());
}
}
if (Dungeon.level.heroFOV[pos]) {
GameScene.flash(0xFFFFFF);
Sample.INSTANCE.play(Assets.SND_BLAST);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class GuardianTrap method activate.
@Override
public void activate() {
for (Mob mob : Dungeon.level.mobs) {
mob.beckon(pos);
}
if (Dungeon.level.heroFOV[pos]) {
GLog.w(Messages.get(this, "alarm"));
CellEmitter.center(pos).start(Speck.factory(Speck.SCREAM), 0.3f, 3);
}
Sample.INSTANCE.play(Assets.SND_ALERT);
for (int i = 0; i < (Dungeon.depth - 5) / 5; i++) {
Guardian guardian = new Guardian();
guardian.state = guardian.WANDERING;
guardian.pos = Dungeon.level.randomRespawnCell();
GameScene.add(guardian);
guardian.beckon(Dungeon.hero.pos);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class CursedWand method commonEffect.
private static void commonEffect(final Wand wand, final Hero user, final Ballistica bolt) {
switch(Random.Int(4)) {
// anti-entropy
case 0:
cursedFX(user, bolt, new Callback() {
public void call() {
Char target = Actor.findChar(bolt.collisionPos);
switch(Random.Int(2)) {
case 0:
if (target != null)
Buff.affect(target, Burning.class).reignite(target);
Buff.affect(user, Frost.class, Frost.duration(user) * Random.Float(3f, 5f));
break;
case 1:
Buff.affect(user, Burning.class).reignite(user);
if (target != null)
Buff.affect(target, Frost.class, Frost.duration(target) * Random.Float(3f, 5f));
break;
}
wand.wandUsed();
}
});
break;
// spawns some regrowth
case 1:
cursedFX(user, bolt, new Callback() {
public void call() {
int c = Dungeon.level.map[bolt.collisionPos];
if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO || c == Terrain.GRASS || c == Terrain.HIGH_GRASS) {
GameScene.add(Blob.seed(bolt.collisionPos, 30, Regrowth.class));
}
wand.wandUsed();
}
});
break;
// random teleportation
case 2:
switch(Random.Int(2)) {
case 0:
ScrollOfTeleportation.teleportHero(user);
wand.wandUsed();
break;
case 1:
cursedFX(user, bolt, new Callback() {
public void call() {
Char ch = Actor.findChar(bolt.collisionPos);
if (ch == user) {
ScrollOfTeleportation.teleportHero(user);
wand.wandUsed();
} else if (ch != null && !ch.properties().contains(Char.Property.IMMOVABLE)) {
int count = 10;
int pos;
do {
pos = Dungeon.level.randomRespawnCell();
if (count-- <= 0) {
break;
}
} while (pos == -1);
if (pos == -1 || Dungeon.bossLevel()) {
GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
} else {
ch.pos = pos;
if (((Mob) ch).state == ((Mob) ch).HUNTING)
((Mob) ch).state = ((Mob) ch).WANDERING;
ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.level.heroFOV[pos];
}
}
wand.wandUsed();
}
});
break;
}
break;
// random gas at location
case 3:
cursedFX(user, bolt, new Callback() {
public void call() {
switch(Random.Int(3)) {
case 0:
GameScene.add(Blob.seed(bolt.collisionPos, 800, ConfusionGas.class));
break;
case 1:
GameScene.add(Blob.seed(bolt.collisionPos, 500, ToxicGas.class));
break;
case 2:
GameScene.add(Blob.seed(bolt.collisionPos, 200, ParalyticGas.class));
break;
}
wand.wandUsed();
}
});
break;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob 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