- The "Chooser" parameter now works as expected with triggered abilities.

- Converted Ghastlord of Fugue to script.
This commit is contained in:
jendave
2011-08-06 22:50:45 +00:00
parent 2baaaac16a
commit c12eccc1a0
3 changed files with 14 additions and 66 deletions

View File

@@ -1,9 +1,11 @@
Name:Ghastlord of Fugue
ManaCost:UB UB UB UB UB
Types:Creature Spirit Avatar
Text:Whenever Ghastlord of Fugue deals combat damage to a player, that player reveals his or her hand. You choose a card from it. That player exiles that card.
Text:no text
PT:4/4
K:Unblockable
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigChangeZone | TriggerZones$ Battlefield | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, that player reveals his or her hand. You choose a card from it. That player exiles that card.
SVar:TrigChangeZone:AB$ChangeZone | Cost$ 0 | Origin$ Hand | Destination$ Exile | Defined$ TriggeredTarget | Chooser$ You | ChangeType$ Card | ChangeNum$ 1
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/ghastlord_of_fugue.jpg
SetInfo:SHM|Rare|http://magiccards.info/scans/en/shm/162.jpg

View File

@@ -2619,8 +2619,7 @@ public class GameActionUtil {
}//isEquipped
if(c.getName().equals("Ghastlord of Fugue")) playerCombatDamage_Ghastlord_of_Fugue(c);
else if(c.getName().equals("Scalpelexis")) playerCombatDamage_Scalpelexis(c);
if(c.getName().equals("Scalpelexis")) playerCombatDamage_Scalpelexis(c);
else if(c.getName().equals("Augury Adept")) playerCombatDamage_Augury_Adept(c);
else if(c.getName().equals("Spawnwrithe")) playerCombatDamage_Spawnwrithe(c);
else if(c.getName().equals("Rootwater Thief")) playerCombatDamage_Rootwater_Thief(c);
@@ -2675,54 +2674,6 @@ public class GameActionUtil {
}
private static void playerCombatDamage_Ghastlord_of_Fugue(Card c) {
final Player player = c.getController();
final Player opponent = player.getOpponent();
if(c.getNetAttack() > 0) {
Ability ability2 = new Ability(c, "0") {
@Override
public void resolve() {
Card choice = null;
//check for no cards in hand on resolve
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, opponent);
Card[] handChoices = removeLand(hand.getCards());
if(handChoices.length == 0) return;
//human chooses
if(opponent.equals(AllZone.ComputerPlayer)) {
choice = GuiUtils.getChoice("Choose", handChoices);
} else//computer chooses
{
choice = CardUtil.getRandom(handChoices); // wise choice should be here
}
AllZone.GameAction.exile(choice);
}//resolve()
@Override
public boolean canPlayAI() {
Card[] c = removeLand(AllZone.Human_Hand.getCards());
return 0 < c.length;
}
Card[] removeLand(Card[] in) {
return in;
}//removeLand()
};// ability2
StringBuilder sb = new StringBuilder();
sb.append(c.getName()).append(" - ").append("opponent discards a card.");
ability2.setStackDescription(sb.toString());
AllZone.Stack.addSimultaneousStackEntry(ability2);
}
} //Ghastlord of Fugue
private static void playerCombatDamage_Rootwater_Thief(Card c) {
SpellAbility[] sa = c.getSpellAbility();

View File

@@ -470,35 +470,34 @@ public class AbilityFactory_ChangeZone {
HashMap<String,String> params = af.getMapParams();
ArrayList<Player> fetchers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
Player chooser = null;
if (params.containsKey("Chooser")) {
if (params.get("Chooser").equals("Targeted") && af.getAbTgt().getTargetPlayers() != null)
fetchers = af.getAbTgt().getTargetPlayers();
else fetchers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Chooser"), sa);
chooser = af.getAbTgt().getTargetPlayers().get(0);
else chooser = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Chooser"), sa).get(0);
}
for(Player player : fetchers){
if (player.isComputer()){
changeHiddenOriginResolveAI(af, sa);
if (chooser == null)
chooser = player;
if (chooser.isComputer()){
changeHiddenOriginResolveAI(af, sa, player);
}
else{
changeHiddenOriginResolveHuman(af, sa);
changeHiddenOriginResolveHuman(af, sa, player);
}
}
}
private static void changeHiddenOriginResolveHuman(AbilityFactory af, SpellAbility sa){
private static void changeHiddenOriginResolveHuman(AbilityFactory af, SpellAbility sa, Player player){
HashMap<String,String> params = af.getMapParams();
Card card = af.getHostCard();
Target tgt = af.getAbTgt();
Player player;
if (tgt != null){
player = tgt.getTargetPlayers().get(0);
if (!player.canTarget(sa.getSourceCard()))
return;
}
else{
player = AllZone.HumanPlayer;
}
String origin = params.get("Origin");
String destination = params.get("Destination");
@@ -574,20 +573,16 @@ public class AbilityFactory_ChangeZone {
}
}
private static void changeHiddenOriginResolveAI(AbilityFactory af, SpellAbility sa){
private static void changeHiddenOriginResolveAI(AbilityFactory af, SpellAbility sa, Player player){
HashMap<String,String> params = af.getMapParams();
Target tgt = af.getAbTgt();
Card card = af.getHostCard();
Player player;
if (tgt != null){
player = tgt.getTargetPlayers().get(0);
if (!player.canTarget(sa.getSourceCard()))
return;
}
else{
player = AllZone.ComputerPlayer;
}
String origin = params.get("Origin");