mirror of
https://github.com/correl/mage.git
synced 2024-11-22 03:00:11 +00:00
Implementation of Tiny Leaders for XMage
Initial Implementation of Tiny Leaders
This commit is contained in:
parent
ca63b42e79
commit
d87ec67965
9 changed files with 556 additions and 14 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -18,6 +18,7 @@ Mage.Server.Plugins/Mage.Deck.Limited/target
|
|||
Mage.Server.Plugins/Mage.Game.CommanderDuel/target
|
||||
Mage.Server.Plugins/Mage.Game.FreeForAll/target
|
||||
Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/target
|
||||
Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/target
|
||||
Mage.Server.Plugins/Mage.Player.AI/target
|
||||
Mage.Server.Plugins/Mage.Player.AIMinimax/target
|
||||
Mage.Server.Plugins/Mage.Player.AI.MA/target
|
||||
|
@ -82,4 +83,5 @@ Mage.Server.Plugins/Mage.Draft.8PlayerBooster/target
|
|||
|
||||
/Mage.Server/config/ai.please.cast.this.txt
|
||||
/Mage.Stats/target/
|
||||
/Utils/*_unimplemented.txt
|
||||
/Utils/*_unimplemented.txt
|
||||
*.netbeans_automatic_build
|
|
@ -0,0 +1,202 @@
|
|||
/*
|
||||
* Copyright 2011 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.deck;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import mage.abilities.common.CanBeYourCommanderAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidator;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JRHerlehy
|
||||
*/
|
||||
public class TinyLeaders extends DeckValidator {
|
||||
|
||||
protected List<String> banned = new ArrayList<>();
|
||||
protected List<String> bannedCommander = new ArrayList<>();
|
||||
|
||||
public TinyLeaders() {
|
||||
this("Tiny Leaders");
|
||||
//Banned list from tinyleaders.blodspot.ca/p/ban-list.html
|
||||
//Ban list updated as of 11/08/14
|
||||
banned.add("Ancestral Recall");
|
||||
banned.add("Balance");
|
||||
banned.add("Black Lotus");
|
||||
banned.add("Channel");
|
||||
banned.add("Counterbalance");
|
||||
banned.add("Demonic Tutor");
|
||||
banned.add("Earthcraft");
|
||||
banned.add("Edric, Spymaster of Trest");
|
||||
banned.add("Fastbond");
|
||||
banned.add("Goblin Recruiter");
|
||||
banned.add("Hermit Druid");
|
||||
banned.add("Imperial Seal");
|
||||
banned.add("Library of Alexandria");
|
||||
banned.add("Karakas");
|
||||
banned.add("Mana Crypt");
|
||||
banned.add("Mana Drain");
|
||||
banned.add("Mana Vault");
|
||||
banned.add("metalworker");
|
||||
banned.add("Mind Twist");
|
||||
banned.add("Mishra's Workshop");
|
||||
banned.add("Mox Emerald");
|
||||
banned.add("Mox Jet");
|
||||
banned.add("Mox Pearl");
|
||||
banned.add("Mox Ruby");
|
||||
banned.add("Mox Sapphire");
|
||||
banned.add("Necropotence");
|
||||
banned.add("Painter's Servant");
|
||||
banned.add("Shahrazad");
|
||||
banned.add("Skullclamp");
|
||||
banned.add("Sol Ring");
|
||||
banned.add("Strip Mine");
|
||||
banned.add("Survival of the Fittest");
|
||||
banned.add("Sword of Body and Mind");
|
||||
banned.add("Time Vault");
|
||||
banned.add("Time Walk");
|
||||
banned.add("Timetwister");
|
||||
banned.add("Tolarian Academy");
|
||||
banned.add("Umezawa's Jitte");
|
||||
banned.add("Vampiric Tutor");
|
||||
banned.add("Yawgmoth's Will");
|
||||
|
||||
//Additionally, these Legendary creatures cannot be used as Commanders
|
||||
bannedCommander.add("Erayo, Soratami Ascendant");
|
||||
bannedCommander.add("Rofellos, Llanowar Emissary");
|
||||
bannedCommander.add("Derevi, Empyrical Tactician");
|
||||
}
|
||||
|
||||
public TinyLeaders(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param deck
|
||||
* @return - True if deck is valid
|
||||
*/
|
||||
@Override
|
||||
public boolean validate(Deck deck) {
|
||||
boolean valid = true;
|
||||
|
||||
if (deck.getCards().size() != 49) {
|
||||
invalid.put("Deck", "Must contain 49 cards: has " + deck.getCards().size() + " cards");
|
||||
valid = false;
|
||||
}
|
||||
|
||||
List<String> basicLandNames = new ArrayList<>(Arrays.asList("Forest", "Island", "Mountain", "Swamp", "Plains",
|
||||
"Snow-Covered Forest", "Snow-Covered Island", "Snow-Covered Mountain", "Snow-Covered Swamp", "Snow-Covered Plains"));
|
||||
Map<String, Integer> counts = new HashMap<>();
|
||||
countCards(counts, deck.getCards());
|
||||
countCards(counts, deck.getSideboard());
|
||||
for (Map.Entry<String, Integer> entry : counts.entrySet()) {
|
||||
if (entry.getValue() > 1) {
|
||||
if (!basicLandNames.contains(entry.getKey()) && !entry.getKey().equals("Relentless Rats") && !entry.getKey().equals("Shadowborn Apostle")) {
|
||||
invalid.put(entry.getKey(), "Too many: " + entry.getValue());
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (String bannedCard : banned) {
|
||||
if (counts.containsKey(bannedCard)) {
|
||||
invalid.put(bannedCard, "Banned");
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (deck.getSideboard().size() == 1) {
|
||||
Card commander = (Card) deck.getSideboard().toArray()[0];
|
||||
|
||||
/**
|
||||
* 905.5b - Each card must have a converted mana cost of three of less.
|
||||
* Cards with {X} in their mana cost count X as zero.
|
||||
* Split and double-face cards are legal only if both of their halves would be legal independently.
|
||||
*/
|
||||
|
||||
if (commander == null || commander.getManaCost().convertedManaCost() > 3) {
|
||||
invalid.put("Commander", "Commander invalide ");
|
||||
return false;
|
||||
}
|
||||
if ((commander.getCardType().contains(CardType.CREATURE) && commander.getSupertype().contains("Legendary"))
|
||||
|| (commander.getCardType().contains(CardType.PLANESWALKER) && commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) {
|
||||
if (!bannedCommander.contains(commander.getName())) {
|
||||
FilterMana color = CardUtil.getColorIdentity(commander);
|
||||
for (Card card : deck.getCards()) {
|
||||
if (!cardHasValideColor(color, card)) {
|
||||
invalid.put(card.getName(), "Invalid color (" + commander.getName() + ")");
|
||||
valid = false;
|
||||
}
|
||||
|
||||
//905.5b - Converted mana cost must be 3 or less
|
||||
if (card.getManaCost().convertedManaCost() > 3) {
|
||||
invalid.put(card.getName(), "Invalid cost (" + card.getManaCost().convertedManaCost() + ")");
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
invalid.put("Commander", "Commander banned (" + commander.getName() + ")");
|
||||
valid = false;
|
||||
}
|
||||
} else {
|
||||
invalid.put("Commander", "Commander invalide (" + commander.getName() + ")");
|
||||
valid = false;
|
||||
}
|
||||
} else {
|
||||
invalid.put("Commander", "Sideboard must contain only the commander");
|
||||
valid = false;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commander FilterMana object with Color Identity of Commander set
|
||||
* @param card Card to validate
|
||||
* @return True if card has a valid color identity
|
||||
*/
|
||||
public boolean cardHasValideColor(FilterMana commander, Card card) {
|
||||
FilterMana cardColor = CardUtil.getColorIdentity(card);
|
||||
return !(cardColor.isBlack() && !commander.isBlack()
|
||||
|| cardColor.isBlue() && !commander.isBlue()
|
||||
|| cardColor.isGreen() && !commander.isGreen()
|
||||
|| cardColor.isRed() && !commander.isRed()
|
||||
|| cardColor.isWhite() && !commander.isWhite());
|
||||
}
|
||||
|
||||
}
|
50
Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/pom.xml
Normal file
50
Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/pom.xml
Normal file
|
@ -0,0 +1,50 @@
|
|||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-server-plugins</artifactId>
|
||||
<version>1.3.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-game-tinyleadersduel</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Mage Game Tiny Leaders Two Player</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mage</artifactId>
|
||||
<version>1.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
<finalName>mage-game-tinyleadersduel</finalName>
|
||||
</build>
|
||||
|
||||
<properties/>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* 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.constants.MultiplayerAttackOption;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.game.match.MatchType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JRHerlehy
|
||||
*/
|
||||
public class TinyLeadersDuel extends GameTinyLeadersImpl {
|
||||
|
||||
public TinyLeadersDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) {
|
||||
super(attackOption, range, freeMulligans, startLife);
|
||||
}
|
||||
|
||||
public TinyLeadersDuel(final TinyLeadersDuel game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MatchType getGameType() {
|
||||
return new TinyLeadersDuelType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumPlayers() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TinyLeadersDuel copy() {
|
||||
return new TinyLeadersDuel(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* 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 JRHerlehy
|
||||
*/
|
||||
public class TinyLeadersDuelMatch extends MatchImpl {
|
||||
|
||||
public TinyLeadersDuelMatch(MatchOptions options) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startGame() throws GameException {
|
||||
//Tiny Leaders Play Rule 13: Players begin the game with 25 life.
|
||||
int startLife = 25;
|
||||
|
||||
TinyLeadersDuel game = new TinyLeadersDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife);
|
||||
game.setStartMessage(this.createGameStartMessage());
|
||||
|
||||
//"Tucking a Tiny Leader is legal
|
||||
game.setAlsoLibrary(false);
|
||||
this.initGame(game);
|
||||
games.add(game);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* 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.MatchType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JRHerlehy
|
||||
*/
|
||||
class TinyLeadersDuelType extends MatchType {
|
||||
|
||||
public TinyLeadersDuelType() {
|
||||
this.name = "Tiny Leaders Two Player Duel";
|
||||
this.maxPlayers = 2;
|
||||
this.minPlayers = 2;
|
||||
this.numTeams = 0;
|
||||
this.useAttackOption = false;
|
||||
this.useRange = false;
|
||||
this.sideboardingAllowed = false;
|
||||
}
|
||||
|
||||
protected TinyLeadersDuelType(final TinyLeadersDuelType matchType){
|
||||
super(matchType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TinyLeadersDuelType copy() {
|
||||
return new TinyLeadersDuelType(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -21,15 +21,8 @@
|
|||
<module>Mage.Game.CommanderFreeForAll</module>
|
||||
<module>Mage.Game.FreeForAll</module>
|
||||
<module>Mage.Game.TwoPlayerDuel</module>
|
||||
<module>Mage.Player.AI</module>
|
||||
<module>Mage.Player.AIMinimax</module>
|
||||
<module>Mage.Player.AI.MA</module>
|
||||
<module>Mage.Player.AIMCTS</module>
|
||||
<module>Mage.Player.AI.DraftBot</module>
|
||||
<module>Mage.Player.Human</module>
|
||||
<module>Mage.Tournament.BoosterDraft</module>
|
||||
<module>Mage.Tournament.Constructed</module>
|
||||
<module>Mage.Tournament.Sealed</module>
|
||||
</modules>
|
||||
<module>Mage.Game.TinyLeadersDuel</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
116
Mage/src/mage/game/GameTinyLeadersImpl.java
Normal file
116
Mage/src/mage/game/GameTinyLeadersImpl.java
Normal file
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* 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 java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EmptyEffect;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.continious.CommanderManaReplacementEffect;
|
||||
import mage.abilities.effects.common.continious.CommanderReplacementEffect;
|
||||
import mage.abilities.effects.common.cost.CommanderCostModification;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.MultiplayerAttackOption;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.turn.TurnMod;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Justin
|
||||
*/
|
||||
public abstract class GameTinyLeadersImpl extends GameImpl{
|
||||
|
||||
protected boolean alsoLibrary; // replace also commander going to library
|
||||
protected boolean startingPlayerSkipsDraw = true;
|
||||
|
||||
public GameTinyLeadersImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) {
|
||||
super(attackOption, range, freeMulligans, startLife);
|
||||
}
|
||||
|
||||
public GameTinyLeadersImpl(final GameTinyLeadersImpl game) {
|
||||
super(game);
|
||||
this.alsoLibrary = game.alsoLibrary;
|
||||
this.startingPlayerSkipsDraw = game.startingPlayerSkipsDraw;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(UUID choosingPlayerId, GameOptions gameOptions) {
|
||||
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new EmptyEffect("Commander effects"));
|
||||
//Move tiny leader to command zone
|
||||
for (UUID playerId: state.getPlayerList(startingPlayerId)) {
|
||||
Player player = getPlayer(playerId);
|
||||
if (player != null){
|
||||
if (player.getSideboard().size() > 0){
|
||||
Card commander = getCard((UUID)player.getSideboard().toArray()[0]);
|
||||
if (commander != null) {
|
||||
player.setCommanderId(commander.getId());
|
||||
commander.moveToZone(Zone.COMMAND, null, this, true);
|
||||
ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoLibrary));
|
||||
ability.addEffect(new CommanderCostModification(commander.getId()));
|
||||
ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
|
||||
getState().setValue(commander.getId() + "_castCount", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
this.getState().addAbility(ability, null);
|
||||
super.init(choosingPlayerId, gameOptions);
|
||||
if (startingPlayerSkipsDraw) {
|
||||
state.getTurnMods().add(new TurnMod(startingPlayerId, PhaseStep.DRAW));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getOpponents(UUID playerId) {
|
||||
Set<UUID> opponents = new HashSet<>();
|
||||
for (UUID opponentId: this.getPlayer(playerId).getInRange()) {
|
||||
if (!opponentId.equals(playerId)) {
|
||||
opponents.add(opponentId);
|
||||
}
|
||||
}
|
||||
return opponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpponent(Player player, UUID playerToCheck) {
|
||||
return !player.getId().equals(playerToCheck);
|
||||
}
|
||||
|
||||
public void setAlsoLibrary(boolean alsoLibrary) {
|
||||
this.alsoLibrary = alsoLibrary;
|
||||
}
|
||||
|
||||
}
|
7
pom.xml
7
pom.xml
|
@ -50,17 +50,16 @@
|
|||
</plugins>
|
||||
</build>
|
||||
<modules>
|
||||
<module>Mage</module>
|
||||
<module>Mage.Common</module>
|
||||
<module>Mage.Server</module>
|
||||
<module>Mage.Sets</module>
|
||||
<module>Mage.Client</module>
|
||||
<module>Mage.Plugins</module>
|
||||
<module>Mage</module>
|
||||
<module>Mage.Server</module>
|
||||
<module>Mage.Sets</module>
|
||||
<module>Mage.Server.Plugins</module>
|
||||
<module>Mage.Server.Console</module>
|
||||
<module>Mage.Tests</module>
|
||||
<module>Mage.Updater</module>
|
||||
<module>Mage.Stats</module>
|
||||
</modules>
|
||||
|
||||
<repositories>
|
||||
|
|
Loading…
Reference in a new issue