mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
JMP: Add Bruvac the Grandiloquent
This commit is contained in:
@@ -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++) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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),
|
||||
|
||||
@@ -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.)
|
||||
Reference in New Issue
Block a user