mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
Fixed Issue 74 (Decimator Web)
This commit is contained in:
parent
59cf5a2646
commit
553f3f3777
2 changed files with 17 additions and 8 deletions
|
@ -36,6 +36,7 @@ import mage.Constants.Rarity;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
|
@ -43,20 +44,22 @@ import mage.cards.CardImpl;
|
|||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
* @author Loki, nantuko
|
||||
*/
|
||||
public class DecimatorWeb extends CardImpl<DecimatorWeb> {
|
||||
|
||||
public DecimatorWeb (UUID ownerId) {
|
||||
super(ownerId, 105, "Decimator Web", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||
this.expansionSetCode = "MBS";
|
||||
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new LoseLifeTargetEffect(2), new TapSourceCost());
|
||||
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new LoseLifeTargetEffect(2), new ManaCostsImpl("{4}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addEffect(new AddCountersTargetEffect(CounterType.POISON.createInstance()));
|
||||
ability.addEffect(new PutLibraryIntoGraveTargetEffect(6));
|
||||
ability.addTarget(new TargetPlayer());
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.counters.Counter;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -63,14 +64,19 @@ public class AddCountersTargetEffect extends OneShotEffect<AddCountersTargetEffe
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
for (UUID permanentId : source.getTargets().get(0).getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
for (UUID uuid : source.getTargets().get(0).getTargets()) {
|
||||
Permanent permanent = game.getPermanent(uuid);
|
||||
if (permanent != null) {
|
||||
if (counter != null) {
|
||||
permanent.addCounters(counter);
|
||||
permanent.addCounters(counter);
|
||||
} else {
|
||||
permanent.addCounters(name, amount);
|
||||
}
|
||||
} else {
|
||||
permanent.addCounters(name, amount);
|
||||
}
|
||||
Player player = game.getPlayer(uuid);
|
||||
if (player != null) {
|
||||
player.getCounters().addCounter(counter);
|
||||
}
|
||||
}
|
||||
}
|
||||
return affectedTargets > 0;
|
||||
|
|
Loading…
Reference in a new issue