diff --git a/Mage.Sets/src/mage/sets/starwars/BatheInBacta.java b/Mage.Sets/src/mage/sets/starwars/BatheInBacta.java
index 69a86552521..87e4e5d5e0b 100644
--- a/Mage.Sets/src/mage/sets/starwars/BatheInBacta.java
+++ b/Mage.Sets/src/mage/sets/starwars/BatheInBacta.java
@@ -47,18 +47,11 @@ public class BatheInBacta extends CardImpl {
super(ownerId, 129, "Bathe in Bacta", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{G}");
this.expansionSetCode = "SWS";
- // You gain 6 life.
+ // You gain 6 life. If you lost life from a source other than combat damage this turn, you gain 9 life instead.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
- new GainLifeEffect(6),
+ new GainLifeEffect(6), new GainLifeEffect(9),
new InvertCondition(HateCondition.getInstance()),
- "You gain 6 life"));
-
- // If you lost life from a source other than combat damage this turn, you gain 9 life instead.
- this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
- new GainLifeEffect(9),
- HateCondition.getInstance(),
- "If you lost life from a source other than combat damage this turn, you gain 9 life instead"));
-
+ "You gain 6 life. If you lost life from a source other than combat damage this turn, you gain 9 life instead"));
this.getSpellAbility().addWatcher(new LifeLossOtherFromCombatWatcher());
}
diff --git a/Mage.Sets/src/mage/sets/starwars/MoistureFarm.java b/Mage.Sets/src/mage/sets/starwars/MoistureFarm.java
index 5de0baf6ff2..39868634ddf 100644
--- a/Mage.Sets/src/mage/sets/starwars/MoistureFarm.java
+++ b/Mage.Sets/src/mage/sets/starwars/MoistureFarm.java
@@ -31,11 +31,11 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
-import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.AddManaOfAnyColorEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.ColorlessManaAbility;
+import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
@@ -59,7 +59,7 @@ public class MoistureFarm extends CardImpl {
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost()));
// {T}, Remove a storage counter from Moisture Farm: Add one mana of any color to your mana pool.
- Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(1), new TapSourceCost());
+ Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(1), new TapSourceCost());
ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
this.addAbility(ability);
}
diff --git a/Mage.Sets/src/mage/sets/starwars/Terentatek.java b/Mage.Sets/src/mage/sets/starwars/Terentatek.java
index 3350f684ca8..1265e2fcb63 100644
--- a/Mage.Sets/src/mage/sets/starwars/Terentatek.java
+++ b/Mage.Sets/src/mage/sets/starwars/Terentatek.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.HateCondition;
import mage.abilities.effects.RestrictionEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
@@ -41,7 +42,6 @@ import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
-import mage.watchers.common.LifeLossOtherFromCombatWatcher;
/**
*
@@ -57,10 +57,8 @@ public class Terentatek extends CardImpl {
this.toughness = new MageInt(3);
// Terentatek can't attack or block unless you control a Sith.
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new Terentatek1RestrictionEffect()));
-
// Hate — If an opponent lost life from source other than combat damage this turn, Terentatek may attack as though you controlled a Sith.
- this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new Terentatek2RestrictionEffect()), new LifeLossOtherFromCombatWatcher());
+ this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new Terentatek1RestrictionEffect()));
}
@@ -84,7 +82,8 @@ class Terentatek1RestrictionEffect extends RestrictionEffect {
public Terentatek1RestrictionEffect() {
super(Duration.WhileOnBattlefield);
- staticText = "{this} can't attack or block unless you control a Sith";
+ staticText = "{this} can't attack or block unless you control a Sith."
+ + "
Hate — If an opponent lost life from source other than combat damage this turn, {this} may attack as though you controlled a Sith";
}
public Terentatek1RestrictionEffect(final Terentatek1RestrictionEffect effect) {
@@ -98,53 +97,23 @@ class Terentatek1RestrictionEffect extends RestrictionEffect {
@Override
public boolean canAttack(Game game) {
- return false;
+ Ability source = (Ability) getValue("source");
+ return game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0
+ || HateCondition.getInstance().apply(game, source);
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
- return false;
+ return game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0;
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
+
if (permanent.getId().equals(source.getSourceId())) {
- if (game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) {
- return false;
- }
+ setValue("source", source);
return true;
}
return false;
}
}
-
-class Terentatek2RestrictionEffect extends RestrictionEffect {
-
- public Terentatek2RestrictionEffect() {
- super(Duration.WhileOnBattlefield);
- staticText = "Hate — If an opponent lost life from source other than combat damage this turn, {this} may attack as though you controlled a Sith.";
- }
-
- public Terentatek2RestrictionEffect(final Terentatek2RestrictionEffect effect) {
- super(effect);
- }
-
- @Override
- public Terentatek2RestrictionEffect copy() {
- return new Terentatek2RestrictionEffect(this);
- }
-
- @Override
- public boolean canAttack(Game game) {
- return true;
- }
-
- @Override
- public boolean applies(Permanent permanent, Ability source, Game game) {
- if (permanent.getId().equals(source.getSourceId())) {
- LifeLossOtherFromCombatWatcher watcher = (LifeLossOtherFromCombatWatcher) game.getState().getWatchers().get("NonCombatDamageWatcher");
- return watcher != null && watcher.opponentLostLifeOtherFromCombat(source.getControllerId());
- }
- return false;
- }
-}
diff --git a/Mage/src/main/java/mage/abilities/condition/common/HateCondition.java b/Mage/src/main/java/mage/abilities/condition/common/HateCondition.java
index 1d35e6c3e07..f8ebbe51f88 100644
--- a/Mage/src/main/java/mage/abilities/condition/common/HateCondition.java
+++ b/Mage/src/main/java/mage/abilities/condition/common/HateCondition.java
@@ -55,7 +55,7 @@ public class HateCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
LifeLossOtherFromCombatWatcher watcher = (LifeLossOtherFromCombatWatcher) game.getState().getWatchers().get(LifeLossOtherFromCombatWatcher.class.getName());
- return watcher != null && watcher.opponentLostLifeOtherFromCombat(source.getControllerId());
+ return watcher != null && watcher.opponentLostLifeOtherFromCombat(source.getControllerId(), game);
}
@Override
diff --git a/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java
index 8f85ed82836..d19f91f7774 100644
--- a/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java
+++ b/Mage/src/main/java/mage/abilities/costs/common/DiscardTargetCost.java
@@ -75,16 +75,14 @@ public class DiscardTargetCost extends CostImpl {
int amount = this.getTargets().get(0).getNumberOfTargets();
if (randomDiscard) {
this.cards.addAll(player.discard(amount, true, ability, game).getCards(game));
- } else {
- if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
- for (UUID targetId : targets.get(0).getTargets()) {
- Card card = player.getHand().get(targetId, game);
- if (card == null) {
- return false;
- }
- player.discard(card, ability, game);
- this.cards.add(card);
+ } else if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
+ for (UUID targetId : targets.get(0).getTargets()) {
+ Card card = player.getHand().get(targetId, game);
+ if (card == null) {
+ return false;
}
+ player.discard(card, ability, game);
+ this.cards.add(card);
}
}
paid = cards.size() >= amount;
diff --git a/Mage/src/main/java/mage/abilities/keyword/RepairAbility.java b/Mage/src/main/java/mage/abilities/keyword/RepairAbility.java
index 99ebe7ad270..a73fda38bba 100644
--- a/Mage/src/main/java/mage/abilities/keyword/RepairAbility.java
+++ b/Mage/src/main/java/mage/abilities/keyword/RepairAbility.java
@@ -55,6 +55,10 @@ public class RepairAbility extends DiesTriggeredAbility {
return ruleText;
}
+ @Override
+ public RepairAbility copy() {
+ return new RepairAbility(this);
+ }
}
class RepairCastFromGraveyardEffect extends AsThoughEffectImpl {
diff --git a/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java b/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java
index 39a9b0133d4..c409d1a977f 100644
--- a/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java
+++ b/Mage/src/main/java/mage/watchers/common/LifeLossOtherFromCombatWatcher.java
@@ -33,6 +33,7 @@ import java.util.UUID;
import mage.constants.WatcherScope;
import mage.game.Game;
import mage.game.events.GameEvent;
+import mage.players.Player;
import mage.watchers.Watcher;
/*
@@ -61,9 +62,14 @@ public class LifeLossOtherFromCombatWatcher extends Watcher {
}
}
- public boolean opponentLostLifeOtherFromCombat(UUID playerId) {
- return (!players.contains(playerId) && players.size() > 0)
- || (players.contains(playerId) && players.size() > 1);
+ public boolean opponentLostLifeOtherFromCombat(UUID playerId, Game game) {
+ Player player = game.getPlayer(playerId);
+ if (player != null) {
+ if (players.stream().anyMatch((damagedPlayerId) -> (player.hasOpponent(damagedPlayerId, game)))) {
+ return true;
+ }
+ }
+ return false;
}
@Override