mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
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 ")) {
|
||||
|
|
|
|||
|
|
@ -496,6 +496,19 @@ public enum SubType {
|
|||
return predicate;
|
||||
}
|
||||
|
||||
|
||||
public String getIndefiniteArticle() {
|
||||
if (isVowel(description.charAt(0))) {
|
||||
return "an";
|
||||
} else {
|
||||
return "a";
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isVowel(char c) {
|
||||
return "AEIOUaeiou".indexOf(c) != -1;
|
||||
}
|
||||
|
||||
public static SubType fromString(String value) {
|
||||
for (SubType st : SubType.values()) {
|
||||
if (st.toString().equals(value)) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
public final class UnicornToken extends TokenImpl {
|
||||
|
||||
public UnicornToken() {
|
||||
super("Unicorn", "2/2 white Unicorn creature token");
|
||||
setExpansionSetCodeForImage("JMP");
|
||||
cardType.add(CardType.CREATURE);
|
||||
subtype.add(SubType.UNICORN);
|
||||
color.setWhite(true);
|
||||
power = new MageInt(2);
|
||||
toughness = new MageInt(2);
|
||||
}
|
||||
|
||||
private UnicornToken(final UnicornToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnicornToken copy() {
|
||||
return new UnicornToken(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue