mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Merge pull request #1437 from LoneFox78/master
Cards from Judgment + fixes
This commit is contained in:
commit
75305a133e
67 changed files with 1480 additions and 382 deletions
|
|
@ -55,7 +55,7 @@ public class DrawDiscardTargetEffect extends OneShotEffect {
|
|||
staticText = new StringBuilder("Target player draws ")
|
||||
.append(cardsToDraw == 1?"a": CardUtil.numberToText(cardsToDraw))
|
||||
.append(" card").append(cardsToDraw == 1?" ": "s")
|
||||
.append(", then discard ")
|
||||
.append(", then discards ")
|
||||
.append(cardsToDiscard == 1?"a": CardUtil.numberToText(cardsToDiscard))
|
||||
.append(" card").append(cardsToDiscard == 1?" ": "s").toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,15 +96,18 @@ public class CanBlockAdditionalCreatureEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
private String setText() {
|
||||
StringBuilder sb = new StringBuilder("{this} can block ");
|
||||
String text = "{this} can block ";
|
||||
switch(amount) {
|
||||
case 0:
|
||||
sb.append("any number of creatures");
|
||||
text += "any number of creatures";
|
||||
break;
|
||||
default:
|
||||
sb.append(CardUtil.numberToText(amount, "an")).append(" additional creature").append(amount > 1 ? "s":"");
|
||||
text += CardUtil.numberToText(amount, "an") + " additional creature" + (amount > 1 ? "s" : "");
|
||||
}
|
||||
return sb.toString();
|
||||
if(duration == Duration.EndOfTurn) {
|
||||
text += " this turn";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import java.util.UUID;
|
|||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
|
|
@ -77,7 +78,6 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
|||
this.ability = ability;
|
||||
this.filter = filter;
|
||||
this.excludeSource = excludeSource;
|
||||
setText();
|
||||
}
|
||||
|
||||
public GainAbilityAllEffect(final GainAbilityAllEffect effect) {
|
||||
|
|
@ -141,8 +141,13 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void setText() {
|
||||
public String getText(Mode mode) {
|
||||
if(staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
boolean quotes = (ability instanceof SimpleActivatedAbility) || (ability instanceof TriggeredAbility);
|
||||
if (excludeSource) {
|
||||
sb.append("Other ");
|
||||
|
|
@ -171,6 +176,6 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
|||
if (duration.toString().length() > 0) {
|
||||
sb.append(" ").append(duration.toString());
|
||||
}
|
||||
staticText = sb.toString();
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* 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.effects.common.continuous;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public class GainProtectionFromColorAllEffect extends GainAbilityAllEffect {
|
||||
|
||||
protected ChoiceColor choice;
|
||||
|
||||
public GainProtectionFromColorAllEffect(Duration duration, FilterPermanent filter) {
|
||||
super(new ProtectionAbility(new FilterCard()), duration, filter);
|
||||
choice = new ChoiceColor(true);
|
||||
}
|
||||
|
||||
public GainProtectionFromColorAllEffect(final GainProtectionFromColorAllEffect effect) {
|
||||
super(effect);
|
||||
choice = effect.choice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GainProtectionFromColorAllEffect copy() {
|
||||
return new GainProtectionFromColorAllEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FilterCard protectionFilter = (FilterCard)((ProtectionAbility)ability).getFilter();
|
||||
protectionFilter.add(new ColorPredicate(choice.getColor()));
|
||||
protectionFilter.setMessage(choice.getChoice());
|
||||
((ProtectionAbility)ability).setFilter(protectionFilter);
|
||||
return super.apply(game, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if(sourceObject != null && controller != null) {
|
||||
choice.clearChoice();
|
||||
while(!choice.isChosen()) {
|
||||
controller.choose(Outcome.Protect, choice, game);
|
||||
if(!controller.canRespond()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(choice.isChosen() && !game.isSimulation()) {
|
||||
game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen protection from " + choice.getChoice()); }
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if(staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
|
||||
String text = "Choose a color. " + filter.getMessage() + " gain protection from the chosen color " + duration.toString();
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
|
@ -51,41 +51,42 @@ import mage.players.Player;
|
|||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class AnyColorOpponentLandsProduceManaAbility extends ManaAbility {
|
||||
public class AnyColorLandsProduceManaAbility extends ManaAbility {
|
||||
|
||||
public AnyColorOpponentLandsProduceManaAbility() {
|
||||
super(Zone.BATTLEFIELD, new AnyColorOpponentLandsProduceManaEffect(),new TapSourceCost());
|
||||
public AnyColorLandsProduceManaAbility(TargetController targetController) {
|
||||
super(Zone.BATTLEFIELD, new AnyColorLandsProduceManaEffect(targetController), new TapSourceCost());
|
||||
}
|
||||
|
||||
public AnyColorOpponentLandsProduceManaAbility(final AnyColorOpponentLandsProduceManaAbility ability) {
|
||||
public AnyColorLandsProduceManaAbility(final AnyColorLandsProduceManaAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnyColorOpponentLandsProduceManaAbility copy() {
|
||||
return new AnyColorOpponentLandsProduceManaAbility(this);
|
||||
public AnyColorLandsProduceManaAbility copy() {
|
||||
return new AnyColorLandsProduceManaAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game) {
|
||||
return ((AnyColorOpponentLandsProduceManaEffect)getEffects().get(0)).getNetMana(game, this);
|
||||
return ((AnyColorLandsProduceManaEffect)getEffects().get(0)).getNetMana(game, this);
|
||||
}
|
||||
}
|
||||
|
||||
class AnyColorOpponentLandsProduceManaEffect extends ManaEffect {
|
||||
class AnyColorLandsProduceManaEffect extends ManaEffect {
|
||||
|
||||
private static final FilterPermanent filter = new FilterLandPermanent();
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
}
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public AnyColorOpponentLandsProduceManaEffect() {
|
||||
public AnyColorLandsProduceManaEffect(TargetController targetController) {
|
||||
super();
|
||||
staticText = "Add to your mana pool one mana of any color that a land an opponent controls could produce";
|
||||
filter = new FilterLandPermanent();
|
||||
filter.add(new ControllerPredicate(targetController));
|
||||
String text = targetController == TargetController.OPPONENT ? "an opponent controls" : "you control";
|
||||
staticText = "Add to your mana pool one mana of any color that a land " + text + " could produce";
|
||||
}
|
||||
|
||||
public AnyColorOpponentLandsProduceManaEffect(final AnyColorOpponentLandsProduceManaEffect effect) {
|
||||
public AnyColorLandsProduceManaEffect(final AnyColorLandsProduceManaEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -140,7 +141,7 @@ class AnyColorOpponentLandsProduceManaEffect extends ManaEffect {
|
|||
case "White":
|
||||
mana.setWhite(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
checkToFirePossibleEvents(mana, game, source);
|
||||
player.getManaPool().addMana(mana, game, source);
|
||||
}
|
||||
|
|
@ -194,7 +195,7 @@ class AnyColorOpponentLandsProduceManaEffect extends ManaEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AnyColorOpponentLandsProduceManaEffect copy() {
|
||||
return new AnyColorOpponentLandsProduceManaEffect(this);
|
||||
public AnyColorLandsProduceManaEffect copy() {
|
||||
return new AnyColorLandsProduceManaEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue