private int healingThisTick(){ return (int)GameMath.gate(1, Math.round(healingLeft * percentHealPerTick) + flatHealPerTick, healingLeft); }
private int healingThisTick(){ return (int)GameMath.gate(1, Math.round(healingLeft * percentHealPerTick) + flatHealPerTick, healingLeft); }
protected final Point getDoorCenter(){ PointF doorCenter = new PointF(0, 0); for (Door door : connected.values()) { doorCenter.x += door.x; doorCenter.y += door.y; } Point c = new Point((int)doorCenter.x / connected.size(), (int)doorCenter.y / connected.size()); if (Random.Float() < doorCenter.x % 1) c.x++; if (Random.Float() < doorCenter.y % 1) c.y++; c.x = (int) GameMath.gate(left+2, c.x, right-2); c.y = (int)GameMath.gate(top+2, c.y, bottom-2); return c; }
@Override public boolean onMouseScroll(int scroll) { mouseZoom -= scroll / 3f; if (PDInputProcessor.modifier) { mouseZoom = zoom( mouseZoom ); } else { zoom( Math.round( mouseZoom ) ); mouseZoom = GameMath.gate( PixelScene.minZoom, mouseZoom, PixelScene.maxZoom ); } return true; }
protected final Point getDoorCenter(){ PointF doorCenter = new PointF(0, 0); for (Door door : connected.values()) { doorCenter.x += door.x; doorCenter.y += door.y; } Point c = new Point((int)doorCenter.x / connected.size(), (int)doorCenter.y / connected.size()); if (Random.Float() < doorCenter.x % 1) c.x++; if (Random.Float() < doorCenter.y % 1) c.y++; c.x = (int) GameMath.gate(left+2, c.x, right-2); c.y = (int)GameMath.gate(top+2, c.y, bottom-2); return c; }
protected final Point getDoorCenter(){ PointF doorCenter = new PointF(0, 0); for (Door door : connected.values()) { doorCenter.x += door.x; doorCenter.y += door.y; } Point c = new Point((int)doorCenter.x / connected.size(), (int)doorCenter.y / connected.size()); if (Random.Float() < doorCenter.x % 1) c.x++; if (Random.Float() < doorCenter.y % 1) c.y++; c.x = (int) GameMath.gate(left+2, c.x, right-2); c.y = (int)GameMath.gate(top+2, c.y, bottom-2); return c; }
public float penaltyFactor( Hero hero, boolean identified ) { return 1.0f - 0.025f * GameMath.gate( 0, penaltyBase(hero, strShown( identified ) ) - ( this instanceof Weapon && ((Weapon)this).enchantment instanceof Ethereal ? bonus : 0 ), 20 ); }
public static Armor randomArmor(int floorSet) { floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1); try { Armor a = (Armor)Category.ARMOR.classes[Random.chances(floorSetTierProbs[floorSet])].newInstance(); a.random(); return a; } catch (Exception e) { ShatteredPixelDungeon.reportException(e); return null; } }
public static Armor randomArmor(int floorSet) { floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1); try { Armor a = (Armor)Category.ARMOR.classes[Random.chances(floorSetTierProbs[floorSet])].newInstance(); a.random(); return a; } catch (Exception e) { ShatteredPixelDungeon.reportException(e); return null; } }
public static MissileWeapon randomMissile(int floorSet) { floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1); try { Category c = misTiers[Random.chances(floorSetTierProbs[floorSet])]; MissileWeapon w = (MissileWeapon)c.classes[Random.chances(c.probs)].newInstance(); w.random(); return w; } catch (Exception e) { ShatteredPixelDungeon.reportException(e); return null; } }
public static MeleeWeapon randomWeapon(int floorSet) { floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1); try { Category c = wepTiers[Random.chances(floorSetTierProbs[floorSet])]; MeleeWeapon w = (MeleeWeapon)c.classes[Random.chances(c.probs)].newInstance(); w.random(); return w; } catch (Exception e) { ShatteredPixelDungeon.reportException(e); return null; } }
public static MeleeWeapon randomWeapon(int floorSet) { floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1); try { Category c = wepTiers[Random.chances(floorSetTierProbs[floorSet])]; MeleeWeapon w = (MeleeWeapon)c.classes[Random.chances(c.probs)].newInstance(); w.random(); return w; } catch (Exception e) { ShatteredPixelDungeon.reportException(e); return null; } }
@Override protected void onDrag(Touchscreen.Touch touch) { if (pressed) { PointF p = camera().screenToCamera((int) touch.current.x, (int) touch.current.y); sliderNode.x = GameMath.gate(sliderBG.x - 2, p.x, sliderBG.x + sliderBG.width() - 2); } }
@Override protected void onDrag(NoosaInputProcessor.Touch touch) { if (pressed) { PointF p = camera().screenToCamera((int) touch.current.x, (int) touch.current.y); sliderNode.x = GameMath.gate(sliderBG.x - 2, p.x, sliderBG.x + sliderBG.width() - 2); } }
public int viewDistance(){ if( restoreHealth ) return 0; int distance = buff( Light.class ) != null ? super.viewDistance() : super.viewDistance() / 2 ; return GameMath.gate( 1, distance, 8 ); }
public static MissileWeapon randomMissile(int floorSet) { floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1); try { Category c = misTiers[Random.chances(floorSetTierProbs[floorSet])]; MissileWeapon w = (MissileWeapon)c.classes[Random.chances(c.probs)].newInstance(); w.random(); return w; } catch (Exception e) { ShatteredPixelDungeon.reportException(e); return null; } }
@Override protected void onTouchDown(Touchscreen.Touch touch) { pressed = true; PointF p = camera().screenToCamera((int) touch.current.x, (int) touch.current.y); sliderNode.x = GameMath.gate(sliderBG.x-2, p.x, sliderBG.x+sliderBG.width()-2); sliderNode.brightness(1.5f); }
@Override protected void onTouchDown(NoosaInputProcessor.Touch touch) { pressed = true; PointF p = camera().screenToCamera((int) touch.current.x, (int) touch.current.y); sliderNode.x = GameMath.gate(sliderBG.x-2, p.x, sliderBG.x+sliderBG.width()-2); sliderNode.brightness(1.5f); }