v0.7.4: adjusted logic for where wards can be placed

This commit is contained in:
Evan Debenham 2019-07-07 19:10:42 -04:00
parent 99d47f3825
commit 93c312a53e
2 changed files with 12 additions and 12 deletions

View File

@ -117,14 +117,19 @@ public class WandOfWarding extends Wand {
int adjacentBlockedCells = 0; int adjacentBlockedCells = 0;
int adjacentCellGroups = 0; int adjacentCellGroups = 0;
boolean prevOpen = openCell(pos + PathFinder.CIRCLE8[PathFinder.CIRCLE8.length-1]);
boolean[] passable = Dungeon.level.passable;
boolean prevPassable = passable[pos + PathFinder.CIRCLE8[PathFinder.CIRCLE8.length-1]];
for (int i : PathFinder.CIRCLE8){ for (int i : PathFinder.CIRCLE8){
if (!openCell(pos + i)){ if (Actor.findChar(pos+i) instanceof Ward){
return false;
}
if (!passable[pos + i]){
adjacentBlockedCells++; adjacentBlockedCells++;
} }
if (prevOpen != openCell(pos + i)){ if (prevPassable != passable[pos + i]){
prevOpen = !prevOpen; prevPassable = !prevPassable;
adjacentCellGroups++; adjacentCellGroups++;
} }
} }
@ -133,8 +138,8 @@ public class WandOfWarding extends Wand {
case 0: case 1: case 0: case 1:
return true; return true;
case 2: case 2:
return (openCell(pos + PathFinder.CIRCLE4[0]) || openCell( pos + PathFinder.CIRCLE4[2])) return (passable[pos + PathFinder.CIRCLE4[0]] || passable[ pos + PathFinder.CIRCLE4[2]])
&& (openCell(pos + PathFinder.CIRCLE4[1]) || openCell( pos + PathFinder.CIRCLE4[3])); && (passable[pos + PathFinder.CIRCLE4[1]] || passable[ pos + PathFinder.CIRCLE4[3]]);
case 3: case 3:
return adjacentCellGroups <= 2; return adjacentCellGroups <= 2;
default: default:
@ -143,11 +148,6 @@ public class WandOfWarding extends Wand {
} }
private static boolean openCell(int pos){
//a cell is considered blocked if it isn't passable or a ward is there
return Dungeon.level.passable[pos] && !(Actor.findChar(pos) instanceof Ward);
}
public static class Ward extends NPC { public static class Ward extends NPC {
private int tier = 1; private int tier = 1;

View File

@ -1218,7 +1218,7 @@ items.wands.wandoftransfusion.stats_desc=When used on allies, this wand saps som
items.wands.wandofwarding.name=wand of warding items.wands.wandofwarding.name=wand of warding
items.wands.wandofwarding.staff_name=staff of warding items.wands.wandofwarding.staff_name=staff of warding
items.wands.wandofwarding.no_more_wards=Your wand can't sustain any more wards. items.wands.wandofwarding.no_more_wards=Your wand can't sustain any more wards.
items.wands.wandofwarding.bad_location=There isn't enough room to place a ward here. items.wands.wandofwarding.bad_location=There isn't enough space to place a ward here. Wards cannot be placed in corners, hallways, or next to other wards.
items.wands.wandofwarding.desc=This short metal wand has a bright purple gem floating above its tip. items.wands.wandofwarding.desc=This short metal wand has a bright purple gem floating above its tip.
items.wands.wandofwarding.stats_desc=Rather than directly damaging an enemy, this wand will summon stationary wards and sentries. Note that wards require some empty space around where they are summoned, and the wand can only sustain so many wards or sentries at one time. items.wands.wandofwarding.stats_desc=Rather than directly damaging an enemy, this wand will summon stationary wards and sentries. Note that wards require some empty space around where they are summoned, and the wand can only sustain so many wards or sentries at one time.
items.wands.wandofwarding$ward.name_1=lesser ward items.wands.wandofwarding$ward.name_1=lesser ward