v2.1.4: fixed a few caess of game effects not accounting for branches

This commit is contained in:
Evan Debenham
2023-07-05 18:31:30 -04:00
parent 8c4a8acae5
commit 3d01bc8c2e
7 changed files with 21 additions and 8 deletions
@@ -914,7 +914,7 @@ public class Dungeon {
}
for (TalismanOfForesight.HeapAwareness h : hero.buffs(TalismanOfForesight.HeapAwareness.class)){
if (Dungeon.depth != h.depth) continue;
if (Dungeon.depth != h.depth || Dungeon.branch != h.branch) continue;
BArray.or( level.visited, level.heroFOV, h.pos - 1 - level.width(), 3, level.visited );
BArray.or( level.visited, level.heroFOV, h.pos - 1, 3, level.visited );
BArray.or( level.visited, level.heroFOV, h.pos - 1 + level.width(), 3, level.visited );
@@ -922,7 +922,7 @@ public class Dungeon {
}
for (RevealedArea a : hero.buffs(RevealedArea.class)){
if (Dungeon.depth != a.depth) continue;
if (Dungeon.depth != a.depth || Dungeon.branch != a.branch) continue;
BArray.or( level.visited, level.heroFOV, a.pos - 1 - level.width(), 3, level.visited );
BArray.or( level.visited, level.heroFOV, a.pos - 1, 3, level.visited );
BArray.or( level.visited, level.heroFOV, a.pos - 1 + level.width(), 3, level.visited );
@@ -35,7 +35,7 @@ public class RevealedArea extends FlavourBuff{
type = Buff.buffType.POSITIVE;
}
public int pos, depth;
public int pos, depth, branch;
@Override
public void detach() {
@@ -64,6 +64,7 @@ public class RevealedArea extends FlavourBuff{
return Messages.get(this, "desc", (int)visualcooldown());
}
private static final String BRANCH = "branch";
private static final String DEPTH = "depth";
private static final String POS = "pos";
@@ -71,6 +72,7 @@ public class RevealedArea extends FlavourBuff{
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(DEPTH, depth);
bundle.put(BRANCH, branch);
bundle.put(POS, pos);
}
@@ -78,6 +80,7 @@ public class RevealedArea extends FlavourBuff{
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
depth = bundle.getInt(DEPTH);
branch = bundle.getInt(BRANCH);
pos = bundle.getInt(POS);
}
}
@@ -383,9 +383,11 @@ public class TalismanOfForesight extends Artifact {
public int pos;
public int depth = Dungeon.depth;
public int branch = Dungeon.branch;
private static final String POS = "pos";
private static final String DEPTH = "depth";
private static final String BRANCH = "branch";
@Override
public void detach() {
@@ -399,6 +401,7 @@ public class TalismanOfForesight extends Artifact {
super.restoreFromBundle(bundle);
pos = bundle.getInt(POS);
depth = bundle.getInt(DEPTH);
branch = bundle.getInt(BRANCH);
}
@Override
@@ -406,6 +409,7 @@ public class TalismanOfForesight extends Artifact {
super.storeInBundle(bundle);
bundle.put(POS, pos);
bundle.put(DEPTH, depth);
bundle.put(BRANCH, branch);
}
}
@@ -38,7 +38,8 @@ public abstract class Key extends Item {
stackable = true;
unique = true;
}
//TODO currently keys can only appear on branch = 0, add branch support here if that changes
public int depth;
@Override
@@ -33,7 +33,8 @@ import java.util.Collections;
public class Notes {
public static abstract class Record implements Comparable<Record>, Bundlable {
//TODO currently notes can only relate to branch = 0, add branch support here if that changes
protected int depth;
public int depth(){
@@ -1337,7 +1337,7 @@ public abstract class Level implements Bundlable {
}
for (TalismanOfForesight.HeapAwareness h : c.buffs(TalismanOfForesight.HeapAwareness.class)){
if (Dungeon.depth != h.depth) continue;
if (Dungeon.depth != h.depth || Dungeon.branch != h.branch) continue;
for (int i : PathFinder.NEIGHBOURS9) heroMindFov[h.pos+i] = true;
}
@@ -1354,7 +1354,7 @@ public abstract class Level implements Bundlable {
}
for (RevealedArea a : c.buffs(RevealedArea.class)){
if (Dungeon.depth != a.depth) continue;
if (Dungeon.depth != a.depth || Dungeon.branch != a.branch) continue;
for (int i : PathFinder.NEIGHBOURS9) heroMindFov[a.pos+i] = true;
}
@@ -79,12 +79,13 @@ public class PitfallTrap extends Trap {
int pos;
int depth;
int branch;
@Override
public boolean act() {
boolean herofell = false;
if (depth == Dungeon.depth) {
if (depth == Dungeon.depth && branch == Dungeon.branch) {
for (int i : PathFinder.NEIGHBOURS9) {
int cell = pos + i;
@@ -131,12 +132,14 @@ public class PitfallTrap extends Trap {
private static final String POS = "pos";
private static final String DEPTH = "depth";
private static final String BRANCH = "branch";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(POS, pos);
bundle.put(DEPTH, depth);
bundle.put(BRANCH, branch);
}
@Override
@@ -144,6 +147,7 @@ public class PitfallTrap extends Trap {
super.restoreFromBundle(bundle);
pos = bundle.getInt(POS);
depth = bundle.getInt(DEPTH);
branch = bundle.getInt(BRANCH);
}
}