mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Added Conditions to AF (currently only for Damage, and the AI does not take Conditions into consideration)
- Convert Molten Rain to Condition - Convert Hexmage to Modern Cost/Target
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
Name:Molten Rain
|
Name:Molten Rain
|
||||||
ManaCost:1 R R
|
ManaCost:1 R R
|
||||||
Types:Sorcery
|
Types:Sorcery
|
||||||
Text:Destroy target land. If that land is nonbasic, Molten Rain deals 2 damage to the land's controller.
|
Text:no text
|
||||||
|
A:SP$ Destroy | Cost$ 1 R R | ValidTgts$ Land | TgtPrompt$ Select target land | SubAbility$ SVar=DBDamage | SpellDescription$ Destroy target land. If that land is nonbasic, Molten Rain deals 2 damage to the land's controller.
|
||||||
|
SVar:DBDamage:DB$ DealDamage | Defined$ TargetedController | NumDmg$ 2 | ConditionDefined$ Targeted | ConditionPresent$ Land.Basic | ConditionCompare$ EQ0 | ConditionDescription $ If that land is nonbasic,
|
||||||
SVar:Rarity:Common
|
SVar:Rarity:Common
|
||||||
SVar:Picture:http://resources.wizards.com/magic/cards/mrd/en-us/card46000.jpg
|
SVar:Picture:http://resources.wizards.com/magic/cards/mrd/en-us/card46000.jpg
|
||||||
SetInfo:MRD|Common|http://magiccards.info/scans/en/mi/101.jpg
|
SetInfo:MRD|Common|http://magiccards.info/scans/en/mi/101.jpg
|
||||||
|
|||||||
@@ -998,7 +998,6 @@ public class AbilityFactory {
|
|||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static ArrayList<Player> getDefinedPlayers(Card card, String def, SpellAbility sa){
|
public static ArrayList<Player> getDefinedPlayers(Card card, String def, SpellAbility sa){
|
||||||
ArrayList<Player> players = new ArrayList<Player>();
|
ArrayList<Player> players = new ArrayList<Player>();
|
||||||
String defined = (def == null) ? "You" : def;
|
String defined = (def == null) ? "You" : def;
|
||||||
@@ -1186,6 +1185,52 @@ public class AbilityFactory {
|
|||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean checkConditional(HashMap<String,String> params, SpellAbility sa){
|
||||||
|
// ConditionPresent is required. Other paramaters are optional.
|
||||||
|
// ConditionDefined$ What cardlist we will be comparing (Triggered, Valid, Targeted etc)
|
||||||
|
// ConditionPresent$ Similar to IsPresent, but the Condition is checked on Resolution, not Activation
|
||||||
|
// ConditionCompare$ Similar to PresentCompare, but the Condition is checked on Resolution, not Activation
|
||||||
|
// ConditionDescription$ Not used here, but can be used in StackDescription
|
||||||
|
|
||||||
|
String present = params.get("ConditionPresent");
|
||||||
|
if (present == null) // If CP doesn't exist, return true
|
||||||
|
return true;
|
||||||
|
|
||||||
|
String compare = params.get("ConditionCompare");
|
||||||
|
if (compare == null) // Compare defaults to "Does this exist?"
|
||||||
|
compare = "GE1";
|
||||||
|
|
||||||
|
String defined = params.get("ConditionDefined");
|
||||||
|
CardList list;
|
||||||
|
if (defined == null)
|
||||||
|
list = AllZoneUtil.getCardsInPlay();
|
||||||
|
else{
|
||||||
|
list = new CardList(AbilityFactory.getDefinedCards(sa.getSourceCard(), defined, sa));
|
||||||
|
}
|
||||||
|
|
||||||
|
list = list.getValidCards(present.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||||
|
|
||||||
|
int right;
|
||||||
|
String rightString = compare.substring(2);
|
||||||
|
try{ // If this is an Integer, just parse it
|
||||||
|
right = Integer.parseInt(rightString);
|
||||||
|
}
|
||||||
|
catch(NumberFormatException e){ // Otherwise, grab it from the SVar
|
||||||
|
right = CardFactoryUtil.xCount(sa.getSourceCard(), sa.getSourceCard().getSVar(rightString));
|
||||||
|
}
|
||||||
|
|
||||||
|
int left = list.size();
|
||||||
|
|
||||||
|
return Card.compare(left, compare, right);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void resolveSubAbility(SpellAbility sa){
|
||||||
|
Ability_Sub abSub = sa.getSubAbility();
|
||||||
|
if (abSub != null){
|
||||||
|
abSub.resolve();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void handleRemembering(AbilityFactory AF)
|
public static void handleRemembering(AbilityFactory AF)
|
||||||
{
|
{
|
||||||
HashMap<String,String> params = AF.getMapParams();
|
HashMap<String,String> params = AF.getMapParams();
|
||||||
|
|||||||
@@ -139,8 +139,13 @@ public class AbilityFactory_DealDamage {
|
|||||||
tgts = sa.getTarget().getTargets();
|
tgts = sa.getTarget().getTargets();
|
||||||
|
|
||||||
if (!(sa instanceof Ability_Sub))
|
if (!(sa instanceof Ability_Sub))
|
||||||
sb.append(name).append(" - ");
|
sb.append(name).append(" -");
|
||||||
|
sb.append(" ");
|
||||||
|
|
||||||
|
String conditionDesc = af.getMapParams().get("ConditionDescription");
|
||||||
|
if (conditionDesc != null)
|
||||||
|
sb.append(conditionDesc).append(" ");
|
||||||
|
|
||||||
ArrayList<Card> definedSources = AbilityFactory.getDefinedCards(sa.getSourceCard(), af.getMapParams().get("DamageSource"), sa);
|
ArrayList<Card> definedSources = AbilityFactory.getDefinedCards(sa.getSourceCard(), af.getMapParams().get("DamageSource"), sa);
|
||||||
Card source = definedSources.get(0);
|
Card source = definedSources.get(0);
|
||||||
|
|
||||||
@@ -502,8 +507,13 @@ public class AbilityFactory_DealDamage {
|
|||||||
|
|
||||||
private void doResolve(SpellAbility saMe)
|
private void doResolve(SpellAbility saMe)
|
||||||
{
|
{
|
||||||
int dmg = getNumDamage(saMe);
|
|
||||||
HashMap<String,String> params = AF.getMapParams();
|
HashMap<String,String> params = AF.getMapParams();
|
||||||
|
if (!AbilityFactory.checkConditional(params, saMe)){
|
||||||
|
AbilityFactory.resolveSubAbility(saMe);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dmg = getNumDamage(saMe);
|
||||||
|
|
||||||
boolean noPrevention = params.containsKey("NoPrevention");
|
boolean noPrevention = params.containsKey("NoPrevention");
|
||||||
|
|
||||||
@@ -540,28 +550,7 @@ public class AbilityFactory_DealDamage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AF.hasSubAbility()){
|
AbilityFactory.resolveSubAbility(saMe);
|
||||||
Ability_Sub abSub = saMe.getSubAbility();
|
|
||||||
if (abSub != null){
|
|
||||||
abSub.resolve();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Object obj = tgts.get(0);
|
|
||||||
|
|
||||||
Player pl = null;
|
|
||||||
Card c = null;
|
|
||||||
|
|
||||||
if (obj instanceof Card){
|
|
||||||
c = (Card)obj;
|
|
||||||
pl = c.getController();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
pl = (Player)obj;
|
|
||||||
}
|
|
||||||
CardFactoryUtil.doDrawBack(params.get("SubAbility"), dmg, AF.getHostCard().getController(),
|
|
||||||
AF.getHostCard().getController().getOpponent(), pl, AF.getHostCard(), c, saMe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ******************************************************************************************************
|
// ******************************************************************************************************
|
||||||
|
|||||||
@@ -4152,9 +4152,13 @@ public class CardFactory_Creatures {
|
|||||||
/*
|
/*
|
||||||
* Sacrifice Vampire Hexmage: Remove all counters from target permanent.
|
* Sacrifice Vampire Hexmage: Remove all counters from target permanent.
|
||||||
*/
|
*/
|
||||||
final SpellAbility ability = new Ability(card, "0") {
|
|
||||||
|
|
||||||
@Override
|
Cost cost = new Cost("Sac<1/CARDNAME>", cardName, true);
|
||||||
|
final Target tgt = new Target(card, "Select a permanent", "Permanent".split(","));
|
||||||
|
final SpellAbility ability = new Ability_Activated(card, cost, tgt) {
|
||||||
|
private static final long serialVersionUID = -5084369399105353155L;
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
|
|
||||||
//Dark Depths:
|
//Dark Depths:
|
||||||
@@ -4168,7 +4172,7 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
if (list.size()>0)
|
if (list.size()>0)
|
||||||
{
|
{
|
||||||
setTargetCard(list.get(0));
|
tgt.addTarget(list.get(0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4183,17 +4187,12 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
if (list.size()>0)
|
if (list.size()>0)
|
||||||
{
|
{
|
||||||
setTargetCard(list.get(0));
|
tgt.addTarget(list.get(0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlay() {
|
|
||||||
return AllZoneUtil.isCardInPlay(card) && super.canPlay();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
@@ -4203,11 +4202,9 @@ public class CardFactory_Creatures {
|
|||||||
c.setCounter(counter, 0, false);
|
c.setCounter(counter, 0, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AllZone.GameAction.sacrifice(card);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
card.addSpellAbility(ability);
|
card.addSpellAbility(ability);
|
||||||
ability.setBeforePayMana(CardFactoryUtil.input_targetPermanent(ability));
|
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
|
|||||||
@@ -44,35 +44,8 @@ public class CardFactory_Sorceries {
|
|||||||
public static Card getCard(final Card card, final String cardName, Player owner)
|
public static Card getCard(final Card card, final String cardName, Player owner)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
if(cardName.equals("Molten Rain")) {
|
if(cardName.equals("Political Trickery")) {
|
||||||
final SpellAbility spell = new Spell(card) {
|
|
||||||
private static final long serialVersionUID = 8855786097956610090L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
Card c = getTargetCard();
|
|
||||||
if(AllZoneUtil.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) {
|
|
||||||
if(!c.getType().contains("Basic")) c.getController().addDamage(2, card);
|
|
||||||
AllZone.GameAction.destroy(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
}// resolve()
|
|
||||||
|
|
||||||
};// Spell
|
|
||||||
|
|
||||||
// Do not remove SpellAbilities created by AbilityFactory or Keywords.
|
|
||||||
card.clearFirstSpellAbility();
|
|
||||||
card.addSpellAbility(spell);
|
|
||||||
|
|
||||||
spell.setChooseTargetAI(CardFactoryUtil.AI_targetType("Land", AllZone.Human_Battlefield));
|
|
||||||
spell.setBeforePayMana(CardFactoryUtil.input_targetType(spell, "Land"));
|
|
||||||
}// *************** END ************ END **************************
|
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
|
||||||
else if(cardName.equals("Political Trickery")) {
|
|
||||||
final Card[] target = new Card[2];
|
final Card[] target = new Card[2];
|
||||||
final int[] index = new int[1];
|
final int[] index = new int[1];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user