From c5d8ca7b07d5ada4d6287c1c00e29231c5475626 Mon Sep 17 00:00:00 2001 From: Oskar Wiksten Date: Fri, 3 Aug 2012 12:24:39 +0200 Subject: [PATCH 1/3] Bugfix: do not move monsters around unnecessarily when loading savegames. --- .../com/gpl/rpg/AndorsTrail/controller/MovementController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MovementController.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MovementController.java index 72660fc3b..17fc74355 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MovementController.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MovementController.java @@ -257,7 +257,7 @@ public final class MovementController implements TimedMessageTask.Callback { for (PredefinedMap map : world.maps.predefinedMaps) { for (MonsterSpawnArea a : map.spawnAreas) { for (Monster m : a.monsters) { - if (!world.model.currentMap.isWalkable(m.rectPosition)) { + if (!map.isWalkable(m.rectPosition)) { Coord p = map.getRandomFreePosition(a.area, m.actorTraits.tileSize, model.player.position); if (p == null) continue; m.position.set(p); From 11ba3825bacbee03c63c2677ecb2c11b64bd3f07 Mon Sep 17 00:00:00 2001 From: Oskar Wiksten Date: Fri, 3 Aug 2012 12:30:06 +0200 Subject: [PATCH 2/3] Bugfix: more fixes to movement of blocked monsters when loading savegames. --- .../gpl/rpg/AndorsTrail/controller/MovementController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MovementController.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MovementController.java index 17fc74355..a93c5e800 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MovementController.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/MovementController.java @@ -255,10 +255,12 @@ public final class MovementController implements TimedMessageTask.Callback { // If any monsters somehow spawned on an unwalkable tile, we move the monster to a new position on the spawnarea // This could happen if we change some tile to non-walkable in a future version. for (PredefinedMap map : world.maps.predefinedMaps) { + Coord playerPosition = null; + if (map == model.currentMap) playerPosition = model.player.position; for (MonsterSpawnArea a : map.spawnAreas) { for (Monster m : a.monsters) { if (!map.isWalkable(m.rectPosition)) { - Coord p = map.getRandomFreePosition(a.area, m.actorTraits.tileSize, model.player.position); + Coord p = map.getRandomFreePosition(a.area, m.actorTraits.tileSize, playerPosition); if (p == null) continue; m.position.set(p); } From b47d063c6be1fa0b8011e2ae613c28043a423718 Mon Sep 17 00:00:00 2001 From: Oskar Wiksten Date: Tue, 7 Aug 2012 14:14:44 +0200 Subject: [PATCH 3/3] Bugfix: do not give out rewards from conversation phrases when returning to the conversation activity. Rewards should only be applied when first visiting a phrase. --- .../activity/ConversationActivity.java | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/ConversationActivity.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/ConversationActivity.java index f9d9b34f7..9bcb18f58 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/ConversationActivity.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/ConversationActivity.java @@ -61,6 +61,7 @@ public final class ConversationActivity extends Activity implements OnKeyListene private RadioGroup replyGroup; private OnCheckedChangeListener radioButtonListener; private boolean displayActors = true; + private boolean applyPhraseRewards = true; private final ConversationCollection conversationCollection = new ConversationCollection(); @@ -80,6 +81,7 @@ public final class ConversationActivity extends Activity implements OnKeyListene phraseID = uri.getLastPathSegment().toString(); if (savedInstanceState != null) { + applyPhraseRewards = false; phraseID = savedInstanceState.getString("phraseID"); conversationHistory = savedInstanceState.getParcelableArrayList("conversationHistory"); if (conversationHistory == null) conversationHistory = new ArrayList(); @@ -135,6 +137,7 @@ public final class ConversationActivity extends Activity implements OnKeyListene super.onResume(); setPhrase(phraseID); + applyPhraseRewards = true; nextButton.requestFocus(); } @@ -228,7 +231,11 @@ public final class ConversationActivity extends Activity implements OnKeyListene if (AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES) { if (phrase == null) phrase = new Phrase("(phrase \"" + phraseID + "\" not implemented yet)", null, null); } - Loot loot = ConversationController.applyPhraseRewards(player, phrase, world); + + Loot loot = null; + if (applyPhraseRewards) { + loot = ConversationController.applyPhraseRewards(player, phrase, world); + } if (phrase.message == null) { for (Reply r : phrase.replies) { @@ -241,23 +248,25 @@ public final class ConversationActivity extends Activity implements OnKeyListene String message = ConversationController.getDisplayMessage(phrase, player); - if (loot != null && loot.hasItemsOrExp()) { - message += "\n"; - if (loot.exp > 0) { - message += "\n" + getResources().getString(R.string.conversation_rewardexp, loot.exp); - } - if (loot.gold > 0) { - message += "\n" + getResources().getString(R.string.conversation_rewardgold, loot.gold); - } else if (loot.gold < 0) { - message += "\n" + getResources().getString(R.string.conversation_lostgold, -loot.gold); - } - if (!loot.items.isEmpty()) { - final int len = loot.items.countItems(); - if (len == 1) { - message += "\n" + getResources().getString(R.string.conversation_rewarditem); - } else { - message += "\n" + getResources().getString(R.string.conversation_rewarditems, len); - } + if (applyPhraseRewards && loot != null) { + if (loot.hasItemsOrExp()) { + message += "\n"; + if (loot.exp > 0) { + message += "\n" + getResources().getString(R.string.conversation_rewardexp, loot.exp); + } + if (loot.gold > 0) { + message += "\n" + getResources().getString(R.string.conversation_rewardgold, loot.gold); + } else if (loot.gold < 0) { + message += "\n" + getResources().getString(R.string.conversation_lostgold, -loot.gold); + } + if (!loot.items.isEmpty()) { + final int len = loot.items.countItems(); + if (len == 1) { + message += "\n" + getResources().getString(R.string.conversation_rewarditem); + } else { + message += "\n" + getResources().getString(R.string.conversation_rewarditems, len); + } + } } }