mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Added an AI cost preference for discard costs, the SVar is called "DiscardMe". Squee, Goblin Nabob is an example.
This commit is contained in:
@@ -6,6 +6,7 @@ PT:1/1
|
|||||||
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Graveyard | OptionalDecider$ You | Execute$ TrigChange | TriggerDescription$ At the beginning of your upkeep, you may return CARDNAME from your graveyard to your hand.
|
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Graveyard | OptionalDecider$ You | Execute$ TrigChange | TriggerDescription$ At the beginning of your upkeep, you may return CARDNAME from your graveyard to your hand.
|
||||||
SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Graveyard | Destination$ Hand | Defined$ Self
|
SVar:TrigChange:AB$ChangeZone | Cost$ 0 | Origin$ Graveyard | Destination$ Hand | Defined$ Self
|
||||||
SVar:SacMe:2
|
SVar:SacMe:2
|
||||||
|
SVar:DiscardMe:2
|
||||||
SVar:Rarity:Rare
|
SVar:Rarity:Rare
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/squee_goblin_nabob.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/squee_goblin_nabob.jpg
|
||||||
SetInfo:MMQ|Rare|http://magiccards.info/scans/en/mm/214.jpg
|
SetInfo:MMQ|Rare|http://magiccards.info/scans/en/mm/214.jpg
|
||||||
|
|||||||
@@ -867,6 +867,22 @@ public class ComputerUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pref.contains("DiscardCost")) { // search for permanents with DiscardMe
|
||||||
|
for (int ip = 0; ip < 9; ip++) { // priority 0 is the lowest, priority 5 the highest
|
||||||
|
final int priority = 9 - ip;
|
||||||
|
CardList SacMeList = typeList.filter(new CardListFilter() {
|
||||||
|
public boolean addCard(Card c) {
|
||||||
|
return (!c.getSVar("DiscardMe").equals("") && Integer.parseInt(c.getSVar("DiscardMe")) == priority);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (SacMeList.size() != 0) {
|
||||||
|
SacMeList.shuffle();
|
||||||
|
return SacMeList.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,8 +61,15 @@ public class CostUtil {
|
|||||||
|
|
||||||
static public boolean checkDiscardCost(Cost cost, Card source){
|
static public boolean checkDiscardCost(Cost cost, Card source){
|
||||||
for(CostPart part : cost.getCostParts()){
|
for(CostPart part : cost.getCostParts()){
|
||||||
if (part instanceof CostDiscard)
|
if (part instanceof CostDiscard) {
|
||||||
return false;
|
CostDiscard disc = (CostDiscard)part;
|
||||||
|
|
||||||
|
String type = disc.getType();
|
||||||
|
CardList typeList = AllZoneUtil.getPlayerHand(AllZone.getComputerPlayer());
|
||||||
|
typeList = typeList.getValidCards(type.split(","), source.getController(), source);
|
||||||
|
if (ComputerUtil.getCardPreference(source, "DiscardCost", typeList) == null)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user