use of com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfRemoveCurse method uncurse.
public static boolean uncurse(Hero hero, Item... items) {
boolean procced = false;
for (Item item : items) {
if (item != null && item.cursed) {
item.cursed = false;
procced = true;
}
if (item instanceof Weapon) {
Weapon w = (Weapon) item;
if (w.hasCurseEnchant()) {
w.enchant(null);
w.cursed = false;
procced = true;
}
}
if (item instanceof Armor) {
Armor a = (Armor) item;
if (a.hasCurseGlyph()) {
a.inscribe(null);
a.cursed = false;
procced = true;
}
}
if (item instanceof Bag) {
for (Item bagItem : ((Bag) item).items) {
if (bagItem != null && bagItem.cursed) {
bagItem.cursed = false;
procced = true;
}
}
}
}
if (procced) {
hero.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10);
// for ring of might
hero.updateHT(false);
}
return procced;
}
use of com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor in project shattered-pixel-dungeon-gdx by 00-Evan.
the class ScrollOfUpgrade method onItemSelected.
@Override
protected void onItemSelected(Item item) {
upgrade(curUser);
// ...yes this is rather messy
if (item instanceof Weapon) {
Weapon w = (Weapon) item;
boolean wasCursed = w.cursed;
boolean hadCursedEnchant = w.hasCurseEnchant();
boolean hadGoodEnchant = w.hasGoodEnchant();
w.upgrade();
if (hadCursedEnchant && !w.hasCurseEnchant()) {
removeCurse(Dungeon.hero);
} else if (wasCursed && !w.cursed) {
weakenCurse(Dungeon.hero);
}
if (hadGoodEnchant && !w.hasGoodEnchant()) {
GLog.w(Messages.get(Weapon.class, "incompatible"));
}
} else if (item instanceof Armor) {
Armor a = (Armor) item;
boolean wasCursed = a.cursed;
boolean hadCursedGlyph = a.hasCurseGlyph();
boolean hadGoodGlyph = a.hasGoodGlyph();
a.upgrade();
if (hadCursedGlyph && !a.hasCurseGlyph()) {
removeCurse(Dungeon.hero);
} else if (wasCursed && !a.cursed) {
weakenCurse(Dungeon.hero);
}
if (hadGoodGlyph && !a.hasGoodGlyph()) {
GLog.w(Messages.get(Armor.class, "incompatible"));
}
} else if (item instanceof Wand || item instanceof Ring) {
boolean wasCursed = item.cursed;
item.upgrade();
if (wasCursed && !item.cursed) {
removeCurse(Dungeon.hero);
}
} else {
item.upgrade();
}
Badges.validateItemLevelAquired(item);
}
use of com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Hero method speed.
@Override
public float speed() {
float speed = super.speed();
speed *= RingOfHaste.speedMultiplier(this);
Armor armor = belongings.armor;
if (armor != null) {
if (armor.hasGlyph(Swiftness.class)) {
speed *= (1.1f + 0.01f * belongings.armor.level());
} else if (armor.hasGlyph(Flow.class) && Dungeon.level.water[pos]) {
speed *= (1.5f + 0.05f * belongings.armor.level());
}
}
int aEnc = armor != null ? armor.STRReq() - STR() : 0;
if (aEnc > 0)
speed /= Math.pow(1.2, aEnc);
Momentum momentum = buff(Momentum.class);
if (momentum != null) {
((HeroSprite) sprite).sprint(1f + 0.05f * momentum.stacks());
speed *= momentum.speedMultiplier();
}
return speed;
}
Aggregations