diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/AkutaBornOfAsh.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/AkutaBornOfAsh.java index 676040adb3..36f4127408 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/AkutaBornOfAsh.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/AkutaBornOfAsh.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.Condition; +import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.DoIfCostPaid; @@ -44,8 +44,6 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; -import mage.players.Player; import mage.target.common.TargetControlledPermanent; /** @@ -90,26 +88,3 @@ public class AkutaBornOfAsh extends CardImpl { } } -class MoreCardsInHandThanOpponentsCondition implements Condition { - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player != null) { - int cardsInHand = player.getHand().size(); - for (UUID playerId : game.getOpponents(source.getControllerId())) { - Player opponent = game.getPlayer(playerId); - if (opponent != null && opponent.getHand().size() >= cardsInHand) { - return false; - } - } - } - return true; - } - - @Override - public String toString() { - return "you have more cards in hand than each opponent"; - } - -} diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/DeathOfAThousandStings.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/DeathOfAThousandStings.java index 7004b3dff2..b969aeaebe 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/DeathOfAThousandStings.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/DeathOfAThousandStings.java @@ -30,6 +30,7 @@ package mage.sets.saviorsofkamigawa; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.Effect; import mage.abilities.effects.common.GainLifeEffect; diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfKiyomaro.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfKiyomaro.java index a3784c658a..52904673f1 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfKiyomaro.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfKiyomaro.java @@ -32,6 +32,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DealsCombatDamageTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/ExileIntoDarkness.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/ExileIntoDarkness.java index 38b37e95f4..d94bdc9d29 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/ExileIntoDarkness.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/ExileIntoDarkness.java @@ -30,6 +30,7 @@ package mage.sets.saviorsofkamigawa; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect; import mage.abilities.effects.common.SacrificeEffect; diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/KitsuneBonesetter.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/KitsuneBonesetter.java index 882c814dce..a659294b88 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/KitsuneBonesetter.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/KitsuneBonesetter.java @@ -30,6 +30,7 @@ package mage.sets.saviorsofkamigawa; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.decorator.ConditionalActivatedAbility; import mage.abilities.effects.common.PreventDamageToTargetEffect; diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/OkinaNightwatch.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/OkinaNightwatch.java index 7afcb36e68..70c6f2bbcd 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/OkinaNightwatch.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/OkinaNightwatch.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/Secretkeeper.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/Secretkeeper.java index cfbc5f5193..0420dca7a7 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/Secretkeeper.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/Secretkeeper.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.MoreCardsInHandThanOpponentsCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; diff --git a/Mage/src/main/java/mage/abilities/condition/common/MoreCardsInHandThanOpponentsCondition.java b/Mage/src/main/java/mage/abilities/condition/common/MoreCardsInHandThanOpponentsCondition.java new file mode 100644 index 0000000000..846f59eb22 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/condition/common/MoreCardsInHandThanOpponentsCondition.java @@ -0,0 +1,32 @@ +package mage.abilities.condition.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +public class MoreCardsInHandThanOpponentsCondition implements Condition { + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + int cardsInHand = player.getHand().size(); + for (UUID playerId : game.getOpponents(source.getControllerId())) { + Player opponent = game.getPlayer(playerId); + if (opponent != null && opponent.getHand().size() >= cardsInHand) { + return false; + } + } + } + return true; + } + + @Override + public String toString() { + return "you have more cards in hand than each opponent"; + } + +}