mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
introduced XorLessLifeCondition
This commit is contained in:
parent
e44b2fd673
commit
1f89b4eedf
8 changed files with 32 additions and 44 deletions
|
|
@ -27,25 +27,28 @@
|
|||
*/
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.players.PlayerList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author maurer.it_at_gmail.com
|
||||
*/
|
||||
public class TenOrLessLifeCondition implements Condition {
|
||||
public class XorLessLifeCondition implements Condition {
|
||||
|
||||
public enum CheckType { AN_OPPONENT, CONTROLLER, TARGET_OPPONENT, EACH_PLAYER }
|
||||
|
||||
private final CheckType type;
|
||||
private final int amount;
|
||||
|
||||
public TenOrLessLifeCondition ( CheckType type ) {
|
||||
public XorLessLifeCondition ( CheckType type , int amount) {
|
||||
this.type = type;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -55,11 +58,11 @@ public class TenOrLessLifeCondition implements Condition {
|
|||
switch ( this.type ) {
|
||||
case AN_OPPONENT:
|
||||
for ( UUID opponentUUID : game.getOpponents(source.getControllerId()) ) {
|
||||
conditionApplies |= game.getPlayer(opponentUUID).getLife() <= 10;
|
||||
conditionApplies |= game.getPlayer(opponentUUID).getLife() <= amount;
|
||||
}
|
||||
break;
|
||||
case CONTROLLER:
|
||||
conditionApplies |= game.getPlayer(source.getControllerId()).getLife() <= 10;
|
||||
conditionApplies |= game.getPlayer(source.getControllerId()).getLife() <= amount;
|
||||
break;
|
||||
case TARGET_OPPONENT:
|
||||
//TODO: Implement this.
|
||||
|
|
@ -71,11 +74,11 @@ public class TenOrLessLifeCondition implements Condition {
|
|||
Player p = game.getPlayer(pid);
|
||||
if (p != null) {
|
||||
if (maxLife < p.getLife()) {
|
||||
maxLife = p.getLife();
|
||||
maxLife = p.getLife();
|
||||
}
|
||||
}
|
||||
}
|
||||
conditionApplies |= maxLife <= 10;
|
||||
conditionApplies |= maxLife <= amount;
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue