- Added "Optional" parameter to AF Sacrifice.

- Fixed Rathi Dragon.
This commit is contained in:
Sloth
2012-02-07 10:17:27 +00:00
parent 819adefff8
commit 94e860a021
2 changed files with 11 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ Text:no text
PT:5/5 PT:5/5
K:Flying K:Flying
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSacMtn | TriggerDescription$ When CARDNAME enters the battlefield, sacrifice it unless you sacrifice two Mountains. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSacMtn | TriggerDescription$ When CARDNAME enters the battlefield, sacrifice it unless you sacrifice two Mountains.
SVar:TrigSacMtn:AB$ Sacrifice | Cost$ 0 | Amount$ 2 | SacValid$ Mountain | RememberSacrificed$ True | SubAbility$ DBSacSelf SVar:TrigSacMtn:AB$ Sacrifice | Cost$ 0 | Amount$ 2 | SacValid$ Mountain | RememberSacrificed$ True | Optional$ True | SubAbility$ DBSacSelf
SVar:DBSacSelf:DB$ Sacrifice | Cost$ 0 | Defined$ Self | SubAbility$ DBCleanup | ConditionCheckSVar$ X | ConditionSVarCompare$ LT2 SVar:DBSacSelf:DB$ Sacrifice | Cost$ 0 | Defined$ Self | SubAbility$ DBCleanup | ConditionCheckSVar$ X | ConditionSVarCompare$ LT2
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Remembered$Amount SVar:X:Remembered$Amount

View File

@@ -484,7 +484,8 @@ public class AbilityFactorySacrifice {
if (p.isComputer()) { if (p.isComputer()) {
sacList = AbilityFactorySacrifice.sacrificeAI(p, amount, valid, sa, destroy); sacList = AbilityFactorySacrifice.sacrificeAI(p, amount, valid, sa, destroy);
} else { } else {
sacList = AbilityFactorySacrifice.sacrificeHuman(p, amount, valid, sa, destroy); sacList = AbilityFactorySacrifice.sacrificeHuman(p, amount, valid, sa, destroy,
params.containsKey("Optional"));
} }
if (remSacrificed) { if (remSacrificed) {
for (int i = 0; i < sacList.size(); i++) { for (int i = 0; i < sacList.size(); i++) {
@@ -538,7 +539,7 @@ public class AbilityFactorySacrifice {
* a {@link java.lang.String} object. * a {@link java.lang.String} object.
*/ */
private static CardList sacrificeHuman(final Player p, final int amount, final String valid, final SpellAbility sa, private static CardList sacrificeHuman(final Player p, final int amount, final String valid, final SpellAbility sa,
final boolean destroy) { final boolean destroy, final boolean optional) {
CardList saccedList = new CardList(); CardList saccedList = new CardList();
CardList list = p.getCardsIn(Zone.Battlefield); CardList list = p.getCardsIn(Zone.Battlefield);
list = list.getValidCards(valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard()); list = list.getValidCards(valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
@@ -548,7 +549,11 @@ public class AbilityFactorySacrifice {
break; break;
} }
Object o; Object o;
o = GuiUtils.getChoice("Select a card to sacrifice", list.toArray()); if (optional) {
o = GuiUtils.getChoiceOptional("Select a card to sacrifice", list.toArray());
} else {
o = GuiUtils.getChoice("Select a card to sacrifice", list.toArray());
}
if (o != null) { if (o != null) {
final Card c = (Card) o; final Card c = (Card) o;
@@ -563,6 +568,8 @@ public class AbilityFactorySacrifice {
} }
list.remove(c); list.remove(c);
} else {
return saccedList;
} }
} }
return saccedList; return saccedList;