*Some Commander infrastructure added

This commit is contained in:
Hellfish
2013-04-02 06:15:58 +00:00
parent 67817aaecd
commit 3d57a98d3c
6 changed files with 36 additions and 10 deletions

View File

@@ -133,6 +133,7 @@ public class Card extends GameEntity implements Comparable<Card> {
private List<Card> blockedThisTurn = null;
private List<Card> blockedByThisTurn = null;
private boolean isCommander = false;
private boolean startsGameInPlay = false;
private boolean drawnThisTurn = false;
private boolean tapped = false;
@@ -7320,6 +7321,10 @@ public class Card extends GameEntity implements Comparable<Card> {
if (!this.isType(source.getChosenType())) {
return false;
}
} else if (property.equals("IsCommander")) {
if(!this.isCommander) {
return false;
}
} else {
if (!this.isType(property)) {
return false;
@@ -9139,13 +9144,13 @@ public class Card extends GameEntity implements Comparable<Card> {
cardRules = r;
}
/**
* TODO: Write javadoc for this method.
* @return
*/
public boolean isEdhGeneral() {
public boolean isCommander() {
// TODO - have a field
return false;
return this.isCommander;
}
public void setCommander(boolean b) {
this.isCommander = b;
}
} // end Card class

View File

@@ -40,6 +40,7 @@ public class CardCollections {
private final IStorage<Deck> cube;
private final IStorage<Deck> scheme;
private final IStorage<Deck> plane;
private final IStorage<Deck> commander;
/**
* TODO: Write javadoc for Constructor.
@@ -56,9 +57,10 @@ public class CardCollections {
this.cube = new StorageImmediatelySerialized<Deck>(new DeckSerializer(new File(NewConstants.DECK_CUBE_DIR)));
this.scheme = new StorageImmediatelySerialized<Deck>(new DeckSerializer(new File(NewConstants.DECK_SCHEME_DIR)));
this.plane = new StorageImmediatelySerialized<Deck>(new DeckSerializer(new File(NewConstants.DECK_PLANE_DIR)));
this.commander = new StorageImmediatelySerialized<Deck>(new DeckSerializer(new File(NewConstants.DECK_COMMANDER_DIR)));
sw.stop();
System.out.printf("Read decks (%d ms): %d constructed, %d sealed, %d draft, %d cubes, %d scheme, %d planar.%n", sw.getTime(), constructed.size(), sealed.size(), draft.size(), cube.size(), scheme.size(), plane.size());
System.out.printf("Read decks (%d ms): %d constructed, %d sealed, %d draft, %d cubes, %d scheme, %d planar, %d commander.%n", sw.getTime(), constructed.size(), sealed.size(), draft.size(), cube.size(), scheme.size(), plane.size(),commander.size());
// int sum = constructed.size() + sealed.size() + draft.size() + cube.size() + scheme.size() + plane.size();
// FSkin.setProgessBarMessage(String.format("Loaded %d decks in %f sec", sum, sw.getTime() / 1000f ));
// remove this after most people have been switched to new layout
@@ -116,5 +118,12 @@ public class CardCollections {
public IStorage<Deck> getPlane() {
return plane;
}
/**
* @return the plane
*/
public IStorage<Deck> getCommander() {
return commander;
}
}

View File

@@ -16,7 +16,8 @@ public enum GameType {
Constructed ( DeckFormat.Constructed, false, true ),
Archenemy ( DeckFormat.Archenemy, false, false ),
Planechase ( DeckFormat.Planechase, false, false ),
Vanguard ( DeckFormat.Vanguard, true, true );
Vanguard ( DeckFormat.Vanguard, true, true ),
Commander ( DeckFormat.Commander, false, false);
private final DeckFormat decksFormat;
private final boolean bCardpoolLimited;

View File

@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Map;
import forge.deck.Deck;
import forge.deck.DeckSection;
import forge.game.player.LobbyPlayer;
import forge.item.CardPrinted;
@@ -33,6 +34,15 @@ public class MatchStartHelper {
players.put(player, start);
}
public void addCommanderPlayer(final LobbyPlayer player, final Deck deck)
{
PlayerStartConditions start = new PlayerStartConditions(deck);
start.setStartingLife(40);
start.setCardsInCommand(deck.get(DeckSection.Commander).toFlatList());
players.put(player, start);
}
public void addArchenemy(final LobbyPlayer player, final Deck deck, final Iterable<CardPrinted> schemes) {
PlayerStartConditions start = new PlayerStartConditions(deck);

View File

@@ -644,7 +644,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
}
this.assignedDamage.put(source, damageToDo);
if(source.isEdhGeneral())
if(source.isCommander())
this.edhGeneralDamage+= damageToDo;
GameActionUtil.executeDamageDealingEffects(source, damageToDo);

View File

@@ -75,6 +75,7 @@ public final class NewConstants {
public static final String DECK_SEALED_DIR = DECK_BASE_DIR + "sealed/";
public static final String DECK_SCHEME_DIR = DECK_BASE_DIR + "scheme/";
public static final String DECK_PLANE_DIR = DECK_BASE_DIR + "planar/";
public static final String DECK_COMMANDER_DIR = DECK_BASE_DIR + "commander/";
public static final String QUEST_SAVE_DIR = USER_QUEST_DIR + "saves/";
public static final String MAIN_PREFS_FILE = USER_PREFS_DIR + "forge.preferences";
public static final String QUEST_PREFS_FILE = USER_PREFS_DIR + "quest.preferences";