add Drop of Honey (from Arabian Nights)

This commit is contained in:
jendave
2011-08-06 07:18:23 +00:00
parent 7223038f1e
commit 3707e3ad96
4 changed files with 100 additions and 0 deletions

1
.gitattributes vendored
View File

@@ -963,6 +963,7 @@ res/cardsfolder/drifting_meadow.txt -text svneol=native#text/plain
res/cardsfolder/dripping_tongue_zubera.txt -text svneol=native#text/plain
res/cardsfolder/dromad_purebred.txt -text svneol=native#text/plain
res/cardsfolder/dromars_attendant.txt -text svneol=native#text/plain
res/cardsfolder/drop_of_honey.txt -text svneol=native#text/plain
res/cardsfolder/dross_crocodile.txt -text svneol=native#text/plain
res/cardsfolder/dross_golem.txt -text svneol=native#text/plain
res/cardsfolder/dross_harvester.txt -text svneol=native#text/plain

View File

@@ -0,0 +1,7 @@
Name:Drop of Honey
ManaCost:G
Types:Enchantment
Text:At the beginning of your upkeep, destroy the creature with the least power. It can't be regenerated. If two or more creatures are tied for least power, you choose one of them.\r\nWhen there are no creatures on the battlefield, sacrifice Drop of Honey.
K:SVar:Rarity:Rare
K:SVar:Picture:http://www.wizards.com/global/images/magic/general/drop_of_honey.jpg
End

View File

@@ -719,6 +719,27 @@ public class CardFactoryUtil {
return target;
}//input_sacrifice()
public static Input input_destroyNoRegeneration(final CardList choices, final String message) {
Input target = new Input() {
private static final long serialVersionUID = -6637588517573573232L;
@Override
public void showMessage() {
AllZone.Display.showMessage(message);
ButtonUtil.disableAll();
}
@Override
public void selectCard(Card card, PlayerZone zone) {
if(choices.contains(card)) {
AllZone.GameAction.destroyNoRegeneration(card);
stop();
}
}
};
return target;
}//input_destroyNoRegeneration()
public static Input input_sacrificePermanents(final int nCards) {
Input target = new Input() {
private static final long serialVersionUID = -8149416676562317629L;

View File

@@ -23,6 +23,7 @@ public class GameActionUtil {
AllZone.GameAction.CheckWheneverKeyword(AllZone.CardFactory.HumanNullCard, "BeginningOfUpkeep", null);
upkeep_Drop_of_Honey();
upkeep_Genesis();
upkeep_Phyrexian_Arena();
upkeep_Master_of_the_Wild_Hunt();
@@ -3528,6 +3529,76 @@ public class GameActionUtil {
}
}//damageUpkeepCost
private static void upkeep_Drop_of_Honey() {
/*
* At the beginning of your upkeep, destroy the creature with the
* least power. It can't be regenerated. If two or more creatures
* are tied for least power, you choose one of them.
*
* When there are no creatures on the battlefield, sacrifice Drop of Honey.
*/
final String player = AllZone.Phase.getActivePlayer();
final CardList cards = AllZoneUtil.getPlayerCardsInPlay(player, "Drop of Honey");
//if no creatures in play, sacrifice all "Drop of Honey"s
if(AllZoneUtil.getCreaturesInPlay().size() == 0) {
for(Card drop:cards) {
AllZone.GameAction.sacrifice(drop);
}
return;
}
for(int i = 0; i < cards.size(); i++) {
final Card c = cards.get(i);
final Ability ability = new Ability(c, "") {
@Override
public void resolve() {
CardList creatures = AllZoneUtil.getCreaturesInPlay();
CardListUtil.sortAttackLowFirst(creatures);
int power = creatures.get(0).getNetAttack();
if(player.equals(Constant.Player.Human)) {
AllZone.InputControl.setInput(CardFactoryUtil.input_destroyNoRegeneration(getLowestPowerList(creatures), "Select creature with power: "+power+" to sacrifice."));
}
else { //computer
Card compyTarget = getCompyCardToDestroy(creatures);
AllZone.GameAction.destroyNoRegeneration(compyTarget);
}
}//resolve
private CardList getLowestPowerList(CardList original) {
CardList lowestPower = new CardList();
int power = original.get(0).getNetAttack();
int i = 0;
while(original.get(i).getNetAttack() == power) {
lowestPower.add(original.get(i));
i++;
}
return lowestPower;
}
private Card getCompyCardToDestroy(CardList original) {
CardList options = getLowestPowerList(original);
CardList humanCreatures = options.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.getController().equals(Constant.Player.Human);
}
});
if(humanCreatures.isEmpty()) {
options.shuffle();
return options.get(0);
}
else {
humanCreatures.shuffle();
return humanCreatures.get(0);
}
}
};
ability.setStackDescription(c.getName()+" - destroy 1 creature with lowest power.");
AllZone.Stack.add(ability);
}//end for
}
/**
* runs the upkeep for Genesis
*/