[GRN] Added Thief of Sanity.

This commit is contained in:
LevelX2 2018-09-22 16:43:15 +02:00
parent e50a922970
commit 4c17a13bce
7 changed files with 274 additions and 16 deletions

View file

@ -12,7 +12,7 @@ import mage.game.Game;
*/
public interface AsThoughEffect extends ContinuousEffect {
boolean applies(UUID sourceId, Ability affectedAbility, Ability source, Game game);
boolean applies(UUID sourceId, Ability affectedAbility, Ability source, Game game, UUID playerId);
boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game);

View file

@ -1,4 +1,3 @@
package mage.abilities.effects;
import java.util.UUID;
@ -29,8 +28,12 @@ public abstract class AsThoughEffectImpl extends ContinuousEffectImpl implements
}
@Override
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game) {
return applies(objectId, source, affectedAbility.getControllerId(), game);
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
if (getAsThoughEffectType().equals(AsThoughEffectType.LOOK_AT_FACE_DOWN)) {
return applies(objectId, source, playerId, game);
} else {
return applies(objectId, source, affectedAbility.getControllerId(), game);
}
}
@Override

View file

@ -1,4 +1,3 @@
package mage.abilities.effects;
import java.io.Serializable;
@ -496,7 +495,7 @@ public class ContinuousEffects implements Serializable {
if (effect.applies(objectId, ability, controllerId, game)) {
return new MageObjectReference(ability.getSourceObject(game), game);
}
} else if (effect.applies(objectId, affectedAbility, ability, game)) {
} else if (effect.applies(objectId, affectedAbility, ability, game, controllerId)) {
return new MageObjectReference(ability.getSourceObject(game), game);
}
}
@ -512,7 +511,7 @@ public class ContinuousEffects implements Serializable {
Set<Ability> abilities = asThoughEffectsMap.get(AsThoughEffectType.SPEND_ONLY_MANA).getAbility(effect.getId());
for (Ability ability : abilities) {
if ((affectedAbility == null && effect.applies(objectId, ability, controllerId, game))
|| effect.applies(objectId, affectedAbility, ability, game)) {
|| effect.applies(objectId, affectedAbility, ability, game, controllerId)) {
if (((AsThoughManaEffect) effect).getAsThoughManaType(manaType, mana, controllerId, ability, game) == null) {
return null;
}
@ -525,7 +524,7 @@ public class ContinuousEffects implements Serializable {
Set<Ability> abilities = asThoughEffectsMap.get(AsThoughEffectType.SPEND_OTHER_MANA).getAbility(effect.getId());
for (Ability ability : abilities) {
if ((affectedAbility == null && effect.applies(objectId, ability, controllerId, game))
|| effect.applies(objectId, affectedAbility, ability, game)) {
|| effect.applies(objectId, affectedAbility, ability, game, controllerId)) {
ManaType usableManaType = ((AsThoughManaEffect) effect).getAsThoughManaType(manaType, mana, controllerId, ability, game);
if (usableManaType != null) {
return usableManaType;

View file

@ -43,7 +43,7 @@ public class ActivateAbilitiesAnyTimeYouCouldCastInstantEffect extends AsThoughE
}
@Override
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game) {
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
return affectedAbility.isControlledBy(source.getControllerId())
&& activatedAbility.isInstance(affectedAbility);
}

View file

@ -104,7 +104,7 @@ class OfferingAsThoughEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID sourceId, Ability affectedAbility, Ability source, Game game) {
public boolean applies(UUID sourceId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
if (sourceId.equals(source.getSourceId())) {
Card card = game.getCard(sourceId);
if (!card.isOwnedBy(source.getControllerId())) {