mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 04:39:18 -08:00
[minor] formattings
This commit is contained in:
parent
61c7e87cea
commit
215ccb8eb5
2 changed files with 49 additions and 53 deletions
|
|
@ -63,7 +63,7 @@ public class Outwit extends CardImpl<Outwit> {
|
||||||
|
|
||||||
// Counter target spell that targets a player.
|
// Counter target spell that targets a player.
|
||||||
this.getSpellAbility().addEffect(new CounterTargetEffect());
|
this.getSpellAbility().addEffect(new CounterTargetEffect());
|
||||||
this.getSpellAbility().addTarget(new CustomTargetSpell(filter));
|
this.getSpellAbility().addTarget(new CustomTargetSpell(filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Outwit(final Outwit card) {
|
public Outwit(final Outwit card) {
|
||||||
|
|
@ -80,76 +80,77 @@ public class Outwit extends CardImpl<Outwit> {
|
||||||
protected FilterSpell filter;
|
protected FilterSpell filter;
|
||||||
|
|
||||||
public CustomTargetSpell() {
|
public CustomTargetSpell() {
|
||||||
this(1, 1, new FilterSpell());
|
this(1, 1, new FilterSpell());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomTargetSpell(FilterSpell filter) {
|
public CustomTargetSpell(FilterSpell filter) {
|
||||||
this(1, 1, filter);
|
this(1, 1, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomTargetSpell(int numTargets, FilterSpell filter) {
|
public CustomTargetSpell(int numTargets, FilterSpell filter) {
|
||||||
this(numTargets, numTargets, filter);
|
this(numTargets, numTargets, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomTargetSpell(int minNumTargets, int maxNumTargets, FilterSpell filter) {
|
public CustomTargetSpell(int minNumTargets, int maxNumTargets, FilterSpell filter) {
|
||||||
this.minNumberOfTargets = minNumTargets;
|
this.minNumberOfTargets = minNumTargets;
|
||||||
this.maxNumberOfTargets = maxNumTargets;
|
this.maxNumberOfTargets = maxNumTargets;
|
||||||
this.zone = Constants.Zone.STACK;
|
this.zone = Constants.Zone.STACK;
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
this.targetName = filter.getMessage();
|
this.targetName = filter.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomTargetSpell(final CustomTargetSpell target) {
|
public CustomTargetSpell(final CustomTargetSpell target) {
|
||||||
super(target);
|
super(target);
|
||||||
this.filter = target.filter.copy();
|
this.filter = target.filter.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
return canChoose(sourceControllerId, game);
|
return canChoose(sourceControllerId, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
return possibleTargets(sourceControllerId, game);
|
return possibleTargets(sourceControllerId, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||||
if (super.canTarget(id, source, game)) {
|
if (super.canTarget(id, source, game)) {
|
||||||
if (targetsPlayer(id, game)) {
|
if (targetsPlayer(id, game)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (StackObject stackObject : game.getStack()) {
|
for (StackObject stackObject : game.getStack()) {
|
||||||
if (stackObject instanceof Spell && filter.match((Spell) stackObject, game)) {
|
if (stackObject instanceof Spell && filter.match((Spell) stackObject, game)) {
|
||||||
if (targetsPlayer(stackObject.getId(), game)) {
|
if (targetsPlayer(stackObject.getId(), game)) {
|
||||||
count++;
|
count++;
|
||||||
if (count >= this.minNumberOfTargets)
|
if (count >= this.minNumberOfTargets) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
||||||
Set<UUID> possibleTargets = new HashSet<UUID>();
|
Set<UUID> possibleTargets = new HashSet<UUID>();
|
||||||
for (StackObject stackObject : game.getStack()) {
|
for (StackObject stackObject : game.getStack()) {
|
||||||
if (stackObject instanceof Spell && filter.match((Spell) stackObject, game)) {
|
if (stackObject instanceof Spell && filter.match((Spell) stackObject, game)) {
|
||||||
if (targetsPlayer(stackObject.getId(), game)) {
|
if (targetsPlayer(stackObject.getId(), game)) {
|
||||||
possibleTargets.add(stackObject.getId());
|
possibleTargets.add(stackObject.getId());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return possibleTargets;
|
}
|
||||||
|
return possibleTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -158,26 +159,26 @@ public class Outwit extends CardImpl<Outwit> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean targetsPlayer(UUID id, Game game) {
|
private boolean targetsPlayer(UUID id, Game game) {
|
||||||
StackObject spell = game.getStack().getStackObject(id);
|
StackObject spell = game.getStack().getStackObject(id);
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
Ability ability = spell.getStackAbility();
|
Ability ability = spell.getStackAbility();
|
||||||
if (ability != null && !ability.getTargets().isEmpty()) {
|
if (ability != null && !ability.getTargets().isEmpty()) {
|
||||||
for (Target target : ability.getTargets()) {
|
for (Target target : ability.getTargets()) {
|
||||||
for (UUID playerId : target.getTargets()) {
|
for (UUID playerId : target.getTargets()) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CustomTargetSpell copy() {
|
public CustomTargetSpell copy() {
|
||||||
return new CustomTargetSpell(this);
|
return new CustomTargetSpell(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,22 +28,17 @@
|
||||||
package mage.sets.dragonsmaze;
|
package mage.sets.dragonsmaze;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.Constants.AbilityType;
|
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
import mage.Constants.TargetController;
|
import mage.Constants.TargetController;
|
||||||
import mage.Constants.Zone;
|
import mage.Constants.Zone;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.costs.Cost;
|
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
|
||||||
import mage.abilities.effects.common.DamagePlayersEffect;
|
import mage.abilities.effects.common.DamagePlayersEffect;
|
||||||
import mage.abilities.mana.GreenManaAbility;
|
import mage.abilities.mana.GreenManaAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue