Merge remote-tracking branch 'choose_remote_name/master'

This commit is contained in:
Zukero
2017-10-03 22:47:14 +02:00
4 changed files with 25 additions and 13 deletions

View File

@@ -13,6 +13,7 @@
"attackChance": 50,
"droplistID": "debugshop1",
"phraseID": "debugshop",
"movementAggressionType":"wholeMap",
"attackDamage": {
"min": 1,
"max": 2
@@ -85,6 +86,7 @@
"attackCost": 10,
"attackChance": 50,
"droplistID": "debuglist1",
"movementAggressionType":"wholeMap",
"attackDamage": {
"min": 1,
"max": 2

View File

@@ -186,6 +186,13 @@ public final class MapController {
if (!satisfiesCondition(replacement)) continue;
else ConversationController.requirementFulfilled(world, replacement.requirement);
tileMap.applyReplacement(replacement);
for (ReplaceableMapSection impactedReplacement : tileMap.replacements) {
if (impactedReplacement.isApplied && impactedReplacement.replacementArea.intersects(replacement.replacementArea)) {
//The applied replacement has overwritten changes made by a previously applied replacement.
//This previous replacement must now be considered as unapplied to let it be reapplied later eventually.
impactedReplacement.isApplied = false;
}
}
hasUpdated = true;
}
}

View File

@@ -76,15 +76,7 @@ public final class MonsterMovementController implements EvaluateWalkable {
PredefinedMap map = world.model.currentMap;
LayeredTileMap tileMap = world.model.currentTileMap;
m.nextActionTime = System.currentTimeMillis() + getMillisecondsPerMove(m);
if (m.movementDestination == null) {
// Monster has waited and should start to move again.
m.movementDestination = new Coord(m.position);
if (Constants.rnd.nextBoolean()) {
m.movementDestination.x = area.area.topLeft.x + Constants.rnd.nextInt(area.area.size.width);
} else {
m.movementDestination.y = area.area.topLeft.y + Constants.rnd.nextInt(area.area.size.height);
}
} else if (m.position.equals(m.movementDestination)) {
if (m.movementDestination != null && m.position.equals(m.movementDestination)) {
// Monster has been moving and arrived at the destination.
cancelCurrentMonsterMovement(m);
} else {
@@ -108,7 +100,7 @@ public final class MonsterMovementController implements EvaluateWalkable {
}
private void determineMonsterNextPosition(Monster m, MonsterSpawnArea area, Coord playerPosition) {
if (m.isAgressive()) {
// if (m.isAgressive()) {
boolean searchForPath = false;
if (m.getMovementAggressionType() == MonsterType.AggressionType.protectSpawn) {
if (area.area.contains(playerPosition)) searchForPath = true;
@@ -118,8 +110,18 @@ public final class MonsterMovementController implements EvaluateWalkable {
if (searchForPath) {
if (findPathFor(m, playerPosition)) return;
}
}
// }
// Monster has waited and should start to move again.
if (m.movementDestination == null) {
m.movementDestination = new Coord(m.position);
if (Constants.rnd.nextBoolean()) {
m.movementDestination.x = area.area.topLeft.x + Constants.rnd.nextInt(area.area.size.width);
} else {
m.movementDestination.y = area.area.topLeft.y + Constants.rnd.nextInt(area.area.size.height);
}
}
// Monster is moving in a straight line.
m.nextPosition.topLeft.set(
m.position.x + sgn(m.movementDestination.x - m.position.x)

View File

@@ -288,7 +288,8 @@ public final class TMXMapTranslator {
else if (prop.name.equalsIgnoreCase(LAYERNAME_ABOVE)) layerNames.aboveLayersName = prop.value;
else if (prop.name.equalsIgnoreCase(LAYERNAME_WALKABLE)) layerNames.walkableLayersName = prop.value;
else if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
L.log("OPTIMIZE: Map " + map.name + " contains replace area with unknown property \"" + prop.name + "\".");
if (!requirementPropertiesNames.contains(prop.name))
L.log("OPTIMIZE: Map " + map.name + " contains replace area with unknown property \"" + prop.name + "\".");
}
}
MapSection replacementSection = transformMapSection(map, tileCache, position, layersPerLayerName, usedTileIDs, layerNames);