- Add Arcanis the Omnipotent Avatar

- Count$Random can now randomize with SVars for min/max values
This commit is contained in:
Sol
2013-02-28 01:45:05 +00:00
parent 198ee38ba6
commit 0d46dc55bc
6 changed files with 33 additions and 3 deletions

View File

@@ -23,6 +23,8 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang.StringUtils;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
@@ -2178,8 +2180,21 @@ public class CardFactoryUtil {
//Count$Random.<Min>.<Max>
if (sq[0].equals("Random")) {
int min = Integer.parseInt(sq[1]);
int max = Integer.parseInt(sq[2]);
int min = 0;
int max = 0;
if (StringUtils.isNumeric(sq[1])) {
min = Integer.parseInt(sq[1]);
} else {
min = CardFactoryUtil.xCount(c, c.getSVar(sq[1]));
}
if (StringUtils.isNumeric(sq[2])) {
max = Integer.parseInt(sq[2]);
} else {
max = CardFactoryUtil.xCount(c, c.getSVar(sq[2]));
}
return forge.util.MyRandom.getRandom().nextInt(max) + min;
}

View File

@@ -99,11 +99,13 @@ public class CostReturn extends CostPartWithList {
@Override
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost, final GameState game) {
if (!this.isTargetingThis()) {
boolean needsAnnoucement = ability.hasParam("Announce") && this.getType().contains(ability.getParam("Announce"));
List<Card> typeList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Battlefield));
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
final Integer amount = this.convertAmount();
if ((amount != null) && (typeList.size() < amount)) {
if (!needsAnnoucement && amount != null && typeList.size() < amount) {
return false;
}
} else if (!source.isInPlay()) {

View File

@@ -1774,6 +1774,8 @@ public abstract class SpellAbility implements ISpellAbility {
String value = this.getActivatingPlayer().getController().announceRequirements(this, aVar);
if (value == null || !StringUtils.isNumeric(value)) {
return false;
} else if (this.getPayCosts().getCostMana().isxCantBe0() && Integer.parseInt(value) == 0) {
return false;
}
this.setSVar(aVar, "Number$" + value);
this.getSourceCard().setSVar(aVar, "Number$" + value);

View File

@@ -125,6 +125,7 @@ public class SpellAbilityRequirements {
if (!this.ability.announceRequirements()) {
this.select.setCancel(true);
this.finishedTargeting();
return;
}
// Skip to paying if parent ability doesn't target and has no