JMP: Add Bruvac the Grandiloquent

This commit is contained in:
swordshine
2020-06-24 22:08:15 +08:00
parent cbc3f6a568
commit 1053b3fdea
4 changed files with 102 additions and 1 deletions

View File

@@ -1662,11 +1662,31 @@ public class Player extends GameEntity implements Comparable<Player> {
return notes.get(notedFor);
}
public final CardCollectionView mill(final int n, final ZoneType destination,
public final CardCollectionView mill(int n, final ZoneType destination,
final boolean bottom, SpellAbility sa, CardZoneTable table) {
final CardCollectionView lib = getCardsIn(ZoneType.Library);
final CardCollection milled = new CardCollection();
// Replacement effects
final Map<AbilityKey, Object> repRunParams = AbilityKey.mapFromAffected(this);
repRunParams.put(AbilityKey.Number, n);
repRunParams.put(AbilityKey.Destination, destination);
switch (getGame().getReplacementHandler().run(ReplacementType.Mill, repRunParams)) {
case NotReplaced:
break;
case Updated:
// check if this is still the affected player
if (this.equals(repRunParams.get(AbilityKey.Affected))) {
n = (int) repRunParams.get(AbilityKey.Number);
} else {
return milled;
}
break;
default:
return milled;
}
final int max = Math.min(n, lib.size());
for (int i = 0; i < max; i++) {

View File

@@ -0,0 +1,71 @@
/*
* Forge: Play Magic: the Gathering.
* Copyright (C) 2011 Forge Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.game.replacement;
import forge.game.ability.AbilityKey;
import forge.game.card.Card;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import java.util.Map;
/**
* TODO: Write javadoc for this type.
*
*/
public class ReplaceMill extends ReplacementEffect {
/**
* Instantiates a new replace mill.
*
* @param params the params
* @param host the host
*/
public ReplaceMill(final Map<String, String> params, final Card host, final boolean intrinsic) {
super(params, host, intrinsic);
}
/* (non-Javadoc)
* @see forge.card.replacement.ReplacementEffect#canReplace(java.util.HashMap)
*/
@Override
public boolean canReplace(Map<AbilityKey, Object> runParams) {
if (ZoneType.Graveyard != ((ZoneType) runParams.get(AbilityKey.Destination))) {
return false;
}
if (hasParam("ValidPlayer")) {
if (!matchesValid(runParams.get(AbilityKey.Affected), getParam("ValidPlayer").split(","), getHostCard())) {
return false;
}
}
return true;
}
/* (non-Javadoc)
* @see forge.card.replacement.ReplacementEffect#setReplacingObjects(java.util.HashMap, forge.card.spellability.SpellAbility)
*/
@Override
public void setReplacingObjects(Map<AbilityKey, Object> runParams, SpellAbility sa) {
sa.setReplacingObject(AbilityKey.Player, runParams.get(AbilityKey.Affected));
sa.setReplacingObject(AbilityKey.Number, runParams.get(AbilityKey.Number));
}
}

View File

@@ -21,6 +21,7 @@ public enum ReplacementType {
DrawCards(ReplaceDrawCards.class),
GainLife(ReplaceGainLife.class),
GameLoss(ReplaceGameLoss.class),
Mill(ReplaceMill.class),
Moved(ReplaceMoved.class),
ProduceMana(ReplaceProduceMana.class),
SetInMotion(ReplaceSetInMotion.class),

View File

@@ -0,0 +1,9 @@
Name:Bruvac the Grandiloquent
ManaCost:2 U
Types:Legendary Creature Human Advisor
PT:1/4
R:Event$ Mill | ActiveZones$ Battlefield | ValidPlayer$ Player.Opponent | ReplaceWith$ MillTwice | Description$ If an opponent would mill one or more cards, they mill twice that many cards instead. (To mill a card, a player puts the top card of their library into their graveyard.)
SVar:MillTwice:DB$ ReplaceEffect | VarName$ Number | VarValue$ X | References$ X
SVar:X:ReplaceCount$Number/Twice
DeckHints:Ability$Mill
Oracle:If an opponent would mill one or more cards, they mill twice that many cards instead. (To mill a card, a player puts the top card of their library into their graveyard.)