use of com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Char method resist.
// returns percent effectiveness after resistances
// TODO currently resistances reduce effectiveness by a static 50%, and do not stack.
public float resist(Class effect) {
HashSet<Class> resists = new HashSet<>(resistances);
for (Property p : properties()) {
resists.addAll(p.resistances());
}
for (Buff b : buffs()) {
resists.addAll(b.resistances());
}
float result = 1f;
for (Class c : resists) {
if (c.isAssignableFrom(effect)) {
result *= 0.5f;
}
}
return result * RingOfElements.resist(this, effect);
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Hero method actDescend.
private boolean actDescend(HeroAction.Descend action) {
int stairs = action.dst;
if (pos == stairs && pos == Dungeon.level.exit) {
curAction = null;
Buff buff = buff(TimekeepersHourglass.timeFreeze.class);
if (buff != null)
buff.detach();
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
Game.switchScene(InterlevelScene.class);
return false;
} else if (getCloser(stairs)) {
return true;
} else {
ready();
return false;
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff in project shattered-pixel-dungeon-gdx by 00-Evan.
the class BuffIndicator method layout.
@Override
protected void layout() {
ArrayList<Buff> newBuffs = new ArrayList<>();
for (Buff buff : ch.buffs()) {
if (buff.icon() != NONE) {
newBuffs.add(buff);
}
}
// remove any icons no longer present
for (Buff buff : buffIcons.keySet().toArray(new Buff[0])) {
if (!newBuffs.contains(buff)) {
Image icon = buffIcons.get(buff).icon;
icon.origin.set(SIZE / 2);
add(icon);
add(new AlphaTweener(icon, 0, 0.6f) {
@Override
protected void updateValues(float progress) {
super.updateValues(progress);
image.scale.set(1 + 5 * progress);
}
@Override
protected void onComplete() {
image.killAndErase();
}
});
buffIcons.get(buff).destroy();
remove(buffIcons.get(buff));
buffIcons.remove(buff);
}
}
// add new icons
for (Buff buff : newBuffs) {
if (!buffIcons.containsKey(buff)) {
BuffIcon icon = new BuffIcon(buff);
add(icon);
buffIcons.put(buff, icon);
}
}
// layout
int pos = 0;
for (BuffIcon icon : buffIcons.values()) {
icon.updateIcon();
icon.setRect(x + pos * (SIZE + 2), y, 9, 12);
pos++;
}
}
Aggregations