...
 
Commits (4)
......@@ -144,8 +144,6 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
if (lkicheck) {
game.getAction().checkStaticAbilities(false);
game.getTracker().unfreeze();
// reset owner for lki
card.setController(null, 0);
}
if (!(isInstant || activator.canCastSorcery() || flash || getRestrictions().isInstantSpeed()
......@@ -154,7 +152,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
return false;
}
if (!this.getRestrictions().canPlay(card, this)) {
if (!this.getRestrictions().canPlay(getHostCard(), this)) {
return false;
}
......
......@@ -3,10 +3,7 @@ package forge.screens.home.gengrid;
import forge.screens.home.genrenew.ColourWheel;
import forge.screens.home.genrenew.Format;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Properties;
import java.util.Random;
import java.util.*;
/**
* Created by AquamentosGames on 05/06/2018.
......@@ -28,6 +25,14 @@ public class GridArchetype {
public final GreatPool pool = new GreatPool(this);
public boolean hasWheel(RenColour rc){
return colourWheels.containsKey(rc);
}
public Set<RenColour> currentWheels(){
return colourWheels.keySet();
}
public GridColourWheel getWheel(RenColour rc) {
if (!colourWheels.containsKey(rc)) {
colourWheels.put(rc, new GridColourWheel(rc));
......@@ -404,6 +409,7 @@ public class GridArchetype {
s = s.replace("Player ","");
s = s.replace("Advance ","");
s = s.replace("Legacy ","");
s = s.replace("Opponent ","");
return s;
}
/*
......
......@@ -478,16 +478,21 @@ public class GridDeck {
return false;
}
public boolean addCard(GridCard gc, boolean main){
public boolean addCard(GridCard gc, boolean main) {
return addCard(gc, main, false);
}
public boolean addCard(GridCard gc, boolean main, boolean forceColour){
if (gc==null || gc.getCount() == 0 || gc.getCard()==null)
return false;
if (!tribe.set.format.isLegal(gc.getCard()))
return false;
if (tribe.archetype.isFaction() && offFaction(gc.getCard())){
return false;
}
if (!tribe.set.format.isLegal(gc.getCard())){
boolean legal = tribe.set.format.isLegal(gc.getCard());
if (legal && forceColour)
legal = tribe.colour.canPlay(gc.getCard());
if (!legal){
if (gc.getCard().getRules().getType().isLand()){
// add a different land
RenColour landc = RenColour.determineStrictColour(gc.getCard());
......@@ -608,9 +613,60 @@ public class GridDeck {
return count;
}
public boolean createPartialSeed(){
System.out.println("Trying partial seed: "+tribe.getViewName());
System.out.println("\t\t"+tribe.archetype.getCompName());
ArrayList<GridSeed> seeds = new ArrayList<>();
for (RenColour rc : tribe.archetype.seeds.keySet()) {
if (!rc.contains(tribe.colour) || tribe.archetype.seeds.get(rc).size() == 0)
continue;
if (tribe.archetype.seeds == null)
continue;
for (GridSeed gg : tribe.archetype.seeds.get(rc)) {
if (gg.determineColour().contains(tribe.colour) || tribe.colour.contains(gg.determineColour()))
seeds.add(gg);
}
}
if (seeds.size() == 0)
return false;
GridSeed seed = seeds.get(rand.nextInt(seeds.size()));
for (GridCard gc : seed.main){
addCard(new GridCard(gc.getCard(),gc.getCount()), true, true);
}
// if less than 60 it is presumed some cards were illegal so we are going to add in the sideboard.
// usually this is a format-shift issue
if (countDeck(true) < 50 && seed.side.size() > 0) {
for (GridCard gc : seed.side) {
addCard(new GridCard(gc.getCard(),gc.getCount()), true);
}
}
if (seed.side.size()>0) {
GridCard s = seed.side.get(rand.nextInt(seed.side.size()));
addCard(new GridCard(s.getCard(), s.getCount()), true);
}
fixCounts();
mutate();
if (determineColour() != tribe.colour){
GridDeck gd = new GridDeck(this.tribe, tribe.colour.subtract(determineColour()));
gd.createGenetics(true);
breedOver(gd);
}
return true;
}
public void createSeed(){
if (!tribe.archetype.seeds.containsKey(tribe.colour) ||
tribe.archetype.seeds.get(tribe.colour).size() == 0){
for (RenColour rc : tribe.archetype.seeds.keySet()){
if (tribe.archetype.seeds.containsKey(rc) &&
tribe.archetype.seeds.get(rc).size() > 0 &&
rc.contains(tribe.colour)
) {
if (createPartialSeed())
return;
}
}
createGenetics(true);
return;
}
......@@ -624,7 +680,7 @@ public class GridDeck {
seeds = tribe.archetype.seeds.get(tribe.colour);
GridSeed seed = seeds.get(rand.nextInt(seeds.size()));
for (GridCard gc : seed.main){
addCard(new GridCard(gc.getCard(),gc.getCount()), true);
addCard(new GridCard(gc.getCard(),gc.getCount()), true , true);
}
// if less than 60 it is presumed some cards were illegal so we are going to add in the sideboard.
// usually this is a format-shift issue
......@@ -859,12 +915,22 @@ public class GridDeck {
}
if (countDeck(true) == 0) {
if (tribe.archetype.isSeeded())
if (rand.nextInt(100)<60 || tribe.colour.getIdent().length < 2)
if (tribe.archetype.isSeeded()) {
boolean canMeld = false;
for (RenColour rc : tribe.colour.allSubIdents()){
if (tribe.archetype.hasWheel(rc)) {
canMeld = true;
break;
}
}
if (rand.nextInt(100) < 60 || tribe.colour.getIdent().length < 2 || !canMeld)
createSeed();
else
else {
System.out.println("Meld Arch");
createGenetics(true);
else
}
} else
createGenetics(true);
}
......@@ -1524,7 +1590,7 @@ public class GridDeck {
if (tribe.colour == RenColour.Colourless && pc.getRules().getType().isLand())
pc = null;
if (pc != null && !allowMut && tribe.getRunCount()<10) {
if (pc != null && !allowMut && tribe.getRunCount()<10 && !pc.getRules().getType().isBasicLand()) {
boolean editionOK = pc.getEdition().equals(tribe.set.setName) || pc.getEdition().equals(GridTourney.activeTourney.coreProperties.getProperty("NewestSet", ""));
......
......@@ -592,6 +592,8 @@ public class GridSet {
public void loadArchetypes(GridTourney rt){
if (allowedColours.getIdent().length < 2)
return;
if (format.ordinal() > rt.highestBase.ordinal())
return;
GridUtilities.Log("init","Loading Archetypes for: "+this.setName);
String[] archId = GridUtilities.getDirs(String.format("%s", getSetDir()));
......
......@@ -24,7 +24,7 @@ public class GridTourney implements Runnable {
public static final boolean viewGames = true;
public static ArchID forceArch = null;//new ArchID(GridFormat.Year, RenColour.Dimir, "Surveil");
public static GridFormat highestBase = GridFormat.Standard;
public static GridFormat highestBase = GridFormat.Origin;
public static final boolean loadPreBase = false;//ShivaUtility.rand.nextBoolean();
public static final boolean loadDerp = false;// !viewGames;
public static boolean useAdjustedForBest = true;//doBestDeck ? false : true;//!viewGames;
......@@ -230,14 +230,15 @@ public class GridTourney implements Runnable {
if (setList.size() > 0 && !doBestDeck && !doBestTribe) {
System.out.println("Cap: " + cap + "\t" + set.setName + "\t" + gf.name());
for (GridSet gs : setList) {
if (rand.nextInt(100)<40)
/*for (GridSet gs : setList) {
if (rand.nextInt(100) > 2)
continue;
if (gs.format.ordinal() < gf.ordinal()) {
gf = gs.format;
set = gs;
}
}
}*/
System.out.println("\t\t"+set.setName+"\t"+gf.name());
//gf = GridFormat.Arena;
mini = true;
GridTribe.tribeList.sort(GridTribe.tribeAdjustedRunComparator);
......
......@@ -372,6 +372,18 @@ public class GridUtilities {
return true;
if (checkTheme(pc, "Golgari"))
return true;
if (checkTheme(pc, "Dovin"))
return true;
if (checkTheme(pc, "Kaya"))
return true;
if (checkTheme(pc, "Domri"))
return true;
if (checkTheme(pc, "Azorius"))
return true;
if (checkTheme(pc, "Orzhov"))
return true;
if (checkTheme(pc, "Gruul"))
return true;
}
if (theme.equals("Nicol Bolas") && checkTheme(pc, "God") && checkTheme(pc, "Pharoah"))
return true;
......
......@@ -3,8 +3,8 @@ ManaCost:1 G
Types:Creature Elf Druid
PT:0/2
K:Adapt:3:3 G G
A:AB$ ManaReflected | Cost$ T | ColorOrType$ Type | Valid$ Land.YouCtrl | Amount$ IncubationAmount | ReflectProperty$ Produce | SpellDescription$ Add one mana of any type that a land you control could produce. If CARDNAME has a +1/+1 counter on it, add three mana of that type instead.
A:AB$ ManaReflected | Cost$ T | ColorOrType$ Type | Valid$ Land.YouCtrl | Amount$ Inc | ReflectProperty$ Produce | SpellDescription$ Add one mana of any type that a land you control could produce. If CARDNAME has a +1/+1 counter on it, add three mana of that type instead.
SVar:Inc:Count$Compare Y GE1.3.1
SVar:Y:Count$Valid Card.Self+counters_GE1_P1P1
SVar:IncubationAmount:Count$Compare Y GE1.3.1
DeckHas:Ability$Counters
Oracle:{T}: Add one mana of any type that a land you control could produce. If Incubation Druid has a +1/+1 counter on it, add three mana of that type instead.\n{3}{G}{G}: Adapt 3. (If this creature has no +1/+1 counters on it, put three +1/+1 counters on it.)
Name:Macabre Hatchery
ManaCost:3 B B
Types:Sorcery
A:SP$ ChooseCard | Cost$ 3 B B | Choices$ Creature.YouCtrl.cmcEQ1 | ChoiceZone$ Graveyard | RememberChosen$ True | SubAbility$ DBChooseCard2
SVar:DBChooseCard2:DB$ ChooseCard | Choices$ Creature.YouCtrl.cmcEQ2 | ChoiceZone$ Graveyard | RememberChosen$ True | SubAbility$ DBChooseCard3
SVar:DBChooseCard3:DB$ ChooseCard | Choices$ Creature.YouCtrl.cmcEQ3 | ChoiceZone$ Graveyard | RememberChosen$ True | SubAbility$ DBReturn
SVar:DBReturn:DB$ ChangeZoneAll | ChangeType$ Card.IsRemembered | Origin$ Graveyard | Destination$ Battlefield | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearChosenCard$ True
Oracle:Choose a creature card with converted mana cost 1 in your graveyard, then do the same for a creature card with converted mana cost 2 and 3. Return those cards to the battlefield.
\ No newline at end of file