mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
[LTR] Implement Frodo, Sauron's Bane
This commit is contained in:
parent
8585a7c570
commit
9385a31c4a
5 changed files with 115 additions and 11 deletions
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
|
|
@ -14,16 +14,18 @@ import mage.game.Game;
|
|||
*/
|
||||
public class AddContinuousEffectToGame extends OneShotEffect {
|
||||
|
||||
private final ContinuousEffect effect;
|
||||
private final Effects effects = new Effects();
|
||||
|
||||
public AddContinuousEffectToGame(ContinuousEffect effect) {
|
||||
public AddContinuousEffectToGame(ContinuousEffect... effects) {
|
||||
super(Outcome.Benefit);
|
||||
this.effect = effect;
|
||||
for (ContinuousEffect effect : effects) {
|
||||
this.effects.add(effect);
|
||||
}
|
||||
}
|
||||
|
||||
public AddContinuousEffectToGame(final AddContinuousEffectToGame effect) {
|
||||
super(effect);
|
||||
this.effect = effect.effect;
|
||||
this.effects.addAll(effect.effects);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -33,12 +35,14 @@ public class AddContinuousEffectToGame extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
game.addEffect(effect, source);
|
||||
for (Effect effect : this.effects) {
|
||||
game.addEffect((ContinuousEffect) effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
return effect.getText(mode);
|
||||
return effects.getText(mode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,16 @@ import java.util.Locale;
|
|||
*/
|
||||
public class AddCardSubTypeSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final boolean inAddition;
|
||||
private final List<SubType> addedSubTypes = new ArrayList<>();
|
||||
|
||||
public AddCardSubTypeSourceEffect(Duration duration, SubType... addedSubType) {
|
||||
this(duration, false, addedSubType);
|
||||
}
|
||||
|
||||
public AddCardSubTypeSourceEffect(Duration duration, boolean inAddition, SubType... addedSubType) {
|
||||
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
this.inAddition = inAddition;
|
||||
for (SubType cardType : addedSubType) {
|
||||
this.addedSubTypes.add(cardType);
|
||||
}
|
||||
|
|
@ -28,6 +34,7 @@ public class AddCardSubTypeSourceEffect extends ContinuousEffectImpl {
|
|||
|
||||
private AddCardSubTypeSourceEffect(final AddCardSubTypeSourceEffect effect) {
|
||||
super(effect);
|
||||
this.inAddition = effect.inAddition;
|
||||
this.addedSubTypes.addAll(effect.addedSubTypes);
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +48,9 @@ public class AddCardSubTypeSourceEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) {
|
||||
if (!inAddition) {
|
||||
permanent.removeAllCreatureTypes(game);
|
||||
}
|
||||
for (SubType cardType : addedSubTypes) {
|
||||
permanent.addSubType(game, cardType);
|
||||
}
|
||||
|
|
@ -75,7 +85,10 @@ public class AddCardSubTypeSourceEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
sb.append(subType.toString().toLowerCase(Locale.ENGLISH)).append(" ");
|
||||
}
|
||||
sb.append(" in addition to its other types ").append(this.getDuration().toString());
|
||||
if (inAddition) {
|
||||
sb.append(" in addition to its other types ");
|
||||
}
|
||||
sb.append(this.getDuration().toString());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue