mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Add Arcanis the Omnipotent Avatar
- Count$Random can now randomize with SVars for min/max values
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user