forked from External/mage
simplify LKI check using common method
This commit is contained in:
parent
63ae2e5a56
commit
78b5b8bdef
21 changed files with 39 additions and 169 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.o;
|
||||
|
||||
import mage.MageObject;
|
||||
|
|
@ -60,7 +59,7 @@ public final class OverwhelmingSplendor extends CardImpl {
|
|||
|
||||
class OverwhelmingSplendorLoseAbilitiesEffect extends ContinuousEffectImpl {
|
||||
|
||||
public OverwhelmingSplendorLoseAbilitiesEffect() {
|
||||
OverwhelmingSplendorLoseAbilitiesEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.LoseAbility);
|
||||
staticText = "Creatures enchanted player controls lose all abilities and have base power and toughness 1/1";
|
||||
}
|
||||
|
|
@ -76,21 +75,14 @@ class OverwhelmingSplendorLoseAbilitiesEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
// In the case that the enchantment is blinked
|
||||
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||
Permanent enchantment = source.getSourcePermanentOrLKI(game);
|
||||
if (enchantment == null) {
|
||||
// It was not blinked, use the standard method
|
||||
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (enchantment == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = game.getPlayer(enchantment.getAttachedTo());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Permanent permanent : game.getState().getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game)) {
|
||||
switch (layer) {
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
|
|
@ -120,7 +112,7 @@ class OverwhelmingSplendorLoseAbilitiesEffect extends ContinuousEffectImpl {
|
|||
|
||||
class OverwhelmingSplendorCantActivateEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
public OverwhelmingSplendorCantActivateEffect() {
|
||||
OverwhelmingSplendorCantActivateEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "Enchanted player can't activate abilities that aren't mana abilities or loyalty abilities";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue