mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- 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:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -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/rhystic_deluge.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/ribbon_snake.txt -text
|
||||
res/cardsfolder/r/ribbons_of_night.txt -text svneol=unset#text/plain
|
||||
|
||||
11
res/cardsfolder/r/rhystic_tutor.txt
Normal file
11
res/cardsfolder/r/rhystic_tutor.txt
Normal 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
|
||||
@@ -7,4 +7,5 @@ A:AB$ LoseLife | Cost$ B | ValidTgts$ Player.wasDealtDamageBySourceThisTurn | Tg
|
||||
SVar:Rarity:Uncommon
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/wicked_akuba.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
|
||||
@@ -2784,7 +2784,7 @@ public class AbilityFactory {
|
||||
|
||||
// The player who has the chance to cancel the ability
|
||||
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
|
||||
String unlessCost = params.get("UnlessCost").trim();
|
||||
@@ -2809,7 +2809,6 @@ public class AbilityFactory {
|
||||
// nothing to do here
|
||||
}
|
||||
};
|
||||
ability.setActivatingPlayer(payer);
|
||||
|
||||
final Command paidCommand = new Command() {
|
||||
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;
|
||||
|
||||
@Override
|
||||
@@ -2832,27 +2831,49 @@ public class AbilityFactory {
|
||||
AbilityFactory.resolveSubAbilities(sa, usedStack);
|
||||
}
|
||||
};
|
||||
|
||||
if (payer.isHuman()) {
|
||||
GameActionUtil.payCostDuringAbilityResolve(ability, cost, paidCommand, unpaidCommand, sa);
|
||||
} else {
|
||||
if (ComputerUtil.canPayCost(ability, payer) && CostUtil.checkLifeCost(payer, cost, source, 4, sa)
|
||||
&& CostUtil.checkDamageCost(payer, cost, source, 4)
|
||||
&& (!source.getName().equals("Tyrannize") || payer.getCardsIn(ZoneType.Hand).size() > 2)) {
|
||||
// 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
|
||||
ability.setTarget(sa.getTarget());
|
||||
ComputerUtil.playNoStack(payer, ability); // Unless cost was payed - no
|
||||
// resolve
|
||||
boolean paid = false;
|
||||
for (Player payer : payers) {
|
||||
if (payer.isComputer()) {
|
||||
// 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)
|
||||
&& CostUtil.checkDamageCost(payer, cost, source, 4)
|
||||
&& (!source.getName().equals("Tyrannize") || payer.getCardsIn(ZoneType.Hand).size() > 2)) {
|
||||
// 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
|
||||
ability.setTarget(sa.getTarget());
|
||||
ComputerUtil.playNoStack(payer, ability); // Unless cost was payed - no 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);
|
||||
} else {
|
||||
sa.resolve();
|
||||
if (params.containsKey("PowerSink")) {
|
||||
GameActionUtil.doPowerSink(payer);
|
||||
GameActionUtil.doPowerSink(payers.get(0));
|
||||
}
|
||||
AbilityFactory.resolveSubAbilities(sa, usedStack);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user