mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
- now these cards work with split-cards.
This commit is contained in:
parent
678f77c2a3
commit
5eecfb2a86
10 changed files with 22 additions and 21 deletions
|
@ -122,16 +122,15 @@ class CunningAbductionSpendAnyManaEffect extends AsThoughEffectImpl implements A
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
||||||
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
|
|
||||||
if (affectedControllerId.equals(source.getControllerId())) {
|
if (affectedControllerId.equals(source.getControllerId())) {
|
||||||
// if the card moved from exile to spell the zone change counter is increased by 1
|
// if the card moved from exile to spell the zone change counter is increased by 1
|
||||||
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
} else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
||||||
// object has moved zone so effect can be discarted
|
// object has moved zone so effect can be discarted
|
||||||
this.discard();
|
this.discard();
|
||||||
|
|
|
@ -177,6 +177,7 @@ class DaxosOfMeletisSpendAnyManaEffect extends AsThoughEffectImpl implements AsT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
return source.isControlledBy(affectedControllerId)
|
return source.isControlledBy(affectedControllerId)
|
||||||
&& Objects.equals(objectId, ((FixedTarget) getTargetPointer()).getTarget())
|
&& Objects.equals(objectId, ((FixedTarget) getTargetPointer()).getTarget())
|
||||||
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
||||||
|
|
|
@ -178,16 +178,15 @@ class DeadMansChestSpendManaEffect extends AsThoughEffectImpl implements AsThoug
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
||||||
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
|
|
||||||
if (affectedControllerId.equals(source.getControllerId())) {
|
if (affectedControllerId.equals(source.getControllerId())) {
|
||||||
// if the card moved from exile to spell the zone change counter is increased by 1
|
// if the card moved from exile to spell the zone change counter is increased by 1
|
||||||
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
||||||
// object has moved zone so effect can be discarted
|
// object has moved zone so effect can be discarted
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.cards.g;
|
package mage.cards.g;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -155,7 +154,8 @@ class GontiLordOfLuxuryCastFromExileEffect extends AsThoughEffectImpl {
|
||||||
&& affectedControllerId.equals(source.getControllerId())) {
|
&& affectedControllerId.equals(source.getControllerId())) {
|
||||||
Card card = game.getCard(objectId);
|
Card card = game.getCard(objectId);
|
||||||
// TODO: Allow to cast Zoetic Cavern face down
|
// TODO: Allow to cast Zoetic Cavern face down
|
||||||
return card != null && !card.isLand();
|
return card != null
|
||||||
|
&& !card.isLand();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -184,16 +184,15 @@ class GontiLordOfLuxurySpendAnyManaEffect extends AsThoughEffectImpl implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
||||||
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
|
|
||||||
if (affectedControllerId.equals(source.getControllerId())) {
|
if (affectedControllerId.equals(source.getControllerId())) {
|
||||||
// if the card moved from exile to spell the zone change counter is increased by 1
|
// if the card moved from exile to spell the zone change counter is increased by 1
|
||||||
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
} else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
||||||
// object has moved zone so effect can be discarted
|
// object has moved zone so effect can be discarted
|
||||||
this.discard();
|
this.discard();
|
||||||
|
@ -230,13 +229,18 @@ class GontiLordOfLuxuryLookEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId) == Zone.EXILED) {
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
|
if (affectedControllerId.equals(source.getControllerId())
|
||||||
|
&& game.getState().getZone(objectId) == Zone.EXILED) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
MageObject sourceObject = source.getSourceObject(game);
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
if (controller != null && sourceObject != null) {
|
if (controller != null
|
||||||
|
&& sourceObject != null) {
|
||||||
Card card = game.getCard(objectId);
|
Card card = game.getCard(objectId);
|
||||||
if (card != null && card.isFaceDown(game)) {
|
if (card != null
|
||||||
Set<UUID> exileZones = (Set<UUID>) game.getState().getValue(GontiLordOfLuxury.VALUE_PREFIX + source.getSourceId().toString());
|
&& card.isFaceDown(game)) {
|
||||||
|
Set<UUID> exileZones = (Set<UUID>) game.getState().getValue(
|
||||||
|
GontiLordOfLuxury.VALUE_PREFIX + source.getSourceId().toString());
|
||||||
if (exileZones != null) {
|
if (exileZones != null) {
|
||||||
for (ExileZone exileZone : game.getExile().getExileZones()) {
|
for (ExileZone exileZone : game.getExile().getExileZones()) {
|
||||||
if (exileZone.contains(objectId)) {
|
if (exileZone.contains(objectId)) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.cards.h;
|
package mage.cards.h;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -174,16 +173,15 @@ class HostageTakerSpendAnyManaEffect extends AsThoughEffectImpl implements AsTho
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
||||||
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
|
|
||||||
if (affectedControllerId.equals(source.getControllerId())) {
|
if (affectedControllerId.equals(source.getControllerId())) {
|
||||||
// if the card moved from exile to spell the zone change counter is increased by 1
|
// if the card moved from exile to spell the zone change counter is increased by 1
|
||||||
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
||||||
// object has moved zone so effect can be discarted
|
// object has moved zone so effect can be discarted
|
||||||
|
|
|
@ -156,6 +156,7 @@ class MnemonicBetrayalAnyColorEffect extends AsThoughEffectImpl implements AsTho
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
if (objectId.equals(card.getId())
|
if (objectId.equals(card.getId())
|
||||||
&& card.getZoneChangeCounter(game) <= zoneCounter + 1
|
&& card.getZoneChangeCounter(game) <= zoneCounter + 1
|
||||||
&& affectedControllerId.equals(source.getControllerId())) {
|
&& affectedControllerId.equals(source.getControllerId())) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.cards.p;
|
package mage.cards.p;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -187,16 +186,15 @@ class PsychicIntrusionSpendAnyManaEffect extends AsThoughEffectImpl implements A
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
||||||
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
|
|
||||||
if (affectedControllerId.equals(source.getControllerId())) {
|
if (affectedControllerId.equals(source.getControllerId())) {
|
||||||
// if the card moved from exile to spell the zone change counter is increased by 1
|
// if the card moved from exile to spell the zone change counter is increased by 1
|
||||||
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
||||||
// object has moved zone so effect can be discarted
|
// object has moved zone so effect can be discarted
|
||||||
|
|
|
@ -164,6 +164,7 @@ class StolenStrategySpendAnyManaEffect extends AsThoughEffectImpl implements AsT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
return source.isControlledBy(affectedControllerId)
|
return source.isControlledBy(affectedControllerId)
|
||||||
&& Objects.equals(objectId, ((FixedTarget) getTargetPointer()).getTarget())
|
&& Objects.equals(objectId, ((FixedTarget) getTargetPointer()).getTarget())
|
||||||
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
||||||
|
|
|
@ -197,16 +197,15 @@ class ThiefOfSanitySpendAnyManaEffect extends AsThoughEffectImpl implements AsTh
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
||||||
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
|
|
||||||
if (affectedControllerId.equals(authorizedPlayerId)) {
|
if (affectedControllerId.equals(authorizedPlayerId)) {
|
||||||
// if the card moved from exile to stack the zone change counter is increased by 1
|
// if the card moved from exile to stack the zone change counter is increased by 1
|
||||||
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
} else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
||||||
// object has moved zone so effect can be discarted
|
// object has moved zone so effect can be discarted
|
||||||
this.discard();
|
this.discard();
|
||||||
|
|
|
@ -170,6 +170,7 @@ class TobiasBeckettSpendAnyManaEffect extends AsThoughEffectImpl implements AsTh
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
objectId = game.getCard(objectId).getMainCard().getId(); // for split cards
|
||||||
return source.isControlledBy(affectedControllerId)
|
return source.isControlledBy(affectedControllerId)
|
||||||
&& Objects.equals(objectId, ((FixedTarget) getTargetPointer()).getTarget())
|
&& Objects.equals(objectId, ((FixedTarget) getTargetPointer()).getTarget())
|
||||||
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
||||||
|
|
Loading…
Reference in a new issue