v2.2.0: removed usages of negative values in Actor.addDelayed
This commit is contained in:
@@ -321,7 +321,7 @@ public abstract class Actor implements Bundlable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addDelayed( Actor actor, float delay ) {
|
public static void addDelayed( Actor actor, float delay ) {
|
||||||
add( actor, now + delay );
|
add( actor, now + Math.max(delay, 0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static synchronized void add( Actor actor, float time ) {
|
private static synchronized void add( Actor actor, float time ) {
|
||||||
|
|||||||
+1
-1
@@ -147,7 +147,7 @@ public class WarpBeacon extends ArmorAbility {
|
|||||||
|
|
||||||
if (!candidates.isEmpty()){
|
if (!candidates.isEmpty()){
|
||||||
ScrollOfTeleportation.appear(hero, tracker.pos);
|
ScrollOfTeleportation.appear(hero, tracker.pos);
|
||||||
Actor.addDelayed( new Pushing( toPush, toPush.pos, candidates.get(0) ), -1 );
|
Actor.add( new Pushing( toPush, toPush.pos, candidates.get(0) ));
|
||||||
|
|
||||||
toPush.pos = candidates.get(0);
|
toPush.pos = candidates.get(0);
|
||||||
Dungeon.level.occupyCell(toPush);
|
Dungeon.level.occupyCell(toPush);
|
||||||
|
|||||||
+1
-1
@@ -124,7 +124,7 @@ public class DemonSpawner extends Mob {
|
|||||||
Dungeon.level.occupyCell(spawn);
|
Dungeon.level.occupyCell(spawn);
|
||||||
|
|
||||||
if (sprite.visible) {
|
if (sprite.visible) {
|
||||||
Actor.addDelayed(new Pushing(spawn, pos, spawn.pos), -1);
|
Actor.add(new Pushing(spawn, pos, spawn.pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
spawnCooldown += 60;
|
spawnCooldown += 60;
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public class Ghoul extends Mob {
|
|||||||
Dungeon.level.occupyCell(child);
|
Dungeon.level.occupyCell(child);
|
||||||
|
|
||||||
if (sprite.visible) {
|
if (sprite.visible) {
|
||||||
Actor.addDelayed( new Pushing( child, pos, child.pos ), -1 );
|
Actor.add( new Pushing( child, pos, child.pos ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Buff b : buffs(ChampionEnemy.class)){
|
for (Buff b : buffs(ChampionEnemy.class)){
|
||||||
@@ -277,7 +277,7 @@ public class Ghoul extends Mob {
|
|||||||
}
|
}
|
||||||
if (candidates.size() > 0) {
|
if (candidates.size() > 0) {
|
||||||
int newPos = Random.element( candidates );
|
int newPos = Random.element( candidates );
|
||||||
Actor.addDelayed( new Pushing( ghoul, ghoul.pos, newPos ), -1 );
|
Actor.add( new Pushing( ghoul, ghoul.pos, newPos ) );
|
||||||
ghoul.pos = newPos;
|
ghoul.pos = newPos;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -101,11 +101,11 @@ public class Guard extends Mob {
|
|||||||
Effects.Type.CHAIN,
|
Effects.Type.CHAIN,
|
||||||
new Callback() {
|
new Callback() {
|
||||||
public void call() {
|
public void call() {
|
||||||
Actor.addDelayed(new Pushing(enemy, enemy.pos, newPosFinal, new Callback() {
|
Actor.add(new Pushing(enemy, enemy.pos, newPosFinal, new Callback() {
|
||||||
public void call() {
|
public void call() {
|
||||||
pullEnemy(enemy, newPosFinal);
|
pullEnemy(enemy, newPosFinal);
|
||||||
}
|
}
|
||||||
}), -1);
|
}));
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
+1
-1
@@ -202,7 +202,7 @@ public class Necromancer extends Mob {
|
|||||||
//push enemy, or wait a turn if there is no valid pushing position
|
//push enemy, or wait a turn if there is no valid pushing position
|
||||||
if (pushPos != pos) {
|
if (pushPos != pos) {
|
||||||
Char ch = Actor.findChar(summoningPos);
|
Char ch = Actor.findChar(summoningPos);
|
||||||
Actor.addDelayed( new Pushing( ch, ch.pos, pushPos ), -1 );
|
Actor.add( new Pushing( ch, ch.pos, pushPos ) );
|
||||||
|
|
||||||
ch.pos = pushPos;
|
ch.pos = pushPos;
|
||||||
Dungeon.level.occupyCell(ch );
|
Dungeon.level.occupyCell(ch );
|
||||||
|
|||||||
+1
-1
@@ -187,7 +187,7 @@ public class RipperDemon extends Mob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (endPos != leapPos){
|
if (endPos != leapPos){
|
||||||
Actor.addDelayed(new Pushing(RipperDemon.this, leapPos, endPos), -1);
|
Actor.add(new Pushing(RipperDemon.this, leapPos, endPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = endPos;
|
pos = endPos;
|
||||||
|
|||||||
+1
-1
@@ -125,7 +125,7 @@ public class SpectralNecromancer extends Necromancer {
|
|||||||
//push enemy, or wait a turn if there is no valid pushing position
|
//push enemy, or wait a turn if there is no valid pushing position
|
||||||
if (pushPos != pos) {
|
if (pushPos != pos) {
|
||||||
Char ch = Actor.findChar(summoningPos);
|
Char ch = Actor.findChar(summoningPos);
|
||||||
Actor.addDelayed( new Pushing( ch, ch.pos, pushPos ), -1 );
|
Actor.add( new Pushing( ch, ch.pos, pushPos ) );
|
||||||
|
|
||||||
ch.pos = pushPos;
|
ch.pos = pushPos;
|
||||||
Dungeon.level.occupyCell(ch );
|
Dungeon.level.occupyCell(ch );
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class Swarm extends Mob {
|
|||||||
GameScene.add( clone, SPLIT_DELAY ); //we add before assigning HP due to ascension
|
GameScene.add( clone, SPLIT_DELAY ); //we add before assigning HP due to ascension
|
||||||
|
|
||||||
clone.HP = (HP - damage) / 2;
|
clone.HP = (HP - damage) / 2;
|
||||||
Actor.addDelayed( new Pushing( clone, pos, clone.pos ), -1 );
|
Actor.add( new Pushing( clone, pos, clone.pos ) );
|
||||||
|
|
||||||
Dungeon.level.occupyCell(clone);
|
Dungeon.level.occupyCell(clone);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -334,7 +334,7 @@ public class YogDzewa extends Mob {
|
|||||||
if (spawnPos != -1) {
|
if (spawnPos != -1) {
|
||||||
summon.pos = spawnPos;
|
summon.pos = spawnPos;
|
||||||
GameScene.add( summon );
|
GameScene.add( summon );
|
||||||
Actor.addDelayed( new Pushing( summon, pos, summon.pos ), -1 );
|
Actor.add( new Pushing( summon, pos, summon.pos ) );
|
||||||
summon.beckon(Dungeon.hero.pos);
|
summon.beckon(Dungeon.hero.pos);
|
||||||
Dungeon.level.occupyCell(summon);
|
Dungeon.level.occupyCell(summon);
|
||||||
|
|
||||||
@@ -453,7 +453,7 @@ public class YogDzewa extends Mob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GameScene.add(fist, 4);
|
GameScene.add(fist, 4);
|
||||||
Actor.addDelayed( new Pushing( fist, Dungeon.level.exit(), fist.pos ), -1 );
|
Actor.add( new Pushing( fist, Dungeon.level.exit(), fist.pos ) );
|
||||||
Dungeon.level.occupyCell(fist);
|
Dungeon.level.occupyCell(fist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class Pushing extends Actor {
|
|||||||
private Callback callback;
|
private Callback callback;
|
||||||
|
|
||||||
{
|
{
|
||||||
actPriority = VFX_PRIO;
|
actPriority = VFX_PRIO+10;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pushing( Char ch, int from, int to ) {
|
public Pushing( Char ch, int from, int to ) {
|
||||||
|
|||||||
@@ -76,15 +76,20 @@ public class Amulet extends Item {
|
|||||||
Statistics.amuletObtained = true;
|
Statistics.amuletObtained = true;
|
||||||
hero.spend(-TIME_TO_PICK_UP);
|
hero.spend(-TIME_TO_PICK_UP);
|
||||||
|
|
||||||
//add a delayed actor here so pickup behaviour can fully process.
|
//delay with an actor here so pickup behaviour can fully process.
|
||||||
Actor.addDelayed(new Actor(){
|
Actor.add(new Actor(){
|
||||||
|
|
||||||
|
{
|
||||||
|
actPriority = VFX_PRIO;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean act() {
|
protected boolean act() {
|
||||||
Actor.remove(this);
|
Actor.remove(this);
|
||||||
showAmuletScene( true );
|
showAmuletScene( true );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}, -5);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class Honeypot extends Item {
|
|||||||
bee.pos = newPos;
|
bee.pos = newPos;
|
||||||
|
|
||||||
GameScene.add( bee );
|
GameScene.add( bee );
|
||||||
if (newPos != pos) Actor.addDelayed( new Pushing( bee, pos, newPos ), -1f );
|
if (newPos != pos) Actor.add( new Pushing( bee, pos, newPos ) );
|
||||||
|
|
||||||
bee.sprite.alpha( 0 );
|
bee.sprite.alpha( 0 );
|
||||||
bee.sprite.parent.add( new AlphaTweener( bee.sprite, 1, 0.15f ) );
|
bee.sprite.parent.add( new AlphaTweener( bee.sprite, 1, 0.15f ) );
|
||||||
|
|||||||
+1
-1
@@ -132,7 +132,7 @@ public class BeaconOfReturning extends Spell {
|
|||||||
if (toPush == hero){
|
if (toPush == hero){
|
||||||
returnPos = candidates.get(0);
|
returnPos = candidates.get(0);
|
||||||
} else {
|
} else {
|
||||||
Actor.addDelayed( new Pushing( toPush, toPush.pos, candidates.get(0) ), -1 );
|
Actor.add( new Pushing( toPush, toPush.pos, candidates.get(0) ) );
|
||||||
toPush.pos = candidates.get(0);
|
toPush.pos = candidates.get(0);
|
||||||
Dungeon.level.occupyCell(toPush);
|
Dungeon.level.occupyCell(toPush);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -149,7 +149,7 @@ public class WandOfBlastWave extends DamageWand {
|
|||||||
final boolean finalCollided = collided && collideDmg;
|
final boolean finalCollided = collided && collideDmg;
|
||||||
final int initialpos = ch.pos;
|
final int initialpos = ch.pos;
|
||||||
|
|
||||||
Actor.addDelayed(new Pushing(ch, ch.pos, newPos, new Callback() {
|
Actor.add(new Pushing(ch, ch.pos, newPos, new Callback() {
|
||||||
public void call() {
|
public void call() {
|
||||||
if (initialpos != ch.pos || Actor.findChar(newPos) != null) {
|
if (initialpos != ch.pos || Actor.findChar(newPos) != null) {
|
||||||
//something caused movement or added chars before pushing resolved, cancel to be safe.
|
//something caused movement or added chars before pushing resolved, cancel to be safe.
|
||||||
@@ -178,7 +178,7 @@ public class WandOfBlastWave extends DamageWand {
|
|||||||
GameScene.updateFog();
|
GameScene.updateFog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}), -1);
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -186,9 +186,9 @@ public class WandOfBlastWave extends DamageWand {
|
|||||||
//acts like elastic enchantment
|
//acts like elastic enchantment
|
||||||
//we delay this with an actor to prevent conflicts with regular elastic
|
//we delay this with an actor to prevent conflicts with regular elastic
|
||||||
//so elastic always fully resolves first, then this effect activates
|
//so elastic always fully resolves first, then this effect activates
|
||||||
Actor.addDelayed(new Actor() {
|
Actor.add(new Actor() {
|
||||||
{
|
{
|
||||||
actPriority = VFX_PRIO-1; //act after pushing effects
|
actPriority = VFX_PRIO+9; //act after pushing effects
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -199,7 +199,7 @@ public class WandOfBlastWave extends DamageWand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}, -1);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BlastWaveOnHit extends Elastic{
|
private static class BlastWaveOnHit extends Elastic{
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ConfusionTrap;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FlockTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.FlockTrap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.GatewayTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.GatewayTrap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.OozeTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.OozeTrap;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.PitfallTrap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ShockingTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.ShockingTrap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.SummoningTrap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.TeleportationTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.TeleportationTrap;
|
||||||
@@ -99,7 +100,7 @@ public class SewerLevel extends RegularLevel {
|
|||||||
@Override
|
@Override
|
||||||
protected Class<?>[] trapClasses() {
|
protected Class<?>[] trapClasses() {
|
||||||
return Dungeon.depth == 1 ?
|
return Dungeon.depth == 1 ?
|
||||||
new Class<?>[]{ WornDartTrap.class } :
|
new Class<?>[]{ PitfallTrap.class } :
|
||||||
new Class<?>[]{
|
new Class<?>[]{
|
||||||
ChillingTrap.class, ShockingTrap.class, ToxicTrap.class, WornDartTrap.class,
|
ChillingTrap.class, ShockingTrap.class, ToxicTrap.class, WornDartTrap.class,
|
||||||
AlarmTrap.class, OozeTrap.class,
|
AlarmTrap.class, OozeTrap.class,
|
||||||
|
|||||||
+1
@@ -55,6 +55,7 @@ public class PitfallTrap extends Trap {
|
|||||||
|
|
||||||
DelayedPit p = Buff.append(Dungeon.hero, DelayedPit.class, 1);
|
DelayedPit p = Buff.append(Dungeon.hero, DelayedPit.class, 1);
|
||||||
p.depth = Dungeon.depth;
|
p.depth = Dungeon.depth;
|
||||||
|
p.branch = Dungeon.branch;
|
||||||
p.pos = pos;
|
p.pos = pos;
|
||||||
|
|
||||||
for (int i : PathFinder.NEIGHBOURS9){
|
for (int i : PathFinder.NEIGHBOURS9){
|
||||||
|
|||||||
Reference in New Issue
Block a user