@Override public Item random() { //always +0 //30% chance to be cursed if (Random.Float() < 0.3f) { cursed = true; } return this; }
protected Room randomRoom( Room.Type type, int tries ) { for (int i=0; i < tries; i++) { Room room = Random.element( rooms ); if (room.type == type) { return room; } } return null; }
@Override public int proc( Weapon weapon, Char attacker, Char defender, int damage ) { // lvl 0 - 13% // lvl 1 - 22% // lvl 2 - 30% int level = Math.max( 0, weapon.level() ); if (Random.Int( level + 8 ) >= 7) { Buff.prolong( defender, Paralysis.class, Random.Float( 1, 1.5f + level ) ); defender.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 12 ); } return damage; }
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; }
@Override public int proc(Weapon weapon, Char attacker, Char defender, int damage ) { if (attacker == Dungeon.hero && Random.Int(15) == 0) { Buff.affect(attacker, Weakness.class, Random.NormalIntRange(5, 20)); } return damage; }
@Override protected int standardRooms() { //6 to 9, average 7.333 return 6+Random.chances(new float[]{2, 3, 3, 1}); }
@Override public int drRoll() { return Random.NormalIntRange(0, 1); } }
public Piranha() { super( Dungeon.depth + 1 ); name = "giant piranha"; spriteClass = PiranhaSprite.class; baseSpeed = 2f; minDamage += tier * 2; maxDamage += tier * 2; HP = HT += Random.IntRange(2, 4); loot = new MysteryMeat(); lootChance = 0.5f; }
public int getRandomSpawnPoint() { ArrayList<Integer> list = new ArrayList<>(); for (int i=0; i < 5; i++) { int pos = (TOP + CHAMBER_HEIGHT + 1) * WIDTH + LEFT + i * 2 + 1; if( Actor.findChar( pos ) == null ) { list.add( pos ); } } return list.size() > 0 ? (int)(Random.oneOf( list.toArray() ) ) : 0; }
public static long Long( long max ) { long result = Long(); if (result < 0) result += Long.MAX_VALUE; return result % max; }
public static int spawnImages( Hero hero, int nImages ){ ArrayList<Integer> respawnPoints = new ArrayList<Integer>(); for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) { int p = hero.pos + PathFinder.NEIGHBOURS8[i]; if (Actor.findChar( p ) == null && Dungeon.level.passable[p]) { respawnPoints.add( p ); } } int spawned = 0; while (nImages > 0 && respawnPoints.size() > 0) { int index = Random.index( respawnPoints ); MirrorImage mob = new MirrorImage(); mob.duplicate( hero ); GameScene.add( mob ); ScrollOfTeleportation.appear( mob, respawnPoints.get( index ) ); respawnPoints.remove( index ); nImages--; spawned++; } return spawned; }
@Override public int proc( Armor armor, Char attacker, Char defender, int damage) { int level = Math.max(0, armor.level()); if (Random.Int( level / 2 + 10 ) >= 9) { int duration = Random.IntRange( 4, 12 ); Buff.affect( attacker, Charm.class, duration ).object = defender.id(); attacker.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 ); } return damage; }
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; }