use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class ScrollOfCurse method doRead.
@SuppressWarnings("unchecked")
@Override
protected void doRead() {
Invisibility.dispel(getCurUser());
if (getCurUser() instanceof Hero) {
Hero hero = getCurUser();
hero.getSprite().emitter().burst(ShadowParticle.CURSE, 6);
Sample.INSTANCE.play(Assets.SND_CURSED);
Class<? extends FlavourBuff> buffClass = (Class<? extends FlavourBuff>) Random.oneOf(badBuffs);
Buff.prolong(hero, buffClass, 10);
if (getCurUser().belongings.armor != null) {
getCurUser().belongings.armor.cursed = true;
}
if (getCurUser().belongings.weapon != null) {
getCurUser().belongings.weapon.cursed = true;
}
if (getCurUser().belongings.ring1 != null) {
getCurUser().belongings.ring1.cursed = true;
}
if (getCurUser().belongings.ring2 != null) {
getCurUser().belongings.ring2.cursed = true;
}
}
setKnown();
getCurUser().spendAndNext(TIME_TO_READ);
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class SummoningSpell method cast.
@Override
public boolean cast(@NonNull Char chr) {
if (chr instanceof Hero) {
Hero hero = (Hero) chr;
if (isSummoningLimitReached(hero)) {
GLog.w(getLimitWarning(getSummonLimit()));
return false;
}
hero.spend(castTime);
hero.busy();
hero.getSprite().zap(hero.getPos());
}
if (!super.cast(chr)) {
return false;
}
Level level = Dungeon.level;
int spawnPos = level.getEmptyCellNextTo(chr.getPos());
Wound.hit(chr);
Buff.detach(chr, Sungrass.Health.class);
if (level.cellValid(spawnPos)) {
Mob pet = getSummonMob();
if (chr instanceof Hero) {
Hero hero = (Hero) chr;
pet = Mob.makePet(pet, hero);
} else if (chr instanceof Mob) {
Mob mob = (Mob) chr;
pet.setFraction(mob.fraction());
} else {
pet.setFraction(Fraction.DUNGEON);
}
pet.setPos(spawnPos);
level.spawnMob(pet);
}
castCallback(chr);
return true;
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class AirElemental method attackProc.
@Override
public int attackProc(@NonNull Char enemy, int damage) {
Ballistica.cast(getPos(), enemy.getPos(), true, false);
Char ch;
for (int i = 1; i < maxDistance; i++) {
int c = Ballistica.trace[i];
if ((ch = Actor.findChar(c)) != null && ch instanceof Hero) {
int next = Ballistica.trace[i + 1];
if ((Dungeon.level.passable[next] || Dungeon.level.avoid[next]) && Actor.findChar(next) == null) {
ch.move(next);
ch.getSprite().move(ch.getPos(), next);
Dungeon.observe();
ch.getSprite().emitter().burst(WindParticle.FACTORY, 5);
ch.getSprite().burst(0xFF99FFFF, 3);
Sample.INSTANCE.play(Assets.SND_MELD);
} else {
return damage * 2;
}
}
}
return damage;
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class Trap method stepOn.
@Override
public boolean stepOn(Char chr) {
interact(chr);
if (chr instanceof Hero) {
Hero hero = (Hero) chr;
hero.interrupt();
}
return true;
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class Mob method ressurrect.
public void ressurrect(Char parent) {
int spawnPos = Dungeon.level.getEmptyCellNextTo(parent.getPos());
Mob new_mob;
try {
new_mob = this.getClass().newInstance();
} catch (Exception e) {
throw new TrackedRuntimeException("resurrect issue");
}
if (Dungeon.level.cellValid(spawnPos)) {
new_mob.setPos(spawnPos);
Dungeon.level.spawnMob(new_mob);
if (parent instanceof Hero) {
Mob.makePet(new_mob, (Hero) parent);
Actor.addDelayed(new Pushing(new_mob, parent.getPos(), new_mob.getPos()), -1);
}
}
}
Aggregations