- Improved the AI of the ChangeZone AF.

- Added Tapped as option for ChangeZoneAll.
- Converted Retract to ChangeZoneAll.
- Added Planar Birth.
This commit is contained in:
jendave
2011-08-06 16:34:56 +00:00
parent 8297830dcc
commit 5fd79bcdf6
5 changed files with 36 additions and 14 deletions

1
.gitattributes vendored
View File

@@ -4011,6 +4011,7 @@ res/cardsfolder/plague_wind.txt -text svneol=native#text/plain
res/cardsfolder/plague_witch.txt -text svneol=native#text/plain
res/cardsfolder/plagued_rusalka.txt -text svneol=native#text/plain
res/cardsfolder/plains.txt -text svneol=native#text/plain
res/cardsfolder/planar_birth.txt -text svneol=native#text/plain
res/cardsfolder/planar_cleansing.txt -text svneol=native#text/plain
res/cardsfolder/planar_collapse.txt -text svneol=native#text/plain
res/cardsfolder/planar_despair.txt -text svneol=native#text/plain

View File

@@ -0,0 +1,9 @@
Name:Planar Birth
ManaCost:1 W
Types:Sorcery
Text:no text
A:SP$ChangeZoneAll | Cost$ 1 W | ChangeType$ Land.Basic | Origin$ Graveyard | Destination$ Battlefield | Tapped$ True | SpellDescription$ Return all basic land cards from all graveyards to the battlefield tapped under their owners' control.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/planar_birth.jpg
End

View File

@@ -1,8 +1,8 @@
Name:Retract
ManaCost:U
Types:Instant
Text:Return all artifacts you control to their owner's hand.
K:spBounceAll:Artifact.YouCtrl:Hand
Text:no text
A:SP$ChangeZoneAll | Cost$ U | ChangeType$ Artifact.YouCtrl | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return all artifacts you control to their owner's hand.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/retract.jpg

View File

@@ -646,8 +646,9 @@ public class AbilityFactory_ChangeZone {
// AI Targeting
Card choice = null;
if (list.getNotType("Creature").size() == 0 && destination.equals("Battlefield"))
choice = CardFactoryUtil.AI_getBestCreature(list); //if only creatures take the best
if (CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false).isCreature()
&& destination.equals("Battlefield"))
choice = CardFactoryUtil.AI_getBestCreatureToBounce(list); //if a creature is most expensive take the best
else if (destination.equals("Battlefield"))
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, af.getHostCard(), false);
else{
@@ -1035,11 +1036,13 @@ public class AbilityFactory_ChangeZone {
else if (origin.equals("Battlefield")){
// this statement is assuming the AI is trying to use this spell offensively
// if the AI is using it defensively, then something else needs to occur
if (computerType.size()+1 > humanType.size())
return false;
if (humanType.size() <= 1) // unless that 1 thing is going to kill me soon?
return false;
// if only creatures are affected evaluate both lists and pass only if human creatures are more valuable
if (humanType.getNotType("Creature").size() == 0 && computerType.getNotType("Creature").size() == 0) {
if(CardFactoryUtil.evaluateCreatureList(computerType) + 200 >= CardFactoryUtil.evaluateCreatureList(humanType))
return false;
} // otherwise evaluate both lists by CMC and pass only if human permanents are more valuable
else if(CardFactoryUtil.evaluatePermanentList(computerType) + 3 >= CardFactoryUtil.evaluatePermanentList(humanType))
return false;
// Don't cast during main1?
if (AllZone.Phase.is(Constant.Phase.Main1, AllZone.ComputerPlayer))
@@ -1066,14 +1069,21 @@ public class AbilityFactory_ChangeZone {
if (destination.equals(Constant.Zone.Battlefield)){
if (params.get("GainControl") != null){
// todo: don't activate if less than 4 cards.
// although if those cards are awesome, or we need the blockers maybe we should
if (humanType.size() + computerType.size() < 4)
// Check if the cards are valuable enough
if (humanType.getNotType("Creature").size() == 0 && computerType.getNotType("Creature").size() == 0) {
if(CardFactoryUtil.evaluateCreatureList(computerType) + CardFactoryUtil.evaluateCreatureList(humanType) < 400)
return false;
} // otherwise evaluate both lists by CMC and pass only if human permanents are less valuable
else if(CardFactoryUtil.evaluatePermanentList(computerType) + CardFactoryUtil.evaluatePermanentList(humanType) < 6)
return false;
}
else{
// don't activate if human gets more back than AI does
if (humanType.size() > computerType.size())
if (humanType.getNotType("Creature").size() == 0 && computerType.getNotType("Creature").size() == 0) {
if(CardFactoryUtil.evaluateCreatureList(computerType) <= CardFactoryUtil.evaluateCreatureList(humanType) + 100)
return false;
} // otherwise evaluate both lists by CMC and pass only if human permanents are less valuable
else if(CardFactoryUtil.evaluatePermanentList(computerType) <= CardFactoryUtil.evaluatePermanentList(humanType) + 2)
return false;
}
}
@@ -1128,6 +1138,8 @@ public class AbilityFactory_ChangeZone {
// I don't know if library position is necessary. It's here if it is, just in case
int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0;
for(Card c : cards){
if (destination.equals("Battlefield") && params.containsKey("Tapped"))
c.tap();
if (params.containsKey("GainControl"))
AllZone.GameAction.moveToPlay(c, sa.getActivatingPlayer());
else

View File

@@ -391,7 +391,7 @@ public class CardFactoryUtil {
if (biggest.isToken()) biggestvalue += 100; // raise the value of tokens
newvalue = evaluateCreature(all.get(i));
if (all.get(i).isToken()) newvalue += 100; // raise the value of tokens
if(evaluateCreature(biggest) < evaluateCreature(all.get(i))) biggest = all.get(i);
if(biggestvalue < newvalue) biggest = all.get(i);
}
}
return biggest;