added 3 Dominari cards, benalish marshal, charge, knight of grace, added a new condition and a new ability

This commit is contained in:
igoudt 2018-03-18 00:18:47 +01:00
parent b046428f8c
commit ddf568679f
9 changed files with 365 additions and 28 deletions

View file

@ -0,0 +1,61 @@
/*
* 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.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.players.Player;
import java.util.Map;
import java.util.UUID;
/**
* @author North
*/
public class AnyPlayerControlsCondition implements Condition {
private final FilterPermanent filter;
public AnyPlayerControlsCondition(FilterPermanent filter) {
this.filter = filter;
}
@Override
public boolean apply(Game game, Ability source) {
for (UUID player : game.getPlayers().keySet()) {
if(player != null && game.getBattlefield().countAll(filter, player, game)> 0){
return true;
}
}
return false;
}
}

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 black (This creature or player can't be the target of black spells or abilities
* your opponents control.)
*
* @author igoudt
*/
public class HexproofFromBlackAbility extends SimpleStaticAbility implements MageSingleton {
private static final HexproofFromBlackAbility instance;
static {
instance = new HexproofFromBlackAbility();
}
private Object readResolve() throws ObjectStreamException {
return instance;
}
public static HexproofFromBlackAbility getInstance() {
return instance;
}
private HexproofFromBlackAbility() {
super(Zone.BATTLEFIELD, null);
}
@Override
public HexproofFromBlackAbility copy() {
return instance;
}
@Override
public String getRule() {
return "hexproof from black";
}
}

View file

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