-Added Leeches

-addPoison and getPoison (player) added to GameAction
This commit is contained in:
jendave
2011-08-06 07:22:33 +00:00
parent 6b9cd3b067
commit 66ea30d5f6
5 changed files with 69 additions and 13 deletions

1
.gitattributes vendored
View File

@@ -2017,6 +2017,7 @@ res/cardsfolder/leafdrake_roost.txt -text svneol=native#text/plain
res/cardsfolder/leap.txt -text svneol=native#text/plain
res/cardsfolder/leaping_lizard.txt -text svneol=native#text/plain
res/cardsfolder/leatherback_baloth.txt -text svneol=native#text/plain
res/cardsfolder/leeches.txt svneol=native#text/plain
res/cardsfolder/legacy_weapon.txt -text svneol=native#text/plain
res/cardsfolder/leonin_elder.txt -text svneol=native#text/plain
res/cardsfolder/leonin_scimitar.txt -text svneol=native#text/plain

View File

@@ -0,0 +1,7 @@
Name:Leeches
ManaCost:1 W W
Types:Sorcery
Text:Target player loses all poison counters. Leeches deals that much damage to that player.
K:SVar:Rarity:Rare
K:SVar:Picture:http://www.wizards.com/global/images/magic/general/leeches.jpg
End

View File

@@ -8397,6 +8397,47 @@ public class CardFactory_Sorceries {
card.setSVar("PlayMain1", "TRUE");
}//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Leeches")) {
/*
* Target player loses all poison counters.
* Leeches deals that much damage to that player.
*/
SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = 8555498267738686288L;
@Override
public void resolve() {
int counters = AllZone.GameAction.getPoison(getTargetPlayer());
AllZone.GameAction.addDamage(getTargetPlayer(), card, counters);
AllZone.GameAction.addPoison(getTargetPlayer(), -counters);
}// resolve()
@Override
public boolean canPlayAI() {
PlayerLife compLife = AllZone.GameAction.getPlayerLife(Constant.Player.Computer);
PlayerLife humanLife = AllZone.GameAction.getPlayerLife(Constant.Player.Human);
int humanPoison = AllZone.GameAction.getPoison(Constant.Player.Human);
int compPoison = AllZone.GameAction.getPoison(Constant.Player.Computer);
if(humanLife.getLife() <= humanPoison ) {
setTargetPlayer(Constant.Player.Human);
return true;
}
if( (2*(11 - compPoison) < compLife.getLife() || compPoison > 7) && compPoison < compLife.getLife() - 2) {
setTargetPlayer(Constant.Player.Computer);
return true;
}
return false;
}
};// SpellAbility
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
card.clearSpellAbility();
card.addSpellAbility(spell);
}// *************** END ************ END **************************
/* Converted to keyword
//*************** START *********** START **************************
else if(cardName.equals("Fabricate")) {

View File

@@ -3744,12 +3744,7 @@ public class GameAction {
{
//addDamage(player, source, damage);
if (source.getKeyword().contains("Infect"))
{
if(player.equals(Constant.Player.Human))
AllZone.Human_PoisonCounter.addPoisonCounters(damage);
else
AllZone.Computer_PoisonCounter.addPoisonCounters(damage);
}
addPoison(player, damage);
else
getPlayerLife(player).subtractLife(damage,source);
@@ -3760,12 +3755,7 @@ public class GameAction {
public void addDamage(String player, Card source, int damage) {
if (source.getKeyword().contains("Infect"))
{
if(player.equals(Constant.Player.Human))
AllZone.Human_PoisonCounter.addPoisonCounters(damage);
else
AllZone.Computer_PoisonCounter.addPoisonCounters(damage);
}
addPoison(player, damage);
else
getPlayerLife(player).subtractLife(damage,source);
@@ -3779,6 +3769,21 @@ public class GameAction {
GameActionUtil.executePlayerDamageEffects(player, source, damage, false);
}
public void addPoison(String player, int poison)
{
if(player.equals(Constant.Player.Human))
AllZone.Human_PoisonCounter.addPoisonCounters(poison);
else
AllZone.Computer_PoisonCounter.addPoisonCounters(poison);
}
public int getPoison(String player)
{
if(player.equals(Constant.Player.Human))
return AllZone.Human_PoisonCounter.getPoisonCounters();
else
return AllZone.Computer_PoisonCounter.getPoisonCounters();
}
public void searchLibraryLand(String type, String player, String Zone1, boolean tapLand) {
searchLibraryTwoLand(type, player, Zone1, tapLand, "", false);
}

View File

@@ -5233,7 +5233,9 @@ public class GameActionUtil {
sb.append(c);
sb.append(" - Poisonous: ");
sb.append(AllZone.GameAction.getOpponent(c.getController()));
sb.append(" gets poison counters.");
sb.append(" gets ");
sb.append(poison);
sb.append(" poison counters.");
ability.setStackDescription(sb.toString());
ArrayList<String> keywords = c.getKeyword();