mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
the way it should have been done
This commit is contained in:
@@ -5,6 +5,7 @@ import forge.Card;
|
||||
import forge.CardList;
|
||||
import forge.CardUtil;
|
||||
import forge.FileUtil;
|
||||
import forge.Player;
|
||||
import forge.deck.DeckManager;
|
||||
import forge.properties.ForgeProps;
|
||||
import forge.properties.NewConstants;
|
||||
@@ -141,23 +142,9 @@ public class QuestEventManager {
|
||||
else if(key.equalsIgnoreCase("HumanExtras") && !value.equals("")) {
|
||||
String[] names = value.split("\\|");
|
||||
CardList templist = new CardList();
|
||||
Card tempcard;
|
||||
|
||||
for(String n : names) {
|
||||
// Token card creation
|
||||
if(n.substring(0,5).equals("TOKEN")) {
|
||||
tempcard = QuestUtil.createToken(n);
|
||||
tempcard.addController(AllZone.getHumanPlayer());
|
||||
tempcard.setOwner(AllZone.getHumanPlayer());
|
||||
templist.add(tempcard);
|
||||
}
|
||||
// Standard card creation
|
||||
else {
|
||||
tempcard = AllZone.getCardFactory().getCard(n, AllZone.getHumanPlayer());
|
||||
tempcard.setCurSetCode(tempcard.getMostRecentSet());
|
||||
tempcard.setImageFilename(CardUtil.buildFilename(tempcard));
|
||||
templist.add(tempcard);
|
||||
}
|
||||
templist.add(readExtraCard(n, AllZone.getHumanPlayer()));
|
||||
}
|
||||
|
||||
qq.humanExtraCards = templist;
|
||||
@@ -166,23 +153,9 @@ public class QuestEventManager {
|
||||
else if(key.equalsIgnoreCase("AIExtras") && !value.equals("")) {
|
||||
String[] names = value.split("\\|");
|
||||
CardList templist = new CardList();
|
||||
Card tempcard;
|
||||
|
||||
for(String n : names) {
|
||||
// Token card creation
|
||||
if(n.substring(0,5).equals("TOKEN")) {
|
||||
tempcard = QuestUtil.createToken(n);
|
||||
tempcard.addController(AllZone.getComputerPlayer());
|
||||
tempcard.setOwner(AllZone.getComputerPlayer());
|
||||
templist.add(tempcard);
|
||||
}
|
||||
// Standard card creation
|
||||
else {
|
||||
tempcard = AllZone.getCardFactory().getCard(n, AllZone.getComputerPlayer());
|
||||
tempcard.setCurSetCode(tempcard.getMostRecentSet());
|
||||
tempcard.setImageFilename(CardUtil.buildFilename(tempcard));
|
||||
templist.add(tempcard);
|
||||
}
|
||||
templist.add(readExtraCard(n, AllZone.getComputerPlayer()));
|
||||
}
|
||||
|
||||
qq.aiExtraCards = templist;
|
||||
@@ -195,6 +168,25 @@ public class QuestEventManager {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Card readExtraCard(String name, Player owner) {
|
||||
// Token card creation
|
||||
Card tempcard;
|
||||
if(name.startsWith("TOKEN")) {
|
||||
tempcard = QuestUtil.createToken(name);
|
||||
tempcard.addController(owner);
|
||||
tempcard.setOwner(owner);
|
||||
}
|
||||
// Standard card creation
|
||||
else {
|
||||
tempcard = AllZone.getCardFactory().getCard(name, owner);
|
||||
tempcard.setCurSetCode(tempcard.getMostRecentSet());
|
||||
tempcard.setImageFilename(CardUtil.buildFilename(tempcard));
|
||||
}
|
||||
return tempcard;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>assembleEventMetadata.</p>
|
||||
* Handler for metadata contained in event files.
|
||||
|
||||
Reference in New Issue
Block a user