mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
* Jaheira's Respite - fixed that it allows to choose any cards amount (#10206), added card hint;
* Arachnogenesis, Blessed Reversal - added card hint;
This commit is contained in:
parent
29afbe042c
commit
79b8093047
4 changed files with 67 additions and 86 deletions
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.CreaturesAttackingYouCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.PreventAllDamageByAllPermanentsEffect;
|
||||
|
|
@ -14,16 +11,15 @@ import mage.constants.Duration;
|
|||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.permanent.token.SpiderToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class Arachnogenesis extends CardImpl {
|
||||
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("non-Spider creatures");
|
||||
|
||||
static {
|
||||
|
|
@ -31,15 +27,16 @@ public final class Arachnogenesis extends CardImpl {
|
|||
}
|
||||
|
||||
public Arachnogenesis(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{G}");
|
||||
|
||||
// create X 1/2 green Spider creature tokens with reach, where X is the number of creatures attacking you.
|
||||
Effect effect = new CreateTokenEffect(new SpiderToken(), new ArachnogenesisCount());
|
||||
// Create X 1/2 green Spider creature tokens with reach, where X is the number of creatures attacking you.
|
||||
Effect effect = new CreateTokenEffect(new SpiderToken(), CreaturesAttackingYouCount.instance);
|
||||
effect.setText("create X 1/2 green Spider creature tokens with reach, where X is the number of creatures attacking you");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
|
||||
this.getSpellAbility().addHint(CreaturesAttackingYouCount.getHint());
|
||||
|
||||
// Prevent all combat damage that would be dealt this turn by non-Spider creatures.
|
||||
this.getSpellAbility().addEffect(new PreventAllDamageByAllPermanentsEffect(filter, Duration.EndOfTurn, true));
|
||||
this.getSpellAbility().addEffect(new PreventAllDamageByAllPermanentsEffect(filter, Duration.EndOfTurn, true));
|
||||
}
|
||||
|
||||
private Arachnogenesis(final Arachnogenesis card) {
|
||||
|
|
@ -50,28 +47,4 @@ public final class Arachnogenesis extends CardImpl {
|
|||
public Arachnogenesis copy() {
|
||||
return new Arachnogenesis(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ArachnogenesisCount implements DynamicValue {
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int count = 0;
|
||||
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if (combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) {
|
||||
count += combatGroup.getAttackers().size();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "creatures attacking you";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +1,26 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.MultipliedValue;
|
||||
import mage.abilities.dynamicvalue.common.CreaturesAttackingYouCount;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class BlessedReversal extends CardImpl {
|
||||
|
||||
public BlessedReversal(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
|
||||
|
||||
|
||||
// You gain 3 life for each creature attacking you.
|
||||
this.getSpellAbility().addEffect(new GainLifeEffect(new BlessedReversalCount()));
|
||||
this.getSpellAbility().addEffect(new GainLifeEffect(new MultipliedValue(CreaturesAttackingYouCount.instance, 3)));
|
||||
this.getSpellAbility().addHint(CreaturesAttackingYouCount.getHint());
|
||||
}
|
||||
|
||||
private BlessedReversal(final BlessedReversal card) {
|
||||
|
|
@ -35,32 +32,3 @@ public final class BlessedReversal extends CardImpl {
|
|||
return new BlessedReversal(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BlessedReversalCount implements DynamicValue {
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int count = 0;
|
||||
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if (combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) {
|
||||
count += combatGroup.getAttackers().size();
|
||||
}
|
||||
}
|
||||
return count * 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "creature attacking you";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "3";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.j;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.CreaturesAttackingYouCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.PreventAllDamageByAllPermanentsEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -13,11 +14,9 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -30,6 +29,7 @@ public final class JaheirasRespite extends CardImpl {
|
|||
|
||||
// Search your library for up to X basic land cards, where X is the number of creatures attacking you, put those cards onto the battlefield tapped, then shuffle.
|
||||
this.getSpellAbility().addEffect(new JaheirasRespiteEffect());
|
||||
this.getSpellAbility().addHint(CreaturesAttackingYouCount.getHint());
|
||||
|
||||
// Prevent all combat damage that would be dealt this turn.
|
||||
this.getSpellAbility().addEffect(new PreventAllDamageByAllPermanentsEffect(Duration.EndOfTurn, true).concatBy("<br>"));
|
||||
|
|
@ -68,14 +68,10 @@ class JaheirasRespiteEffect extends OneShotEffect {
|
|||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
int count = game
|
||||
.getCombat()
|
||||
.getGroups()
|
||||
.stream()
|
||||
.filter(combatGroup -> source.isControlledBy(combatGroup.getDefenderId()))
|
||||
.map(CombatGroup::getAttackers)
|
||||
.mapToInt(List::size)
|
||||
.sum();
|
||||
int count = CreaturesAttackingYouCount.instance.calculate(game, source, this);
|
||||
if (count == 0) {
|
||||
return false;
|
||||
}
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, count, StaticFilters.FILTER_CARD_BASIC_LANDS);
|
||||
player.searchLibrary(target, source, game);
|
||||
Cards cards = new CardsImpl();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
|
||||
/**
|
||||
* @author JayDi85
|
||||
*/
|
||||
public enum CreaturesAttackingYouCount implements DynamicValue {
|
||||
|
||||
instance;
|
||||
|
||||
private static final Hint hint = new ValueHint("Creatures attacking you", instance);
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int count = 0;
|
||||
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
|
||||
if (combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) {
|
||||
count += combatGroup.getAttackers().size();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue copy() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "creatures attacking you";
|
||||
}
|
||||
|
||||
public static Hint getHint() {
|
||||
return hint;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue