mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
- Fixed AI for Tribute to the Wild.
This commit is contained in:
@@ -398,40 +398,45 @@ public class AbilityFactorySacrifice {
|
|||||||
tgt.resetTargets();
|
tgt.resetTargets();
|
||||||
if (AllZone.getHumanPlayer().canBeTargetedBy(sa)) {
|
if (AllZone.getHumanPlayer().canBeTargetedBy(sa)) {
|
||||||
tgt.addTarget(AllZone.getHumanPlayer());
|
tgt.addTarget(AllZone.getHumanPlayer());
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
final String defined = params.get("Defined");
|
|
||||||
if (defined == null) {
|
|
||||||
// Self Sacrifice.
|
|
||||||
} else if (defined.equals("Each")) {
|
|
||||||
// If Sacrifice hits both players:
|
|
||||||
// Only cast it if Human has the full amount of valid
|
|
||||||
// Only cast it if AI doesn't have the full amount of Valid
|
|
||||||
// TODO: Cast if the type is favorable: my "worst" valid is
|
|
||||||
// worse than his "worst" valid
|
|
||||||
final String valid = params.get("SacValid");
|
|
||||||
final String num = params.containsKey("Amount") ? params.get("Amount") : "1";
|
|
||||||
int amount = AbilityFactory.calculateAmount(card, num, sa);
|
|
||||||
|
|
||||||
final Card source = sa.getSourceCard();
|
final String defined = params.get("Defined");
|
||||||
if (num.equals("X") && source.getSVar(num).equals("Count$xPaid")) {
|
if (defined == null) {
|
||||||
// Set PayX here to maximum value.
|
// Self Sacrifice.
|
||||||
amount = Math.min(ComputerUtil.determineLeftoverMana(sa), amount);
|
} else if (defined.equals("Each")
|
||||||
}
|
|| (defined.equals("Opponent") && !sa.isTrigger())) {
|
||||||
|
// If Sacrifice hits both players:
|
||||||
|
// Only cast it if Human has the full amount of valid
|
||||||
|
// Only cast it if AI doesn't have the full amount of Valid
|
||||||
|
// TODO: Cast if the type is favorable: my "worst" valid is
|
||||||
|
// worse than his "worst" valid
|
||||||
|
final String valid = params.get("SacValid");
|
||||||
|
final String num = params.containsKey("Amount") ? params.get("Amount") : "1";
|
||||||
|
int amount = AbilityFactory.calculateAmount(card, num, sa);
|
||||||
|
|
||||||
CardList humanList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
final Card source = sa.getSourceCard();
|
||||||
humanList = humanList.getValidCards(valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
if (num.equals("X") && source.getSVar(num).equals("Count$xPaid")) {
|
||||||
CardList computerList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
// Set PayX here to maximum value.
|
||||||
computerList = computerList.getValidCards(valid.split(","), sa.getActivatingPlayer(),
|
amount = Math.min(ComputerUtil.determineLeftoverMana(sa), amount);
|
||||||
sa.getSourceCard());
|
}
|
||||||
|
|
||||||
// Since all of the cards have remAIDeck:True, I enabled 1 for 1
|
CardList humanList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||||
// (or X for X) trades for special decks
|
humanList = humanList.getValidCards(valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||||
if (humanList.size() < amount) {
|
CardList computerList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||||
return false;
|
if (defined.equals("Opponent")) {
|
||||||
}
|
computerList = new CardList();
|
||||||
|
}
|
||||||
|
computerList = computerList.getValidCards(valid.split(","), sa.getActivatingPlayer(),
|
||||||
|
sa.getSourceCard());
|
||||||
|
|
||||||
|
// Since all of the cards have remAIDeck:True, I enabled 1 for 1
|
||||||
|
// (or X for X) trades for special decks
|
||||||
|
if (humanList.size() < amount) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user