added Academy Drake, Knight of Malice, Hexproof from White

This commit is contained in:
igoudt 2018-03-22 12:05:06 +01:00
parent ad8b046b05
commit af83a34c64
6 changed files with 163 additions and 4 deletions

View file

@ -51,13 +51,13 @@ import mage.target.common.TargetOpponent;
public class Modes extends LinkedHashMap<UUID, Mode> {
private Mode currentMode; // the current mode of the selected modes
private final ArrayList<UUID> selectedModes = new ArrayList<>();
private final List<UUID> selectedModes = new ArrayList<>();
private int minModes;
private int maxModes;
private TargetController modeChooser;
private boolean eachModeMoreThanOnce; // each mode can be selected multiple times during one choice
private boolean eachModeOnlyOnce; // state if each mode can be chosen only once as long as the source object exists
private final LinkedHashMap<UUID, Mode> duplicateModes = new LinkedHashMap<>();
private final Map<UUID, Mode> duplicateModes = new LinkedHashMap<>();
private OptionalAdditionalModeSourceCosts optionalAdditionalModeSourceCosts = null; // only set if costs have to be paid
private Filter maxModesFilter = null; // calculates the max number of available modes
@ -139,7 +139,7 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
return null;
}
public ArrayList<UUID> getSelectedModes() {
public List<UUID> getSelectedModes() {
return selectedModes;
}
@ -292,7 +292,7 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
* @param source
* @param game
*/
private void setAlreadySelectedModes(ArrayList<UUID> selectedModes, Ability source, Game game) {
private void setAlreadySelectedModes(List<UUID> selectedModes, Ability source, Game game) {
for (UUID modeId : selectedModes) {
String key = getKey(source, game, modeId);
game.getState().setValue(key, true);

View file

@ -0,0 +1,44 @@
package mage.abilities.keyword;
import mage.abilities.MageSingleton;
import mage.abilities.common.SimpleStaticAbility;
import mage.constants.Zone;
import java.io.ObjectStreamException;
/**
* Hexproof from white (This creature or player can't be the target of white spells or abilities
* your opponents control.)
*
* @author igoudt
*/
public class HexproofFromWhiteAbility extends SimpleStaticAbility implements MageSingleton {
private static final HexproofFromWhiteAbility instance;
static {
instance = new HexproofFromWhiteAbility();
}
private Object readResolve() throws ObjectStreamException {
return instance;
}
public static HexproofFromWhiteAbility getInstance() {
return instance;
}
private HexproofFromWhiteAbility() {
super(Zone.BATTLEFIELD, null);
}
@Override
public HexproofFromWhiteAbility copy() {
return instance;
}
@Override
public String getRule() {
return "hexproof from white";
}
}

View file

@ -955,6 +955,14 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
}
}
if (abilities.containsKey(HexproofFromWhiteAbility.getInstance().getId()) ) {
if (game.getPlayer(this.getControllerId()).hasOpponent(sourceControllerId, game)
&& !game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, sourceControllerId, game)
&& source.getColor(game).isWhite()) {
return false;
}
}
if (hasProtectionFrom(source, game)) {
return false;
}