mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Implemented Gorm the Great
This commit is contained in:
parent
3fdfccce30
commit
8556285f0c
5 changed files with 80 additions and 1 deletions
52
Mage.Sets/src/mage/cards/g/GormTheGreat.java
Normal file
52
Mage.Sets/src/mage/cards/g/GormTheGreat.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
package mage.cards.g;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.effects.common.combat.MustBeBlockedByAtLeastOneSourceEffect;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.SuperType;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.abilities.keyword.PartnerWithAbility;
|
||||||
|
import mage.abilities.keyword.VigilanceAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author L_J
|
||||||
|
*/
|
||||||
|
public final class GormTheGreat extends CardImpl {
|
||||||
|
|
||||||
|
public GormTheGreat(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
|
||||||
|
|
||||||
|
this.addSuperType(SuperType.LEGENDARY);
|
||||||
|
this.subtype.add(SubType.GIANT);
|
||||||
|
this.subtype.add(SubType.WARRIOR);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(7);
|
||||||
|
|
||||||
|
// Partner with Virtus the Veiled (When this creature enters the battlefield, target player may put Virtus into their hand from their library, then shuffle.)
|
||||||
|
this.addAbility(new PartnerWithAbility("Virtus the Veiled", true));
|
||||||
|
|
||||||
|
// Vigilance
|
||||||
|
this.addAbility(VigilanceAbility.getInstance());
|
||||||
|
|
||||||
|
// Gorm the Great must be blocked if able, and Gorm must be blocked by two or more creatures if able.
|
||||||
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MustBeBlockedByAtLeastOneSourceEffect(Duration.WhileOnBattlefield, 2)
|
||||||
|
.setText("{this} must be blocked if able, and {this} must be blocked by two or more creatures if able")));
|
||||||
|
}
|
||||||
|
|
||||||
|
public GormTheGreat(final GormTheGreat card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GormTheGreat copy() {
|
||||||
|
return new GormTheGreat(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -115,6 +115,7 @@ public final class Battlebond extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Giant Growth", 200, Rarity.COMMON, mage.cards.g.GiantGrowth.class));
|
cards.add(new SetCardInfo("Giant Growth", 200, Rarity.COMMON, mage.cards.g.GiantGrowth.class));
|
||||||
cards.add(new SetCardInfo("Goblin Razerunners", 179, Rarity.RARE, mage.cards.g.GoblinRazerunners.class));
|
cards.add(new SetCardInfo("Goblin Razerunners", 179, Rarity.RARE, mage.cards.g.GoblinRazerunners.class));
|
||||||
cards.add(new SetCardInfo("Gold-Forged Sentinel", 236, Rarity.UNCOMMON, mage.cards.g.GoldForgedSentinel.class));
|
cards.add(new SetCardInfo("Gold-Forged Sentinel", 236, Rarity.UNCOMMON, mage.cards.g.GoldForgedSentinel.class));
|
||||||
|
cards.add(new SetCardInfo("Gorm the Great", 8, Rarity.RARE, mage.cards.g.GormTheGreat.class));
|
||||||
cards.add(new SetCardInfo("Greater Good", 201, Rarity.RARE, mage.cards.g.GreaterGood.class));
|
cards.add(new SetCardInfo("Greater Good", 201, Rarity.RARE, mage.cards.g.GreaterGood.class));
|
||||||
cards.add(new SetCardInfo("Grotesque Mutation", 145, Rarity.COMMON, mage.cards.g.GrotesqueMutation.class));
|
cards.add(new SetCardInfo("Grotesque Mutation", 145, Rarity.COMMON, mage.cards.g.GrotesqueMutation.class));
|
||||||
cards.add(new SetCardInfo("Grothama, All-Devouring", 71, Rarity.MYTHIC, mage.cards.g.GrothamaAllDevouring.class));
|
cards.add(new SetCardInfo("Grothama, All-Devouring", 71, Rarity.MYTHIC, mage.cards.g.GrothamaAllDevouring.class));
|
||||||
|
|
|
@ -76,6 +76,10 @@ public abstract class RequirementEffect extends ContinuousEffectImpl {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMinNumberOfBlockers() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player related check The player returned or controlled planeswalker must
|
* Player related check The player returned or controlled planeswalker must
|
||||||
* be attacked with at least one attacker
|
* be attacked with at least one attacker
|
||||||
|
|
|
@ -36,17 +36,25 @@ import mage.game.permanent.Permanent;
|
||||||
*/
|
*/
|
||||||
public class MustBeBlockedByAtLeastOneSourceEffect extends RequirementEffect {
|
public class MustBeBlockedByAtLeastOneSourceEffect extends RequirementEffect {
|
||||||
|
|
||||||
|
private int minNumberOfBlockers;
|
||||||
|
|
||||||
public MustBeBlockedByAtLeastOneSourceEffect() {
|
public MustBeBlockedByAtLeastOneSourceEffect() {
|
||||||
this(Duration.EndOfTurn);
|
this(Duration.EndOfTurn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MustBeBlockedByAtLeastOneSourceEffect(Duration duration) {
|
public MustBeBlockedByAtLeastOneSourceEffect(Duration duration) {
|
||||||
|
this(duration, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MustBeBlockedByAtLeastOneSourceEffect(Duration duration, int minNumberOfBlockers) {
|
||||||
super(duration);
|
super(duration);
|
||||||
|
this.minNumberOfBlockers = minNumberOfBlockers;
|
||||||
staticText = "{this} must be blocked " + (duration == Duration.EndOfTurn ? "this turn " : "") + "if able";
|
staticText = "{this} must be blocked " + (duration == Duration.EndOfTurn ? "this turn " : "") + "if able";
|
||||||
}
|
}
|
||||||
|
|
||||||
public MustBeBlockedByAtLeastOneSourceEffect(final MustBeBlockedByAtLeastOneSourceEffect effect) {
|
public MustBeBlockedByAtLeastOneSourceEffect(final MustBeBlockedByAtLeastOneSourceEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
this.minNumberOfBlockers = effect.minNumberOfBlockers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,6 +77,11 @@ public class MustBeBlockedByAtLeastOneSourceEffect extends RequirementEffect {
|
||||||
return source.getSourceId();
|
return source.getSourceId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinNumberOfBlockers() {
|
||||||
|
return minNumberOfBlockers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MustBeBlockedByAtLeastOneSourceEffect copy() {
|
public MustBeBlockedByAtLeastOneSourceEffect copy() {
|
||||||
return new MustBeBlockedByAtLeastOneSourceEffect(this);
|
return new MustBeBlockedByAtLeastOneSourceEffect(this);
|
||||||
|
|
|
@ -695,6 +695,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
//20101001 - 509.1c
|
//20101001 - 509.1c
|
||||||
// map with attackers (UUID) that must be blocked by at least one blocker and a set of all creatures that can block it and don't block yet
|
// map with attackers (UUID) that must be blocked by at least one blocker and a set of all creatures that can block it and don't block yet
|
||||||
Map<UUID, Set<UUID>> mustBeBlockedByAtLeastOne = new HashMap<>();
|
Map<UUID, Set<UUID>> mustBeBlockedByAtLeastOne = new HashMap<>();
|
||||||
|
int minNumberOfBlockers = 0;
|
||||||
|
|
||||||
// check mustBlock requirements of creatures from opponents of attacking player
|
// check mustBlock requirements of creatures from opponents of attacking player
|
||||||
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES_CONTROLLED, player.getId(), game)) {
|
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES_CONTROLLED, player.getId(), game)) {
|
||||||
|
@ -710,6 +711,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
for (Ability ability : entry.getValue()) {
|
for (Ability ability : entry.getValue()) {
|
||||||
UUID toBeBlockedCreature = effect.mustBlockAttackerIfElseUnblocked(ability, game);
|
UUID toBeBlockedCreature = effect.mustBlockAttackerIfElseUnblocked(ability, game);
|
||||||
if (toBeBlockedCreature != null) {
|
if (toBeBlockedCreature != null) {
|
||||||
|
minNumberOfBlockers = effect.getMinNumberOfBlockers();
|
||||||
Set<UUID> potentialBlockers;
|
Set<UUID> potentialBlockers;
|
||||||
if (mustBeBlockedByAtLeastOne.containsKey(toBeBlockedCreature)) {
|
if (mustBeBlockedByAtLeastOne.containsKey(toBeBlockedCreature)) {
|
||||||
potentialBlockers = mustBeBlockedByAtLeastOne.get(toBeBlockedCreature);
|
potentialBlockers = mustBeBlockedByAtLeastOne.get(toBeBlockedCreature);
|
||||||
|
@ -804,6 +806,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
for (Ability ability : entry.getValue()) {
|
for (Ability ability : entry.getValue()) {
|
||||||
UUID toBeBlockedCreature = effect.mustBlockAttackerIfElseUnblocked(ability, game);
|
UUID toBeBlockedCreature = effect.mustBlockAttackerIfElseUnblocked(ability, game);
|
||||||
if (toBeBlockedCreature != null) {
|
if (toBeBlockedCreature != null) {
|
||||||
|
minNumberOfBlockers = effect.getMinNumberOfBlockers();
|
||||||
Set<UUID> potentialBlockers;
|
Set<UUID> potentialBlockers;
|
||||||
if (mustBeBlockedByAtLeastOne.containsKey(toBeBlockedCreature)) {
|
if (mustBeBlockedByAtLeastOne.containsKey(toBeBlockedCreature)) {
|
||||||
potentialBlockers = mustBeBlockedByAtLeastOne.get(toBeBlockedCreature);
|
potentialBlockers = mustBeBlockedByAtLeastOne.get(toBeBlockedCreature);
|
||||||
|
@ -898,6 +901,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
requirementFulfilled &= (combatGroup.getBlockers().size() >= Math.min(minNumberOfBlockers, mustBeBlockedByAtLeastOne.get(toBeBlockedCreatureId).size()));
|
||||||
if (!requirementFulfilled) {
|
if (!requirementFulfilled) {
|
||||||
// creature is not blocked but has possible blockers
|
// creature is not blocked but has possible blockers
|
||||||
if (controller.isHuman()) {
|
if (controller.isHuman()) {
|
||||||
|
@ -906,6 +910,9 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
// check if all possible blocker block other creatures they are forced to block
|
// check if all possible blocker block other creatures they are forced to block
|
||||||
// read through all possible blockers
|
// read through all possible blockers
|
||||||
for (UUID possibleBlockerId : mustBeBlockedByAtLeastOne.get(toBeBlockedCreatureId)) {
|
for (UUID possibleBlockerId : mustBeBlockedByAtLeastOne.get(toBeBlockedCreatureId)) {
|
||||||
|
if (combatGroup.getBlockers().contains(possibleBlockerId)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String blockRequiredMessage = isCreatureDoingARequiredBlock(
|
String blockRequiredMessage = isCreatureDoingARequiredBlock(
|
||||||
possibleBlockerId, toBeBlockedCreatureId, mustBeBlockedByAtLeastOne, game);
|
possibleBlockerId, toBeBlockedCreatureId, mustBeBlockedByAtLeastOne, game);
|
||||||
if (blockRequiredMessage != null) { // message means not required
|
if (blockRequiredMessage != null) { // message means not required
|
||||||
|
@ -931,7 +938,9 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
}
|
}
|
||||||
defender.declareBlocker(defender.getId(), possibleBlockerId, toBeBlockedCreatureId, game);
|
defender.declareBlocker(defender.getId(), possibleBlockerId, toBeBlockedCreatureId, game);
|
||||||
}
|
}
|
||||||
break;
|
if (combatGroup.getBlockers().size() >= minNumberOfBlockers) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue