Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 482 - Rogue trash query #530

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions androminion/res/values/strings-server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@
<string name="urchin_trash_for_mercenary">Trash it for Mercenary</string>
<string name="madman_option">Return Madman</string>
<string name="rogue_query">Select a card to gain from the trash</string>
<string name="rogue_trash_query">Select a card to trash</string>
<string name="taxman_part">gain</string>
<string name="doctor_overpay_option_one">Trash</string>
<string name="doctor_overpay_option_two">Discard</string>
Expand Down
7 changes: 5 additions & 2 deletions androminion/src/com/mehtank/androminion/ui/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,11 @@ public static String getSelectOptionHeader(Card card, Object[] extras) {
} else if (cardName.equals(getCardName(Cards.raze))) {
return getString(R.string.raze_query);
} else if(cardName.equals(getCardName(Cards.rogue))) {
return getString(R.string.rogue_query);
} else if (cardName.equals(getCardName(Cards.scheme))) {
if (extras[0] == ActionType.GAIN)
return getString(R.string.rogue_query);
else if (extras[0] == ActionType.TRASH)
return getString(R.string.rogue_trash_query);
} else if (cardName.equals(getCardName(Cards.scheme))) {
return getString(R.string.scheme_query);
} else if (cardName.equals(getCardName(Cards.sentry))) {
Card currentCard = (Card)extras[0];
Expand Down
19 changes: 16 additions & 3 deletions vdom/src/com/vdom/core/IndirectPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2503,22 +2503,35 @@ public Card rebuild_cardToGain(MoveContext context, int maxCost, int maxDebt, bo
public Card rogue_cardToGain(MoveContext context) {
ArrayList<Card> options = new ArrayList<Card>();
Set<Card> inTrashPile = new HashSet<Card>();

for (Card c : game.trashPile) {
if (!c.costPotion() && c.getCost(context) >= 3 && c.getCost(context) <= 6)
inTrashPile.add(c);
}
options.addAll(inTrashPile);
Collections.sort(options, new Util.CardNameComparator());

if (options.isEmpty()) {
return null;
}
return options.get(selectOption(context, Cards.rogue, options.toArray()));

Object[] optionsAction = new Object[1 + options.size()];

optionsAction[0] = ActionType.GAIN;
for (int i = 0; i < options.size(); i++) {
optionsAction[i + 1] = options.get(i);
}
return options.get(selectOption(context, Cards.rogue, optionsAction, null));
}

@Override
public Card rogue_cardToTrash(MoveContext context, ArrayList<Card> canTrash) {
return canTrash.get(selectOption(context, Cards.rogue, canTrash.toArray()));
Object[] options = new Object[1 + canTrash.size()];
options[0] = ActionType.TRASH;
for (int i = 0; i < canTrash.size(); i++) {
options[i + 1] = canTrash.get(i);
}
return canTrash.get(selectOption(context, Cards.rogue, options, null));
}

@Override
Expand Down