- Added the cost "DamageYou".

- Added Dwarven Driller.
This commit is contained in:
Sloth
2012-08-31 21:58:42 +00:00
parent 37e34e862b
commit 086a2c3cee
7 changed files with 241 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ import forge.card.abilityfactory.AbilityFactory;
import forge.card.spellability.SpellAbility;
import forge.control.input.Input;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
import forge.game.zone.ZoneType;
import forge.gui.GuiUtils;
@@ -134,6 +135,36 @@ public class CostUtil {
return true;
}
/**
* Check life cost.
*
* @param cost
* the cost
* @param source
* the source
* @param remainingLife
* the remaining life
* @return true, if successful
*/
public static boolean checkDamageCost(final Cost cost, final Card source, final int remainingLife) {
if (cost == null) {
return true;
}
for (final CostPart part : cost.getCostParts()) {
if (part instanceof CostDamage) {
final CostDamage pay = (CostDamage) part;
Player computer = AllZone.getComputerPlayer();
int realDamage = computer.predictDamage(pay.convertAmount(), source, false);
if (computer.getLife() - realDamage < remainingLife
&& realDamage > 0 && !computer.cantLoseForZeroOrLessLife()
&& computer.canLoseLife()) {
return false;
}
}
}
return true;
}
/**
* Check discard cost.
*