use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.
the class TeleportationTrap method activate.
@Override
public void activate() {
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
Char ch = Actor.findChar(pos);
if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero((Hero) ch);
} else if (ch != null) {
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 (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING) {
((Mob) ch).state = ((Mob) ch).WANDERING;
}
ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.level.heroFOV[pos];
}
}
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null) {
int cell = Dungeon.level.randomRespawnCell();
Item item = heap.pickUp();
if (cell != -1) {
Dungeon.level.drop(item, cell);
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Fadeleaf method activate.
@Override
public void activate() {
Char ch = Actor.findChar(pos);
if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero((Hero) ch);
((Hero) ch).curAction = null;
} else if (ch instanceof Mob && !ch.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()) {
ch.pos = newPos;
if (((Mob) ch).state == ((Mob) ch).HUNTING)
((Mob) ch).state = ((Mob) ch).WANDERING;
ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.level.heroFOV[ch.pos];
}
}
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Plant method trigger.
public void trigger() {
Char ch = Actor.findChar(pos);
if (ch instanceof Hero) {
((Hero) ch).interrupt();
if (((Hero) ch).subClass == HeroSubClass.WARDEN) {
Buff.affect(ch, Barkskin.class).level(ch.HT / 3);
}
}
wither();
activate();
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Dirk method damageRoll.
@Override
public int damageRoll(Char owner) {
if (owner instanceof Hero) {
Hero hero = (Hero) owner;
Char enemy = hero.enemy();
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
// deals 67% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = imbue.damageFactor(Random.NormalIntRange(min() + Math.round(diff * 0.67f), max()));
int exStr = hero.STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange(0, exStr);
}
return damage;
}
}
return super.damageRoll(owner);
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ThrowingKnife method damageRoll.
@Override
public int damageRoll(Char owner) {
if (owner instanceof Hero) {
Hero hero = (Hero) owner;
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
// deals 75% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = imbue.damageFactor(Random.NormalIntRange(min() + Math.round(diff * 0.75f), max()));
damage = Math.round(damage * RingOfSharpshooting.damageMultiplier(hero));
int exStr = hero.STR() - STRReq();
if (exStr > 0 && hero.heroClass == HeroClass.HUNTRESS) {
damage += Random.IntRange(0, exStr);
}
return damage;
}
}
return super.damageRoll(owner);
}
Aggregations