* Some code clean up.

This commit is contained in:
LevelX2 2020-08-10 14:48:04 +02:00
parent 2ce1a488f6
commit 300bb550df
10 changed files with 13 additions and 13 deletions

View file

@ -200,7 +200,7 @@ class CelestialDawnSpendAnyManaEffect extends AsThoughEffectImpl implements AsTh
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
return affectedControllerId.equals(source.getControllerId());
return source.isControlledBy(affectedControllerId);
}
@Override
@ -235,7 +235,7 @@ class CelestialDawnSpendColorlessManaEffect extends AsThoughEffectImpl implement
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
return affectedControllerId.equals(source.getControllerId());
return source.isControlledBy(affectedControllerId);
}
@Override

View file

@ -126,7 +126,7 @@ class CunningAbductionSpendAnyManaEffect extends AsThoughEffectImpl implements A
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
// if the card moved from exile to spell the zone change counter is increased by 1 (effect must applies before and on stack, use isCheckPlayableMode?)
return affectedControllerId.equals(source.getControllerId());
return source.isControlledBy(affectedControllerId);
} else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
// object has moved zone so effect can be discarted
this.discard();

View file

@ -173,7 +173,7 @@ class DeadMansChestSpendManaEffect extends AsThoughEffectImpl implements AsThoug
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
// if the card moved from exile to spell the zone change counter is increased by 1 (effect must applies before and on stack, use isCheckPlayableMode?)
return affectedControllerId.equals(source.getControllerId());
return source.isControlledBy(affectedControllerId);
} else {
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
// object has moved zone so effect can be discarted

View file

@ -196,7 +196,7 @@ class GontiLordOfLuxurySpendAnyManaEffect extends AsThoughEffectImpl implements
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
// if the card moved from exile to spell the zone change counter is increased by 1 (effect must applies before and on stack, use isCheckPlayableMode?)
return affectedControllerId.equals(source.getControllerId());
return source.isControlledBy(affectedControllerId);
} else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
// object has moved zone so effect can be discarted
this.discard();

View file

@ -125,7 +125,7 @@ class ManascapeRefractorSpendAnyManaEffect extends AsThoughEffectImpl implements
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
objectId = CardUtil.getMainCardId(game, objectId); // for split cards
return objectId.equals(source.getSourceId()) && affectedControllerId.equals(source.getControllerId());
return objectId.equals(source.getSourceId()) && source.isControlledBy(affectedControllerId);
}
@Override

View file

@ -129,7 +129,7 @@ class MnemonicBetrayalCastFromExileEffect extends AsThoughEffectImpl {
}
return objectId.equals(card.getId())
&& card.getZoneChangeCounter(game) == zoneCounter
&& affectedControllerId.equals(source.getControllerId())
&& source.isControlledBy(affectedControllerId)
&& !card.isLand(); // cast only not play
}
}
@ -166,7 +166,7 @@ class MnemonicBetrayalAnyColorEffect extends AsThoughEffectImpl implements AsTho
objectId = CardUtil.getMainCardId(game, objectId); // for split cards
if (objectId.equals(card.getId())
&& card.getZoneChangeCounter(game) <= zoneCounter + 1
&& affectedControllerId.equals(source.getControllerId())) {
&& source.isControlledBy(affectedControllerId)) {
return true;
} else {
if (objectId.equals(card.getId())) {

View file

@ -152,8 +152,7 @@ class ManaCanBeSpentAsAnyColorEffect extends AsThoughEffectImpl implements AsTho
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
Player controller = game.getPlayer(source.getControllerId());
return controller != null && game.getState().getPlayersInRange(controller.getId(), game).contains(affectedControllerId);
return game.getState().getPlayersInRange(source.getControllerId(), game).contains(affectedControllerId);
}
@Override

View file

@ -184,7 +184,7 @@ class PsychicIntrusionSpendAnyManaEffect extends AsThoughEffectImpl implements A
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
// if the card moved from exile to spell the zone change counter is increased by 1 (effect must applies before and on stack, use isCheckPlayableMode?)
return affectedControllerId.equals(source.getControllerId());
return source.isControlledBy(affectedControllerId);
} else {
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
// object has moved zone so effect can be discarted

View file

@ -109,7 +109,8 @@ class QuickSilverElementalBlueManaEffect extends AsThoughEffectImpl implements A
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
objectId = CardUtil.getMainCardId(game, objectId); // for split cards
return objectId.equals(source.getSourceId()) && affectedControllerId.equals(source.getControllerId());
return objectId.equals(source.getSourceId())
&& source.isControlledBy(affectedControllerId);
}
@Override

View file

@ -54,7 +54,7 @@ class SunglassesOfUrzaManaAsThoughtEffect extends AsThoughEffectImpl implements
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
return affectedControllerId.equals(source.getControllerId());
return source.isControlledBy(affectedControllerId);
}
@Override