This commit is contained in:
maurer.it 2010-12-29 13:40:36 -05:00
commit 4653a53078
127 changed files with 3754 additions and 788 deletions

View file

@ -28,16 +28,14 @@
package mage.interfaces;
import mage.game.match.MatchOptions;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;
import java.util.UUID;
import mage.Constants.MultiplayerAttackOption;
import mage.Constants.RangeOfInfluence;
import mage.cards.decks.DeckCardLists;
import mage.game.GameException;
import mage.interfaces.callback.CallbackServer;
import mage.view.GameTypeView;
import mage.view.TableView;
import mage.view.GameView;
@ -54,8 +52,9 @@ public interface Server extends Remote, CallbackServer {
public ServerState getServerState() throws RemoteException, MageException;
//table methods
public TableView createTable(UUID sessionId, UUID roomId, String gameType, String deckType, List<String> playerTypes, MultiplayerAttackOption attackOption, RangeOfInfluence range) throws RemoteException, MageException;
public TableView createTable(UUID sessionId, UUID roomId, MatchOptions matchOptions) throws RemoteException, MageException;
public boolean joinTable(UUID sessionId, UUID roomId, UUID tableId, String name, DeckCardLists deckList) throws RemoteException, MageException, GameException;
public boolean submitDeck(UUID sessionId, UUID tableId, DeckCardLists deckList) throws RemoteException, MageException, GameException;
public boolean watchTable(UUID sessionId, UUID roomId, UUID tableId) throws RemoteException, MageException;
public boolean replayTable(UUID sessionId, UUID roomId, UUID tableId) throws RemoteException, MageException;
public void leaveTable(UUID sessionId, UUID roomId, UUID tableId) throws RemoteException, MageException;
@ -77,7 +76,7 @@ public interface Server extends Remote, CallbackServer {
public UUID getMainRoomId() throws RemoteException, MageException;
//game methods
public void startGame(UUID sessionId, UUID roomId, UUID tableId) throws RemoteException, MageException;
public void startMatch(UUID sessionId, UUID roomId, UUID tableId) throws RemoteException, MageException;
public void joinGame(UUID gameId, UUID sessionId) throws RemoteException, MageException;
public void watchGame(UUID gameId, UUID sessionId) throws RemoteException, MageException;
public void stopWatching(UUID gameId, UUID sessionId) throws RemoteException, MageException;

View file

@ -31,7 +31,7 @@ public interface CardPlugin extends Plugin {
void downloadImages(Set<Card> allCards);
void downloadSymbols();
Image getManaSymbolImage(String symbol);
void onAddCard(MagePermanent card);
void onRemoveCard(MagePermanent card);
void onAddCard(MagePermanent card, int count);
void onRemoveCard(MagePermanent card, int count);
JComponent getCardInfoPane();
}

View file

@ -48,7 +48,7 @@ public class AbilityView extends CardView {
this.sourceName = sourceName;
this.sourceCard = sourceCard;
this.rules = new ArrayList<String>();
rules.add(formatRule(ability.getRule()));
rules.add(ability.getRule(sourceName));
this.power = "";
this.toughness = "";
this.loyalty = "";
@ -60,13 +60,6 @@ public class AbilityView extends CardView {
this.art = "";
}
@Override
protected String formatRule(String rule) {
String newRule = rule.replace("{this}", this.sourceName);
newRule.replace("{source}", this.sourceName);
return newRule;
}
public CardView getSourceCard() {
return this.sourceCard;
}

View file

@ -76,7 +76,7 @@ public class CardView implements Serializable {
public CardView(Card card) {
this.id = card.getId();
this.name = card.getName();
this.rules = formatRules(card.getRules());
this.rules = card.getRules();
if (card instanceof Permanent) {
this.power = Integer.toString(card.getPower().getValue());
this.toughness = Integer.toString(card.getToughness().getValue());
@ -118,7 +118,7 @@ public class CardView implements Serializable {
CardView(Token token) {
this.id = token.getId();
this.name = token.getName();
this.rules = formatRules(token.getAbilities().getRules());
this.rules = token.getAbilities().getRules(this.name);
this.power = token.getPower().toString();
this.toughness = token.getToughness().toString();
this.loyalty = token.getLoyalty().toString();
@ -143,19 +143,19 @@ public class CardView implements Serializable {
}
}
protected List<String> formatRules(List<String> rules) {
List<String> newRules = new ArrayList<String>();
for (String rule: rules) {
newRules.add(formatRule(rule));
}
return newRules;
}
protected String formatRule(String rule) {
String replace = rule.replace("{this}", this.name);
replace = replace.replace("{source}", this.name);
return replace;
}
// protected List<String> formatRules(List<String> rules) {
// List<String> newRules = new ArrayList<String>();
// for (String rule: rules) {
// newRules.add(formatRule(rule));
// }
// return newRules;
// }
//
// protected String formatRule(String rule) {
// String replace = rule.replace("{this}", this.name);
// replace = replace.replace("{source}", this.name);
// return replace;
// }
public String getName() {
return name;

View file

@ -29,7 +29,7 @@
package mage.view;
import java.io.Serializable;
import mage.game.GameType;
import mage.game.match.MatchType;
/**
*
@ -45,7 +45,7 @@ public class GameTypeView implements Serializable {
private boolean useRange;
private boolean useAttackOption;
public GameTypeView(GameType gameType) {
public GameTypeView(MatchType gameType) {
this.name = gameType.getName();
this.minPlayers = gameType.getMinPlayers();
this.maxPlayers = gameType.getMaxPlayers();

View file

@ -47,7 +47,7 @@ public class StackAbilityView extends CardView {
this.sourceName = sourceName;
this.sourceCard = sourceCard;
this.rules = new ArrayList<String>();
rules.add(formatRule(ability.getRule()));
rules.add(ability.getRule(sourceName));
this.power = ability.getPower().toString();
this.toughness = ability.getToughness().toString();
this.loyalty = ability.getLoyalty().toString();
@ -60,13 +60,6 @@ public class StackAbilityView extends CardView {
setTargets(ability.getTargets());
}
@Override
protected String formatRule(String rule) {
String newRule = rule.replace("{this}", this.sourceName);
newRule.replace("{source}", this.sourceName);
return newRule;
}
public CardView getSourceCard() {
return this.sourceCard;
}

View file

@ -0,0 +1,71 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.view;
import java.io.Serializable;
import java.util.UUID;
import mage.cards.decks.Deck;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class TableClientMessage implements Serializable {
private Deck deck;
private UUID tableId;
private UUID gameId;
private UUID playerId;
public TableClientMessage(Deck deck, UUID tableId) {
this.deck = deck;
this.tableId = tableId;
}
public TableClientMessage(UUID gameId, UUID playerId) {
this.gameId = gameId;
this.playerId = playerId;
}
public Deck getDeck() {
return deck;
}
public UUID getTableId() {
return tableId;
}
public UUID getGameId() {
return gameId;
}
public UUID getPlayerId() {
return playerId;
}
}