mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Fixed a typo with the Whenever Keyword (Thanks Dennis). Expanded the Whenever Keyword so it can be used for end of turn effects. Also added a ModifyLife Effect to the Whenever Keyword and added Dross Harvester.
This commit is contained in:
@@ -38,6 +38,7 @@ snow_covered_mountain.jpg http://www.wizards.com/global/images/magic/gene
|
||||
snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg
|
||||
snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg
|
||||
snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg
|
||||
dross_harvester.jpg http://www.wizards.com/global/images/magic/general/dross_harvester.jpg
|
||||
arc_runner.jpg http://www.wizards.com/global/images/magic/general/arc_runner.jpg
|
||||
armored_cancrix.jpg http://www.wizards.com/global/images/magic/general/armored_cancrix.jpg
|
||||
assault_griffin.jpg http://www.wizards.com/global/images/magic/general/assault_griffin.jpg
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
Dross Harvester
|
||||
1 B B
|
||||
Creature Horror
|
||||
no text
|
||||
4/4
|
||||
Protection from white
|
||||
WheneverKeyword:PermanentIntoGraveyard:Type/Creature:Play:ModifyLife/2:ControllingPlayer_Self:ASAP:No_Condition:No Special Condition:Whenever a creature is put into a graveyard from the battlefield, you gain 2 life.
|
||||
WheneverKeyword:BeginningOfEndStep:No_Initiator:Play:ModifyLife/-4:ControllingPlayer_Self:ASAP:No_Condition:ControllerEndStep:At the beginning of your end step, you lose 4 life.
|
||||
|
||||
Time Reversal
|
||||
3 U U
|
||||
Sorcery
|
||||
@@ -181,7 +190,7 @@ Soulcatcher
|
||||
Creature Bird Soldier
|
||||
no text
|
||||
1/1
|
||||
WheneverKeyword:PermanentIntoGraveyard:Type/Creature:Play:+1+1 Counters/1:Self:ASAP:No_Condition:Initator - Has Keyword/Flying:Whenever a creature with flying is put into a graveyard from the battlefield, put a +1/+1 counter on Soulcatcher.
|
||||
WheneverKeyword:PermanentIntoGraveyard:Type/Creature:Play:+1+1 Counters/1:Self:ASAP:No_Condition:Initiator - Has Keyword/Flying:Whenever a creature with flying is put into a graveyard from the battlefield, put a +1/+1 counter on Soulcatcher.
|
||||
Flying
|
||||
|
||||
Kresh the Bloodbraided
|
||||
@@ -189,7 +198,7 @@ Kresh the Bloodbraided
|
||||
Legendary Creature Human Warrior
|
||||
no text
|
||||
3/3
|
||||
WheneverKeyword:PermanentIntoGraveyard:Type/Creature:Play:+1+1 Counters/Power:Self:ASAP:Yes_No:Initator - Other than Self:Whenever another creature is put into a graveyard from the battlefield, you may put X +1/+1 counters on Kresh the Bloodbraided, where X is that creature's power.
|
||||
WheneverKeyword:PermanentIntoGraveyard:Type/Creature:Play:+1+1 Counters/Power:Self:ASAP:Yes_No:Initiator - Other than Self:Whenever another creature is put into a graveyard from the battlefield, you may put X +1/+1 counters on Kresh the Bloodbraided, where X is that creature's power.
|
||||
|
||||
Mind Peel
|
||||
B
|
||||
|
||||
@@ -548,22 +548,11 @@ public class Card extends MyObservable {
|
||||
if(i != 0) sb.append(", ");
|
||||
if(!keyword.get(i).toString().contains("WheneverKeyword")) sb.append(keyword.get(i).toString());
|
||||
else {
|
||||
ArrayList<String> a = getKeyword();
|
||||
int WheneverKeywords = 0;
|
||||
int WheneverKeyword_Number[] = new int[a.size()];
|
||||
for(int x = 0; x < a.size(); x++)
|
||||
if(a.get(x).toString().startsWith("WheneverKeyword")) {
|
||||
WheneverKeyword_Number[WheneverKeywords] = x;
|
||||
WheneverKeywords = WheneverKeywords + 1;
|
||||
}
|
||||
for(int CKeywords = 0; CKeywords < WheneverKeywords; CKeywords++) {
|
||||
String parse = getKeyword().get(WheneverKeyword_Number[CKeywords]).toString();
|
||||
String k[] = parse.split(":");
|
||||
String k[] = keyword.get(i).split(":");
|
||||
sb.append(k[9]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append("\r\n");
|
||||
sb.append(text);
|
||||
sb.append("\r\n");
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
package forge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
//import java.util.*;
|
||||
|
||||
//handles "until end of turn" and "at end of turn" commands from cards
|
||||
@@ -16,6 +18,40 @@ public class EndOfTurn implements java.io.Serializable
|
||||
|
||||
public void executeAt()
|
||||
{
|
||||
// Whenever Keyword
|
||||
CardList Cards_In_Play = new CardList();
|
||||
Cards_In_Play.addAll(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards());
|
||||
Cards_In_Play.addAll(AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer).getCards());
|
||||
Cards_In_Play = Cards_In_Play.filter(new CardListFilter() {
|
||||
public boolean addCard(Card c) {
|
||||
if(c.getKeyword().toString().contains("WheneverKeyword")) return true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
boolean Triggered = false;
|
||||
for(int i = 0; i < Cards_In_Play.size() ; i++) {
|
||||
if(Triggered == false) {
|
||||
Card card = Cards_In_Play.get(i);
|
||||
ArrayList<String> a = card.getKeyword();
|
||||
int WheneverKeywords = 0;
|
||||
int WheneverKeyword_Number[] = new int[a.size()];
|
||||
for(int x = 0; x < a.size(); x++)
|
||||
if(a.get(x).toString().startsWith("WheneverKeyword")) {
|
||||
WheneverKeyword_Number[WheneverKeywords] = x;
|
||||
WheneverKeywords = WheneverKeywords + 1;
|
||||
}
|
||||
for(int CKeywords = 0; CKeywords < WheneverKeywords; CKeywords++) {
|
||||
String parse = card.getKeyword().get(WheneverKeyword_Number[CKeywords]).toString();
|
||||
String k[] = parse.split(":");
|
||||
if((k[1].equals("BeginningOfEndStep"))) {
|
||||
AllZone.GameAction.RunWheneverKeyword(card, "BeginningOfEndStep"); // Beached
|
||||
Triggered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Whenever Keyword
|
||||
|
||||
//Pyrohemia and Pestilence
|
||||
CardList all = new CardList();
|
||||
all.addAll(AllZone.Human_Play.getCards());
|
||||
|
||||
@@ -662,6 +662,150 @@ public class GameAction {
|
||||
sacrificeDestroy(c);
|
||||
}
|
||||
|
||||
// Whenever Keyword
|
||||
public void RunWheneverKeyword(Card c, String Event) {
|
||||
CardList Cards_In_Play = new CardList();
|
||||
Cards_In_Play.addAll(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards());
|
||||
Cards_In_Play.addAll(AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer).getCards());
|
||||
Cards_In_Play = Cards_In_Play.filter(new CardListFilter() {
|
||||
public boolean addCard(Card c) {
|
||||
if(c.getKeyword().toString().contains("WheneverKeyword")) return true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
for(int i = 0; i < Cards_In_Play.size() ; i++) {
|
||||
Card card = Cards_In_Play.get(i);
|
||||
final Card crd = card;
|
||||
ArrayList<String> a = card.getKeyword();
|
||||
int WheneverKeywords = 0;
|
||||
int WheneverKeyword_Number[] = new int[a.size()];
|
||||
for(int x = 0; x < a.size(); x++)
|
||||
if(a.get(x).toString().startsWith("WheneverKeyword")) {
|
||||
WheneverKeyword_Number[WheneverKeywords] = x;
|
||||
WheneverKeywords = WheneverKeywords + 1;
|
||||
}
|
||||
for(int CKeywords = 0; CKeywords < WheneverKeywords; CKeywords++) {
|
||||
String parse = card.getKeyword().get(WheneverKeyword_Number[CKeywords]).toString();
|
||||
String k[] = parse.split(":");
|
||||
final String F_k[] = k;
|
||||
if((k[1].equals("PermanentIntoGraveyard")) && Event.equals("PermanentIntoGraveyard")
|
||||
|| (k[1].equals("BeginningOfEndStep")) && Event.equals("BeginningOfEndStep"))
|
||||
{
|
||||
if(k[2].contains("Type")) {
|
||||
String TypeParse = k[2];
|
||||
String Type[] = TypeParse.split("/");
|
||||
for(int z = 0; z < Type.length - 1; z++) if(!(c.getType()).contains(Type[z + 1])) k[4] = "Null";
|
||||
}
|
||||
if(k[8].contains("Initiator - Other than Self")) {
|
||||
if(card.equals(c)) k[4] = "Null";
|
||||
}
|
||||
if(k[8].contains("Initiator - Has Keyword")) {
|
||||
boolean Nullified = true;
|
||||
String KeywordParse = k[8];
|
||||
String Keyword[] = KeywordParse.split("/");
|
||||
for(int z = 0; z < Keyword.length - 1; z++) if((c.getKeyword()).contains(Keyword[z + 1])) Nullified = false;
|
||||
if(Nullified == true) k[4] = "Null";
|
||||
}
|
||||
if(k[8].contains("ControllerEndStep")) {
|
||||
if(!getLastPlayerToDraw().equals(card.getController())) k[4] = "Null";
|
||||
}
|
||||
|
||||
// +1 +1 Counters
|
||||
if(k[4].contains("+1+1 Counters")) {
|
||||
Card Target = null;
|
||||
final Card Destroyed = c;
|
||||
if(k[5].equals("Self")) Target = crd;
|
||||
final Card F_Target = Target;
|
||||
String AmountParse = k[4];
|
||||
String S_Amount = AmountParse.split("/")[1];
|
||||
int I_Amount = 0;
|
||||
if(S_Amount.equals("Power")) I_Amount = Destroyed.getNetAttack();
|
||||
else I_Amount = Integer.valueOf(S_Amount);
|
||||
final int F_Amount = I_Amount;
|
||||
Ability ability = new Ability(Target, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
boolean Go = true;
|
||||
if(F_k[3].equals("Play")) {
|
||||
PlayerZone Required_Zone = AllZone.getZone(Constant.Zone.Play, F_Target.getController());
|
||||
if(AllZone.GameAction.isCardInZone(F_Target,Required_Zone)) {
|
||||
if(F_k[7].equals("Yes_No")) {
|
||||
if(F_Target.getController().equals("Human")) {
|
||||
Object[] possibleValues = {"Yes", "No"};
|
||||
Object q = JOptionPane.showOptionDialog(null, "Activate - " + F_Target.getName(),F_Target.getName() + " Ability",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
|
||||
null, possibleValues, possibleValues[0]);
|
||||
if(q.equals(1)) {
|
||||
Go = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Go == true) if(AllZone.GameAction.isCardInPlay(F_Target)) F_Target.addCounter(Counters.P1P1, F_Amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
ability.setStackDescription(Target.getName() + " - gets " + F_Amount + " +1/+1 counters.");
|
||||
if(k[3].equals("Play")) {
|
||||
PlayerZone Required_Zone = AllZone.getZone(Constant.Zone.Play, Target.getController());
|
||||
if(AllZone.GameAction.isCardInZone(Target,Required_Zone)) {
|
||||
if(k[6].equals("ASAP")) AllZone.Stack.add(ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Gain Life
|
||||
if(k[4].contains("ModifyLife")) {
|
||||
String Target = "";
|
||||
if(k[5].equals("ControllingPlayer_Self")) Target = card.getController();
|
||||
final String F_Target = Target;
|
||||
String AmountParse = k[4];
|
||||
String S_Amount = AmountParse.split("/")[1];
|
||||
int I_Amount = 0;
|
||||
if(S_Amount.equals("Some random condition not implemented yet")) I_Amount = 3;
|
||||
else I_Amount = Integer.valueOf(S_Amount);
|
||||
final int F_Amount = I_Amount;
|
||||
Ability ability = new Ability(card, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
boolean Go = true;
|
||||
if(F_k[3].equals("Play")) {
|
||||
PlayerZone Required_Zone = AllZone.getZone(Constant.Zone.Play, F_Target);
|
||||
if(AllZone.GameAction.isCardInZone(crd,Required_Zone)) {
|
||||
if(F_k[7].equals("Yes_No")) {
|
||||
if(F_Target.equals("Human")) {
|
||||
Object[] possibleValues = {"Yes", "No"};
|
||||
Object q = JOptionPane.showOptionDialog(null, "Activate - " + crd.getName(),crd.getName() + " Ability",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
|
||||
null, possibleValues, possibleValues[0]);
|
||||
if(q.equals(1)) {
|
||||
Go = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Go == true) if(AllZone.GameAction.isCardInPlay(crd)) {
|
||||
PlayerLife life = AllZone.GameAction.getPlayerLife(F_Target);
|
||||
if(F_Amount > -1) life.addLife(F_Amount);
|
||||
else life.subtractLife(F_Amount * -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
ability.setStackDescription(crd + " - " + crd.getController() + ((F_Amount > -1)? " gains " + F_Amount:"") + ((F_Amount <= -1)? " loses " + F_Amount * -1:"") + " life.");
|
||||
if(k[3].equals("Play")) {
|
||||
PlayerZone Required_Zone = AllZone.getZone(Constant.Zone.Play, Target);
|
||||
if(AllZone.GameAction.isCardInZone(crd,Required_Zone)) {
|
||||
if(k[6].equals("ASAP")) AllZone.Stack.add(ability);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Whenever Keyword
|
||||
|
||||
private void sacrificeDestroy(Card c) {
|
||||
if(!isCardInPlay(c)) return;
|
||||
|
||||
@@ -718,95 +862,7 @@ public class GameAction {
|
||||
}
|
||||
});
|
||||
|
||||
// Whenever Keyword
|
||||
CardList Cards_In_Play = new CardList();
|
||||
Cards_In_Play.addAll(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards());
|
||||
Cards_In_Play.addAll(AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer).getCards());
|
||||
Cards_In_Play = Cards_In_Play.filter(new CardListFilter() {
|
||||
public boolean addCard(Card c) {
|
||||
if(c.getKeyword().toString().contains("WheneverKeyword")) return true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
for(int i = 0; i < Cards_In_Play.size() ; i++) {
|
||||
Card card = Cards_In_Play.get(i);
|
||||
ArrayList<String> a = card.getKeyword();
|
||||
int WheneverKeywords = 0;
|
||||
int WheneverKeyword_Number[] = new int[a.size()];
|
||||
for(int x = 0; x < a.size(); x++)
|
||||
if(a.get(x).toString().startsWith("WheneverKeyword")) {
|
||||
WheneverKeyword_Number[WheneverKeywords] = x;
|
||||
WheneverKeywords = WheneverKeywords + 1;
|
||||
}
|
||||
for(int CKeywords = 0; CKeywords < WheneverKeywords; CKeywords++) {
|
||||
String parse = card.getKeyword().get(WheneverKeyword_Number[CKeywords]).toString();
|
||||
String k[] = parse.split(":");
|
||||
final String F_k[] = k;
|
||||
if((k[1].equals("PermanentIntoGraveyard"))) // No Check Necessary as it is in GameAction
|
||||
{
|
||||
if(k[2].contains("Type")) {
|
||||
String TypeParse = k[2];
|
||||
String Type[] = TypeParse.split("/");
|
||||
for(int z = 0; z < Type.length - 1; z++) if(!(c.getType()).contains(Type[z + 1])) k[4] = "Null";
|
||||
}
|
||||
if(k[8].contains("Initator - Other than Self")) {
|
||||
if(card.equals(c)) k[4] = "Null";
|
||||
}
|
||||
if(k[8].contains("Initator - Has Keyword")) {
|
||||
boolean Nullified = true;
|
||||
String KeywordParse = k[8];
|
||||
String Keyword[] = KeywordParse.split("/");
|
||||
for(int z = 0; z < Keyword.length - 1; z++) if((c.getKeyword()).contains(Keyword[z + 1])) Nullified = false;
|
||||
if(Nullified == true) k[4] = "Null";
|
||||
}
|
||||
final Card crd = card;
|
||||
final Card Destroyed = c;
|
||||
|
||||
if(k[4].contains("+1+1 Counters")) {
|
||||
Card Target = null;
|
||||
if(k[5].equals("Self")) Target = crd;
|
||||
final Card F_Target = Target;
|
||||
String AmountParse = k[4];
|
||||
String S_Amount = AmountParse.split("/")[1];
|
||||
int I_Amount = 0;
|
||||
if(S_Amount.equals("Power")) I_Amount = Destroyed.getNetAttack();
|
||||
else I_Amount = Integer.valueOf(S_Amount);
|
||||
final int F_Amount = I_Amount;
|
||||
Ability ability = new Ability(Target, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
boolean Go = true;
|
||||
if(F_k[3].equals("Play")) {
|
||||
PlayerZone Required_Zone = AllZone.getZone(Constant.Zone.Play, F_Target.getController());
|
||||
if(AllZone.GameAction.isCardInZone(F_Target,Required_Zone)) {
|
||||
if(F_k[7].equals("Yes_No")) {
|
||||
if(F_Target.getController().equals("Human")) {
|
||||
Object[] possibleValues = {"Yes", "No"};
|
||||
Object q = JOptionPane.showOptionDialog(null, "Activate - " + F_Target.getName(),F_Target.getName() + " Ability",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
|
||||
null, possibleValues, possibleValues[0]);
|
||||
if(q.equals(1)) {
|
||||
Go = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Go == true) if(AllZone.GameAction.isCardInPlay(F_Target)) F_Target.addCounter(Counters.P1P1, F_Amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
ability.setStackDescription(Target.getName() + " - gets " + F_Amount + " +1/+1 counters.");
|
||||
if(k[3].equals("Play")) {
|
||||
PlayerZone Required_Zone = AllZone.getZone(Constant.Zone.Play, Target.getController());
|
||||
if(AllZone.GameAction.isCardInZone(Target,Required_Zone)) {
|
||||
if(k[6].equals("ASAP")) AllZone.Stack.add(ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Whenever Keyword
|
||||
RunWheneverKeyword(c, "PermanentIntoGraveyard");
|
||||
for(int i = 0; i < list.size(); i++)
|
||||
GameActionUtil.executeDestroyCardEffects(list.get(i), c);
|
||||
for(int i = 0; i < grv.size(); i++)
|
||||
|
||||
Reference in New Issue
Block a user