mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Redirect added. M13 is complete. 2 unimplemented cards in T2 remaining.
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -8731,6 +8731,7 @@ res/cardsfolder/r/red_suns_zenith.txt svneol=native#text/plain
|
|||||||
res/cardsfolder/r/red_ward.txt svneol=native#text/plain
|
res/cardsfolder/r/red_ward.txt svneol=native#text/plain
|
||||||
res/cardsfolder/r/redeem.txt svneol=native#text/plain
|
res/cardsfolder/r/redeem.txt svneol=native#text/plain
|
||||||
res/cardsfolder/r/redeem_the_lost.txt svneol=native#text/plain
|
res/cardsfolder/r/redeem_the_lost.txt svneol=native#text/plain
|
||||||
|
res/cardsfolder/r/redirect.txt -text
|
||||||
res/cardsfolder/r/reduce_to_dreams.txt svneol=native#text/plain
|
res/cardsfolder/r/reduce_to_dreams.txt svneol=native#text/plain
|
||||||
res/cardsfolder/r/redwood_treefolk.txt svneol=native#text/plain
|
res/cardsfolder/r/redwood_treefolk.txt svneol=native#text/plain
|
||||||
res/cardsfolder/r/reef_pirates.txt svneol=native#text/plain
|
res/cardsfolder/r/reef_pirates.txt svneol=native#text/plain
|
||||||
|
|||||||
6
res/cardsfolder/r/redirect.txt
Normal file
6
res/cardsfolder/r/redirect.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Name:Redirect
|
||||||
|
ManaCost:U U
|
||||||
|
Types:Instant
|
||||||
|
A:SP$ ChangeTargets | Cost$ U U | TargetType$ Spell | Optional$ True | ValidTgts$ Card | SpellDescription$ You may choose new targets for target spell.
|
||||||
|
SVar:RemAIDeck:True
|
||||||
|
Oracle:You may choose new targets for target spell.
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
Name:Seeds of Strength
|
Name:Seeds of Strength
|
||||||
ManaCost:G W
|
ManaCost:G W
|
||||||
Types:Instant
|
Types:Instant
|
||||||
A:SP$ Pump | Cost$ G W | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ 1 | NumDef$ 1 | SubAbility$ DBPump1 | SpellDescription$ Target creature gets +1/+1 until end of turn. Target creature gets +1/+1 until end of turn. Target creature gets +1/+1 until end of turn.
|
A:SP$ Pump | Cost$ G W | ValidTgts$ Creature | TgtPrompt$ Select target creature (1) | NumAtt$ 1 | NumDef$ 1 | SubAbility$ DBPump1 | SpellDescription$ Target creature gets +1/+1 until end of turn. Target creature gets +1/+1 until end of turn. Target creature gets +1/+1 until end of turn.
|
||||||
SVar:DBPump1:DB$Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ 1 | NumDef$ 1 | SubAbility$ DBPump2
|
SVar:DBPump1:DB$Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature (2) | NumAtt$ 1 | NumDef$ 1 | SubAbility$ DBPump2
|
||||||
SVar:DBPump2:DB$Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ 1 | NumDef$ 1
|
SVar:DBPump2:DB$Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature (3)| NumAtt$ 1 | NumDef$ 1
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/seeds_of_strength.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/seeds_of_strength.jpg
|
||||||
Oracle:Target creature gets +1/+1 until end of turn.\nTarget creature gets +1/+1 until end of turn.\nTarget creature gets +1/+1 until end of turn.
|
Oracle:Target creature gets +1/+1 until end of turn.\nTarget creature gets +1/+1 until end of turn.\nTarget creature gets +1/+1 until end of turn.
|
||||||
SetInfo:RAV Common
|
SetInfo:RAV Common
|
||||||
@@ -8,7 +8,6 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import forge.Card;
|
|
||||||
import forge.ITargetable;
|
import forge.ITargetable;
|
||||||
import forge.card.ability.SpellAbilityEffect;
|
import forge.card.ability.SpellAbilityEffect;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
@@ -39,12 +38,17 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean preserveNumber = sa.hasParam("PreserveNumber"); // Redirect is not supposed to change number of targets
|
|
||||||
boolean changesOneTarget = sa.hasParam("ChangeSingleTarget"); // The only card known to replace targets with self is Spellskite
|
boolean changesOneTarget = sa.hasParam("ChangeSingleTarget"); // The only card known to replace targets with self is Spellskite
|
||||||
|
// There is also Muck Drubb but it replaces ALL occurences of a single target with itself (unlike Spellskite that has to be activated for each).
|
||||||
|
|
||||||
SpellAbilityStackInstance changingTgtSI = si;
|
SpellAbilityStackInstance changingTgtSI = si;
|
||||||
Player chooser = sa.getActivatingPlayer();
|
Player chooser = sa.getActivatingPlayer();
|
||||||
|
|
||||||
|
// Redirect rules read 'you MAY choose new targets' ... okay!
|
||||||
|
boolean isOptional = sa.hasParam("Optional");
|
||||||
|
if( isOptional && !chooser.getController().confirmAction(sa, null, "Do you want to change targets of " + tgtSA.getSourceCard() + "?"))
|
||||||
|
continue;
|
||||||
|
|
||||||
if( changesOneTarget ) {
|
if( changesOneTarget ) {
|
||||||
// 1. choose a target of target spell
|
// 1. choose a target of target spell
|
||||||
List<Pair<SpellAbilityStackInstance, ITargetable>> allTargets = new ArrayList<>();
|
List<Pair<SpellAbilityStackInstance, ITargetable>> allTargets = new ArrayList<>();
|
||||||
@@ -57,6 +61,7 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
|||||||
changingTgtSI = changingTgtSI.getSubInstace();
|
changingTgtSI = changingTgtSI.getSubInstace();
|
||||||
}
|
}
|
||||||
if( allTargets.isEmpty() ) {
|
if( allTargets.isEmpty() ) {
|
||||||
|
// is it an error or not?
|
||||||
System.err.println("Player managed to target a spell without targets with Spellskite's ability.");
|
System.err.println("Player managed to target a spell without targets with Spellskite's ability.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -81,7 +86,7 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
|||||||
// Update targets, with a potential new target
|
// Update targets, with a potential new target
|
||||||
SpellAbility changingTgtSA = changingTgtSI.getSpellAbility();
|
SpellAbility changingTgtSA = changingTgtSI.getSpellAbility();
|
||||||
TargetChoices newTarget = sa.getActivatingPlayer().getController().chooseNewTargetsFor(changingTgtSA);
|
TargetChoices newTarget = sa.getActivatingPlayer().getController().chooseNewTargetsFor(changingTgtSA);
|
||||||
if ( null != newTarget)
|
if (null != newTarget)
|
||||||
changingTgtSI.updateTarget(newTarget);
|
changingTgtSI.updateTarget(newTarget);
|
||||||
changingTgtSI = changingTgtSI.getSubInstace();
|
changingTgtSI = changingTgtSI.getSubInstace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import forge.CardColor;
|
|||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.CounterType;
|
import forge.CounterType;
|
||||||
import forge.ITargetable;
|
|
||||||
import forge.ImageCache;
|
import forge.ImageCache;
|
||||||
import forge.card.CardCharacteristics;
|
import forge.card.CardCharacteristics;
|
||||||
import forge.card.CardDb;
|
import forge.card.CardDb;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class HumanPlaySpellAbility {
|
|||||||
if( tgt != null && tgt.doesTarget()) {
|
if( tgt != null && tgt.doesTarget()) {
|
||||||
clearTargets(beingTargeted);
|
clearTargets(beingTargeted);
|
||||||
final TargetSelection select = new TargetSelection(beingTargeted);
|
final TargetSelection select = new TargetSelection(beingTargeted);
|
||||||
if (!select.chooseTargets() ) {
|
if (!select.chooseTargets(null) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,14 +65,15 @@ public class TargetSelection {
|
|||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final boolean chooseTargets() {
|
public final boolean chooseTargets(Integer numTargets) {
|
||||||
TargetRestrictions tgt = getTgt();
|
TargetRestrictions tgt = getTgt();
|
||||||
final boolean canTarget = tgt != null && tgt.doesTarget();
|
final boolean canTarget = tgt != null && tgt.doesTarget();
|
||||||
if( !canTarget )
|
if( !canTarget )
|
||||||
throw new RuntimeException("TargetSelection.chooseTargets called for ability that does not target - " + ability);
|
throw new RuntimeException("TargetSelection.chooseTargets called for ability that does not target - " + ability);
|
||||||
|
|
||||||
final int minTargets = tgt.getMinTargets(ability.getSourceCard(), ability);
|
// Number of targets is explicitly set only if spell is being redirected (ex. Swerve or Redirect)
|
||||||
final int maxTargets = tgt.getMaxTargets(ability.getSourceCard(), ability);
|
final int minTargets = numTargets != null ? numTargets.intValue() : tgt.getMinTargets(ability.getSourceCard(), ability);
|
||||||
|
final int maxTargets = numTargets != null ? numTargets.intValue() : tgt.getMaxTargets(ability.getSourceCard(), ability);
|
||||||
final int numTargeted = ability.getTargets().getNumTargeted();
|
final int numTargeted = ability.getTargets().getNumTargeted();
|
||||||
|
|
||||||
boolean hasEnoughTargets = minTargets == 0 || numTargeted >= minTargets;
|
boolean hasEnoughTargets = minTargets == 0 || numTargeted >= minTargets;
|
||||||
@@ -82,7 +83,6 @@ public class TargetSelection {
|
|||||||
if (this.bTargetingDone && !hasEnoughTargets)
|
if (this.bTargetingDone && !hasEnoughTargets)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
if (this.bTargetingDone && hasEnoughTargets || hasAllTargets || tgt.isDividedAsYouChoose() && tgt.getStillToDivide() == 0) {
|
if (this.bTargetingDone && hasEnoughTargets || hasAllTargets || tgt.isDividedAsYouChoose() && tgt.getStillToDivide() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ public class TargetSelection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// some inputs choose cards one-by-one and need to be called again
|
// some inputs choose cards one-by-one and need to be called again
|
||||||
return choiceResult && chooseTargets();
|
return choiceResult && chooseTargets(numTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
TargetChoices oldTarget = ability.getTargets();
|
TargetChoices oldTarget = ability.getTargets();
|
||||||
TargetSelection select = new TargetSelection(ability);
|
TargetSelection select = new TargetSelection(ability);
|
||||||
ability.resetTargets();
|
ability.resetTargets();
|
||||||
if (select.chooseTargets()) {
|
if (select.chooseTargets(oldTarget.getNumTargeted())) {
|
||||||
return ability.getTargets();
|
return ability.getTargets();
|
||||||
} else {
|
} else {
|
||||||
// Return old target, since we had to reset them above
|
// Return old target, since we had to reset them above
|
||||||
|
|||||||
Reference in New Issue
Block a user