v0.7.0: fixes/adjustments:
- ballisticas now go through vision-blocking terrain, but not solid - bleeding is now floating-point internally - fixed hanging when caustic ooze is attached to a dead character - attached a check for shadowcaster crashes - fixed problematic interactions between traps, thrown items, and hourglass
This commit is contained in:
parent
b3431dd80c
commit
9337d28948
|
@ -52,6 +52,11 @@ public class Random {
|
|||
public static float Float( float min, float max ) {
|
||||
return min + Float(max - min);
|
||||
}
|
||||
|
||||
//returns a triangularly distributed float in the range [min, max)
|
||||
public static float NormalFloat( float min, float max ) {
|
||||
return min + ((Float(max - min) + Float(max - min))/2f);
|
||||
}
|
||||
|
||||
//returns a uniformly distributed int in the range [0, max)
|
||||
public static int Int( int max ) {
|
||||
|
|
|
@ -28,7 +28,8 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import static com.watabou.utils.Random.NormalFloat;
|
||||
|
||||
public class Bleeding extends Buff {
|
||||
|
||||
|
@ -37,7 +38,7 @@ public class Bleeding extends Buff {
|
|||
announced = true;
|
||||
}
|
||||
|
||||
protected int level;
|
||||
protected float level;
|
||||
|
||||
private static final String LEVEL = "level";
|
||||
|
||||
|
@ -51,7 +52,7 @@ public class Bleeding extends Buff {
|
|||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
level = bundle.getInt( LEVEL );
|
||||
level = bundle.getFloat( LEVEL );
|
||||
}
|
||||
|
||||
public void set( int level ) {
|
||||
|
@ -72,12 +73,15 @@ public class Bleeding extends Buff {
|
|||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
|
||||
if ((level = Random.NormalIntRange( level / 2, level )) > 0) {
|
||||
level = NormalFloat(level / 2f, level);
|
||||
int dmg = Math.round(level);
|
||||
|
||||
if (dmg > 0) {
|
||||
|
||||
target.damage( level, this );
|
||||
target.damage( dmg, this );
|
||||
if (target.sprite.visible) {
|
||||
Splash.at( target.sprite.center(), -PointF.PI / 2, PointF.PI / 6,
|
||||
target.sprite.blood(), Math.min( 10 * level / target.HT, 10 ) );
|
||||
target.sprite.blood(), Math.min( 10 * dmg / target.HT, 10 ) );
|
||||
}
|
||||
|
||||
if (target == Dungeon.hero && !target.isAlive()) {
|
||||
|
|
|
@ -66,6 +66,8 @@ public class Ooze extends Buff {
|
|||
GLog.n( Messages.get(this, "ondeath") );
|
||||
}
|
||||
spend( TICK );
|
||||
} else {
|
||||
detach();
|
||||
}
|
||||
if (Dungeon.level.water[target.pos]) {
|
||||
detach();
|
||||
|
|
|
@ -815,7 +815,7 @@ public abstract class Level implements Bundlable {
|
|||
if (trap != null) {
|
||||
|
||||
TimekeepersHourglass.timeFreeze timeFreeze =
|
||||
ch != null ? ch.buff(TimekeepersHourglass.timeFreeze.class) : null;
|
||||
Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class);
|
||||
|
||||
if (timeFreeze == null) {
|
||||
|
||||
|
|
|
@ -102,13 +102,14 @@ public class Ballistica {
|
|||
while (Dungeon.level.insideMap(cell)) {
|
||||
|
||||
//if we're in a wall, collide with the previous cell along the path.
|
||||
//we don't use solid here because we don't want to stop short of closed doors
|
||||
if (stopTerrain && cell != sourcePos && !Dungeon.level.passable[cell] && !Dungeon.level.avoid[cell]) {
|
||||
collide(path.get(path.size() - 1));
|
||||
}
|
||||
|
||||
path.add(cell);
|
||||
|
||||
if ((stopTerrain && cell != sourcePos && Dungeon.level.losBlocking[cell])
|
||||
if ((stopTerrain && cell != sourcePos && Dungeon.level.solid[cell])
|
||||
|| (cell != sourcePos && stopChars && Actor.findChar( cell ) != null)
|
||||
|| (cell == to && stopTarget)){
|
||||
collide(cell);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.mechanics;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||
|
||||
//based on: http://www.roguebasin.com/index.php?title=FOV_using_recursive_shadowcasting
|
||||
|
@ -55,14 +56,19 @@ public final class ShadowCaster {
|
|||
boolean[] losBlocking = Dungeon.level.losBlocking;
|
||||
|
||||
//scans octants, clockwise
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, +1, -1, false);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, -1, +1, true);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, +1, +1, true);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, +1, +1, false);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, -1, +1, false);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, +1, -1, true);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, -1, -1, true);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, -1, -1, false);
|
||||
try {
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, +1, -1, false);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, -1, +1, true);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, +1, +1, true);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, +1, +1, false);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, -1, +1, false);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, +1, -1, true);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, -1, -1, true);
|
||||
scanOctant(distance, fieldOfView, losBlocking, 1, x, y, 0.0, 1.0, -1, -1, false);
|
||||
} catch (Exception e){
|
||||
ShatteredPixelDungeon.reportException(e);
|
||||
BArray.setFalse(fieldOfView);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user