mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
Merge origin/master
This commit is contained in:
commit
55fe1db60d
22 changed files with 544 additions and 400 deletions
|
|
@ -71,7 +71,18 @@ public class Effects extends ArrayList<Effect> {
|
|||
nextRule = Character.toUpperCase(nextRule.charAt(0)) + nextRule.substring(1);
|
||||
}
|
||||
}
|
||||
sbText.append(endString).append(nextRule);
|
||||
|
||||
String currentRule = endString + nextRule;
|
||||
// fix dot in the combined effect like IfDoCost
|
||||
if (sbText.length() > 0 && currentRule.length() > 0) {
|
||||
boolean prevTextEndsWithDot = sbText.charAt(sbText.length() - 1) == '.';
|
||||
boolean currentTextStartsWithDot = currentRule.startsWith(",") || currentRule.startsWith(".");
|
||||
if (prevTextEndsWithDot && currentTextStartsWithDot) {
|
||||
sbText.delete(sbText.length() - 1, sbText.length());
|
||||
}
|
||||
}
|
||||
|
||||
sbText.append(currentRule);
|
||||
}
|
||||
lastRule = nextRule;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
|
|
@ -16,8 +12,11 @@ import mage.target.Target;
|
|||
import mage.target.targetpointer.FirstTargetPointer;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ExileTargetForSourceEffect extends OneShotEffect {
|
||||
|
|
@ -70,12 +69,24 @@ public class ExileTargetForSourceEffect extends OneShotEffect {
|
|||
return staticText;
|
||||
}
|
||||
|
||||
String amountText = "";
|
||||
if (mode.getTargets().get(0).getMinNumberOfTargets() < mode.getTargets().get(0).getMaxNumberOfTargets()) {
|
||||
amountText = "up to " + CardUtil.numberToText(mode.getTargets().get(0).getMaxNumberOfTargets()) + " ";
|
||||
} else if (mode.getTargets().get(0).getMinNumberOfTargets() > 1) {
|
||||
amountText = CardUtil.numberToText(mode.getTargets().get(0).getMinNumberOfTargets()) + " ";
|
||||
}
|
||||
|
||||
String targetText = "";
|
||||
if (mode.getTargets().get(0).getTargetName().contains("target ")) {
|
||||
targetText = "";
|
||||
} else {
|
||||
targetText = "target ";
|
||||
}
|
||||
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
return "exile it";
|
||||
} else if (mode.getTargets().get(0).getTargetName().startsWith("another")) {
|
||||
return "exile " + mode.getTargets().get(0).getTargetName();
|
||||
} else {
|
||||
return "exile target " + mode.getTargets().get(0).getTargetName();
|
||||
return "exile " + amountText + targetText + mode.getTargets().get(0).getTargetName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
|
|
@ -14,7 +13,6 @@ import mage.util.CardUtil;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ReturnFromExileForSourceEffect extends OneShotEffect {
|
||||
|
|
@ -22,9 +20,10 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
|
|||
private Zone returnToZone;
|
||||
private boolean tapped;
|
||||
private boolean previousZone;
|
||||
private String returnName = "cards";
|
||||
private String returnControlName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param zone Zone the card should return to
|
||||
*/
|
||||
public ReturnFromExileForSourceEffect(Zone zone) {
|
||||
|
|
@ -36,18 +35,28 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param zone
|
||||
* @param tapped
|
||||
* @param previousZone if this is used from a dies leave battlefield or
|
||||
* destroyed trigger, the exile zone is based on previous zone of the object
|
||||
* destroyed trigger, the exile zone is based on previous zone of the object
|
||||
*/
|
||||
public ReturnFromExileForSourceEffect(Zone zone, boolean tapped, boolean previousZone) {
|
||||
super(Outcome.PutCardInPlay);
|
||||
this.returnToZone = zone;
|
||||
this.tapped = tapped;
|
||||
this.previousZone = previousZone;
|
||||
setText();
|
||||
|
||||
// different default name for zones
|
||||
switch (zone) {
|
||||
case BATTLEFIELD:
|
||||
this.returnControlName = "its owner's";
|
||||
break;
|
||||
default:
|
||||
this.returnControlName = "their owner's";
|
||||
break;
|
||||
}
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
public ReturnFromExileForSourceEffect(final ReturnFromExileForSourceEffect effect) {
|
||||
|
|
@ -55,6 +64,10 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
|
|||
this.returnToZone = effect.returnToZone;
|
||||
this.tapped = effect.tapped;
|
||||
this.previousZone = effect.previousZone;
|
||||
this.returnName = effect.returnName;
|
||||
this.returnControlName = effect.returnControlName;
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -85,24 +98,30 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
private void setText() {
|
||||
private void updateText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("return the exiled cards ");
|
||||
sb.append("return the exiled " + this.returnName + " ");
|
||||
switch (returnToZone) {
|
||||
case BATTLEFIELD:
|
||||
sb.append("to the battlefield under its owner's control");
|
||||
sb.append("to the battlefield under " + this.returnControlName + " control");
|
||||
if (tapped) {
|
||||
sb.append(" tapped");
|
||||
}
|
||||
break;
|
||||
case HAND:
|
||||
sb.append("to their owner's hand");
|
||||
sb.append("to " + this.returnControlName + " hand");
|
||||
break;
|
||||
case GRAVEYARD:
|
||||
sb.append("to their owner's graveyard");
|
||||
sb.append("to " + this.returnControlName + " graveyard");
|
||||
break;
|
||||
}
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
||||
public ReturnFromExileForSourceEffect withReturnName(String returnName, String returnControlName) {
|
||||
this.returnName = returnName;
|
||||
this.returnControlName = returnControlName;
|
||||
updateText();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -15,14 +13,17 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEffect {
|
||||
|
||||
private boolean tapped;
|
||||
protected boolean fromExileZone;
|
||||
private String returnName = "that card";
|
||||
private String returnUnderControlName = "its owner's";
|
||||
|
||||
public ReturnToBattlefieldUnderOwnerControlTargetEffect() {
|
||||
this(false);
|
||||
|
|
@ -34,15 +35,26 @@ public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEff
|
|||
|
||||
public ReturnToBattlefieldUnderOwnerControlTargetEffect(boolean tapped, boolean fromExileZone) {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "return that card to the battlefield under its owner's control";
|
||||
this.tapped = tapped;
|
||||
this.fromExileZone = fromExileZone;
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
public ReturnToBattlefieldUnderOwnerControlTargetEffect(final ReturnToBattlefieldUnderOwnerControlTargetEffect effect) {
|
||||
super(effect);
|
||||
this.tapped = effect.tapped;
|
||||
this.fromExileZone = effect.fromExileZone;
|
||||
this.returnName = effect.returnName;
|
||||
this.returnUnderControlName = effect.returnUnderControlName;
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
private void updateText() {
|
||||
this.staticText = "return " + this.returnName
|
||||
+ " to the battlefield" + (tapped ? " tapped" : "")
|
||||
+ " under " + this.returnUnderControlName + " control";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -63,8 +75,7 @@ public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEff
|
|||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
||||
if (exileZone.contains(targetId)) {
|
||||
cardsToBattlefield.add(targetId);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card instanceof MeldCard) {
|
||||
MeldCard meldCard = (MeldCard) card;
|
||||
|
|
@ -91,4 +102,11 @@ public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEff
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ReturnToBattlefieldUnderOwnerControlTargetEffect withReturnNames(String returnName, String returnUnderControlName) {
|
||||
this.returnName = returnName;
|
||||
this.returnUnderControlName = returnUnderControlName;
|
||||
updateText();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ public class ReturnToBattlefieldUnderYourControlTargetEffect extends OneShotEffe
|
|||
private boolean fromExileZone;
|
||||
private boolean tapped;
|
||||
private boolean attacking;
|
||||
private String returnName = "that card";
|
||||
private String returnUnderControlName = "your";
|
||||
|
||||
public ReturnToBattlefieldUnderYourControlTargetEffect() {
|
||||
this(false);
|
||||
|
|
@ -50,12 +52,14 @@ public class ReturnToBattlefieldUnderYourControlTargetEffect extends OneShotEffe
|
|||
this.fromExileZone = effect.fromExileZone;
|
||||
this.tapped = effect.tapped;
|
||||
this.attacking = effect.attacking;
|
||||
this.returnName = effect.returnName;
|
||||
this.returnUnderControlName = effect.returnUnderControlName;
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
private void updateText() {
|
||||
this.staticText = "return that card to the battlefield under your control"
|
||||
this.staticText = "return " + returnName + " to the battlefield under " + returnUnderControlName + " control"
|
||||
+ (tapped ? " tapped" : "")
|
||||
+ (tapped && attacking ? " and" : "")
|
||||
+ (attacking ? " attacking" : "");
|
||||
|
|
@ -111,4 +115,11 @@ public class ReturnToBattlefieldUnderYourControlTargetEffect extends OneShotEffe
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ReturnToBattlefieldUnderYourControlTargetEffect withReturnNames(String returnName, String returnUnderControlName) {
|
||||
this.returnName = returnName;
|
||||
this.returnUnderControlName = returnUnderControlName;
|
||||
updateText();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue