mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
- A better version of Leech Bonder. The counter that gets added to the second target does not seem to affect it in my build. Perhaps someone can see the problem. The first target that has the counter removed works fine.
This commit is contained in:
parent
ce4b9c4456
commit
d0d4ecc89f
1 changed files with 14 additions and 10 deletions
|
@ -45,6 +45,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
|
@ -94,7 +95,7 @@ public class LeechBonder extends CardImpl {
|
|||
class LeechBonderEffect extends OneShotEffect {
|
||||
|
||||
public LeechBonderEffect() {
|
||||
super(Outcome.Detriment);
|
||||
super(Outcome.AIDontUseIt);
|
||||
this.staticText = "Move a counter from target creature onto a second target creature";
|
||||
}
|
||||
|
||||
|
@ -109,26 +110,29 @@ class LeechBonderEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent fromPermanent = game.getPermanent(source.getFirstTarget());
|
||||
Permanent toPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (fromPermanent == null
|
||||
|| toPermanent == null
|
||||
|| you == null) {
|
||||
|| controller == null) {
|
||||
return false;
|
||||
}
|
||||
Choice choice = new ChoiceImpl();
|
||||
Set<String> possibleChoices = new HashSet<String>();
|
||||
Set<String> possibleChoices = new HashSet<>();
|
||||
for (String counterName : fromPermanent.getCounters().keySet()) {
|
||||
possibleChoices.add(counterName);
|
||||
}
|
||||
choice.setChoices(possibleChoices);
|
||||
you.choose(Outcome.Neutral, choice, game);
|
||||
String chosen = choice.getChoice();
|
||||
if (fromPermanent.getCounters().containsKey(chosen)) {
|
||||
fromPermanent.removeCounters(chosen, 1, game);
|
||||
toPermanent.addCounters(chosen, 1, game);
|
||||
if (controller.choose(Outcome.AIDontUseIt, choice, game)) {
|
||||
String chosen = choice.getChoice();
|
||||
if (fromPermanent.getCounters().containsKey(chosen)) {
|
||||
Counter counter = new Counter(chosen, 1);
|
||||
fromPermanent.removeCounters(counter, game);
|
||||
toPermanent.addCounters(counter, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue