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-remix by NYRDS.
the class Weakness method attachTo.
@Override
public boolean attachTo(Char target) {
if (super.attachTo(target)) {
Hero hero = (Hero) target;
hero.belongings.discharge();
return true;
} else {
return false;
}
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class Dungeon method init.
public static void init() {
gameId = String.valueOf(SystemTime.now());
challenges = PixelDungeon.challenges();
Scroll.initLabels();
Potion.initColors();
Wand.initWoods();
Ring.initGems();
Statistics.reset();
Journal.reset();
depth = 0;
gold(0);
potionOfStrength = 0;
scrollsOfUpgrade = 0;
arcaneStyli = 0;
dewVial = true;
transmutation = Random.IntRange(6, 14);
chapters = new HashSet<>();
Ghost.Quest.reset();
WandMaker.Quest.reset();
Blacksmith.Quest.reset();
Imp.Quest.reset();
ScarecrowNPC.Quest.reset();
AzuterronNPC.Quest.reset();
CagedKobold.Quest.reset();
PlagueDoctorNPC.Quest.reset();
Room.shuffleTypes();
hero = new Hero(difficulty);
Badges.reset();
heroClass.initHero(hero);
hero.levelId = DungeonGenerator.getEntryLevel();
SaveUtils.deleteLevels(heroClass);
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class Web method evolve.
@Override
protected void evolve() {
for (int i = 0; i < getLength(); i++) {
int offv = cur[i] > 0 ? cur[i] - 1 : 0;
off[i] = offv;
if (offv > 0) {
volume += offv;
Char ch = Actor.findChar(i);
boolean rootable = false;
if (ch != null) {
rootable = true;
if (ch instanceof Hero) {
if (((Hero) ch).belongings.armor instanceof SpiderArmor) {
rootable = false;
}
}
}
if (rootable) {
Buff.prolong(ch, Roots.class, TICK);
}
}
}
}
use of com.watabou.pixeldungeon.actors.hero.Hero in project pixel-dungeon-remix by NYRDS.
the class Buff method applyToCarriedItems.
protected void applyToCarriedItems(itemAction action) {
if (target instanceof Hero) {
Hero hero = (Hero) target;
int n = 1;
if (hero.getDifficulty() >= 3) {
n = 5;
}
for (int i = 0; i < n; i++) {
Item item = hero.belongings.randomUnequipped();
if (item == null) {
continue;
}
Item srcItem = item.detach(hero.belongings.backpack);
item = action.act(srcItem);
if (item == srcItem) {
// item unaffected by buff
collectOrDropItem(item);
continue;
}
String actionText = null;
if (item == null) {
actionText = action.actionText(srcItem);
action.carrierFx();
} else {
if (!item.equals(srcItem)) {
actionText = action.actionText(srcItem);
collectOrDropItem(item);
action.carrierFx();
}
}
if (actionText != null) {
GLog.w(actionText);
}
}
} else if (target instanceof Thief) {
if (((Thief) target).item == null) {
return;
}
((Thief) target).item = action.act(((Thief) target).item);
action.carrierFx();
}
}
Aggregations