- Added Multiplayer support for unless costs (but not multiple humans yet).

- Added "Any Player" support to unless costs.
- Added Rhystic Tutor.
This commit is contained in:
Sloth
2012-10-20 10:53:10 +00:00
parent dbe930b795
commit b1de033f47
4 changed files with 50 additions and 16 deletions

1
.gitattributes vendored
View File

@@ -7926,6 +7926,7 @@ res/cardsfolder/r/rhys_the_exiled.txt svneol=native#text/plain
res/cardsfolder/r/rhys_the_redeemed.txt svneol=native#text/plain res/cardsfolder/r/rhys_the_redeemed.txt svneol=native#text/plain
res/cardsfolder/r/rhystic_deluge.txt svneol=native#text/plain res/cardsfolder/r/rhystic_deluge.txt svneol=native#text/plain
res/cardsfolder/r/rhystic_study.txt svneol=native#text/plain res/cardsfolder/r/rhystic_study.txt svneol=native#text/plain
res/cardsfolder/r/rhystic_tutor.txt -text
res/cardsfolder/r/rib_cage_spider.txt svneol=native#text/plain res/cardsfolder/r/rib_cage_spider.txt svneol=native#text/plain
res/cardsfolder/r/ribbon_snake.txt -text res/cardsfolder/r/ribbon_snake.txt -text
res/cardsfolder/r/ribbons_of_night.txt -text svneol=unset#text/plain res/cardsfolder/r/ribbons_of_night.txt -text svneol=unset#text/plain

View File

@@ -0,0 +1,11 @@
Name:Rhystic Tutor
ManaCost:2 B
Types:Sorcery
Text:no text
A:SP$ ChangeZone | Cost$ 2 B | Origin$ Library | Destination$ Hand | ChangeType$ Card | ChangeNum$ 1 | UnlessCost$ 2 | UnlessPayer$ Player | Mandatory$ True | SpellDescription$ Unless any player pays 2, search your library for a card, put that card into your hand, then shuffle your library.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/rhystic_tutor.jpg
SetInfo:PCY|Rare|http://magiccards.info/scans/en/pr/77.jpg
Oracle:Unless any player pays {2}, search your library for a card, put that card into your hand, then shuffle your library.
End

View File

@@ -7,4 +7,5 @@ A:AB$ LoseLife | Cost$ B | ValidTgts$ Player.wasDealtDamageBySourceThisTurn | Tg
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/wicked_akuba.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/wicked_akuba.jpg
SetInfo:CHK|Common|http://magiccards.info/scans/en/chk/150.jpg SetInfo:CHK|Common|http://magiccards.info/scans/en/chk/150.jpg
Oracle:{B}: Target player dealt damage by Wicked Akuba this turn loses 1 life.
End End

View File

@@ -2784,7 +2784,7 @@ public class AbilityFactory {
// The player who has the chance to cancel the ability // The player who has the chance to cancel the ability
final String pays = params.containsKey("UnlessPayer") ? params.get("UnlessPayer") : "TargetedController"; final String pays = params.containsKey("UnlessPayer") ? params.get("UnlessPayer") : "TargetedController";
final Player payer = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), pays, sa).get(0); final ArrayList<Player> payers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), pays, sa);
// The cost // The cost
String unlessCost = params.get("UnlessCost").trim(); String unlessCost = params.get("UnlessCost").trim();
@@ -2809,7 +2809,6 @@ public class AbilityFactory {
// nothing to do here // nothing to do here
} }
}; };
ability.setActivatingPlayer(payer);
final Command paidCommand = new Command() { final Command paidCommand = new Command() {
private static final long serialVersionUID = 8094833091127334678L; private static final long serialVersionUID = 8094833091127334678L;
@@ -2820,7 +2819,7 @@ public class AbilityFactory {
} }
}; };
final Command unpaidCommand = new Command() { Command unpaidCommand = new Command() {
private static final long serialVersionUID = 8094833091127334678L; private static final long serialVersionUID = 8094833091127334678L;
@Override @Override
@@ -2832,27 +2831,49 @@ public class AbilityFactory {
AbilityFactory.resolveSubAbilities(sa, usedStack); AbilityFactory.resolveSubAbilities(sa, usedStack);
} }
}; };
boolean paid = false;
if (payer.isHuman()) { for (Player payer : payers) {
GameActionUtil.payCostDuringAbilityResolve(ability, cost, paidCommand, unpaidCommand, sa); if (payer.isComputer()) {
} else { // AI will only pay when it's not already payed and only opponents abilities
if (paid || sa.getActivatingPlayer().equals(payer)) {
continue;
}
ability.setActivatingPlayer(payer);
if (ComputerUtil.canPayCost(ability, payer) && CostUtil.checkLifeCost(payer, cost, source, 4, sa) if (ComputerUtil.canPayCost(ability, payer) && CostUtil.checkLifeCost(payer, cost, source, 4, sa)
&& CostUtil.checkDamageCost(payer, cost, source, 4) && CostUtil.checkDamageCost(payer, cost, source, 4)
&& (!source.getName().equals("Tyrannize") || payer.getCardsIn(ZoneType.Hand).size() > 2)) { && (!source.getName().equals("Tyrannize") || payer.getCardsIn(ZoneType.Hand).size() > 2)) {
// AI was crashing because the blank ability used to pay costs // AI was crashing because the blank ability used to pay costs
// Didn't have any of the data on the original SA to pay dependant costs // Didn't have any of the data on the original SA to pay dependant costs
ability.setTarget(sa.getTarget()); ability.setTarget(sa.getTarget());
ComputerUtil.playNoStack(payer, ability); // Unless cost was payed - no ComputerUtil.playNoStack(payer, ability); // Unless cost was payed - no resolve
// resolve paid = true;
}
}
}
boolean waitForInput = false;
for (Player payer : payers) {
if (payer.isHuman()) {
// if it's paid by the AI already the human can pay, but it won't change anything
if (paid) {
unpaidCommand = paidCommand;
}
GameActionUtil.payCostDuringAbilityResolve(ability, cost, paidCommand, unpaidCommand, sa);
waitForInput = true; // wait for the human input
break; // multiple human players are not supported
}
}
if (!waitForInput) {
if (paid) {
AbilityFactory.resolveSubAbilities(sa, usedStack); AbilityFactory.resolveSubAbilities(sa, usedStack);
} else { } else {
sa.resolve(); sa.resolve();
if (params.containsKey("PowerSink")) { if (params.containsKey("PowerSink")) {
GameActionUtil.doPowerSink(payer); GameActionUtil.doPowerSink(payers.get(0));
} }
AbilityFactory.resolveSubAbilities(sa, usedStack); AbilityFactory.resolveSubAbilities(sa, usedStack);
} }
} }
} }
/** /**