changes to support matches

This commit is contained in:
BetaSteward 2010-12-26 00:34:34 -05:00
parent 9ed6145b4b
commit 6ae4ac3c5e
34 changed files with 443 additions and 128 deletions

View file

@ -28,6 +28,7 @@
package mage.game;
import mage.game.match.MatchType;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@ -59,7 +60,7 @@ public class FreeForAll extends GameImpl<FreeForAll> {
}
@Override
public GameType getGameType() {
public MatchType getGameType() {
return new FreeForAllType();
}

View file

@ -0,0 +1,51 @@
/*
* 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.game;
import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class FreeForAllMatch extends MatchImpl<FreeForAll> {
public FreeForAllMatch(MatchOptions options) {
super(options);
}
@Override
public void startGame() throws GameException {
FreeForAll game = new FreeForAll(options.getAttackOption(), options.getRange());
initGame(game);
games.add(game);
}
}

View file

@ -28,11 +28,13 @@
package mage.game;
import mage.game.match.MatchType;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class FreeForAllType extends GameType {
public class FreeForAllType extends MatchType<FreeForAllType> {
public FreeForAllType() {
this.name = "Free For All";
@ -42,4 +44,13 @@ public class FreeForAllType extends GameType {
this.useAttackOption = true;
this.useRange = true;
}
protected FreeForAllType(final FreeForAllType matchType) {
super(matchType);
}
@Override
public FreeForAllType copy() {
return new FreeForAllType(this);
}
}

View file

@ -28,6 +28,7 @@
package mage.game;
import mage.game.match.MatchType;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@ -39,7 +40,7 @@ import mage.game.turn.TurnMod;
public class TwoPlayerDuel extends GameImpl<TwoPlayerDuel> {
public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range) {
super(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL);
super(attackOption, range);
}
public TwoPlayerDuel(final TwoPlayerDuel game) {
@ -47,7 +48,7 @@ public class TwoPlayerDuel extends GameImpl<TwoPlayerDuel> {
}
@Override
public GameType getGameType() {
public MatchType getGameType() {
return new TwoPlayerDuelType();
}

View file

@ -28,11 +28,13 @@
package mage.game;
import mage.game.match.MatchType;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class TwoPlayerDuelType extends GameType {
public class TwoPlayerDuelType extends MatchType<TwoPlayerDuelType> {
public TwoPlayerDuelType() {
this.name = "Two Player Duel";
@ -43,4 +45,13 @@ public class TwoPlayerDuelType extends GameType {
this.useRange = false;
}
protected TwoPlayerDuelType(final TwoPlayerDuelType matchType) {
super(matchType);
}
@Override
public TwoPlayerDuelType copy() {
return new TwoPlayerDuelType(this);
}
}

View file

@ -0,0 +1,51 @@
/*
* 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.game;
import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class TwoPlayerMatch extends MatchImpl<TwoPlayerDuel> {
public TwoPlayerMatch(MatchOptions options) {
super(options);
}
@Override
public void startGame() throws GameException {
TwoPlayerDuel game = new TwoPlayerDuel(options.getAttackOption(), options.getRange());
initGame(game);
games.add(game);
}
}