mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Added Odds//Ends
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -7324,6 +7324,7 @@ res/cardsfolder/o/obstinate_familiar.txt -text
|
|||||||
res/cardsfolder/o/obzedat_ghost_council.txt -text
|
res/cardsfolder/o/obzedat_ghost_council.txt -text
|
||||||
res/cardsfolder/o/ocular_halo.txt svneol=native#text/plain
|
res/cardsfolder/o/ocular_halo.txt svneol=native#text/plain
|
||||||
res/cardsfolder/o/oculus.txt svneol=native#text/plain
|
res/cardsfolder/o/oculus.txt svneol=native#text/plain
|
||||||
|
res/cardsfolder/o/odds_ends.txt -text
|
||||||
res/cardsfolder/o/odious_trow.txt svneol=native#text/plain
|
res/cardsfolder/o/odious_trow.txt svneol=native#text/plain
|
||||||
res/cardsfolder/o/odylic_wraith.txt svneol=native#text/plain
|
res/cardsfolder/o/odylic_wraith.txt svneol=native#text/plain
|
||||||
res/cardsfolder/o/off_balance.txt svneol=native#text/plain
|
res/cardsfolder/o/off_balance.txt svneol=native#text/plain
|
||||||
|
|||||||
18
res/cardsfolder/o/odds_ends.txt
Normal file
18
res/cardsfolder/o/odds_ends.txt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
Name:Odds
|
||||||
|
ManaCost:U R
|
||||||
|
AlternateMode: Split
|
||||||
|
Types:Instant
|
||||||
|
A:SP$ FlipACoin | Cost$ U R | NoCall$ True | HeadsSubAbility$ OddCounter | TailsSubAbility$ OddCopy | TgtZone$ Stack | TargetType$ Spell | ValidTgts$ Instant,Sorcery | TgtPrompt$ Select target Instant or Sorcery spell | SpellDescription$ Flip a coin. If it comes up heads, counter target instant or sorcery spell. If it comes up tails, copy that spell and you may choose new targets for the copy.
|
||||||
|
SVar:OddCounter:DB$ Counter | Defined$ Targeted
|
||||||
|
SVar:OddCopy:DB$ CopySpellAbility | Defined$ Targeted
|
||||||
|
SVar:Picture:http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=107445&type=card
|
||||||
|
Oracle:Flip a coin. If it comes up heads, counter target instant or sorcery spell. If it comes up tails, copy that spell and you may choose new targets for the copy.
|
||||||
|
|
||||||
|
ALTERNATE
|
||||||
|
|
||||||
|
Name:Ends
|
||||||
|
ManaCost:3 R W
|
||||||
|
Types:Instant
|
||||||
|
A:SP$ Sacrifice | Cost$ 3 R W | ValidTgts$ Player | TgtPrompt$ Select target player to make sacrifice | Amount$ 2 | SacValid$ Creature.attacking | SpellDescription$ Target player sacrifices two attacking creatures.
|
||||||
|
Oracle:Target player sacrifices two attacking creatures.
|
||||||
|
SetInfo:DIS Rare
|
||||||
@@ -4,6 +4,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
@@ -24,10 +26,12 @@ import forge.game.GameActionUtil;
|
|||||||
import forge.game.GameState;
|
import forge.game.GameState;
|
||||||
import forge.game.ai.ComputerUtil;
|
import forge.game.ai.ComputerUtil;
|
||||||
import forge.game.ai.ComputerUtilCost;
|
import forge.game.ai.ComputerUtilCost;
|
||||||
|
import forge.game.event.FlipCoinEvent;
|
||||||
import forge.game.player.AIPlayer;
|
import forge.game.player.AIPlayer;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.util.Expressions;
|
import forge.util.Expressions;
|
||||||
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for this type.
|
* TODO: Write javadoc for this type.
|
||||||
@@ -1253,4 +1257,28 @@ public class AbilityUtils {
|
|||||||
return CardFactoryUtil.xCount(c, s);
|
return CardFactoryUtil.xCount(c, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* flipACoin without call.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
* a {@link forge.Card} object.
|
||||||
|
* @return a boolean.
|
||||||
|
*/
|
||||||
|
public static boolean flipCoin(final Card source) {
|
||||||
|
final boolean resultIsHeads = MyRandom.getRandom().nextBoolean();
|
||||||
|
|
||||||
|
Singletons.getModel().getGame().getEvents().post(new FlipCoinEvent());
|
||||||
|
final StringBuilder msgTitle = new StringBuilder();
|
||||||
|
msgTitle.append(source);
|
||||||
|
msgTitle.append(" Flip result:");
|
||||||
|
final StringBuilder result = new StringBuilder();
|
||||||
|
result.append("Flip comes up");
|
||||||
|
result.append(resultIsHeads ? " heads." : " tails.");
|
||||||
|
JOptionPane.showMessageDialog(null, result, msgTitle.toString(), JOptionPane.PLAIN_MESSAGE);
|
||||||
|
|
||||||
|
return resultIsHeads;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,11 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
|||||||
caller.add(player);
|
caller.add(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean victory = GuiDialog.flipCoin(caller.get(0), sa.getSourceCard());
|
final boolean noCall = sa.hasParam("NoCall");
|
||||||
|
boolean victory = false;
|
||||||
|
if (!noCall) {
|
||||||
|
victory = GuiDialog.flipCoin(caller.get(0), sa.getSourceCard());
|
||||||
|
}
|
||||||
|
|
||||||
// Run triggers
|
// Run triggers
|
||||||
// HashMap<String,Object> runParams = new HashMap<String,Object>();
|
// HashMap<String,Object> runParams = new HashMap<String,Object>();
|
||||||
@@ -46,30 +50,53 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
|||||||
host.addRemembered(host);
|
host.addRemembered(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (victory) {
|
if (noCall) {
|
||||||
if (sa.getParam("RememberWinner") != null) {
|
final boolean resultIsHeads = AbilityUtils.flipCoin(sa.getSourceCard());
|
||||||
host.addRemembered(host);
|
|
||||||
}
|
|
||||||
if (sa.hasParam("WinSubAbility")) {
|
|
||||||
final SpellAbility win = AbilityFactory.getAbility(host.getSVar(sa.getParam("WinSubAbility")), host);
|
|
||||||
win.setActivatingPlayer(player);
|
|
||||||
((AbilitySub) win).setParent(sa);
|
|
||||||
|
|
||||||
AbilityUtils.resolve(win, false);
|
System.out.println("Flipped coin result:" + (resultIsHeads ? " Heads" : " Tails"));
|
||||||
|
if (resultIsHeads) {
|
||||||
|
if (sa.hasParam("HeadsSubAbility")) {
|
||||||
|
final SpellAbility heads = AbilityFactory.getAbility(host.getSVar(sa.getParam("HeadsSubAbility")), host);
|
||||||
|
heads.setActivatingPlayer(player);
|
||||||
|
((AbilitySub) heads).setParent(sa);
|
||||||
|
|
||||||
|
AbilityUtils.resolve(heads, false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (sa.hasParam("TailsSubAbility")) {
|
||||||
|
final SpellAbility tails = AbilityFactory.getAbility(host.getSVar(sa.getParam("TailsSubAbility")), host);
|
||||||
|
tails.setActivatingPlayer(player);
|
||||||
|
((AbilitySub) tails).setParent(sa);
|
||||||
|
|
||||||
|
AbilityUtils.resolve(tails, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// runParams.put("Won","True");
|
|
||||||
} else {
|
} else {
|
||||||
if (sa.getParam("RememberLoser") != null) {
|
if (victory) {
|
||||||
host.addRemembered(host);
|
if (sa.getParam("RememberWinner") != null) {
|
||||||
}
|
host.addRemembered(host);
|
||||||
if (sa.hasParam("LoseSubAbility")) {
|
}
|
||||||
final SpellAbility lose = AbilityFactory.getAbility(host.getSVar(sa.getParam("LoseSubAbility")), host);
|
if (sa.hasParam("WinSubAbility")) {
|
||||||
lose.setActivatingPlayer(player);
|
final SpellAbility win = AbilityFactory.getAbility(host.getSVar(sa.getParam("WinSubAbility")), host);
|
||||||
((AbilitySub) lose).setParent(sa);
|
win.setActivatingPlayer(player);
|
||||||
|
((AbilitySub) win).setParent(sa);
|
||||||
|
|
||||||
AbilityUtils.resolve(lose, false);
|
AbilityUtils.resolve(win, false);
|
||||||
|
}
|
||||||
|
// runParams.put("Won","True");
|
||||||
|
} else {
|
||||||
|
if (sa.getParam("RememberLoser") != null) {
|
||||||
|
host.addRemembered(host);
|
||||||
|
}
|
||||||
|
if (sa.hasParam("LoseSubAbility")) {
|
||||||
|
final SpellAbility lose = AbilityFactory.getAbility(host.getSVar(sa.getParam("LoseSubAbility")), host);
|
||||||
|
lose.setActivatingPlayer(player);
|
||||||
|
((AbilitySub) lose).setParent(sa);
|
||||||
|
|
||||||
|
AbilityUtils.resolve(lose, false);
|
||||||
|
}
|
||||||
|
// runParams.put("Won","False");
|
||||||
}
|
}
|
||||||
// runParams.put("Won","False");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AllZone.getTriggerHandler().runTrigger("FlipsACoin",runParams);
|
// AllZone.getTriggerHandler().runTrigger("FlipsACoin",runParams);
|
||||||
|
|||||||
Reference in New Issue
Block a user