- added gold color

- added gold Dragon Token
- edited new set data (H17) for Sword of Dungeons and Dragons
This commit is contained in:
Saga\Robert 2017-08-01 14:55:17 +02:00
parent c6361cfa87
commit 2e1a820040
8 changed files with 165 additions and 12 deletions

View file

@ -42,12 +42,16 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
public static final ObjectColor BLACK = new ObjectColor("B");
public static final ObjectColor RED = new ObjectColor("R");
public static final ObjectColor GREEN = new ObjectColor("G");
public static final ObjectColor GOLD = new ObjectColor("O");
private boolean white;
private boolean blue;
private boolean black;
private boolean red;
private boolean green;
private boolean gold;
public ObjectColor() {
}
@ -70,6 +74,10 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
case 'G':
green = true;
break;
case 'O':
gold = true;
break;
}
}
}
@ -80,6 +88,8 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
black = color.black;
red = color.red;
green = color.green;
gold = color.gold;
}
/**
@ -96,6 +106,8 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
newColor.black = black || other.black;
newColor.red = red || other.red;
newColor.green = green || other.green;
newColor.gold = gold || other.gold;
return newColor;
}
@ -116,6 +128,10 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
if (red) {
count++;
}
if (gold) {
count++;
}
return count;
}
@ -136,6 +152,10 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
if (this.isGreen()) {
colors.add(ObjectColor.GREEN);
}
if (this.isGold()) {
colors.add(ObjectColor.GOLD);
}
return colors;
}
@ -145,6 +165,8 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
this.setGreen(color.isGreen());
this.setRed(color.isRed());
this.setWhite(color.isWhite());
this.setGold(color.isGold());
}
public void addColor(ObjectColor color) {
@ -163,6 +185,10 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
if (color.isGreen()) {
setGreen(true);
}
if (color.isGold()) {
setGold(true);
}
}
public boolean isColorless() {
@ -170,23 +196,32 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
}
public boolean hasColor() {
return white || blue || black || red || green;
return white || blue || black || red || green
|| gold;
}
public boolean isMulticolored() {
if (isColorless()) {
return false;
}
if (white && (blue || black || red || green)) {
if (white && (blue || black || red || green
|| gold)) {
return true;
}
if (blue && (black || red || green)) {
if (blue && (black || red || green
|| gold)) {
return true;
}
if (black && (red || green)) {
if (black && (red || green
|| gold)) {
return true;
}
return red && green;
if (red && (green
|| gold)) {
return true;
}
return green
&& gold;
}
public boolean isWhite() {
@ -228,6 +263,15 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
public void setGreen(boolean green) {
this.green = green;
}
public boolean isGold() {
return gold;
}
public void setGold(boolean gold) {
this.gold = gold;
}
@Override
public String toString() {
@ -247,6 +291,10 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
if (green) {
sb.append('G');
}
if (gold) {
sb.append('O');
}
return sb.toString();
}
@ -269,6 +317,10 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
if (green) {
return "green";
}
if (gold) {
return "gold";
}
}
return "colorless";
}
@ -294,7 +346,10 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
if (test.red != this.red) {
return false;
}
return test.green == this.green;
if (test.green != this.green) {
return false;
}
return test.gold == this.gold;
}
@Override
@ -305,6 +360,8 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
hash = 23 * hash + (this.black ? 1 : 0);
hash = 23 * hash + (this.red ? 1 : 0);
hash = 23 * hash + (this.green ? 1 : 0);
hash = 23 * hash + (this.gold ? 1 : 0);
return hash;
}
@ -327,6 +384,10 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
if (color.green && this.green) {
return true;
}
if (color.gold && this.gold) {
return true;
}
return false;
}
@ -334,7 +395,8 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
// 105.4. [...] Multicolored is not a color. Neither is colorless.
return !color.isColorless()
&& (color.white && white || color.blue && blue || color.black && black
|| color.red && red || color.green && green);
|| color.red && red || color.green && green
|| color.gold && gold);
}
@Override
@ -348,7 +410,7 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
int o2 = 0;
if (this.isMulticolored()) {
o1 = 6;
o1 = 7;
} else if (this.isColorless()) {
o1 = 0;
} else if (this.isBlack()) {
@ -361,9 +423,12 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
o1 = 4;
} else if (this.isWhite()) {
o1 = 5;
} else if (this.isGold()) {
o1 = 6;
}
if (o.isMulticolored()) {
o2 = 6;
o2 = 7;
} else if (o.isColorless()) {
o2 = 0;
} else if (o.isBlack()) {
@ -376,6 +441,9 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
o2 = 4;
} else if (o.isWhite()) {
o2 = 5;
} else if (o.isGold()) {
o2 = 6;
}
return o1 - o2;
}
@ -402,6 +470,10 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
if (isWhite()) {
return ColoredManaSymbol.W;
}
if (isGold()) {
return ColoredManaSymbol.O;
}
return null;
}
@ -412,6 +484,8 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
colors.add(ObjectColor.BLACK);
colors.add(ObjectColor.RED);
colors.add(ObjectColor.GREEN);
colors.add(ObjectColor.GOLD);
return colors;
}

View file

@ -5,7 +5,9 @@ package mage.constants;
* @author North
*/
public enum ColoredManaSymbol {
W("W","white"), U("U","blue"), B("B","black"), R("R","red"), G("G","green");
W("W","white"), U("U","blue"), B("B","black"), R("R","red"), G("G","green"),
O("O","gold");
private final String text;
private final String colorName;
@ -38,6 +40,9 @@ public enum ColoredManaSymbol {
return B;
case 'U':
return U;
case 'O':
return O;
}
return null;
}

View file

@ -0,0 +1,69 @@
/*
* 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.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.MageInt;
import mage.abilities.keyword.FlyingAbility;
import mage.constants.CardType;
/**
*
* @author Saga
*/
public class DragonTokenGold extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("UST","H17"));
}
public DragonTokenGold() {
this(null, 0);
}
public DragonTokenGold(String setCode) {
this(setCode, 0);
}
public DragonTokenGold(String setCode, int tokenType) {
super("Dragon", "4/4 gold Dragon creature token with flying");
availableImageSetCodes = tokenImageSets;
setOriginalExpansionSetCode(setCode);
cardType.add(CardType.CREATURE);
color.setGold(true);
subtype.add("Dragon");
power = new MageInt(4);
toughness = new MageInt(4);
addAbility(FlyingAbility.getInstance());
}
}