use of com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfTransfusion method onZap.
@Override
protected void onZap(Ballistica beam) {
for (int c : beam.subPath(0, beam.dist)) CellEmitter.center(c).burst(BloodParticle.BURST, 1);
int cell = beam.collisionPos;
Char ch = Actor.findChar(cell);
Heap heap = Dungeon.level.heaps.get(cell);
// if we find a character..
if (ch != null && ch instanceof Mob) {
processSoulMark(ch, chargesPerCast());
// heals an ally, or a charmed enemy
if (ch.alignment == Char.Alignment.ALLY || ch.buff(Charm.class) != null) {
int missingHP = ch.HT - ch.HP;
// heals 30%+3%*lvl missing HP.
int healing = (int) Math.ceil((missingHP * (0.30f + (0.03f * level()))));
ch.HP += healing;
ch.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1 + level() / 2);
ch.sprite.showStatus(CharSprite.POSITIVE, "+%dHP", healing);
// harms the undead
} else if (ch.properties().contains(Char.Property.UNDEAD)) {
// deals 30%+5%*lvl total HP.
int damage = (int) Math.ceil(ch.HT * (0.3f + (0.05f * level())));
ch.damage(damage, this);
ch.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10 + level());
Sample.INSTANCE.play(Assets.SND_BURNING);
// charms an enemy
} else {
float duration = 5 + level();
Buff.affect(ch, Charm.class, duration).object = curUser.id();
duration *= Random.Float(0.75f, 1f);
Buff.affect(curUser, Charm.class, duration).object = ch.id();
ch.sprite.centerEmitter().start(Speck.factory(Speck.HEART), 0.2f, 5);
curUser.sprite.centerEmitter().start(Speck.factory(Speck.HEART), 0.2f, 5);
}
// if we find an item...
} else if (heap != null && heap.type == Heap.Type.HEAP) {
Item item = heap.peek();
// 30% + 10%*lvl chance to uncurse the item and reset it to base level if degraded.
if (item != null && Random.Float() <= 0.3f + level() * 0.1f) {
if (item.cursed) {
item.cursed = false;
CellEmitter.get(cell).start(ShadowParticle.UP, 0.05f, 10);
Sample.INSTANCE.play(Assets.SND_BURNING);
}
int lvldiffFromBase = item.level() - (item instanceof Ring ? 1 : 0);
if (lvldiffFromBase < 0) {
item.upgrade(-lvldiffFromBase);
CellEmitter.get(cell).start(Speck.factory(Speck.UP), 0.2f, 3);
Sample.INSTANCE.play(Assets.SND_BURNING);
}
}
// if we find some trampled grass...
} else if (Dungeon.level.map[cell] == Terrain.GRASS) {
// regrow one grass tile, suuuuuper useful...
Dungeon.level.set(cell, Terrain.HIGH_GRASS);
GameScene.updateMap(cell);
CellEmitter.get(cell).burst(LeafParticle.LEVEL_SPECIFIC, 4);
// If we find embers...
} else if (Dungeon.level.map[cell] == Terrain.EMBERS) {
// 30% + 3%*lvl chance to grow a random plant, or just regrow grass.
if (Random.Float() <= 0.3f + level() * 0.03f) {
Dungeon.level.plant((Plant.Seed) Generator.random(Generator.Category.SEED), cell);
CellEmitter.get(cell).burst(LeafParticle.LEVEL_SPECIFIC, 8);
GameScene.updateMap(cell);
} else {
Dungeon.level.set(cell, Terrain.HIGH_GRASS);
GameScene.updateMap(cell);
CellEmitter.get(cell).burst(LeafParticle.LEVEL_SPECIFIC, 4);
}
} else
// don't damage the hero if we can't find a target;
return;
if (!freeCharge) {
damageHero();
} else {
freeCharge = false;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring 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.rings.Ring in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WaterOfTransmutation method changeRing.
private Ring changeRing(Ring r) {
Ring n;
do {
n = (Ring) Generator.random(Category.RING);
} while (Challenges.isItemBlocked(n) || n.getClass() == r.getClass());
n.level(0);
int level = r.level();
if (level > 0) {
n.upgrade(level);
} else if (level < 0) {
n.degrade(-level);
}
n.levelKnown = r.levelKnown;
n.cursedKnown = r.cursedKnown;
n.cursed = r.cursed;
return n;
}
Aggregations