mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Merge pull request #2837 from spjspj/master
Add Canadian Highlander Deck/Game implementation.
This commit is contained in:
commit
72f4778506
10 changed files with 430 additions and 12 deletions
|
@ -108,6 +108,7 @@ public class CanadianHighlander extends Constructed {
|
|||
|| cn.equals("Treasure Cruise")
|
||||
|| cn.equals("True-Name Nemesis")) {
|
||||
totalPoints += 1;
|
||||
invalid.put(entry.getKey(), " 1 point " + cn);
|
||||
}
|
||||
if (cn.equals("Doomsday")
|
||||
|| cn.equals("Enlightened Tutor")
|
||||
|
@ -119,6 +120,7 @@ public class CanadianHighlander extends Constructed {
|
|||
|| cn.equals("Survival of the Fittest")
|
||||
|| cn.equals("Umezawa's Jitte")) {
|
||||
totalPoints += 2;
|
||||
invalid.put(entry.getKey(), " 2 points " + cn);
|
||||
}
|
||||
if (cn.equals("Birthing Pod")
|
||||
|| cn.equals("Mox Emerald")
|
||||
|
@ -129,24 +131,29 @@ public class CanadianHighlander extends Constructed {
|
|||
|| cn.equals("Protean Hulk")
|
||||
|| cn.equals("Vampiric Tutor")) {
|
||||
totalPoints += 3;
|
||||
invalid.put(entry.getKey(), " 3 points " + cn);
|
||||
}
|
||||
if (cn.equals("Demonic Tutor")
|
||||
|| cn.equals("Hermit Druid")
|
||||
|| cn.equals("Sol Ring")) {
|
||||
totalPoints += 4;
|
||||
invalid.put(entry.getKey(), " 4 points " + cn);
|
||||
}
|
||||
if (cn.equals("Ancestral Recall")
|
||||
|| cn.equals("Natural Order")
|
||||
|| cn.equals("Time Walk")
|
||||
|| cn.equals("Tinker")) {
|
||||
totalPoints += 5;
|
||||
invalid.put(entry.getKey(), " 5 points " + cn);
|
||||
}
|
||||
if (cn.equals("Flash")) {
|
||||
totalPoints += 6;
|
||||
invalid.put(entry.getKey(), " 6 points " + cn);
|
||||
}
|
||||
if (cn.equals("Black Lotus")
|
||||
|| cn.equals("Time Vault")) {
|
||||
totalPoints += 7;
|
||||
invalid.put(entry.getKey(), " 7 points " + cn);
|
||||
}
|
||||
}
|
||||
if (totalPoints > allowedPoints) {
|
||||
|
|
50
Mage.Server.Plugins/Mage.Game.CanadianHighlanderDuel/pom.xml
Normal file
50
Mage.Server.Plugins/Mage.Game.CanadianHighlanderDuel/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/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.mage</groupId>
|
||||
<artifactId>mage-server-plugins</artifactId>
|
||||
<version>1.4.21</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mage-game-canadianhighlanderduel</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Mage Game Canadian Highlander Two Player</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mage</artifactId>
|
||||
<version>${project.version}</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-canadianhighlanderduel</finalName>
|
||||
</build>
|
||||
|
||||
<properties/>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
public class CanadianHighlanderDuel extends GameCanadianHighlanderImpl {
|
||||
|
||||
public CanadianHighlanderDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) {
|
||||
super(attackOption, range, freeMulligans, startLife);
|
||||
}
|
||||
|
||||
public CanadianHighlanderDuel(final CanadianHighlanderDuel game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MatchType getGameType() {
|
||||
return new CanadianHighlanderDuelType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumPlayers() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CanadianHighlanderDuel copy() {
|
||||
return new CanadianHighlanderDuel(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* 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 spjspj
|
||||
*/
|
||||
public class CanadianHighlanderDuelMatch extends MatchImpl {
|
||||
|
||||
public CanadianHighlanderDuelMatch(MatchOptions options) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startGame() throws GameException {
|
||||
int startLife = 20;
|
||||
CanadianHighlanderDuel game = new CanadianHighlanderDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife);
|
||||
game.setStartMessage(this.createGameStartMessage());
|
||||
initGame(game);
|
||||
games.add(game);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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 spjspj
|
||||
*/
|
||||
public class CanadianHighlanderDuelType extends MatchType {
|
||||
|
||||
public CanadianHighlanderDuelType() {
|
||||
this.name = "Canadian Highlander Two Player Duel";
|
||||
this.maxPlayers = 2;
|
||||
this.minPlayers = 2;
|
||||
this.numTeams = 0;
|
||||
this.useAttackOption = false;
|
||||
this.useRange = false;
|
||||
this.sideboardingAllowed = false;
|
||||
}
|
||||
|
||||
protected CanadianHighlanderDuelType(final CanadianHighlanderDuelType matchType) {
|
||||
super(matchType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CanadianHighlanderDuelType copy() {
|
||||
return new CanadianHighlanderDuelType(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Sun Feb 05 18:32:22 AEDT 2017
|
||||
version=1.4.21
|
||||
groupId=org.mage
|
||||
artifactId=mage-game-canadianhighlanderduel
|
|
@ -22,6 +22,7 @@
|
|||
<module>Mage.Game.FreeForAll</module>
|
||||
<module>Mage.Game.MomirDuel</module>
|
||||
<module>Mage.Game.TinyLeadersDuel</module>
|
||||
<module>Mage.Game.CanadianHighlanderDuel</module>
|
||||
<module>Mage.Game.TwoPlayerDuel</module>
|
||||
<module>Mage.Player.AI</module>
|
||||
<module>Mage.Player.AIMinimax</module>
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
<gameType name="Commander Two Player Duel" jar="mage-game-commanderduel.jar" className="mage.game.CommanderDuelMatch" typeName="mage.game.CommanderDuelType"/>
|
||||
<gameType name="Commander Free For All" jar="mage-game-commanderfreeforall.jar" className="mage.game.CommanderFreeForAllMatch" typeName="mage.game.CommanderFreeForAllType"/>
|
||||
<gameType name="Tiny Leaders Two Player Duel" jar="mage-game-tinyleadersduel.jar" className="mage.game.TinyLeadersDuelMatch" typeName="mage.game.TinyLeadersDuelType"/>
|
||||
<gameType name="Canadian Highlander Two Player Duel" jar="mage-game-canadianhighlanderduel.jar" className="mage.game.CanadianHighlanderDuelMatch" typeName="mage.game.CanadianHighlanderDuelType"/>
|
||||
<gameType name="Momir Basic Two Player Duel" jar="mage-game-momirduel.jar" className="mage.game.MomirDuelMatch" typeName="mage.game.MomirDuelType"/>
|
||||
</gameTypes>
|
||||
<tournamentTypes>
|
||||
|
@ -133,10 +134,10 @@
|
|||
<deckType name="Constructed - Super Type 2" jar="mage-deck-constructed.jar" className="mage.deck.SuperType2"/>
|
||||
<deckType name="Constructed - Freeform" jar="mage-deck-constructed.jar" className="mage.deck.Freeform"/>
|
||||
<deckType name="Constructed - Australian Highlander" jar="mage-deck-constructed.jar" className="mage.deck.AusHighlander"/>
|
||||
<deckType name="Constructed - Canadian Highlander" jar="mage-deck-constructed.jar" className="mage.deck.CanadianHighlander"/>
|
||||
<deckType name="Variant Magic - Commander" jar="mage-deck-constructed.jar" className="mage.deck.Commander"/>
|
||||
<deckType name="Variant Magic - Duel Commander" jar="mage-deck-constructed.jar" className="mage.deck.DuelCommander"/>
|
||||
<deckType name="Variant Magic - Tiny Leaders" jar="mage-deck-constructed.jar" className="mage.deck.TinyLeaders"/>
|
||||
<deckType name="Variant Magic - Canadian Highlander" jar="mage-deck-constructed.jar" className="mage.deck.CanadianHighlander"/>
|
||||
<deckType name="Variant Magic - Momir Basic" jar="mage-deck-constructed.jar" className="mage.deck.Momir"/>
|
||||
<deckType name="Block Constructed - Battle for Zendikar" jar="mage-deck-constructed.jar" className="mage.deck.BattleForZendikarBlock"/>
|
||||
<deckType name="Block Constructed - Innistrad" jar="mage-deck-constructed.jar" className="mage.deck.InnistradBlock"/>
|
||||
|
|
|
@ -142,6 +142,12 @@
|
|||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mage-game-canadianhighlanderduel</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mage-game-momirduel</artifactId>
|
||||
|
|
179
Mage/src/main/java/mage/game/GameCanadianHighlanderImpl.java
Normal file
179
Mage/src/main/java/mage/game/GameCanadianHighlanderImpl.java
Normal file
|
@ -0,0 +1,179 @@
|
|||
/*
|
||||
* 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.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.MultiplayerAttackOption;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.game.turn.TurnMod;
|
||||
import mage.players.Player;
|
||||
|
||||
public abstract class GameCanadianHighlanderImpl extends GameImpl {
|
||||
|
||||
protected boolean startingPlayerSkipsDraw = true;
|
||||
protected Map<UUID, String> usedMulligans = new LinkedHashMap<>();
|
||||
|
||||
public GameCanadianHighlanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) {
|
||||
super(attackOption, range, 0, startLife);
|
||||
}
|
||||
|
||||
public GameCanadianHighlanderImpl(final GameCanadianHighlanderImpl game) {
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(UUID choosingPlayerId) {
|
||||
super.init(choosingPlayerId);
|
||||
state.getTurnMods().add(new TurnMod(startingPlayerId, PhaseStep.DRAW));
|
||||
}
|
||||
|
||||
private String getNextMulligan(String mulligan) {
|
||||
if (mulligan.equals("7")) {
|
||||
return "6a";
|
||||
} else if (mulligan.equals("6a")) {
|
||||
return "6b";
|
||||
} else if (mulligan.equals("6b")) {
|
||||
return "5a";
|
||||
} else if (mulligan.equals("5a")) {
|
||||
return "5b";
|
||||
} else if (mulligan.equals("5b")) {
|
||||
return "4a";
|
||||
} else if (mulligan.equals("4a")) {
|
||||
return "4b";
|
||||
} else if (mulligan.equals("4b")) {
|
||||
return "3a";
|
||||
} else if (mulligan.equals("3a")) {
|
||||
return "3b";
|
||||
} else if (mulligan.equals("3b")) {
|
||||
return "2a";
|
||||
} else if (mulligan.equals("2a")) {
|
||||
return "2b";
|
||||
} else if (mulligan.equals("2b")) {
|
||||
return "1a";
|
||||
} else if (mulligan.equals("1a")) {
|
||||
return "1b";
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
private int getNextMulliganNum(String mulligan) {
|
||||
if (mulligan.equals("7")) {
|
||||
return 6;
|
||||
} else if (mulligan.equals("6a")) {
|
||||
return 6;
|
||||
} else if (mulligan.equals("6b")) {
|
||||
return 5;
|
||||
} else if (mulligan.equals("5a")) {
|
||||
return 5;
|
||||
} else if (mulligan.equals("5b")) {
|
||||
return 4;
|
||||
} else if (mulligan.equals("4a")) {
|
||||
return 4;
|
||||
} else if (mulligan.equals("4b")) {
|
||||
return 3;
|
||||
} else if (mulligan.equals("3a")) {
|
||||
return 3;
|
||||
} else if (mulligan.equals("3b")) {
|
||||
return 2;
|
||||
} else if (mulligan.equals("2a")) {
|
||||
return 2;
|
||||
} else if (mulligan.equals("2b")) {
|
||||
return 1;
|
||||
} else if (mulligan.equals("1a")) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int mulliganDownTo(UUID playerId) {
|
||||
Player player = getPlayer(playerId);
|
||||
int deduction = 1;
|
||||
int numToMulliganTo = -1;
|
||||
if (usedMulligans != null) {
|
||||
String mulliganCode = "7";
|
||||
if (usedMulligans.containsKey(player.getId())) {
|
||||
mulliganCode = usedMulligans.get(player.getId());
|
||||
}
|
||||
numToMulliganTo = getNextMulliganNum(mulliganCode);
|
||||
}
|
||||
if (numToMulliganTo == -1) {
|
||||
return player.getHand().size() - deduction;
|
||||
}
|
||||
return numToMulliganTo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mulligan(UUID playerId) {
|
||||
Player player = getPlayer(playerId);
|
||||
int numCards = player.getHand().size();
|
||||
int numToMulliganTo = numCards;
|
||||
player.getLibrary().addAll(player.getHand().getCards(this), this);
|
||||
player.getHand().clear();
|
||||
player.shuffleLibrary(null, this);
|
||||
if (usedMulligans != null) {
|
||||
String mulliganCode = "7";
|
||||
if (usedMulligans.containsKey(player.getId())) {
|
||||
mulliganCode = usedMulligans.get(player.getId());
|
||||
}
|
||||
numToMulliganTo = getNextMulliganNum(mulliganCode);
|
||||
usedMulligans.put(player.getId(), getNextMulligan(mulliganCode));
|
||||
}
|
||||
fireInformEvent(new StringBuilder(player.getLogName())
|
||||
.append(" mulligans to ")
|
||||
.append(Integer.toString(numToMulliganTo))
|
||||
.append(numToMulliganTo == 1 ? " card" : " cards").toString());
|
||||
player.drawCards(numToMulliganTo, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endMulligan(UUID playerId) {
|
||||
super.endMulligan(playerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getOpponents(UUID playerId) {
|
||||
Set<UUID> opponents = new HashSet<>();
|
||||
for (UUID opponentId : getState().getPlayersInRange(playerId, this)) {
|
||||
if (!opponentId.equals(playerId)) {
|
||||
opponents.add(opponentId);
|
||||
}
|
||||
}
|
||||
return opponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpponent(Player player, UUID playerToCheck) {
|
||||
return !player.getId().equals(playerToCheck);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue