use of WayofTime.alchemicalWizardry.common.demonVillage.GridSpace in project BloodMagic by WayofTime.
the class TEDemonPortal method expandAreaInPosZ.
public void expandAreaInPosZ() {
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 1][negZRadius + posZRadius + 2];
for (int i = 0; i <= negXRadius + posXRadius; i++) {
newGrid[i][negZRadius + posZRadius + 1] = new GridSpace();
}
for (int i = 0; i <= negXRadius + posXRadius; i++) {
for (int j = 0; j <= negZRadius + posZRadius; j++) {
newGrid[i][j] = area[i][j];
}
}
area = newGrid;
posZRadius += 1;
}
use of WayofTime.alchemicalWizardry.common.demonVillage.GridSpace in project BloodMagic by WayofTime.
the class TEDemonPortal method expandAreaInPosX.
public void expandAreaInPosX() {
GridSpace[][] newGrid = new GridSpace[negXRadius + posXRadius + 2][negZRadius + posZRadius + 1];
for (int i = 0; i <= negZRadius + posZRadius; i++) {
newGrid[negXRadius + posXRadius + 1][i] = new GridSpace();
}
for (int i = 0; i <= negXRadius + posXRadius; i++) {
for (int j = 0; j <= negZRadius + posZRadius; j++) {
newGrid[i][j] = area[i][j];
}
}
area = newGrid;
posXRadius += 1;
}
use of WayofTime.alchemicalWizardry.common.demonVillage.GridSpace in project BloodMagic by WayofTime.
the class TEDemonPortal method getLength.
public // Number of spaces forward
int getLength(// Number of spaces forward
ForgeDirection dir, // Number of spaces forward
int maxLength, // Number of spaces forward
int x, // Number of spaces forward
int z) {
for (int i = 1; i <= maxLength; i++) {
GridSpace space = this.getGridSpace(x + i * dir.offsetX, z + i * dir.offsetZ);
if (space.isEmpty()) {
for (int k = 1; k <= this.getRoadSpacer(); k++) {
GridSpace space1 = this.getGridSpace(x + i * dir.offsetX + dir.offsetZ * k, z + i * dir.offsetZ + dir.offsetX * k);
GridSpace space2 = this.getGridSpace(x + i * dir.offsetX - dir.offsetZ * k, z + i * dir.offsetZ - dir.offsetX * k);
if (space1.isRoadSegment() || space2.isRoadSegment()) {
return i - 1;
}
}
continue;
}
if (space.isRoadSegment()) {
return i;
} else {
return i - 1;
}
}
return maxLength;
}
use of WayofTime.alchemicalWizardry.common.demonVillage.GridSpace in project BloodMagic by WayofTime.
the class TEDemonPortal method findValidExtentionDirection.
public List<ForgeDirection> findValidExtentionDirection(int x, int z) {
List<ForgeDirection> directions = new LinkedList();
if (this.getGridSpace(x, z) == null || !this.getGridSpace(x, z).isRoadSegment()) {
return directions;
}
GridSpace nextGrid = this.getGridSpace(x + 1, z);
if (nextGrid.isEmpty()) {
directions.add(ForgeDirection.EAST);
}
nextGrid = this.getGridSpace(x - 1, z);
if (nextGrid.isEmpty()) {
directions.add(ForgeDirection.WEST);
}
nextGrid = this.getGridSpace(x, z + 1);
if (nextGrid.isEmpty()) {
directions.add(ForgeDirection.SOUTH);
}
nextGrid = this.getGridSpace(x, z - 1);
if (nextGrid.isEmpty()) {
directions.add(ForgeDirection.NORTH);
}
return directions;
}
use of WayofTime.alchemicalWizardry.common.demonVillage.GridSpace in project BloodMagic by WayofTime.
the class TEDemonPortal method initialize.
public void initialize() {
if (isInitialized) {
return;
}
DemonType[] types = DemonType.values();
this.type = types[rand.nextInt(types.length)];
for (int xIndex = -negXRadius; xIndex <= posXRadius; xIndex++) {
for (int zIndex = -negZRadius; zIndex <= posZRadius; zIndex++) {
if (Math.abs(xIndex) == 1 || Math.abs(zIndex) == 1) {
this.setGridSpace(xIndex, zIndex, new GridSpace(GridSpace.ROAD, yCoord));
} else if (xIndex == 0 && zIndex == 0) {
this.setGridSpace(0, 0, new GridSpace(GridSpace.MAIN_PORTAL, yCoord));
} else {
this.setGridSpace(xIndex, zIndex, new GridSpace());
}
}
}
this.houseCooldown = TEDemonPortal.buildingGridDelay;
this.roadCooldown = TEDemonPortal.roadGridDelay;
this.demonHoardCooldown = TEDemonPortal.demonHoardDelay;
this.createRandomRoad();
if (this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, tier) >= 1) {
System.out.println("Portal building successfully found!");
this.buildingStage = 0;
}
isInitialized = true;
}
Aggregations