mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
[GRN] Added Thief of Sanity.
This commit is contained in:
parent
e50a922970
commit
4c17a13bce
7 changed files with 274 additions and 16 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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())) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue