public static boolean posNeeded() { //2 POS each floor set int posLeftThisSet = 2 - (LimitedDrops.STRENGTH_POTIONS.count - (depth / 5) * 2); if (posLeftThisSet <= 0) return false; int floorThisSet = (depth % 5); //pos drops every two floors, (numbers 1-2, and 3-4) with a 50% chance for the earlier one each time. int targetPOSLeft = 2 - floorThisSet/2; if (floorThisSet % 2 == 1 && Random.Int(2) == 0) targetPOSLeft --; if (targetPOSLeft < posLeftThisSet) return true; else return false; }
public static boolean asNeeded() { //1 AS each floor set int asLeftThisSet = 1 - (LimitedDrops.ARCANE_STYLI.count - (depth / 5)); if (asLeftThisSet <= 0) return false; int floorThisSet = (depth % 5); //chance is floors left / scrolls left return Random.Int(5 - floorThisSet) < asLeftThisSet; }
private int randomPrisonCell(){ int pos = 1+8*32; //initial position at top-left room //randomly assign a room. pos += Random.Int(4)*(4*32); //one of the 4 rows pos += Random.Int(2)*6; // one of the 2 columns //and then a certain tile in that room. pos += Random.Int(3) + Random.Int(3)*32; return pos; }
public synchronized Gizmo random() { if (length > 0) { return members.get( Random.Int(length) ); } else { return null; } }
@SuppressWarnings("unchecked") public static<T> T element( Collection<? extends T> collection ) { int size = collection.size(); return size > 0 ? (T)collection.toArray()[Int( size )] : null; }
public RainbowParticle() { super(); color( Random.Int( 0x1000000 ) ); lifespan = 0.5f; }
public static void restoreGhostHero( Level level, int pos ){ if (heldGhost != null){ level.mobs.add( heldGhost ); int ghostPos; do { ghostPos = pos + PathFinder.NEIGHBOURS8[Random.Int(8)]; } while (Dungeon.level.solid[ghostPos] || level.findMob(ghostPos) != null); heldGhost.pos = ghostPos; heldGhost = null; } }
@Override protected boolean steal( Hero hero ) { if (super.steal( hero )) { Buff.prolong( hero, Blindness.class, Random.Int( 2, 5 ) ); Buff.affect( hero, Poison.class ).set(Random.Int(5, 7) ); Buff.prolong( hero, Cripple.class, Random.Int( 3, 8 ) ); Dungeon.observe(); return true; } else { return false; } }
@Override public int compare(Trap o1, Trap o2) { float diff = Dungeon.level.trueDistance(cell, o1.pos) - Dungeon.level.trueDistance(cell, o2.pos); if (diff < 0){ return -1; } else if (diff == 0){ return Random.Int(2) == 0 ? -1 : 1; } else { return 1; } } });
@Override public int attackProc( Char enemy, int damage ) { damage = super.attackProc( enemy, damage ); if (Random.Int( MAX_ARMY_SIZE ) == 0) { Buff.prolong( enemy, Paralysis.class, 1 ); } return damage; }
@Override public int attackProc( Char enemy, int damage ) { damage = super.attackProc( enemy, damage ); if (Random.Int( 10 ) == 0) { Buff.prolong( enemy, Paralysis.class, 1.1f ); } return super.attackProc( enemy, damage ); }
@Override public int attackProc( Char enemy, int damage ) { damage = super.attackProc( enemy, damage ); if (Random.Int(3) == 0) { Buff.affect(enemy, Ooze.class).set( 20f ); } return damage; }
@Override public int attackProc( Char enemy, int damage ) { damage = super.attackProc( enemy, damage ); if (Random.Int( 2 ) == 0) { Buff.affect( enemy, Burning.class ).reignite( enemy ); } return damage; }
@Override public int attackProc( Char enemy, int damage ) { damage = super.attackProc( enemy, damage ); if (Random.Int( 2 ) == 0) { Buff.affect( enemy, Bleeding.class ).set( damage ); } return damage; } }
public boolean attachTo( Char target ) { if (!target.isImmune(Sleep.class) && super.attachTo(target)) { if (cooldown() == 0) spend(Random.Int(3, 6)); return true; } return false; }
public void proc(Char enemy){ if (Random.Int(2) == 0) Buff.affect( enemy, Burning.class ).reignite( enemy ); enemy.sprite.emitter().burst( FlameParticle.FACTORY, 2 ); }
@Override public void staffFx(MagesStaff.StaffParticle particle) { particle.color( Random.Int( 0x1000000 ) ); particle.am = 0.5f; particle.setLifespan(1f); particle.speed.polar(Random.Float(PointF.PI2), 2f); particle.setSize( 1f, 2f); particle.radiateXY( 0.5f); }