v3.1.0: fixed errors in landmark functionality with returning beacon

This commit is contained in:
Evan Debenham
2025-05-20 12:14:13 -04:00
parent 9fc45f7ba4
commit f44a87af46
2 changed files with 23 additions and 11 deletions

View File

@@ -90,17 +90,17 @@ public class BeaconOfReturning extends Spell {
@Override
protected void onThrow(int cell) {
returnDepth = -1;
if (Dungeon.hero.belongings.getItem(getClass()) == null){
Notes.remove(Notes.Landmark.BEACON_LOCATION);
Notes.remove(Notes.Landmark.BEACON_LOCATION, returnDepth);
}
returnDepth = -1;
super.onThrow(cell);
}
@Override
public void doDrop(Hero hero) {
Notes.remove(Notes.Landmark.BEACON_LOCATION, returnDepth);
returnDepth = -1;
Notes.remove(Notes.Landmark.BEACON_LOCATION);
super.doDrop(hero);
}
@@ -109,7 +109,7 @@ public class BeaconOfReturning extends Spell {
returnBranch = Dungeon.branch;
returnPos = hero.pos;
Notes.add(Notes.Landmark.BEACON_LOCATION);
Notes.add(Notes.Landmark.BEACON_LOCATION, returnDepth);
hero.spend( 1f );
hero.busy();
@@ -181,7 +181,7 @@ public class BeaconOfReturning extends Spell {
Game.switchScene( InterlevelScene.class );
}
if (quantity == 1){
Notes.remove(Notes.Landmark.BEACON_LOCATION);
Notes.remove(Notes.Landmark.BEACON_LOCATION, returnDepth);
}
detach(hero.belongings.backpack);
Catalog.countUse(getClass());

View File

@@ -563,11 +563,15 @@ public class Notes {
records.add( (Record) rec );
}
}
public static boolean add( Landmark landmark ) {
LandmarkRecord l = new LandmarkRecord( landmark, Dungeon.depth );
return add( landmark, Dungeon.depth );
}
public static boolean add( Landmark landmark, int depth ) {
LandmarkRecord l = new LandmarkRecord( landmark, depth );
if (!records.contains(l)) {
boolean result = records.add(new LandmarkRecord(landmark, Dungeon.depth));
boolean result = records.add(l);
Collections.sort(records, comparator);
return result;
}
@@ -575,11 +579,19 @@ public class Notes {
}
public static boolean contains( Landmark landmark ){
return records.contains(new LandmarkRecord( landmark, Dungeon.depth));
return contains( landmark, Dungeon.depth );
}
public static boolean contains( Landmark landmark, int depth ){
return records.contains(new LandmarkRecord( landmark, depth));
}
public static boolean remove( Landmark landmark ) {
return records.remove( new LandmarkRecord(landmark, Dungeon.depth) );
return remove( landmark, Dungeon.depth );
}
public static boolean remove( Landmark landmark, int depth ) {
return records.remove( new LandmarkRecord(landmark, depth) );
}
public static boolean add( Key key ){