mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
[MID] Implemented Sungold Sentinel
This commit is contained in:
parent
6dd0cb69e7
commit
7c2db3c5fc
5 changed files with 231 additions and 0 deletions
|
|
@ -1,12 +1,16 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.MageSingleton;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.icon.abilities.HexproofAbilityIcon;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* an abstract base class for hexproof abilities
|
||||
*
|
||||
|
|
@ -20,4 +24,40 @@ public abstract class HexproofBaseAbility extends SimpleStaticAbility implements
|
|||
}
|
||||
|
||||
public abstract boolean checkObject(MageObject source, Game game);
|
||||
|
||||
public static Set<HexproofBaseAbility> getFromColor(ObjectColor color) {
|
||||
Set<HexproofBaseAbility> abilities = new HashSet<>();
|
||||
if (color.isWhite()) {
|
||||
abilities.add(HexproofFromWhiteAbility.getInstance());
|
||||
}
|
||||
if (color.isBlue()) {
|
||||
abilities.add(HexproofFromBlueAbility.getInstance());
|
||||
}
|
||||
if (color.isBlack()) {
|
||||
abilities.add(HexproofFromBlackAbility.getInstance());
|
||||
}
|
||||
if (color.isRed()) {
|
||||
abilities.add(HexproofFromRedAbility.getInstance());
|
||||
}
|
||||
if (color.isGreen()) {
|
||||
abilities.add(HexproofFromGreenAbility.getInstance());
|
||||
}
|
||||
return abilities;
|
||||
}
|
||||
|
||||
public static HexproofBaseAbility getFirstFromColor(ObjectColor color) {
|
||||
if (color.isWhite()) {
|
||||
return HexproofFromWhiteAbility.getInstance();
|
||||
} else if (color.isBlue()) {
|
||||
return HexproofFromBlueAbility.getInstance();
|
||||
} else if (color.isBlack()) {
|
||||
return HexproofFromBlackAbility.getInstance();
|
||||
} else if (color.isRed()) {
|
||||
return HexproofFromRedAbility.getInstance();
|
||||
} else if (color.isGreen()) {
|
||||
return HexproofFromGreenAbility.getInstance();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
|
||||
/**
|
||||
* Hexproof from green (This creature or player can't be the target of green
|
||||
* spells or abilities your opponents control.)
|
||||
*
|
||||
* @author igoudt
|
||||
*/
|
||||
public class HexproofFromGreenAbility extends HexproofBaseAbility {
|
||||
|
||||
private static final HexproofFromGreenAbility instance;
|
||||
|
||||
static {
|
||||
instance = new HexproofFromGreenAbility();
|
||||
}
|
||||
|
||||
private Object readResolve() throws ObjectStreamException {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static HexproofFromGreenAbility getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private HexproofFromGreenAbility() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObject(MageObject source, Game game) {
|
||||
return source.getColor(game).isGreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HexproofFromGreenAbility copy() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "hexproof from green <i>(This creature can't be the target of green spells or abilities your opponents control.)</i>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
|
||||
/**
|
||||
* Hexproof from red (This creature or player can't be the target of red
|
||||
* spells or abilities your opponents control.)
|
||||
*
|
||||
* @author igoudt
|
||||
*/
|
||||
public class HexproofFromRedAbility extends HexproofBaseAbility {
|
||||
|
||||
private static final HexproofFromRedAbility instance;
|
||||
|
||||
static {
|
||||
instance = new HexproofFromRedAbility();
|
||||
}
|
||||
|
||||
private Object readResolve() throws ObjectStreamException {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static HexproofFromRedAbility getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private HexproofFromRedAbility() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkObject(MageObject source, Game game) {
|
||||
return source.getColor(game).isRed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HexproofFromRedAbility copy() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "hexproof from red <i>(This creature can't be the target of red spells or abilities your opponents control.)</i>";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue