mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
1216a38984
7 changed files with 42 additions and 23 deletions
|
@ -43,7 +43,7 @@ import mage.constants.Zone;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.target.common.TargetCardInGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -71,10 +71,10 @@ public class CropSigil extends CardImpl {
|
||||||
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(true, true), new ManaCostsImpl<>("{2}{G}"),
|
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(true, true), new ManaCostsImpl<>("{2}{G}"),
|
||||||
DeliriumCondition.getInstance(),
|
DeliriumCondition.getInstance(),
|
||||||
"<i>Delirium</i> — {2}{G}, Sacrifice {this}: Return up to one target creature card and up to one target land card from your graveyard to your hand. "
|
"<i>Delirium</i> — {2}{G}, Sacrifice {this}: Return up to one target creature card and up to one target land card from your graveyard to your hand. "
|
||||||
+ "Activate this ability only if there are four or more card types among cards in your graveyard");
|
+ "Activate this ability only if there are four or more card types among cards in your graveyard");
|
||||||
ability.addCost(new SacrificeSourceCost());
|
ability.addCost(new SacrificeSourceCost());
|
||||||
ability.addTarget(new TargetCardInGraveyard(0, 1, filterCreature));
|
ability.addTarget(new TargetCardInYourGraveyard(0, 1, filterCreature));
|
||||||
ability.addTarget(new TargetCardInGraveyard(0, 1, filterLand));
|
ability.addTarget(new TargetCardInYourGraveyard(0, 1, filterLand));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,9 @@ class MirrorwingDragonCopyTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
private boolean checkSpell(Spell spell, Game game) {
|
private boolean checkSpell(Spell spell, Game game) {
|
||||||
if (spell != null
|
if (spell != null
|
||||||
&& (spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))) {
|
&& (spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))) {
|
||||||
|
boolean noTargets = true;
|
||||||
for (TargetAddress addr : TargetAddress.walk(spell)) {
|
for (TargetAddress addr : TargetAddress.walk(spell)) {
|
||||||
|
noTargets = false;
|
||||||
Target targetInstance = addr.getTarget(spell);
|
Target targetInstance = addr.getTarget(spell);
|
||||||
for (UUID target : targetInstance.getTargets()) {
|
for (UUID target : targetInstance.getTargets()) {
|
||||||
Permanent permanent = game.getPermanent(target);
|
Permanent permanent = game.getPermanent(target);
|
||||||
|
@ -117,6 +119,9 @@ class MirrorwingDragonCopyTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (noTargets) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
getEffects().get(0).setValue("triggeringSpell", spell);
|
getEffects().get(0).setValue("triggeringSpell", spell);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -167,6 +172,17 @@ class MirrorwingDragonCopySpellEffect extends CopySpellForEachItCouldTargetEffec
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void modifyCopy(Spell copy, Game game, Ability source) {
|
protected void modifyCopy(Spell copy, Game game, Ability source) {
|
||||||
|
Spell spell = getSpell(game, source);
|
||||||
|
copy.setControllerId(spell.getControllerId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean okUUIDToCopyFor(UUID potentialTarget, Game game, Ability source, Spell spell) {
|
||||||
|
Permanent permanent = game.getPermanent(potentialTarget);
|
||||||
|
if (permanent == null || !permanent.getControllerId().equals(spell.getControllerId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,7 +42,7 @@ import mage.game.permanent.token.DevilToken;
|
||||||
public class DevilsPlayground extends CardImpl {
|
public class DevilsPlayground extends CardImpl {
|
||||||
|
|
||||||
public DevilsPlayground(UUID ownerId) {
|
public DevilsPlayground(UUID ownerId) {
|
||||||
super(ownerId, 151, "Devil's Playground", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{R}{R}");
|
super(ownerId, 151, "Devils' Playground", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{R}{R}");
|
||||||
this.expansionSetCode = "SOI";
|
this.expansionSetCode = "SOI";
|
||||||
|
|
||||||
// Put four 1/1 red Devil creature tokens onto the battlefield. They have "When this creature dies, it deals 1 damage to target creature or player."
|
// Put four 1/1 red Devil creature tokens onto the battlefield. They have "When this creature dies, it deals 1 damage to target creature or player."
|
||||||
|
|
|
@ -82,6 +82,10 @@ public abstract class CopySpellForEachItCouldTargetEffect<T extends MageItem> ex
|
||||||
modifyCopy(copy, game, source);
|
modifyCopy(copy, game, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean okUUIDToCopyFor(UUID potentialTarget, Game game, Ability source, Spell spell) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player actingPlayer = getPlayer(game, source);
|
Player actingPlayer = getPlayer(game, source);
|
||||||
|
@ -122,7 +126,7 @@ public abstract class CopySpellForEachItCouldTargetEffect<T extends MageItem> ex
|
||||||
copy = spell.copySpell(source.getControllerId());
|
copy = spell.copySpell(source.getControllerId());
|
||||||
try {
|
try {
|
||||||
modifyCopy(copy, (T) obj, game, source);
|
modifyCopy(copy, (T) obj, game, source);
|
||||||
if (!filter.match((T) obj, game)) {
|
if (!filter.match((T) obj, source.getSourceId(), actingPlayer.getId(), game)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
|
@ -146,6 +150,7 @@ public abstract class CopySpellForEachItCouldTargetEffect<T extends MageItem> ex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
legal &= okUUIDToCopyFor(objId, game, source, spell);
|
||||||
if (legal) {
|
if (legal) {
|
||||||
for (TargetAddress addr : targetsToBeChanged) {
|
for (TargetAddress addr : targetsToBeChanged) {
|
||||||
Target targetInstance = addr.getTarget(copy);
|
Target targetInstance = addr.getTarget(copy);
|
||||||
|
|
|
@ -24,21 +24,19 @@
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.target;
|
package mage.target;
|
||||||
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.filter.FilterCard;
|
|
||||||
import mage.game.Game;
|
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.cards.Cards;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.FilterCard;
|
||||||
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -87,9 +85,12 @@ public class TargetCard extends TargetObject {
|
||||||
@Override
|
@Override
|
||||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||||
int possibleTargets = 0;
|
int possibleTargets = 0;
|
||||||
for (UUID playerId: game.getState().getPlayersInRange(sourceControllerId, game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(sourceControllerId, game)) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
if (this.minNumberOfTargets == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
switch (zone) {
|
switch (zone) {
|
||||||
case HAND:
|
case HAND:
|
||||||
for (Card card : player.getHand().getCards(filter, sourceId, sourceControllerId, game)) {
|
for (Card card : player.getHand().getCards(filter, sourceId, sourceControllerId, game)) {
|
||||||
|
@ -200,7 +201,7 @@ public class TargetCard extends TargetObject {
|
||||||
|
|
||||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Cards cards, Game game) {
|
public Set<UUID> possibleTargets(UUID sourceControllerId, Cards cards, Game game) {
|
||||||
Set<UUID> possibleTargets = new HashSet<>();
|
Set<UUID> possibleTargets = new HashSet<>();
|
||||||
for (Card card: cards.getCards(filter, game)) {
|
for (Card card : cards.getCards(filter, game)) {
|
||||||
possibleTargets.add(card.getId());
|
possibleTargets.add(card.getId());
|
||||||
}
|
}
|
||||||
return possibleTargets;
|
return possibleTargets;
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class Targets extends ArrayList<Target> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// it is legal when either there is no target or not all targets are illegal
|
// it is legal when either there is no target or not all targets are illegal
|
||||||
return this.size() == 0 || this.size() != illegalCount;
|
return this.isEmpty() || this.size() != illegalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,10 +30,10 @@ package mage.target.common;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
@ -122,10 +122,7 @@ public class TargetCardInYourGraveyard extends TargetCard {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||||
if (game.getPlayer(sourceControllerId).getGraveyard().count(filter, game) >= this.minNumberOfTargets) {
|
return game.getPlayer(sourceControllerId).getGraveyard().count(filter, game) >= this.minNumberOfTargets;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue