private void parsePermEffect(string text, ref Card theCard, int effectNum) { var testRegex = new Regex(CONDITIONALEFFECT, RegexOptions.IgnoreCase); //if the effect has a conditional, i.e "if..." if (testRegex.IsMatch(text)) { foreach (Match tom in testRegex.Matches(text)) { string[] tmp = tom.Groups[1].Value.Split(' '); if (tmp[tmp.Length - 1] == "creature") { theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "loses"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "controlothercolorless"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "2 life"; } else if (tmp[tmp.Length - 1] == "kicked") { if (tom.Groups[2].Value.Split(' ')[0] == "destroy") { theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "creature"; theCard.sides[theCard.side].optionalCosts[0] = "Kicker"; theCard.sides[theCard.side].optionalCosts[1] = "{2}{B}"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "destroy"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "kicked"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "destroy"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Kicker"; } else { theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "creature"; theCard.sides[theCard.side].optionalCosts[0] = "Kicker"; theCard.sides[theCard.side].optionalCosts[1] = "{1}{R}"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "deals"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "kicked"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "2"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Kicker"; } } else if (tmp[0] == "you") { theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "draw"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "pay2"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "1"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Landfall"; } } } //it's not a conditional, its straightforward //parses like oneshot else { Regex effectReg = new Regex(@"((Target|Each|" + theCard.sides[theCard.side].name + @"|you|it)\s(.+)?)?\s?\b(" + string.Join("|", keywordActions.Select(Regex.Escape).ToArray()) + @")\b\s(.+)", RegexOptions.IgnoreCase); Regex identify = new Regex(@"(.+)?(creature|creatures|lands|land|permanent|permanents|" + theCard.sides[theCard.side].name + @"|opponent|oppenents)(.+)?", RegexOptions.IgnoreCase); if (effectReg.IsMatch(text)) { foreach (Match simon in effectReg.Matches(text)) { if (simon.Groups[2].Value == theCard.sides[theCard.side].name || simon.Groups[2].Value == "it") { theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "~";//[3] if (simon.Groups[4].Value.ToLower() == "deals") { //its magmaw theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "creature|player"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = simon.Groups[4].Value; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "1"; } else if (simon.Groups[4].Value.ToLower() == "gains") { //its veteran warleader theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = simon.Groups[4].Value; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "~"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "first strike|vigilance|trample"; } else if (simon.Groups[4].Value.ToLower() == "gets") { //both bloodthrone and baloth, both get +2/+2 till end of turn theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = simon.Groups[4].Value; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "~"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "plus2 end of turn."; } else if (simon.Groups[4].Value.ToLower() == "becomes") { //stirring wildwood theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = simon.Groups[4].Value; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "~"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = simon.Groups[5].Value; } else { Console.WriteLine(theCard.sides[theCard.side].name + " did not work well in name or it"); } } else if (simon.Groups[2].Value.ToLower() == "you") { theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; string[] tmp = simon.Groups[3].Value.Split(' '); int placeCounter = 0; if (tmp[placeCounter] == "may")//[1] { placeCounter++; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "yes"; } else theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; if (tmp[placeCounter] == "have") { placeCounter++; if (tmp[placeCounter] == "target") { placeCounter += 2; theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = simon.Groups[4].Value; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = simon.Groups[5].Value; //its a basilisk, target creature } else if (tmp[placeCounter] == "Tajuru") { placeCounter += 2; theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = simon.Groups[4].Value; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "flying"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "allies"; //its tajuru archer } else { placeCounter += 4; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = simon.Groups[4].Value; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "allies"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "you control"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "vigilence"; //its joraga bard, ally creatures you control } } else { theCard.sides[theCard.side].effects[effectNum].whatDo[2] = simon.Groups[4].Value; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = simon.Groups[5].Value; //find out who falls into here } } else if (simon.Groups[2].Value.ToLower() == "target" || simon.Groups[2].Value == "each") { if (simon.Groups[5].Value == "3 life") { //bloodrite invoker theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "player"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "loses"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "player"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "3life;othergain3life"; } else { Match kyle = identify.Match(simon.Groups[3].Value); if (kyle.Groups[1].Value != " " && kyle.Groups[1].Value != "") { theCard.sides[theCard.side].effects[effectNum].whatDo[4] = kyle.Groups[1].Value; } theCard.sides[theCard.side].effects[effectNum].whatDo[3] = kyle.Groups[2].Value; if (kyle.Groups[3].Value != " " && kyle.Groups[3].Value != "") { theCard.sides[theCard.side].effects[effectNum].whatDo[4] += "|" + kyle.Groups[3].Value;//[4] if (kyle.Groups[1].Value != " " && kyle.Groups[1].Value != "") { Console.WriteLine(theCard.sides[theCard.side].name + " is wierd"); } } theCard.sides[theCard.side].effects[effectNum].whatDo[2] = simon.Groups[4].Value;//[2] theCard.sides[theCard.side].effects[effectNum].whatDo[5] = simon.Groups[5].Value;//[5] } } else if (simon.Groups[4].Value.ToLower() == "add") { theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "add"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = parseManas(simon.Groups[5].Value); if (theCard.sides[theCard.side].effects[effectNum].whatDo[5].Length == 2 && theCard.sides[theCard.side].effects[effectNum].whatDo[5][0] != '6') { Effect tmp = theCard.sides[theCard.side].effects[effectNum]; int tmpNum = effectNum + 1; theCard.sides[theCard.side].effects.Insert(tmpNum, new Effect(tmp)); theCard.sides[theCard.side].effects[tmpNum].whatDo[5] = theCard.sides[theCard.side].effects[effectNum].whatDo[5][1].ToString(); theCard.sides[theCard.side].effects[effectNum].whatDo[5] = theCard.sides[theCard.side].effects[effectNum].whatDo[5][0].ToString(); } else if (theCard.sides[theCard.side].effects[effectNum].whatDo[5].Length == 2) { theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "Eldrazi"; } } else if (simon.Groups[4].Value == "Draw") { theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "draw"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "1"; } else if (simon.Groups[2].Value == "") { theCard.sides[theCard.side].effects[effectNum].whatDo[5] = simon.Groups[5].Value;//[5] theCard.sides[theCard.side].effects[effectNum].whatDo[2] = simon.Groups[4].Value;//[2] } else { Console.WriteLine(theCard.sides[theCard.side].name + " didn't fall into anything"); } } } else { Console.WriteLine(theCard.sides[theCard.side].name + " aint gettin' implmented"); } } }
private void parseTriggered(string[] text, ref Card theCard) { bool oneshot = false; foreach (string line in text) { //ingest is special if (line.Split(' ')[0] == "Ingest") { int Num = theCard.sides[theCard.side].effects.Count(); theCard.sides[theCard.side].effects.Insert(Num, new Effect()); theCard.sides[theCard.side].effects[Num].when[0] = "damages"; theCard.sides[theCard.side].effects[Num].when[1] = "player"; theCard.sides[theCard.side].effects[Num].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[Num].whatDo[1] = "no"; theCard.sides[theCard.side].effects[Num].whatDo[2] = "exile"; theCard.sides[theCard.side].effects[Num].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[Num].whatDo[4] = ""; theCard.sides[theCard.side].effects[Num].whatDo[5] = "topcard"; theCard.sides[theCard.side].effects[Num].whatDo[6] = "Ingest"; return; } //603.1 //triggers always start with When/Whenever/At var testRegex = new Regex(TRIGGEREDABILITY); int effectNum = theCard.sides[theCard.side].effects.Count(); foreach (Match currentMatch in testRegex.Matches(line)) { theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); if (theCard.sides[theCard.side].subtypes[0] == "Equipment") { //Console.WriteLine("equipment!"); theCard.sides[theCard.side].effects[effectNum].when[0] = "attacks"; theCard.sides[theCard.side].effects[effectNum].when[1] = "equipped"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "look"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "land"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "putonbattlefieldtapped"; oneshot = true; } else if (currentMatch.Groups[1].Value.Split(' ')[0] == "At") { //Console.WriteLine("DAT SCUTE"); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.PhaseTrigger; theCard.sides[theCard.side].effects[effectNum].when[0] = "beginning"; theCard.sides[theCard.side].effects[effectNum].when[1] = "1"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "put"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "~"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "control5lands"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "4 plus1"; oneshot = true; } else { theCard.sides[theCard.side].effects[effectNum].effect = EffectType.EventTrigger; //deals with card changing zones (etb/dies/etc) var zoneChangeRegex = new Regex(@"Whe[never]{1,5}\s" + theCard.names[theCard.side] + @"\s(.+)."); if (zoneChangeRegex.IsMatch(line)) { foreach (Match thing in zoneChangeRegex.Matches(line)) { if (line.Split(' ')[0] == "Whenever") { //grab that last word before comma var orRegex = new Regex(@"or\sanother\s(.+)\s(.+),\s(.+)", RegexOptions.Multiline | RegexOptions.IgnoreCase); foreach (Match thing1 in orRegex.Matches(thing.Groups[1].Value)) { //Butcher or pawn if (thing1.Groups[2].Value == "dies") { // Console.WriteLine("BUTCHER OR PAWN"); if (theCard.names[theCard.side].Split(' ')[0] == "Butcher") { theCard.sides[theCard.side].effects[effectNum].when[0] = "dies"; theCard.sides[theCard.side].effects[effectNum].when[1] = "~,creature"; } else { theCard.sides[theCard.side].effects[effectNum].when[0] = "dies"; theCard.sides[theCard.side].effects[effectNum].when[1] = "~,nontokencreature"; } } else { // Console.WriteLine("One of those Ally guys"); theCard.sides[theCard.side].effects[effectNum].when[0] = "etb"; theCard.sides[theCard.side].effects[effectNum].when[1] = "~,ally"; } } } else { var deathVSetbRegex = new Regex(@"enters\sthe\sbattlefield,\s(.+)"); if (deathVSetbRegex.IsMatch(thing.Groups[1].Value)) { //Console.WriteLine("Its got a sick etb"); theCard.sides[theCard.side].effects[effectNum].when[0] = "etb"; theCard.sides[theCard.side].effects[effectNum].when[1] = "~"; } else { theCard.sides[theCard.side].effects[effectNum].when[0] = "dies"; theCard.sides[theCard.side].effects[effectNum].when[1] = "~,nontokencreature"; //Console.WriteLine("Clicked on the Ruined Serviator thing"); } } } } //first word is when, second word is you? Gotta be on cast else if (line.Split(' ')[1] == "you") { if (line.Split(' ')[line.Split(' ').Count() - 1] == "battlefield") { theCard.sides[theCard.side].effects[effectNum].when[0] = "cast"; theCard.sides[theCard.side].effects[effectNum].when[1] = "~"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "return"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "card"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "cc"; } else { //Console.WriteLine("Big Daddy"); theCard.sides[theCard.side].effects[effectNum].when[0] = "cast"; theCard.sides[theCard.side].effects[effectNum].when[1] = "~"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "exile"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "oppenent" : "human"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "top four cards of his or her library, then you may put any number of land cards that player owns from exile onto the battlefield under your control."; } oneshot = true; } //landfall else if (line.Split(' ')[0] == "Landfall") { // Console.WriteLine("LANDFALL HO!"); theCard.sides[theCard.side].effects[effectNum].when[0] = "etb"; theCard.sides[theCard.side].effects[effectNum].when[1] = "land"; } //since Annihilator is the only effect in the deck that doesn't change other than the numPerm, just fill it all out here else if (line.Split(' ')[0] == "Annihilator") { // Console.WriteLine("LANDFALL HO!"); theCard.sides[theCard.side].effects[effectNum].when[0] = "attacks"; theCard.sides[theCard.side].effects[effectNum].when[1] = "~"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "sacrifice"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "permanent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = line.Split(' ')[1]; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Annihilator"; oneshot = true; } else { // Console.WriteLine("IT BETREAYS US!"); theCard.sides[theCard.side].effects[effectNum].when[0] = "sacrifices"; theCard.sides[theCard.side].effects[effectNum].when[1] = "oppenentnontokenperm"; } } if (!oneshot) parsePermEffect(currentMatch.Groups[3].Value, ref theCard, effectNum); //Console.WriteLine("Trigger Group " + j + ": " + tom.Groups[1]); effectNum++; //Console.WriteLine("-------------------------------------------------"); } } if (text[0].Split(' ')[text[0].Split(' ').Length - 1] == "—") { int effectNum = theCard.sides[theCard.side].effects.Count(); theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); string[] choices = theCard.sides[theCard.side].text.Split('\n'); theCard.sides[theCard.side].effects[effectNum].when[0] = "etb"; theCard.sides[theCard.side].effects[effectNum].when[1] = "land"; theCard.sides[theCard.side].effects[effectNum].effect = EffectType.EventTrigger; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "choose"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "one"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = choices[1] + "\n" + choices[2]; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Landfall"; } }
/**/ /* Game::getCost() Game::getCost() NAME Interpreter::getCost - parses out the manas SYNOPSIS void getCost(string text) text --> string of mana, i.e "{3}{4}" DESCRIPTION Creates a list of manas from the string RETURNS returns a list of actual mana objects */ /**/ public List<Mana> getCost(string text) { var testRegex = new Regex(MANACOLORS, RegexOptions.IgnoreCase); List<Mana> theReturn = new List<Mana>(); foreach (Match tom in testRegex.Matches(text)) { foreach (Group g in tom.Groups) { if (!g.Value.Contains("{")) { int attempt; if (int.TryParse(g.Value, out attempt)) { for (int i = 0; i < int.Parse(g.Value); i++) theReturn.Add(new Mana(0, "")); } else { switch (g.Value[0]) { case 'W': theReturn.Add(new Mana(1, null)); break; case 'U': theReturn.Add(new Mana(2, null)); break; case 'B': theReturn.Add(new Mana(3, null)); break; case 'R': theReturn.Add(new Mana(4, null)); break; case 'G': theReturn.Add(new Mana(5, null)); break; } } } } } return theReturn; } /**/ /* Game::parseKeyword() Game::parseKeyword() NAME Interpreter::parseKeyword - sees if there are any keword abilities SYNOPSIS void parseKeyword(string[] text, ref Card theCard); text --> array of lines of textbox theCard --> the actual card to pasrse DESCRIPTION If there is a line that matches anything in the above array, puts that into the Side's keywordAbilities RETURNS Nothing */ /**/ public void parseKeyword(string[] text, ref Card theCard) { Regex keywordsReg = new Regex(@"\b(" + string.Join("|", keywordAbilities.Select(Regex.Escape).ToArray()) + @"\b)"); foreach (string line in text) { foreach (Match m in keywordsReg.Matches(line)) { if (m.Value[0] == 'K') { theCard.sides[theCard.side].optionalCosts[0] = "Kicker"; theCard.sides[theCard.side].optionalCosts[1] = parseManas(line.Split(' ')[1]); } else { theCard.sides[theCard.side].keywordAbilities.Push(m.Value); } } } } /**/ /* Game::parseSide() Game::parseSide() NAME Interpreter::parseSide - entry point for parsing the card text SYNOPSIS void parseSide(Card theCard); theCard --> the object we're parsing that holds the text DESCRIPTION If the card is a basic land, immedietly parses that since they're all the same RETURNS Nothing */ /**/ public void parseSide(Card theCard) { //parse cmc if (!string.IsNullOrEmpty(theCard.sides[0].manaCost)) parseCMC(ref theCard); //it's a one shota and not a permanent if (theCard.sides[theCard.side].types[0] == "Instant" || theCard.sides[theCard.side].types[0] == "Sorcery") { parseOneshot(theCard.sides[theCard.side].text, ref theCard); return; } //all basic lands are the same except for the color it taps for if (!string.IsNullOrEmpty(theCard.sides[theCard.side].supertypes[0]) && theCard.sides[theCard.side].supertypes[0] == "Basic") { int effectNum = theCard.sides[theCard.side].effects.Count(); theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.ActivatedAbility; theCard.sides[theCard.side].effects[effectNum].costs[0] = "Tap"; theCard.sides[theCard.side].effects[effectNum].costs[1] = "~"; theCard.sides[theCard.side].effects[effectNum].tapCost = true; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "opponent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "add"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; switch (theCard.sides[theCard.side].name) { case "Plains": theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "1"; break; case "Island": theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "2"; break; case "Swamp": theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "3"; break; case "Mountain": theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "4"; break; case "Forest": theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "5"; break; } return; } //its vanilla and nothing to parse if (string.IsNullOrEmpty(theCard.sides[theCard.side].text)) { return; } //seperate lines string[] theText = (theCard.sides[theCard.side].text).Split('\n'); //level up cards are like activated abilities, but with extra things attached to it if (theText[0].Split(' ')[0] == "Level") { parseLeveler(theText, ref theCard); } else { //parse Keyword Abilities parseKeyword(theText, ref theCard); //see if it enters tapped parseEnterTapped(theText, ref theCard); //Find triggers parseTriggered(theText, ref theCard); //find activated abilities parseActivated(theText, ref theCard); } //set summoning sickness to true if (theCard.sides[0].types.Contains("Creature")) theCard.sick = true; } private void parseActivated(string[] text, ref Card theCard) { foreach (string line in text) { //defend against false positives if (theCard.sides[theCard.side].name == "Emrakul's Hatcher" || theCard.sides[theCard.side].name == "Pawn of Ulamog") return; //apply regex var testRegex = new Regex(ACTIVATEDABILITY, RegexOptions.IgnoreCase); MatchCollection AllMatches = testRegex.Matches(line); int effectNum = theCard.sides[theCard.side].effects.Count(); //iterate through all the matches and give an effect to all found foreach (Match tom in AllMatches) { theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.ActivatedAbility; parseCost(tom.Groups[1].Value, ref theCard, effectNum); parsePermEffect(tom.Groups[2].Value, ref theCard, effectNum); effectNum++; } } } /**/ /* Game::parseCMC() Game::parseCMC() NAME Interpreter::parseCMC - parses out the cmc SYNOPSIS void parseCMC(ref Card theCard); theCard --> the actual card to pasrse DESCRIPTION Parses out the cmc and stores it in the card RETURNS Nothing */ /**/ private void parseCMC(ref Card theCard) { var testRegex = new Regex(MANACOLORS, RegexOptions.IgnoreCase); foreach (Match tom in testRegex.Matches(theCard.sides[0].manaCost)) { foreach (Group g in tom.Groups) { if (!g.Value.Contains("{")) { int attempt; if (int.TryParse(g.Value, out attempt)) { for (int i = 0; i < int.Parse(g.Value); i++) theCard.sides[theCard.side].manacost.Add(new Mana(0, "")); } else { switch (g.Value[0]) { case 'W': theCard.sides[theCard.side].manacost.Add(new Mana(1, null)); break; case 'U': theCard.sides[theCard.side].manacost.Add(new Mana(2, null)); break; case 'B': theCard.sides[theCard.side].manacost.Add(new Mana(3, null)); break; case 'R': theCard.sides[theCard.side].manacost.Add(new Mana(4, null)); break; case 'G': theCard.sides[theCard.side].manacost.Add(new Mana(5, null)); break; } } } } } } private void parseCost(string text, ref Card theCard, int effectNum) { string[] tmp = text.Split(' '); if (tmp[0] == "Equip") { theCard.sides[theCard.side].effects[effectNum].manaCost.Add(new Mana(0, "1")); return; } string[] heywhats = text.Split(','); var testRegex = new Regex(MANACOSTS, RegexOptions.IgnoreCase); foreach (string tom in heywhats) { if ((testRegex.Match(tom)).Success) { parseManaCost(tom, ref theCard, effectNum); } else { string tmpTom = tom; var aword = new Regex(AWORD); if (tmpTom[0] == ' ') tmpTom = tmpTom.Substring(1, tmpTom.Length - 1); string[] costsSplit = tmpTom.Split(' '); string withoutFirst = ""; for (int i = 1; i < costsSplit.Length; i++) { withoutFirst += costsSplit[i] + " "; } withoutFirst = withoutFirst.Substring(0, withoutFirst.Length - 1); theCard.sides[theCard.side].effects[effectNum].costs[0] = costsSplit[0]; if (withoutFirst == theCard.names[0]) withoutFirst = "~"; theCard.sides[theCard.side].effects[effectNum].costs[1] = withoutFirst; } } } /**/ /* Game::parseEnterTapped() Game::parseEnterTapped() NAME Interpreter::parseEnterTapped - sees if the card enters tapped SYNOPSIS void parseEnterTapped(string[] text, ref Card theCard); text --> array of lines of textbox theCard --> the actual card to pasrse DESCRIPTION If there is "~ enters the battlefield tapped", sets tapped to true making it enter tapped when played later on RETURNS Nothing */ /**/ private void parseEnterTapped(string[] text, ref Card theCard) { //every single one is worded as such if (text[0] == theCard.sides[theCard.side].name + " enters the battlefield tapped.") { theCard.tapped = true; } } /**/ /* Game::parseLeveler() Game::parseLeveler() NAME Interpreter::parseLeveler - parses out leveling abilities SYNOPSIS void parseKeyword(string[] text, ref Card theCard); text --> array of lines of textbox theCard --> the actual card to pasrse DESCRIPTION It's an activated ability, but special; thus it gets its own function RETURNS Nothing */ /**/ private void parseLeveler(string[] text, ref Card theCard) { int effectNum = 0; theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.LevelUp; parseCost(text[0].Split(' ')[2], ref theCard, effectNum); theCard.sides[theCard.side].effects[effectNum].when[0] = "sorcery"; theCard.sides[theCard.side].effects[effectNum].when[1] = ""; theCard.sides[theCard.side].levelUp = text; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "put"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "a"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "level"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Level"; } private void parseManaCost(string text, ref Card theCard, int effectNum) { var testRegex = new Regex(MANACOLORS, RegexOptions.IgnoreCase); foreach (Match tom in testRegex.Matches(text)) { foreach (Group g in tom.Groups) { if (g.Value.Length == 1) { int attempt; if (g.Value == "T") { theCard.sides[theCard.side].effects[effectNum].tapCost = true; } else if (int.TryParse(g.Value, out attempt)) { for (int i = 0; i < int.Parse(g.Value); i++) theCard.sides[theCard.side].effects[effectNum].manaCost.Add(new Mana(0, "")); } else { switch (g.Value[0]) { case 'W': theCard.sides[theCard.side].effects[effectNum].manaCost.Add(new Mana(1, null)); break; case 'U': theCard.sides[theCard.side].effects[effectNum].manaCost.Add(new Mana(2, null)); break; case 'B': theCard.sides[theCard.side].effects[effectNum].manaCost.Add(new Mana(3, null)); break; case 'R': theCard.sides[theCard.side].effects[effectNum].manaCost.Add(new Mana(4, null)); break; case 'G': theCard.sides[theCard.side].effects[effectNum].manaCost.Add(new Mana(5, null)); break; } } } } } } /**/ /* Game::parseManaCost() Game::parseManaCost() NAME Interpreter::parseManaCost - parses out the actual manas SYNOPSIS void parseManaCost(string text, ref Card theCard, int effectNum); text --> string of mana, i.e "{B}{4}" DESCRIPTION Creates a string of numbers to represent mana RETURNS returns a string to represent the mana, i.e "{3}{0}{0}{0}{0}" */ /**/ private string parseManas(string text) { var testRegex = new Regex(MANACOLORS, RegexOptions.IgnoreCase); string total = ""; foreach (Match tom in testRegex.Matches(text)) { foreach (Group g in tom.Groups) { if (g.Value.Length == 1) { int attempt; if (int.TryParse(g.Value, out attempt)) { total += "0"; } switch (g.Value[0]) { case 'C': total += "6"; break; case 'W': total += "1"; break; case 'U': total += "2"; break; case 'B': total += "3"; break; case 'R': total += "4"; break; case 'G': total += "5"; break; } } } } return total; } /**/ /* Game::parseModal() Game::parseModal() NAME Interpreter::parseModal - parses modal abilities SYNOPSIS void parseModal(string[] text, ref Card theCard); text --> array of lines of textbox theCard --> the actual card to pasrse effectNum --> the number of the effect we're adding DESCRIPTION Seperates text by • and iterates through all of them, giving each option its own effect that will later be resolved RETURNS Nothing */ /**/ private void parseModal(string text, ref Card theCard, int effectNum) { string[] splitUp = text.Split('•'); theCard.sides[theCard.side].effects.Add(new Effect()); theCard.sides[theCard.side].effects[0].modal = true; theCard.sides[theCard.side].effects[0].whatDo[0] = (theCard.controller == 0) ? "human" : "opponent"; theCard.sides[theCard.side].effects[0].whatDo[1] = "no"; theCard.sides[theCard.side].effects[0].whatDo[2] = "modal"; theCard.sides[theCard.side].effects[0].whatDo[6] = ""; //skip the first element since that is the choosing number for (int i = 1; i < splitUp.Length; i++) { string[] tmp = splitUp[i].Split(' '); theCard.sides[theCard.side].effects[0].whatDo[6] += splitUp[i] + "|"; theCard.sides[theCard.side].effects.Add(new Effect()); theCard.sides[theCard.side].effects[i].modal = false; theCard.sides[theCard.side].effects[i].whatDo[0] = (theCard.controller == 0) ? "human" : "opponent"; theCard.sides[theCard.side].effects[i].whatDo[1] = "no"; if (i == 3) { theCard.sides[theCard.side].effects[i].whatDo[2] = "shuffle"; theCard.sides[theCard.side].effects[i].whatDo[5] = "graveyard"; } else { theCard.sides[theCard.side].effects[i].whatDo[2] = tmp[1]; theCard.sides[theCard.side].effects[i].whatDo[5] = ""; for (int k = 2; k < tmp.Length; k++) theCard.sides[theCard.side].effects[i].whatDo[5] += tmp[k] + " "; } } theCard.sides[theCard.side].effects.RemoveAt(theCard.sides[theCard.side].effects.Count - 1); } /**/ /* Game::parseOneshot() Game::parseOneshot() NAME Interpreter::parseOneshot - parses the oneshot effects that aren't on permanents SYNOPSIS void parseKeyword(string[] text, ref Card theCard); text --> array of lines of textbox theCard --> the actual card to pasrse DESCRIPTION uses the regex to parse out abilities RETURNS Nothing */ /**/ private void parseOneshot(string text, ref Card theCard) { //create the effect int effectNum = theCard.sides[theCard.side].effects.Count(); theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.OneShot; //This sees that the first words are which decides what kind of effect it is Regex effectReg = new Regex(@"((Target|Each)\s(.+))?\s?\b(" + string.Join("|", keywordActionsSpells.Select(Regex.Escape).ToArray()) + @")\b\s(.+)", RegexOptions.IgnoreCase); //finds out what is targeted Regex identify = new Regex(@"(.+)?(creature|creatures|lands|land|permanent|permanents|" + theCard.sides[theCard.side].name + @"|opponent|oppenents)(.+)?", RegexOptions.IgnoreCase); //if its a modal spell, go parse that seperately if (text.Contains('•')) { parseModal(text, ref theCard, effectNum); Console.WriteLine("Parsin modal"); } //there's only one noncreature kicker card else if (text.Contains("Kicker")) { theCard.sides[theCard.side].optionalCosts[0] = "Kicker"; theCard.sides[theCard.side].optionalCosts[1] = parseManas(text.Split(' ')[1]); //theCard.sides[theCard.side].optionalPaid = false; theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "player"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "get"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creatures"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "player"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "minus1 minus2"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Kicker"; } //there's only on noncreature landfall card else if (text.Contains("Landfall")) { theCard.sides[theCard.side].optionalCosts[0] = "Kicker"; theCard.sides[theCard.side].optionalCosts[1] = parseManas(text.Split(' ')[1]); //theCard.sides[theCard.side].optionalPaid = false; theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "get"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "plus2 plus4"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Landfall"; } //parses out the additional cost else if (text.Contains("As an additional cost")) { Match carl = effectReg.Match(text.Split('\n')[0]); theCard.sides[theCard.side].additionalCosts[0] = carl.Groups[4].Value; theCard.sides[theCard.side].additionalCosts[1] = carl.Groups[5].Value; if (text.Split('\n')[1].Split(' ')[0] != "Target") { theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "search"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "untapped"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "two basic lands"; } else { theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "gets"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "minusX"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Revealed"; } } //there's only one awaken card else if (text.Contains("Awaken")) { Match carl = effectReg.Match(text.Split('\n')[0]); theCard.sides[theCard.side].optionalCosts[0] = "Awaken"; theCard.sides[theCard.side].optionalCosts[1] = parseManas(text.Split('\n')[1].Split('(')[0]); // theCard.sides[theCard.side].optionalPaid = false; theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "destroy"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "tapped"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "destroy"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; effectNum++; theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.OneShot; theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "land"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "put"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "land"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "3 plus1 counters"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Awaken"; } //it's forked bolt else if (text.Contains("among")) { theCard.sides[theCard.side].effects[effectNum].targets[0] = "~"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "1 2"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "deal"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "player"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "2 divided"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = "Bolt"; } //the card destroys else if (text.Split(' ')[0] == "Destroy") { if (text.Split(' ')[1] == "each") { theCard.sides[theCard.side].effects[effectNum].whatDo[0] = "both"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "destroy"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creatures"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "<3cmc"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "each"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; } else { if (text.Split(' ')[2] == "nonblack") { theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "nonblack"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "destroy"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "nonblack"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; effectNum++; theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.OneShot; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "put"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "two 0/1"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; } else { theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "<3cmc"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "destroy"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = "<3cmc"; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; } } } //Read the Bones else if (text.Split(' ')[0] == "Scry") { theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "scry"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "2"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; effectNum++; theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.OneShot; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "draw"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "2"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; effectNum++; theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.OneShot; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "lose"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "2 life"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; } //only one card with tapping else if (text.Split(' ')[0] == "Tap") { theCard.sides[theCard.side].effects[effectNum].targets[0] = ">"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "2"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "tap"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creatures"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; effectNum++; theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.OneShot; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "draw"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "1"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; } //oust else if (text.Split(' ')[0] == "Put") { theCard.sides[theCard.side].effects[effectNum].targets[0] = "1"; theCard.sides[theCard.side].effects[effectNum].targets[1] = "creature"; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "put"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "creatures"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "owners library 2nd from top."; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; effectNum++; theCard.sides[theCard.side].effects.Insert(effectNum, new Effect()); theCard.sides[theCard.side].effects[effectNum].effect = EffectType.OneShot; theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "gain"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = "controller"; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "3 life"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; } //hellion eruption else if (text.Split(' ')[0] == "Sacrifice") { theCard.sides[theCard.side].effects[effectNum].whatDo[0] = (theCard.controller == 0) ? "human" : "oppenent"; theCard.sides[theCard.side].effects[effectNum].whatDo[1] = "no"; theCard.sides[theCard.side].effects[effectNum].whatDo[2] = "put"; theCard.sides[theCard.side].effects[effectNum].whatDo[3] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[4] = ""; theCard.sides[theCard.side].effects[effectNum].whatDo[5] = "that many hellions"; theCard.sides[theCard.side].effects[effectNum].whatDo[6] = ""; } else { Console.WriteLine(theCard.sides[theCard.side].name + " aint gettin' implmented"); } }