mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18: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/redeem.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/redwood_treefolk.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
|
||||
ManaCost:G W
|
||||
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.
|
||||
SVar:DBPump1:DB$Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ 1 | NumDef$ 1 | SubAbility$ DBPump2
|
||||
SVar:DBPump2:DB$Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ 1 | NumDef$ 1
|
||||
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 (2) | NumAtt$ 1 | NumDef$ 1 | SubAbility$ DBPump2
|
||||
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
|
||||
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
|
||||
@@ -8,7 +8,6 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.Card;
|
||||
import forge.ITargetable;
|
||||
import forge.card.ability.SpellAbilityEffect;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
@@ -38,13 +37,18 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
||||
// If there isn't a Stack Instance, there isn't really a target
|
||||
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
|
||||
// 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;
|
||||
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 ) {
|
||||
// 1. choose a target of target spell
|
||||
List<Pair<SpellAbilityStackInstance, ITargetable>> allTargets = new ArrayList<>();
|
||||
@@ -57,6 +61,7 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
||||
changingTgtSI = changingTgtSI.getSubInstace();
|
||||
}
|
||||
if( allTargets.isEmpty() ) {
|
||||
// is it an error or not?
|
||||
System.err.println("Player managed to target a spell without targets with Spellskite's ability.");
|
||||
return;
|
||||
}
|
||||
@@ -81,7 +86,7 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
||||
// Update targets, with a potential new target
|
||||
SpellAbility changingTgtSA = changingTgtSI.getSpellAbility();
|
||||
TargetChoices newTarget = sa.getActivatingPlayer().getController().chooseNewTargetsFor(changingTgtSA);
|
||||
if ( null != newTarget)
|
||||
if (null != newTarget)
|
||||
changingTgtSI.updateTarget(newTarget);
|
||||
changingTgtSI = changingTgtSI.getSubInstace();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import forge.CardColor;
|
||||
import forge.CardUtil;
|
||||
import forge.Command;
|
||||
import forge.CounterType;
|
||||
import forge.ITargetable;
|
||||
import forge.ImageCache;
|
||||
import forge.card.CardCharacteristics;
|
||||
import forge.card.CardDb;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class HumanPlaySpellAbility {
|
||||
if( tgt != null && tgt.doesTarget()) {
|
||||
clearTargets(beingTargeted);
|
||||
final TargetSelection select = new TargetSelection(beingTargeted);
|
||||
if (!select.chooseTargets() ) {
|
||||
if (!select.chooseTargets(null) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,14 +65,15 @@ public class TargetSelection {
|
||||
* </p>
|
||||
*/
|
||||
|
||||
public final boolean chooseTargets() {
|
||||
public final boolean chooseTargets(Integer numTargets) {
|
||||
TargetRestrictions tgt = getTgt();
|
||||
final boolean canTarget = tgt != null && tgt.doesTarget();
|
||||
if( !canTarget )
|
||||
throw new RuntimeException("TargetSelection.chooseTargets called for ability that does not target - " + ability);
|
||||
|
||||
final int minTargets = tgt.getMinTargets(ability.getSourceCard(), ability);
|
||||
final int maxTargets = tgt.getMaxTargets(ability.getSourceCard(), ability);
|
||||
// Number of targets is explicitly set only if spell is being redirected (ex. Swerve or Redirect)
|
||||
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();
|
||||
|
||||
boolean hasEnoughTargets = minTargets == 0 || numTargeted >= minTargets;
|
||||
@@ -81,7 +82,6 @@ public class TargetSelection {
|
||||
// if not enough targets chosen, cancel Ability
|
||||
if (this.bTargetingDone && !hasEnoughTargets)
|
||||
return false;
|
||||
|
||||
|
||||
if (this.bTargetingDone && hasEnoughTargets || hasAllTargets || tgt.isDividedAsYouChoose() && tgt.getStillToDivide() == 0) {
|
||||
return true;
|
||||
@@ -118,7 +118,7 @@ public class TargetSelection {
|
||||
}
|
||||
}
|
||||
// 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();
|
||||
TargetSelection select = new TargetSelection(ability);
|
||||
ability.resetTargets();
|
||||
if (select.chooseTargets()) {
|
||||
if (select.chooseTargets(oldTarget.getNumTargeted())) {
|
||||
return ability.getTargets();
|
||||
} else {
|
||||
// Return old target, since we had to reset them above
|
||||
|
||||
Reference in New Issue
Block a user