mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
[Minor] formatting.
This commit is contained in:
parent
75af2c65fb
commit
773e68d760
2 changed files with 89 additions and 90 deletions
|
|
@ -75,110 +75,109 @@ public class Outwit extends CardImpl<Outwit> {
|
||||||
return new Outwit(this);
|
return new Outwit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class CustomTargetSpell extends TargetObject<CustomTargetSpell> {
|
private class CustomTargetSpell extends TargetObject<CustomTargetSpell> {
|
||||||
|
|
||||||
protected FilterSpell filter;
|
protected FilterSpell filter;
|
||||||
|
|
||||||
public CustomTargetSpell() {
|
public CustomTargetSpell() {
|
||||||
this(1, 1, new FilterSpell());
|
this(1, 1, new FilterSpell());
|
||||||
}
|
|
||||||
|
|
||||||
public CustomTargetSpell(FilterSpell filter) {
|
|
||||||
this(1, 1, filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomTargetSpell(int numTargets, FilterSpell filter) {
|
|
||||||
this(numTargets, numTargets, filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomTargetSpell(int minNumTargets, int maxNumTargets, FilterSpell filter) {
|
|
||||||
this.minNumberOfTargets = minNumTargets;
|
|
||||||
this.maxNumberOfTargets = maxNumTargets;
|
|
||||||
this.zone = Constants.Zone.STACK;
|
|
||||||
this.filter = filter;
|
|
||||||
this.targetName = filter.getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomTargetSpell(final CustomTargetSpell target) {
|
|
||||||
super(target);
|
|
||||||
this.filter = target.filter.copy();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
|
||||||
return canChoose(sourceControllerId, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
|
||||||
return possibleTargets(sourceControllerId, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
|
||||||
if (super.canTarget(id, source, game)) {
|
|
||||||
if (targetsPlayer(id, game)) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public CustomTargetSpell(FilterSpell filter) {
|
||||||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
this(1, 1, filter);
|
||||||
int count = 0;
|
|
||||||
for (StackObject stackObject : game.getStack()) {
|
|
||||||
if (stackObject instanceof Spell && filter.match((Spell) stackObject, game)) {
|
|
||||||
if (targetsPlayer(stackObject.getId(), game)) {
|
|
||||||
count++;
|
|
||||||
if (count >= this.minNumberOfTargets)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public CustomTargetSpell(int numTargets, FilterSpell filter) {
|
||||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
this(numTargets, numTargets, filter);
|
||||||
Set<UUID> possibleTargets = new HashSet<UUID>();
|
|
||||||
for (StackObject stackObject : game.getStack()) {
|
|
||||||
if (stackObject instanceof Spell && filter.match((Spell) stackObject, game)) {
|
|
||||||
if (targetsPlayer(stackObject.getId(), game)) {
|
|
||||||
possibleTargets.add(stackObject.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CustomTargetSpell(int minNumTargets, int maxNumTargets, FilterSpell filter) {
|
||||||
|
this.minNumberOfTargets = minNumTargets;
|
||||||
|
this.maxNumberOfTargets = maxNumTargets;
|
||||||
|
this.zone = Constants.Zone.STACK;
|
||||||
|
this.filter = filter;
|
||||||
|
this.targetName = filter.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomTargetSpell(final CustomTargetSpell target) {
|
||||||
|
super(target);
|
||||||
|
this.filter = target.filter.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
|
return canChoose(sourceControllerId, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
|
return possibleTargets(sourceControllerId, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||||
|
if (super.canTarget(id, source, game)) {
|
||||||
|
if (targetsPlayer(id, game)) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return possibleTargets;
|
}
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Filter getFilter() {
|
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||||
return filter;
|
int count = 0;
|
||||||
}
|
for (StackObject stackObject : game.getStack()) {
|
||||||
|
if (stackObject instanceof Spell && filter.match((Spell) stackObject, game)) {
|
||||||
private boolean targetsPlayer(UUID id, Game game) {
|
if (targetsPlayer(stackObject.getId(), game)) {
|
||||||
StackObject spell = game.getStack().getStackObject(id);
|
count++;
|
||||||
if (spell != null) {
|
if (count >= this.minNumberOfTargets)
|
||||||
Ability ability = spell.getStackAbility();
|
|
||||||
if (ability != null && !ability.getTargets().isEmpty()) {
|
|
||||||
for (Target target : ability.getTargets()) {
|
|
||||||
for (UUID playerId : target.getTargets()) {
|
|
||||||
Player player = game.getPlayer(playerId);
|
|
||||||
if (player != null) {
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
||||||
|
Set<UUID> possibleTargets = new HashSet<UUID>();
|
||||||
|
for (StackObject stackObject : game.getStack()) {
|
||||||
|
if (stackObject instanceof Spell && filter.match((Spell) stackObject, game)) {
|
||||||
|
if (targetsPlayer(stackObject.getId(), game)) {
|
||||||
|
possibleTargets.add(stackObject.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return possibleTargets;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Filter getFilter() {
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean targetsPlayer(UUID id, Game game) {
|
||||||
|
StackObject spell = game.getStack().getStackObject(id);
|
||||||
|
if (spell != null) {
|
||||||
|
Ability ability = spell.getStackAbility();
|
||||||
|
if (ability != null && !ability.getTargets().isEmpty()) {
|
||||||
|
for (Target target : ability.getTargets()) {
|
||||||
|
for (UUID playerId : target.getTargets()) {
|
||||||
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CustomTargetSpell copy() {
|
public CustomTargetSpell copy() {
|
||||||
return new CustomTargetSpell(this);
|
return new CustomTargetSpell(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,9 +117,9 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
StringBuilder sb = new StringBuilder("Whenever ").append(filter.getMessage());
|
StringBuilder sb = new StringBuilder("Whenever ").append(filter.getMessage());
|
||||||
sb.append(" enters the battlefield");
|
sb.append(" enters the battlefield");
|
||||||
if (controlled) {
|
if (controlled) {
|
||||||
sb.append("under your control,");
|
sb.append("under your control, ");
|
||||||
} else {
|
} else {
|
||||||
sb.append(",");
|
sb.append(", ");
|
||||||
}
|
}
|
||||||
sb.append(super.getRule());
|
sb.append(super.getRule());
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue