Compare commits

...

2 Commits

Author SHA1 Message Date
OMGeeky
e6a1312733 Reorganized some code (1)
To make it more readable & less redundant
2022-06-07 22:58:15 +02:00
OMGeeky
71a8158c53 Removed unsued value
The damage value is never used in the heroKillMonster message
2022-06-07 22:56:59 +02:00
4 changed files with 33 additions and 22 deletions

View File

@@ -345,7 +345,7 @@ public final class MainActivity
message(getString(R.string.combat_result_herohit, monsterName, attackResult.damage)); message(getString(R.string.combat_result_herohit, monsterName, attackResult.damage));
} }
if (attackResult.targetDied) { if (attackResult.targetDied) {
message(getString(R.string.combat_result_herokillsmonster, monsterName, attackResult.damage)); message(getString(R.string.combat_result_herokillsmonster, monsterName));
} }
} }

View File

@@ -18,6 +18,7 @@ import android.widget.SimpleExpandableListAdapter;
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication; import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
import com.gpl.rpg.AndorsTrail.R; import com.gpl.rpg.AndorsTrail.R;
import com.gpl.rpg.AndorsTrail.context.WorldContext; import com.gpl.rpg.AndorsTrail.context.WorldContext;
import com.gpl.rpg.AndorsTrail.model.QuestFilters;
import com.gpl.rpg.AndorsTrail.model.actor.Player; import com.gpl.rpg.AndorsTrail.model.actor.Player;
import com.gpl.rpg.AndorsTrail.model.quest.Quest; import com.gpl.rpg.AndorsTrail.model.quest.Quest;
import com.gpl.rpg.AndorsTrail.model.quest.QuestLogEntry; import com.gpl.rpg.AndorsTrail.model.quest.QuestLogEntry;
@@ -75,7 +76,7 @@ public final class HeroinfoActivity_Quests extends Fragment {
} }
}; };
ExpandableListView questlog_contents = (ExpandableListView) v.findViewById(R.id.questlog_contents); ExpandableListView questlog_contents = v.findViewById(R.id.questlog_contents);
questlog_contents_adapter = new SimpleExpandableListAdapter( questlog_contents_adapter = new SimpleExpandableListAdapter(
ctx ctx
, groupList , groupList
@@ -123,12 +124,16 @@ public final class HeroinfoActivity_Quests extends Fragment {
boolean isCompleted = q.isCompleted(player); boolean isCompleted = q.isCompleted(player);
int v = world.model.uiSelections.selectedQuestFilter; int v = world.model.uiSelections.selectedQuestFilter;
if (v == 0) { // Active quests switch (v) {
if (isCompleted) continue; case QuestFilters.Active: // Active quests
} else if (v == 1) { // All quests if (isCompleted) continue;
// Always show. break;
} else if (v == 2) { // Completed quests case QuestFilters.All: // All quests
if (!isCompleted) continue; // Always show.
break;
case QuestFilters.Completed: // Completed quests
if (!isCompleted) continue;
break;
} }
int statusResId; int statusResId;
@@ -146,14 +151,15 @@ public final class HeroinfoActivity_Quests extends Fragment {
List<Map<String, ?>> logItemList = new ArrayList<Map<String, ?>>(); List<Map<String, ?>> logItemList = new ArrayList<Map<String, ?>>();
for(Integer progress : player.getQuestProgress(q.questID)) { for(Integer progress : player.getQuestProgress(q.questID)) {
for(QuestLogEntry e : q.stages) { for(QuestLogEntry e : q.stages) {
if (e.progress == progress.intValue()) { if (e.progress != progress)
if (e.logtext.length() > 0) {
item = new HashMap<String, Object>();
item.put(mn_logText, e.logtext);
logItemList.add(item);
}
continue; continue;
}
if (e.logtext.length() <= 0)
continue;
item = new HashMap<String, Object>();
item.put(mn_logText, e.logtext);
logItemList.add(item);
} }
} }
childList.add(logItemList); childList.add(logItemList);

View File

@@ -44,7 +44,7 @@ public final class CombatController implements VisualEffectCompletedCallback {
this.world = world; this.world = world;
} }
public static enum BeginTurnAs { public enum BeginTurnAs {
player, monsters, continueLastTurn player, monsters, continueLastTurn
} }
@@ -119,12 +119,10 @@ public final class CombatController implements VisualEffectCompletedCallback {
if (!selectedMonster.isAgressive(world.model.player)) return; if (!selectedMonster.isAgressive(world.model.player)) return;
} }
Coord previousSelection = world.model.uiSelections.selectedPosition; Coord previousSelection = world.model.uiSelections.selectedPosition;
if (previousSelection != null) { if (previousSelection != null
world.model.uiSelections.selectedPosition = null; && selectedPosition != null
if (selectedPosition == null || !selectedPosition.equals(previousSelection)) { && selectedPosition.equals(previousSelection)) {
} else { previousSelection = null;
previousSelection = null;
}
} }
world.model.uiSelections.selectedMonster = selectedMonster; world.model.uiSelections.selectedMonster = selectedMonster;
if (selectedPosition != null) { if (selectedPosition != null) {

View File

@@ -0,0 +1,7 @@
package com.gpl.rpg.AndorsTrail.model;
public final class QuestFilters {
public static final int Active=0;
public static final int All=1;
public static final int Completed=2;
}