- Added Jotun Grunt

This commit is contained in:
swordshine
2013-06-08 08:47:49 +00:00
parent dc2cd5daaf
commit ec6dd95c15
3 changed files with 36 additions and 4 deletions

1
.gitattributes vendored
View File

@@ -5606,6 +5606,7 @@ res/cardsfolder/j/jor_kadeen_the_prevailer.txt svneol=native#text/plain
res/cardsfolder/j/joraga_bard.txt svneol=native#text/plain
res/cardsfolder/j/joraga_treespeaker.txt svneol=native#text/plain
res/cardsfolder/j/joraga_warcaller.txt svneol=native#text/plain
res/cardsfolder/j/jotun_grunt.txt -text
res/cardsfolder/j/jotun_owl_keeper.txt -text
res/cardsfolder/j/journey_of_discovery.txt -text
res/cardsfolder/j/journey_to_nowhere.txt svneol=native#text/plain

View File

@@ -0,0 +1,9 @@
Name:Jotun Grunt
ManaCost:1 W
Types:Creature Giant Soldier
PT:4/4
K:Cumulative upkeep:PutCardToLibFromSameGrave<2/-1/Card>:Put two cards from a single graveyard on the bottom of their owner's library.
SVar:X:PlayerCountPlayers$HighestValidGraveyard Card.YouOwn
SVar:NeedsToPlayVar:X GE2
SVar:Picture:http://www.wizards.com/global/images/magic/general/jotun_grunt.jpg
Oracle:Cumulative upkeep-Put two cards from a single graveyard on the bottom of their owner's library. (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.)

View File

@@ -319,6 +319,16 @@ public class CostPutCardToLib extends CostPartWithList {
@Override
public PaymentDecision decideAIPayment(Player ai, SpellAbility ability, Card source) {
Integer c = this.convertAmount();
final Game game = ai.getGame();
List<Card> chosen = new ArrayList<Card>();
List<Card> list;
if (this.sameZone) {
list = new ArrayList<Card>(game.getCardsIn(this.getFrom()));
} else {
list = new ArrayList<Card>(ai.getCardsIn(this.getFrom()));
}
if (c == null) {
final String sVar = ability.getSVar(this.getAmount());
// Generalize this
@@ -328,12 +338,24 @@ public class CostPutCardToLib extends CostPartWithList {
c = AbilityUtils.calculateAmount(source, this.getAmount(), ability);
}
list = CardLists.getValidCards(list, this.getType().split(";"), ai, source);
if (this.sameZone) {
// TODO Determine exile from same zone for AI
return null;
} else {
List<Card> chosen = ComputerUtil.choosePutToLibraryFrom(ai, this.getFrom(), this.getType(), source, ability.getTargetCard(), c);
return null == chosen ? null : new PaymentDecision(chosen);
// Jotun Grunt
// TODO: improve AI
final List<Player> players = game.getPlayers();
for (Player p : players) {
List<Card> enoughType = CardLists.filter(list, CardPredicates.isOwner(p));
if (enoughType.size() >= c) {
chosen.addAll(enoughType);
break;
}
}
chosen = chosen.subList(0, c);
} else {
chosen = ComputerUtil.choosePutToLibraryFrom(ai, this.getFrom(), this.getType(), source, ability.getTargetCard(), c);
}
return chosen.isEmpty() ? null : new PaymentDecision(chosen);
}
}