mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Centralized all milling I could find.
This commit is contained in:
@@ -8841,20 +8841,7 @@ public class CardFactory implements NewConstants {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
String player = getTargetPlayer();
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int max = 2;
|
||||
if(libList.size() < 2) max = libList.size();
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
AllZone.GameAction.mill(getTargetPlayer(), 2);
|
||||
}
|
||||
};
|
||||
ab1.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
|
||||
@@ -9457,20 +9444,8 @@ public class CardFactory implements NewConstants {
|
||||
@Override
|
||||
public void resolve() {
|
||||
String player = getTargetPlayer();
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int numCards = grave.size();
|
||||
|
||||
int max = libList.size();
|
||||
if(numCards > max) numCards = max;
|
||||
|
||||
for(int i = 0; i < numCards; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
AllZone.GameAction.mill(player,
|
||||
AllZone.getZone(Constant.Zone.Graveyard, player).size());
|
||||
}
|
||||
};
|
||||
ab1.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
|
||||
|
||||
@@ -17803,21 +17803,7 @@ public class CardFactory_Creatures {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
String player = getTargetPlayer();
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int max = 3;
|
||||
if(libList.size() < 3) max = libList.size();
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
|
||||
AllZone.GameAction.mill(getTargetPlayer(),3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -17843,20 +17829,7 @@ public class CardFactory_Creatures {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
String player = getTargetPlayer();
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int max = 2;
|
||||
if(libList.size() < 2) max = libList.size();
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
AllZone.GameAction.mill(getTargetPlayer(),2);
|
||||
|
||||
}
|
||||
|
||||
@@ -17883,20 +17856,7 @@ public class CardFactory_Creatures {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
String player = getTargetPlayer();
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int max = 1;
|
||||
if(libList.size() < 1) max = libList.size();
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
AllZone.GameAction.mill(getTargetPlayer(),1);
|
||||
|
||||
}
|
||||
|
||||
@@ -20569,7 +20529,7 @@ public class CardFactory_Creatures {
|
||||
AllZone.Computer_Life.subtractLife(1,card);
|
||||
}//resolve()
|
||||
};//SpellAbility
|
||||
ability.setDescription("G: Ifh-B<>ff Efreet deals 1 damage to each creature with flying and each player. Any player may activate this ability");
|
||||
ability.setDescription("G: Ifh-B<>ff Efreet deals 1 damage to each creature with flying and each player. Any player may activate this ability");
|
||||
ability.setStackDescription(card + " deals 1 damage to each flying creature and each player.");
|
||||
ability.setAnyPlayer(true);
|
||||
card.addSpellAbility(ability);
|
||||
|
||||
@@ -1451,20 +1451,7 @@ public class CardFactory_Instants {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
String player = getTargetPlayer();
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int max = 3;
|
||||
if(libList.size() < max) max = libList.size();
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
AllZone.GameAction.mill(getTargetPlayer(),3);
|
||||
}
|
||||
};//SpellAbility
|
||||
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
||||
|
||||
@@ -2850,20 +2850,7 @@ class CardFactory_Lands {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
String player = getTargetPlayer();
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int max = 1;
|
||||
if(libList.size() < 1) max = libList.size();
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
AllZone.GameAction.mill(getTargetPlayer(),1);
|
||||
}
|
||||
};
|
||||
ability.setBeforePayMana(CardFactoryUtil.input_targetPlayer(ability));
|
||||
|
||||
@@ -1912,20 +1912,7 @@ class CardFactory_Planeswalkers {
|
||||
card2.subtractCounter(Counters.LOYALTY, 10);
|
||||
|
||||
turn[0] = AllZone.Phase.getTurn();
|
||||
String player = getTargetPlayer();
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int max = 20;
|
||||
if(libList.size() < 20) max = libList.size();
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
AllZone.GameAction.mill(getTargetPlayer(),20);
|
||||
|
||||
}//resolve()
|
||||
|
||||
|
||||
@@ -5261,22 +5261,8 @@ public class CardFactory_Sorceries {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
String player = getTargetPlayer();
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int max = 0;
|
||||
if(cardName.equals("Glimpse the Unthinkable")) max = 10;
|
||||
else max = 5;
|
||||
if(libList.size() < max) max = libList.size();
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
AllZone.GameAction.mill(getTargetPlayer(),
|
||||
(cardName.equals("Glimpse the Unthinkable")) ? 10 : 5);
|
||||
}
|
||||
};//SpellAbility
|
||||
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
||||
@@ -6335,26 +6321,7 @@ public class CardFactory_Sorceries {
|
||||
|
||||
public void resolve()
|
||||
{
|
||||
String player = getTargetPlayer();
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int limit;
|
||||
|
||||
if (card.getXManaCostPaid() > lib.size()) {
|
||||
limit = lib.size();
|
||||
} else {
|
||||
limit = card.getXManaCostPaid();
|
||||
}
|
||||
|
||||
// for (int i = 0; i < card.getXManaCostPaid(); i++) {
|
||||
for (int i = 0; i < limit; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
AllZone.GameAction.mill(getTargetPlayer(),card.getXManaCostPaid());
|
||||
|
||||
AllZone.GameAction.getPlayerLife(card.getController()).addLife(card.getXManaCostPaid());
|
||||
card.setXManaCostPaid(0);
|
||||
|
||||
@@ -1778,25 +1778,7 @@ public class CombatUtil {
|
||||
}//Preeminent Captain
|
||||
|
||||
else if(c.getName().equals("Nemesis of Reason") && !c.getCreatureAttackedThisCombat()) {
|
||||
String player = AllZone.GameAction.getOpponent(c.getController());
|
||||
//if (c.getController().equals(Constant.Player.Human))
|
||||
//player="Human";
|
||||
//else if (c.getController().equals(Constant.Player.Computer))
|
||||
//player="Computer";
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int max = 10;
|
||||
if(libList.size() < 10) max = libList.size();
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
Card c1 = libList.get(i);
|
||||
lib.remove(c1);
|
||||
grave.add(c1);
|
||||
}
|
||||
|
||||
AllZone.GameAction.mill( AllZone.GameAction.getOpponent(c.getController()),10);
|
||||
}//Nemesis of Reason
|
||||
|
||||
else if(c.getName().equals("Novablast Wurm") && !c.getCreatureAttackedThisCombat()) {
|
||||
|
||||
@@ -138,6 +138,17 @@ public class GameAction {
|
||||
}
|
||||
*/
|
||||
|
||||
public void mill(String player, int n)
|
||||
{
|
||||
CardList lib = AllZoneUtil.getPlayerCardsInLibrary(player);
|
||||
|
||||
int max = Math.min(n, lib.size());
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
AllZone.GameAction.moveToGraveyard(lib.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void discard(Card c, SpellAbility sa)
|
||||
{
|
||||
if (sa!= null)
|
||||
@@ -1632,6 +1643,7 @@ public class GameAction {
|
||||
Command_Effects[F_Target] = Proper_resolve;
|
||||
StackDescription = StackDescription + F_TargetPlayer[F_Target] + " draws " + F_Amount[0] + " card(s)";
|
||||
}
|
||||
|
||||
|
||||
// Discard Cards
|
||||
if(Effect[y].contains("DiscardCards")) {
|
||||
@@ -2301,10 +2313,14 @@ public class GameAction {
|
||||
* to match the mechanics in Forge
|
||||
* @param c
|
||||
*/
|
||||
|
||||
|
||||
public void exile(Card c) {
|
||||
removeFromGame(c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void removeUnearth(Card c)
|
||||
{
|
||||
PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner());
|
||||
|
||||
@@ -4708,20 +4708,7 @@ public class GameActionUtil {
|
||||
final Ability ability = new Ability(c, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
String player = getTargetPlayer();
|
||||
|
||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||
CardList libList = new CardList(lib.getCards());
|
||||
|
||||
int max = 3;
|
||||
if(libList.size() < 3) max = libList.size();
|
||||
|
||||
for(int i = 0; i < max; i++) {
|
||||
Card c = libList.get(i);
|
||||
lib.remove(c);
|
||||
grave.add(c);
|
||||
}
|
||||
AllZone.GameAction.mill(getTargetPlayer(),3);
|
||||
}
|
||||
};
|
||||
ability.setStackDescription(c.getName() + " - Landfall: " + targetPlayer + " puts the top three cards of his or her library into his or her graveyard.");
|
||||
@@ -5004,13 +4991,7 @@ public class GameActionUtil {
|
||||
new String[] {"Creature", "Wolf"}, 2, 2, new String[] {""});
|
||||
|
||||
|
||||
CardList lib = AllZoneUtil.getPlayerCardsInLibrary(opponent);
|
||||
int max = lib.size();
|
||||
if (max > 10)
|
||||
max = 10;
|
||||
|
||||
for (int i=0;i<max;i++)
|
||||
AllZone.GameAction.moveToGraveyard(lib.get(i));
|
||||
AllZone.GameAction.mill(opponent,10);
|
||||
|
||||
//AllZone.GameAction.getPlayerLife(src.getController()).addLife(3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user