mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Merge branch 'production'
This commit is contained in:
@@ -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<ConversationStatement>();
|
||||
@@ -135,6 +137,7 @@ public final class ConversationActivity extends Activity implements OnKeyListene
|
||||
super.onResume();
|
||||
|
||||
setPhrase(phraseID);
|
||||
applyPhraseRewards = true;
|
||||
nextButton.requestFocus();
|
||||
}
|
||||
|
||||
@@ -229,7 +232,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) {
|
||||
@@ -242,23 +249,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 (!world.model.currentMap.isWalkable(m.rectPosition)) {
|
||||
Coord p = map.getRandomFreePosition(a.area, m.actorTraits.tileSize, model.player.position);
|
||||
if (!map.isWalkable(m.rectPosition)) {
|
||||
Coord p = map.getRandomFreePosition(a.area, m.actorTraits.tileSize, playerPosition);
|
||||
if (p == null) continue;
|
||||
m.position.set(p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user