mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
[G18] added Angelic Guardian
This commit is contained in:
parent
8ad5a3a438
commit
7188373246
1 changed files with 88 additions and 0 deletions
88
Mage.Sets/src/mage/cards/a/AngelicGuardian.java
Normal file
88
Mage.Sets/src/mage/cards/a/AngelicGuardian.java
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||||
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.abilities.keyword.IndestructibleAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JayDi85
|
||||||
|
*/
|
||||||
|
public final class AngelicGuardian extends CardImpl {
|
||||||
|
|
||||||
|
public AngelicGuardian(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}");
|
||||||
|
this.subtype.add(SubType.ANGEL);
|
||||||
|
|
||||||
|
this.power = new MageInt(5);
|
||||||
|
this.toughness = new MageInt(5);
|
||||||
|
|
||||||
|
// Flying
|
||||||
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
// Whenever one or more creatures you control attack, they gain indestructible until end of turn
|
||||||
|
this.addAbility(new AttacksWithCreaturesTriggeredAbility(new AngelicGuardianGainEffect(), 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public AngelicGuardian(final AngelicGuardian card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AngelicGuardian copy() {
|
||||||
|
return new AngelicGuardian(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AngelicGuardianGainEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public AngelicGuardianGainEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "they gain indestructible until end of turn";
|
||||||
|
}
|
||||||
|
|
||||||
|
public AngelicGuardianGainEffect(final AngelicGuardianGainEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AngelicGuardianGainEffect copy() {
|
||||||
|
return new AngelicGuardianGainEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player you = game.getPlayer(source.getControllerId());
|
||||||
|
if (you != null) {
|
||||||
|
game.getCombat().getAttackers().stream()
|
||||||
|
.map(game::getPermanent)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(permanent -> permanent.isControlledBy(you.getId()))
|
||||||
|
.filter(MageObject::isCreature)
|
||||||
|
.forEach(permanent -> {
|
||||||
|
ContinuousEffect effect = new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn);
|
||||||
|
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||||
|
game.addEffect(effect, source);
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue