- Added canPayLife(int lifePayment) to the payer class and made use of it in several places.

This commit is contained in:
jendave
2011-08-06 10:29:48 +00:00
parent 48eb9b63a8
commit e43a4ae95f
4 changed files with 10 additions and 38 deletions

View File

@@ -13845,39 +13845,10 @@ public class CardFactory_Creatures {
card.addComesIntoPlayCommand(gain2Life);
}//*************** END ************ END **************************
/*
//*************** START *********** START **************************
else if(cardName.equals("Godsire")) {
final SpellAbility a1 = new Ability_Tap(card) {
private static final long serialVersionUID = -1160527561099142816L;
@Override
public void resolve() {
makeToken();
}
void makeToken() {
CardFactoryUtil.makeToken("Beast", "RGW 8 8 Beast", card, "R G W", new String[] {
"Creature", "Beast"}, 8, 8, new String[] {""});
}//makeToken()
@Override
public boolean canPlayAI() {
return AllZone.Phase.getPhase().equals("Main2");
}
};//SpellAbility
card.addSpellAbility(a1);
a1.setDescription("tap: Put an 8/8 Beast creature token into play that's red, green, and white.");
a1.setStackDescription("Put an 8/8 Beast creature token into play that's red, green, and white.");
//a1.setBeforePayMana(new Input_PayManaCost(a1));
}//*************** END ************ END **************************
*/
//*************** START *********** START **************************
else if(cardName.equals("Wydwen, the Biting Gale")) {
final SpellAbility a1 = new Ability(card, "U B") {
final SpellAbility a1 = new Ability(card, "U B PayLife<1>") {
@Override
public boolean canPlayAI() {
@@ -13886,8 +13857,6 @@ public class CardFactory_Creatures {
@Override
public void resolve() {
//or payLife()...
card.getController().loseLife(1, card);
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getOwner());
/*
AllZone.getZone(card).remove(card);

View File

@@ -103,10 +103,7 @@ public class Cost_Payment {
}
if (cost.getLifeCost()){
int curLife = card.getController().getLife();
if (curLife < cost.getLifeAmount())
return false;
if(cost.getLifeAmount() > 0 && AllZoneUtil.isCardInPlay("Platinum Emperion",card.getController())) return false;
if (!card.getController().canPayLife(cost.getLifeAmount())) return false;
}
if (cost.getDiscardCost()){

View File

@@ -10127,7 +10127,7 @@ public class GameActionUtil {
public void selectCard(Card card, PlayerZone zone) {
if(zone.is(Constant.Zone.Hand) && true == card.getDrawnThisTurn()) {
/////////////////////////////////////////
if ((player.getLife() >= 4) && GameActionUtil.showYesNoDialog(source, cardQuestion)) {
if (player.canPayLife(4) && GameActionUtil.showYesNoDialog(source, cardQuestion)) {
player.payLife(4, source);
//card stays in hand
}

View File

@@ -162,8 +162,14 @@ public abstract class Player extends MyObservable{
}
*/
public boolean payLife(int lifePayment, Card source) {
public boolean canPayLife(int lifePayment) {
if(life < lifePayment) return false;
if(lifePayment > 0 && AllZoneUtil.isCardInPlay("Platinum Emperion",this)) return false;
return true;
}
public boolean payLife(int lifePayment, Card source) {
if (!canPayLife(lifePayment)) return false;
//rule 118.8
if (life >= lifePayment){
return loseLife(lifePayment, source);