mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
[CMR] Implemented Gor Muldrak, Amphinologist
This commit is contained in:
parent
20cc5571e4
commit
fbae74dcd5
2 changed files with 107 additions and 0 deletions
106
Mage.Sets/src/mage/cards/g/GorMuldrakAmphinologist.java
Normal file
106
Mage.Sets/src/mage/cards/g/GorMuldrakAmphinologist.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControllerEffect;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.SalamnderWarriorToken;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class GorMuldrakAmphinologist extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent(SubType.SALAMANDER, "Salamanders");
|
||||
|
||||
public GorMuldrakAmphinologist(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{U}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.SCOUT);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// You and permanents you control have protection from Salamanders.
|
||||
Ability ability = new SimpleStaticAbility(
|
||||
new GainAbilityControllerEffect(new ProtectionAbility(filter)).setText("you")
|
||||
);
|
||||
ability.addEffect(new GainAbilityControlledEffect(
|
||||
new ProtectionAbility(filter), Duration.WhileOnBattlefield
|
||||
).concatBy("and"));
|
||||
this.addAbility(ability);
|
||||
|
||||
// At the beginning of your end step, each player who controls the fewest creatures creates a 4/3 blue Salamander Warrior creature token.
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
||||
new GorMuldrakAmphinologistEffect(), TargetController.YOU, false
|
||||
));
|
||||
}
|
||||
|
||||
private GorMuldrakAmphinologist(final GorMuldrakAmphinologist card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GorMuldrakAmphinologist copy() {
|
||||
return new GorMuldrakAmphinologist(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GorMuldrakAmphinologistEffect extends OneShotEffect {
|
||||
|
||||
GorMuldrakAmphinologistEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "each player who controls the fewest creatures " +
|
||||
"creates a 4/3 blue Salamander Warrior creature token";
|
||||
}
|
||||
|
||||
private GorMuldrakAmphinologistEffect(final GorMuldrakAmphinologistEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GorMuldrakAmphinologistEffect copy() {
|
||||
return new GorMuldrakAmphinologistEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Map<UUID, Integer> creatureMap = new HashMap<>();
|
||||
game.getBattlefield()
|
||||
.getActivePermanents(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE,
|
||||
source.getControllerId(), game
|
||||
).stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(Controllable::getControllerId)
|
||||
.forEach(uuid -> creatureMap.compute(uuid, (u, i) -> i == null ? 1 : Integer.sum(i, 1)));
|
||||
int minValue = creatureMap.values().stream().mapToInt(x -> x).min().orElse(0);
|
||||
minValue = Math.max(minValue, 0);
|
||||
Token token = new SalamnderWarriorToken();
|
||||
for (Map.Entry<UUID, Integer> entry : creatureMap.entrySet()) {
|
||||
if (entry.getValue() > minValue) {
|
||||
continue;
|
||||
}
|
||||
token.putOntoBattlefield(1, game, source.getSourceId(), entry.getKey());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -53,6 +53,7 @@ public final class CommanderLegends extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Forceful Denial", 69, Rarity.COMMON, mage.cards.f.ForcefulDenial.class));
|
||||
cards.add(new SetCardInfo("Fyndhorn Elves", 228, Rarity.COMMON, mage.cards.f.FyndhornElves.class));
|
||||
cards.add(new SetCardInfo("Ghost of Ramirez DePietro", 71, Rarity.UNCOMMON, mage.cards.g.GhostOfRamirezDePietro.class));
|
||||
cards.add(new SetCardInfo("Gor Muldrak, Amphinologist", 277, Rarity.RARE, mage.cards.g.GorMuldrakAmphinologist.class));
|
||||
cards.add(new SetCardInfo("Halana, Kessig Ranger", 231, Rarity.UNCOMMON, mage.cards.h.HalanaKessigRanger.class));
|
||||
cards.add(new SetCardInfo("Horizon Scholar", 73, Rarity.UNCOMMON, mage.cards.h.HorizonScholar.class));
|
||||
cards.add(new SetCardInfo("Hunter's Insight", 232, Rarity.UNCOMMON, mage.cards.h.HuntersInsight.class));
|
||||
|
|
Loading…
Reference in a new issue