mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Added Regenerate: B to Mortivore.
- Fixed a bug with Cascade and abilities triggering on casting spells.
This commit is contained in:
@@ -5,6 +5,7 @@ package forge;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
@@ -14285,6 +14286,60 @@ public class CardFactory_Creatures {
|
||||
};
|
||||
card.clearSpellAbility();
|
||||
card.addSpellAbility(spell);
|
||||
|
||||
final Command untilEOT = new Command() {
|
||||
private static final long serialVersionUID = 8163158247122311120L;
|
||||
|
||||
public void execute() {
|
||||
card.setShield(0);
|
||||
}
|
||||
};
|
||||
|
||||
final SpellAbility a1 = new Ability(card, "B") {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
if(CardFactoryUtil.AI_isMainPhase()) {
|
||||
if(CardFactoryUtil.AI_doesCreatureAttack(card)) {
|
||||
|
||||
int weight[] = new int[3];
|
||||
|
||||
if(card.getKeyword().size() > 0) weight[0] = 75;
|
||||
else weight[0] = 0;
|
||||
|
||||
CardList HandList = new CardList(AllZone.getZone(Constant.Zone.Hand,
|
||||
Constant.Player.Computer).getCards());
|
||||
|
||||
if(HandList.size() >= 4) weight[1] = 25;
|
||||
else weight[1] = 75;
|
||||
|
||||
int hCMC = 0;
|
||||
for(int i = 0; i < HandList.size(); i++)
|
||||
if(CardUtil.getConvertedManaCost(HandList.getCard(i).getManaCost()) > hCMC) hCMC = CardUtil.getConvertedManaCost(HandList.getCard(
|
||||
i).getManaCost());
|
||||
|
||||
CardList LandList = new CardList(AllZone.getZone(Constant.Zone.Play,
|
||||
Constant.Player.Computer).getCards());
|
||||
LandList = LandList.getType("Land");
|
||||
|
||||
if(hCMC + 2 >= LandList.size()) weight[2] = 50;
|
||||
else weight[2] = 0;
|
||||
|
||||
int aw = (weight[0] + weight[1] + weight[2]) / 3;
|
||||
Random r = new Random();
|
||||
if(r.nextInt(100) <= aw) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
card.addShield();
|
||||
AllZone.EndOfTurn.addUntil(untilEOT);
|
||||
}
|
||||
}; //SpellAbility
|
||||
a1.setDescription("Regenerate: B");
|
||||
card.addSpellAbility(a1);
|
||||
}
|
||||
//*************** END ************ END **************************
|
||||
|
||||
|
||||
@@ -104,6 +104,8 @@ public class GameActionUtil {
|
||||
// (called in MagicStack.java)
|
||||
Card c = sa.getSourceCard();
|
||||
|
||||
playCard_Cascade(c);
|
||||
|
||||
playCard_Dovescape(c); //keep this one top
|
||||
playCard_Demigod_of_Revenge(c);
|
||||
playCard_Halcyon_Glaze(c);
|
||||
@@ -144,7 +146,7 @@ public class GameActionUtil {
|
||||
playCard_Mold_Adder(c);
|
||||
playCard_Fable_of_Wolf_and_Owl(c);
|
||||
|
||||
playCard_Cascade(c);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user