use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon by watabou.
the class MissileWeapon method proc.
@Override
public void proc(Char attacker, Char defender, int damage) {
super.proc(attacker, defender, damage);
Hero hero = (Hero) attacker;
if (hero.rangedWeapon == null && stackable) {
if (quantity == 1) {
doUnequip(hero, false, false);
} else {
detach(null);
}
}
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon by watabou.
the class WndTradeItem method sell.
private void sell(Item item) {
Hero hero = Dungeon.hero;
if (item.isEquipped(hero) && !((EquipableItem) item).doUnequip(hero, false)) {
return;
}
item.detachAll(hero.belongings.backpack);
int price = item.price();
new Gold(price).doPickUp(hero);
GLog.i(TXT_SOLD, item.name(), price);
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon by watabou.
the class Foliage method evolve.
@Override
protected void evolve() {
int from = WIDTH + 1;
int to = Level.LENGTH - WIDTH - 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.GRASS;
regrowth = true;
}
visible = visible || Dungeon.visible[pos];
} else {
off[pos] = 0;
}
}
Hero hero = Dungeon.hero;
if (hero.isAlive() && hero.visibleEnemies() == 0 && cur[hero.pos] > 0) {
Buff.affect(hero, Shadows.class).prolong();
}
if (regrowth) {
GameScene.updateMap();
}
if (visible) {
Journal.add(Journal.Feature.GARDEN);
}
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon by watabou.
the class SacrificialFire method sacrifice.
public static void sacrifice(Char ch) {
Wound.hit(ch);
SacrificialFire fire = (SacrificialFire) Dungeon.level.blobs.get(SacrificialFire.class);
if (fire != null) {
int exp = 0;
if (ch instanceof Mob) {
exp = ((Mob) ch).exp() * Random.IntRange(1, 3);
} else if (ch instanceof Hero) {
exp = ((Hero) ch).maxExp();
}
if (exp > 0) {
int volume = fire.volume - exp;
if (volume > 0) {
fire.seed(fire.pos, volume);
GLog.w(TXT_WORTHY);
} else {
fire.seed(fire.pos, 0);
Journal.remove(Feature.SACRIFICIAL_FIRE);
GLog.w(TXT_REWARD);
GameScene.effect(new Flare(7, 32).color(0x66FFFF, true).show(ch.sprite.parent, DungeonTilemap.tileCenterToWorld(fire.pos), 2f));
Dungeon.level.drop(new ScrollOfWipeOut(), fire.pos).sprite.drop();
}
} else {
GLog.w(TXT_UNWORTHY);
}
}
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon by watabou.
the class Hunger method act.
@Override
public boolean act() {
if (target.isAlive()) {
Hero hero = (Hero) target;
if (isStarving()) {
if (Random.Float() < 0.3f && (target.HP > 1 || !target.paralysed)) {
GLog.n(TXT_STARVING);
hero.damage(1, this);
hero.interrupt();
}
} else {
int bonus = 0;
for (Buff buff : target.buffs(RingOfSatiety.Satiety.class)) {
bonus += ((RingOfSatiety.Satiety) buff).level;
}
float newLevel = level + STEP - bonus;
boolean statusUpdated = false;
if (newLevel >= STARVING) {
GLog.n(TXT_STARVING);
statusUpdated = true;
hero.interrupt();
} else if (newLevel >= HUNGRY && level < HUNGRY) {
GLog.w(TXT_HUNGRY);
statusUpdated = true;
}
level = newLevel;
if (statusUpdated) {
BuffIndicator.refreshHero();
}
}
float step = ((Hero) target).heroClass == HeroClass.ROGUE ? STEP * 1.2f : STEP;
spend(target.buff(Shadows.class) == null ? step : step * 1.5f);
} else {
diactivate();
}
return true;
}
Aggregations