mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Added Chance Encounter
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1646,6 +1646,7 @@ res/cardsfolder/c/champion_of_the_parish.txt -text
|
||||
res/cardsfolder/c/champions_drake.txt svneol=native#text/plain
|
||||
res/cardsfolder/c/champions_helm.txt svneol=native#text/plain
|
||||
res/cardsfolder/c/champions_victory.txt svneol=native#text/plain
|
||||
res/cardsfolder/c/chance_encounter.txt -text
|
||||
res/cardsfolder/c/chancellor_of_the_dross.txt -text
|
||||
res/cardsfolder/c/chancellor_of_the_forge.txt -text
|
||||
res/cardsfolder/c/chancellor_of_the_spires.txt -text
|
||||
@@ -13867,6 +13868,7 @@ src/main/java/forge/card/trigger/TriggerDestroyed.java -text
|
||||
src/main/java/forge/card/trigger/TriggerDevoured.java -text
|
||||
src/main/java/forge/card/trigger/TriggerDiscarded.java svneol=native#text/plain
|
||||
src/main/java/forge/card/trigger/TriggerDrawn.java svneol=native#text/plain
|
||||
src/main/java/forge/card/trigger/TriggerFlipped.java -text
|
||||
src/main/java/forge/card/trigger/TriggerHandler.java svneol=native#text/plain
|
||||
src/main/java/forge/card/trigger/TriggerLandPlayed.java svneol=native#text/plain
|
||||
src/main/java/forge/card/trigger/TriggerLifeGained.java svneol=native#text/plain
|
||||
|
||||
11
res/cardsfolder/c/chance_encounter.txt
Normal file
11
res/cardsfolder/c/chance_encounter.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Name:Chance Encounter
|
||||
ManaCost:2 R R
|
||||
Types:Enchantment
|
||||
T:Mode$ Flipped | ValidPlayer$ You | ValidResult$ Win | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ Whenever you win a coin flip, put a luck counter on CARDNAME.
|
||||
SVar:TrigPutCounter:AB$ PutCounter | Cost$ 0 | CounterType$ LUCK | CounterNum$ 1
|
||||
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | IsPresent$ Card.Self+counters_GE10_LUCK | Execute$ TrigWin | TriggerDescription$ At the beginning of your upkeep, if CARDNAME has ten or more luck counters on it, you win the game.
|
||||
SVar:TrigWin:AB$ WinsGame | Cost$ 0 | Defined$ You
|
||||
SVar:RemRandomDeck:True
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/chance_encounter.jpg
|
||||
Oracle:Whenever you win a coin flip, put a luck counter on Chance Encounter.\nAt the beginning of your upkeep, if Chance Encounter has ten or more luck counters on it, you win the game.
|
||||
SetInfo:ODY Rare
|
||||
@@ -1,5 +1,6 @@
|
||||
package forge.card.ability.effects;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.Card;
|
||||
@@ -9,6 +10,7 @@ import forge.card.ability.AbilityUtils;
|
||||
import forge.card.ability.SpellAbilityEffect;
|
||||
import forge.card.spellability.AbilitySub;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.card.trigger.TriggerType;
|
||||
import forge.game.event.FlipCoinEvent;
|
||||
import forge.game.player.Player;
|
||||
import forge.gui.GuiDialog;
|
||||
@@ -30,6 +32,9 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.ability.SpellAbilityEffect#resolve(forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
@Override
|
||||
public void resolve(SpellAbility sa) {
|
||||
final Card host = sa.getSourceCard();
|
||||
@@ -52,8 +57,11 @@ public class FlipCoinEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
// Run triggers
|
||||
// HashMap<String,Object> runParams = new HashMap<String,Object>();
|
||||
// runParams.put("Player", player);
|
||||
HashMap<String,Object> runParams = new HashMap<String,Object>();
|
||||
runParams.put("Player", caller.get(0));
|
||||
runParams.put("Result", (Boolean) victory);
|
||||
player.getGame().getTriggerHandler().runTrigger(TriggerType.Flipped, runParams, false);
|
||||
|
||||
final boolean rememberResult = sa.hasParam("RememberResult");
|
||||
|
||||
for (final Player flipper : playersToFlip) {
|
||||
|
||||
86
src/main/java/forge/card/trigger/TriggerFlipped.java
Normal file
86
src/main/java/forge/card/trigger/TriggerFlipped.java
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.card.trigger;
|
||||
|
||||
import forge.Card;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Trigger_Flipped class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id: TriggerFlipped.java 17802 2012-10-31 08:05:14Z Max mtg $
|
||||
*/
|
||||
public class TriggerFlipped extends Trigger {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for Trigger_Flipped.
|
||||
* </p>
|
||||
*
|
||||
* @param params
|
||||
* a {@link java.util.HashMap} object.
|
||||
* @param host
|
||||
* a {@link forge.Card} object.
|
||||
* @param intrinsic
|
||||
* the intrinsic
|
||||
*/
|
||||
public TriggerFlipped(final java.util.Map<String, String> params, final Card host, final boolean intrinsic) {
|
||||
super(params, host, intrinsic);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
|
||||
if (this.getMapParams().containsKey("ValidPlayer")) {
|
||||
if (!matchesValid(runParams2.get("Player"), this.getMapParams().get("ValidPlayer").split(","),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.getMapParams().containsKey("ValidResult")) {
|
||||
final boolean result = (Boolean) runParams2.get("Result");
|
||||
final boolean valid = "Win".equals(this.getMapParams().get("ValidResult"));
|
||||
if (result ^ valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerFlipped(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
sa.setTriggeringObject("Player", this.getRunParams().get("Player"));
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ public enum TriggerType {
|
||||
ChangesZone(TriggerChangesZone.class),
|
||||
|
||||
Clashed(TriggerClashed.class),
|
||||
Flipped(TriggerFlipped.class),
|
||||
Attached(TriggerAttached.class),
|
||||
Destroyed(TriggerDestroyed.class),
|
||||
Devoured(TriggerDevoured.class),
|
||||
|
||||
Reference in New Issue
Block a user