forked from External/mage
Implemented Allosaurus Shepherd and Blessed Sanctuary (#6711)
* added allosaurus shepherd and blessed sanctuary * fixed nonascii apostrophes * added continuous effect dependency
This commit is contained in:
parent
785be83484
commit
40036271da
10 changed files with 264 additions and 24 deletions
|
|
@ -27,7 +27,11 @@ public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl {
|
|||
super(duration, Integer.MAX_VALUE, false);
|
||||
this.filter = filter;
|
||||
this.andToYou = andToYou;
|
||||
staticText = "Prevent all non combat damage that would be dealt to " + (andToYou ? "you and " : "") + filter.getMessage() + ' ' + duration.toString();
|
||||
staticText = "Prevent all non combat damage that would be dealt to " + (andToYou ? "you and " : "") + filter.getMessage();
|
||||
|
||||
if (duration != Duration.WhileOnBattlefield) {
|
||||
staticText += ' ' + duration.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private PreventAllNonCombatDamageToAllEffect(final PreventAllNonCombatDamageToAllEffect effect) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
public class CreaturesBecomeOtherTypeEffect extends ContinuousEffectImpl {
|
||||
|
||||
protected final FilterPermanent filter;
|
||||
private final SubType subType;
|
||||
|
||||
public CreaturesBecomeOtherTypeEffect(FilterPermanent filter, SubType subType, Duration duration) {
|
||||
super(duration, Outcome.Neutral);
|
||||
this.filter = filter;
|
||||
this.subType = subType;
|
||||
|
||||
this.dependendToTypes.add(DependencyType.BecomeCreature); // Opalescence and Starfield of Nyx
|
||||
}
|
||||
|
||||
protected CreaturesBecomeOtherTypeEffect(final CreaturesBecomeOtherTypeEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
this.subType = effect.subType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreaturesBecomeOtherTypeEffect copy() {
|
||||
return new CreaturesBecomeOtherTypeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
if (layer == Layer.TypeChangingEffects_4) {
|
||||
for (Permanent object: game.getBattlefield().getActivePermanents(this.filter, source.getControllerId(), game)) {
|
||||
if (!object.hasSubtype(this.subType, game)) {
|
||||
object.getSubtype(game).add(this.subType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.TypeChangingEffects_4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
|
||||
return this.filter.getMessage() + " is " + this.subType.getIndefiniteArticle()
|
||||
+ " " + this.subType.toString() + " in addition to its other types";
|
||||
}
|
||||
}
|
||||
|
|
@ -98,6 +98,10 @@ public class SetPowerToughnessAllEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(filter.getMessage());
|
||||
if (filter.getMessage().toLowerCase(Locale.ENGLISH).startsWith("Each ")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue