mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
- Added some beginnings of Annihilator code.
This commit is contained in:
@@ -476,6 +476,40 @@ public class CardFactoryUtil {
|
|||||||
return target;
|
return target;
|
||||||
}//input_sacrifice()
|
}//input_sacrifice()
|
||||||
|
|
||||||
|
public static Input input_sacrificePermanents(final int nCards) {
|
||||||
|
Input target = new Input() {
|
||||||
|
private static final long serialVersionUID = -8149416676562317629L;
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showMessage() {
|
||||||
|
|
||||||
|
AllZone.Display.showMessage("Select a permanent to sacrifice (" +(nCards-n) +" left)");
|
||||||
|
ButtonUtil.disableAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selectCard(Card card, PlayerZone zone) {
|
||||||
|
if(zone.equals(AllZone.Human_Play) && !card.getName().equals("Mana Pool")) {
|
||||||
|
AllZone.GameAction.sacrifice(card);
|
||||||
|
n++;
|
||||||
|
|
||||||
|
//in case no more {type}s in play
|
||||||
|
CardList list = new CardList(AllZone.Human_Play.getCards());
|
||||||
|
list = list.filter(new CardListFilter(){
|
||||||
|
public boolean addCard(Card c)
|
||||||
|
{
|
||||||
|
return c.isPermanent() && !c.getName().equals("Mana Pool");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(n == nCards || list.size() == 0) stop();
|
||||||
|
else
|
||||||
|
showMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return target;
|
||||||
|
}//input_sacrificePermanents()
|
||||||
|
|
||||||
public static Input input_sacrificePermanents(final int nCards, final String type) {
|
public static Input input_sacrificePermanents(final int nCards, final String type) {
|
||||||
Input target = new Input() {
|
Input target = new Input() {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package forge;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
public class CombatUtil {
|
public class CombatUtil {
|
||||||
@@ -777,6 +779,40 @@ public class CombatUtil {
|
|||||||
if( /*AllZone.Phase.getPhase().equals("Declare Blockers") ||*/
|
if( /*AllZone.Phase.getPhase().equals("Declare Blockers") ||*/
|
||||||
AllZone.Phase.getPhase().equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)) {
|
AllZone.Phase.getPhase().equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)) {
|
||||||
|
|
||||||
|
//Annihilator:
|
||||||
|
ArrayList<String> kws = c.getKeyword();
|
||||||
|
Pattern p = Pattern.compile("Annihilator [0-9]+");
|
||||||
|
Matcher m;
|
||||||
|
for (String key : kws)
|
||||||
|
{
|
||||||
|
m = p.matcher(key);
|
||||||
|
if (m.find())
|
||||||
|
{
|
||||||
|
String k[] = key.split(" ");
|
||||||
|
final int a = Integer.valueOf(k[1]);
|
||||||
|
final Card crd = c;
|
||||||
|
|
||||||
|
final Ability ability = new Ability(c, "0")
|
||||||
|
{
|
||||||
|
public void resolve()
|
||||||
|
{
|
||||||
|
if (crd.getController().equals(Constant.Player.Human))
|
||||||
|
{
|
||||||
|
//comp sacks
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AllZone.InputControl.setInput(CardFactoryUtil.input_sacrificePermanents(a));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ability.setStackDescription("");
|
||||||
|
AllZone.Stack.add(ability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Annihilator
|
||||||
|
|
||||||
//Beastmaster Ascension
|
//Beastmaster Ascension
|
||||||
if(!c.getCreatureAttackedThisCombat()) {
|
if(!c.getCreatureAttackedThisCombat()) {
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController());
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController());
|
||||||
@@ -848,6 +884,9 @@ public class CombatUtil {
|
|||||||
AllZone.Stack.add(ability);
|
AllZone.Stack.add(ability);
|
||||||
}//Raging Ravine
|
}//Raging Ravine
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
if(c.getName().equals("Zhang He, Wei General") && !c.getCreatureAttackedThisCombat()) {
|
if(c.getName().equals("Zhang He, Wei General") && !c.getCreatureAttackedThisCombat()) {
|
||||||
final PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController());
|
final PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user