mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 05:09:16 -08:00
* Fixed that ThoughtAs effects could be used by any player instead of only the controller of the effect. (Fixes e.g. that Misthollow Griffin could be cast by any player from exile).
This commit is contained in:
parent
3dde0bab89
commit
d8236a8d3a
14 changed files with 87 additions and 83 deletions
|
|
@ -28,10 +28,10 @@
|
|||
package mage.sets.avacynrestored;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.effects.common.combat.UnblockableTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@
|
|||
package mage.sets.avacynrestored;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.*;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
|
@ -37,6 +35,12 @@ import mage.abilities.effects.AsThoughEffectImpl;
|
|||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
|
|
@ -74,7 +78,7 @@ class MisthollowGriffinPlayEffect extends AsThoughEffectImpl<MisthollowGriffinPl
|
|||
|
||||
public MisthollowGriffinPlayEffect() {
|
||||
super(AsThoughEffectType.CAST, Duration.EndOfGame, Outcome.Benefit);
|
||||
staticText = "You may cast Misthollow Griffin from exile";
|
||||
staticText = "You may cast {this} from exile";
|
||||
}
|
||||
|
||||
public MisthollowGriffinPlayEffect(final MisthollowGriffinPlayEffect effect) {
|
||||
|
|
@ -93,12 +97,12 @@ class MisthollowGriffinPlayEffect extends AsThoughEffectImpl<MisthollowGriffinPl
|
|||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, Game game) {
|
||||
if (sourceId.equals(source.getSourceId())) {
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null && card.getOwnerId().equals(source.getControllerId()) && game.getState().getZone(source.getSourceId()) == Zone.EXILED) {
|
||||
return true;
|
||||
}
|
||||
if (sourceId.equals(source.getSourceId())) {
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null && card.getOwnerId().equals(source.getControllerId()) && game.getState().getZone(source.getSourceId()) == Zone.EXILED) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -112,9 +112,9 @@ class CantBeBlockedUnlessAllEffect extends RestrictionEffect<CantBeBlockedUnless
|
|||
@Override
|
||||
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
// check if all creatures of defender are able to block this permanent
|
||||
// permanent.canBlock() can't be uses because of recursive call
|
||||
// permanent.canBlock() can't be used because causing recursive call
|
||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(filter, blocker.getControllerId(), game)) {
|
||||
if (permanent.isTapped() && !game.getState().getContinuousEffects().asThough(this.getId(), AsThoughEffectType.BLOCK_TAPPED, game)) {
|
||||
if (permanent.isTapped() && !game.getState().getContinuousEffects().asThough(this.getId(), AsThoughEffectType.BLOCK_TAPPED, blocker.getControllerId(), game)) {
|
||||
return false;
|
||||
}
|
||||
// check blocker restrictions
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class HavengulLichPlayedEffect extends OneShotEffect<HavengulLichPlayedEffect> {
|
|||
|
||||
public HavengulLichPlayedEffect(final HavengulLichPlayedEffect effect) {
|
||||
super(effect);
|
||||
staticText = "When you cast that card this turn, Havengul Lich gains all activated abilities of that card until end of turn";
|
||||
staticText = "When you cast that card this turn, {this} gains all activated abilities of that card until end of turn";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -172,10 +172,7 @@ class HavengulLichDelayedTriggeredAbility extends DelayedTriggeredAbility<Haveng
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getSourceId().equals(cardId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return event.getType() == GameEvent.EventType.SPELL_CAST && event.getSourceId().equals(cardId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -185,14 +182,14 @@ class HavengulLichDelayedTriggeredAbility extends DelayedTriggeredAbility<Haveng
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When you cast that card this turn, Havengul Lich gains all activated abilities of that card until end of turn.";
|
||||
return "When you cast that card this turn, {this} gains all activated abilities of that card until end of turn.";
|
||||
}
|
||||
}
|
||||
|
||||
// copy activated abilities of card
|
||||
class HavengulLichEffect extends ContinuousEffectImpl<HavengulLichEffect> {
|
||||
|
||||
private UUID cardId;
|
||||
private final UUID cardId;
|
||||
|
||||
public HavengulLichEffect(UUID cardId) {
|
||||
super(Duration.EndOfTurn, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
|
|
@ -215,7 +212,7 @@ class HavengulLichEffect extends ContinuousEffectImpl<HavengulLichEffect> {
|
|||
Card card = game.getCard(cardId);
|
||||
if (permanent != null && card != null) {
|
||||
for (ActivatedAbility ability: card.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
|
||||
permanent.addAbility(ability, game);
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ class DaxosOfMeletisCastFromExileEffect extends AsThoughEffectImpl<DaxosOfMeleti
|
|||
|
||||
class DaxosOfMeletisSpendAnyManaEffect extends AsThoughEffectImpl<DaxosOfMeletisSpendAnyManaEffect> {
|
||||
|
||||
private UUID cardId;
|
||||
private final UUID cardId;
|
||||
|
||||
public DaxosOfMeletisSpendAnyManaEffect(UUID cardId) {
|
||||
super(AsThoughEffectType.SPEND_ANY_MANA, Duration.EndOfTurn, Outcome.Benefit);
|
||||
|
|
@ -204,9 +204,6 @@ class DaxosOfMeletisSpendAnyManaEffect extends AsThoughEffectImpl<DaxosOfMeletis
|
|||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, Game game) {
|
||||
if (sourceId.equals(this.cardId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return sourceId.equals(this.cardId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue