use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class Mob method die.
@Override
public void die(Object cause) {
runMobScript("onDie", cause);
Hero hero = Dungeon.hero;
{
// TODO we should move this block out of Mob class
if (hero.heroClass == HeroClass.NECROMANCER) {
if (hero.isAlive()) {
if (hero.belongings.armor instanceof NecromancerRobe) {
hero.accumulateSoulPoints();
}
}
}
for (Item item : hero.belongings) {
if (item instanceof BlackSkull && item.isEquipped(hero)) {
((BlackSkull) item).mobDied(this, hero);
}
}
}
{
if (hero.isAlive()) {
if (!friendly(hero)) {
Statistics.enemiesSlain++;
Badges.validateMonstersSlain();
Statistics.qualifiedForNoKilling = false;
if (Dungeon.nightMode) {
Statistics.nightHunt++;
} else {
Statistics.nightHunt = 0;
}
Badges.validateNightHunter();
}
if (!(cause instanceof Mob) || hero.heroClass == HeroClass.NECROMANCER) {
if (hero.lvl() <= maxLvl && exp > 0) {
hero.earnExp(exp);
}
}
}
}
super.die(cause);
Library.identify(Library.MOB, getMobClassName());
if (hero.lvl() <= maxLvl + 2) {
dropLoot();
}
if (hero.isAlive() && !Dungeon.visible[getPos()]) {
GLog.i(TXT_DIED);
}
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class Monk method attackProc.
@Override
public int attackProc(@NonNull Char enemy, int damage) {
if (Random.Int(6) == 0 && enemy == Dungeon.hero) {
Hero hero = Dungeon.hero;
KindOfWeapon weapon = hero.belongings.weapon;
if (weapon != null && !(weapon instanceof Knuckles) && !weapon.cursed) {
hero.belongings.weapon = null;
Dungeon.level.drop(weapon, hero.getPos()).sprite.drop();
GLog.w(TXT_DISARM, getName(), weapon.name());
}
}
return damage;
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class Foliage method evolve.
@Override
protected void evolve() {
int from = getWidth() + 1;
int to = getLength() - getWidth() - 1;
int[] map = Dungeon.level.map;
boolean regrowth = false;
boolean visible = false;
for (int pos = from; pos < to; pos++) {
if (cur[pos] > 0) {
off[pos] = cur[pos];
volume += off[pos];
if (map[pos] == Terrain.EMBERS || map[pos] == Terrain.EMPTY) {
map[pos] = Terrain.GRASS;
regrowth = true;
}
visible = visible || Dungeon.visible[pos];
} else {
off[pos] = 0;
}
}
Hero hero = Dungeon.hero;
if (hero.isAlive() && hero.visibleEnemies() == 0 && cur[hero.getPos()] > 0) {
Buff.affect(hero, Shadows.class).prolong();
}
if (regrowth) {
GameScene.updateMap();
}
if (visible) {
Journal.add(Journal.Feature.GARDEN.desc());
}
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class Burning method act.
@Override
public boolean act() {
if (target.isAlive()) {
if (target instanceof Hero) {
Buff.prolong(target, Light.class, TICK * 1.01f);
}
int bonusDamage = Dungeon.depth / 2;
target.damage(Random.Int(1 + bonusDamage, 5 + bonusDamage), this);
applyToCarriedItems(new burnItem());
} else {
detach();
}
if (Dungeon.level.flammable[target.getPos()]) {
GameScene.add(Blob.seed(target.getPos(), 4, Fire.class));
}
spend(TICK);
left -= TICK;
if (left <= 0 || Random.Float() > (2 + (float) target.hp() / target.ht()) / 3 || (Dungeon.level.water[target.getPos()] && !target.isFlying())) {
detach();
}
return true;
}
Aggregations