diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java index 9a815c9af..edb01a2f3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java @@ -117,14 +117,19 @@ public class WandOfWarding extends Wand { int adjacentBlockedCells = 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){ - if (!openCell(pos + i)){ + if (Actor.findChar(pos+i) instanceof Ward){ + return false; + } + if (!passable[pos + i]){ adjacentBlockedCells++; } - if (prevOpen != openCell(pos + i)){ - prevOpen = !prevOpen; + if (prevPassable != passable[pos + i]){ + prevPassable = !prevPassable; adjacentCellGroups++; } } @@ -133,8 +138,8 @@ public class WandOfWarding extends Wand { case 0: case 1: return true; case 2: - return (openCell(pos + PathFinder.CIRCLE4[0]) || openCell( pos + PathFinder.CIRCLE4[2])) - && (openCell(pos + PathFinder.CIRCLE4[1]) || openCell( pos + PathFinder.CIRCLE4[3])); + return (passable[pos + PathFinder.CIRCLE4[0]] || passable[ pos + PathFinder.CIRCLE4[2]]) + && (passable[pos + PathFinder.CIRCLE4[1]] || passable[ pos + PathFinder.CIRCLE4[3]]); case 3: return adjacentCellGroups <= 2; 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 { private int tier = 1; diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index 671034021..a64f498b8 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -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.staff_name=staff of warding 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.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