use of com.watabou.pixeldungeon.items.rings.Artifact in project pixel-dungeon-remix by NYRDS.
the class Bones method leave.
public static void leave() {
item = null;
switch(2) {
case 0:
item = Dungeon.hero.belongings.weapon;
break;
case 1:
item = Dungeon.hero.belongings.armor;
break;
case 2:
item = Dungeon.hero.belongings.ring1;
break;
case 3:
item = Dungeon.hero.belongings.ring2;
break;
}
if (item == null || (item instanceof Artifact && !(item instanceof Ring))) {
if (Dungeon.gold() > 0) {
item = new Gold(Random.IntRange(1, Dungeon.gold()));
} else {
item = new Gold(1);
}
}
depth = Dungeon.depth;
Bundle bundle = new Bundle();
bundle.put(LEVEL, depth);
bundle.put(ITEM, item);
try {
OutputStream output = FileSystem.getOutputStream(BONES_FILE);
Bundle.write(bundle, output);
output.close();
} catch (IOException ignored) {
}
}
use of com.watabou.pixeldungeon.items.rings.Artifact in project pixel-dungeon-remix by NYRDS.
the class ItemSlot method item.
public void item(Item item) {
if (item == null) {
active = false;
icon.setVisible(false);
emitter.setVisible(false);
emitter.on = false;
topLeft.setVisible(false);
topRight.setVisible(false);
bottomRight.setVisible(false);
return;
}
active = true;
icon.setVisible(true);
topLeft.setVisible(true);
topRight.setVisible(true);
bottomRight.setVisible(true);
icon.view(item);
if (item.emitter() != null) {
emitter.setVisible(true);
emitter.pour(item.emitter(), item.emitterInterval());
} else {
emitter.setVisible(false);
emitter.on = false;
}
topLeft.text(item.status());
boolean isArmor = item instanceof Armor;
boolean isWeapon = item instanceof Weapon;
if (isArmor || isWeapon) {
if (item.levelKnown || (isWeapon && !(item instanceof MeleeWeapon))) {
int str = isArmor ? ((Armor) item).STR : ((Weapon) item).STR;
topRight.text(Utils.format(TXT_STRENGTH, str));
if (str > Dungeon.hero.effectiveSTR()) {
topRight.hardlight(DEGRADED);
} else {
topRight.resetColor();
}
} else {
topRight.text(Utils.format(TXT_TYPICAL_STR, isArmor ? ((Armor) item).typicalSTR() : ((MeleeWeapon) item).typicalSTR()));
topRight.hardlight(WARNING);
}
topRight.measure();
} else {
topRight.text(null);
}
int level = item.visiblyUpgraded();
if (level != 0) {
bottomRight.text(Utils.format(TXT_LEVEL, level));
bottomRight.measure();
bottomRight.hardlight(level > 0 ? UPGRADED : DEGRADED);
} else {
bottomRight.text(null);
}
if (item instanceof Artifact) {
Artifact artifact = (Artifact) item;
String text = artifact.getText();
if (text != null) {
topLeft.text(artifact.getText());
topLeft.hardlight(artifact.getColor());
topLeft.setVisible(true);
topLeft.measure();
}
}
layout();
}
Aggregations