mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Fixed an issue with non-copyable abilities. Scripted Vesuva
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -10171,6 +10171,7 @@ res/cardsfolder/v/vertigo.txt svneol=native#text/plain
|
||||
res/cardsfolder/v/vertigo_spawn.txt svneol=native#text/plain
|
||||
res/cardsfolder/v/vesper_ghoul.txt svneol=native#text/plain
|
||||
res/cardsfolder/v/vessel_of_endless_rest.txt -text
|
||||
res/cardsfolder/v/vesuva.txt -text
|
||||
res/cardsfolder/v/vesuvan_doppelganger.txt svneol=native#text/plain
|
||||
res/cardsfolder/v/veteran_armorer.txt svneol=native#text/plain
|
||||
res/cardsfolder/v/veteran_armorsmith.txt svneol=native#text/plain
|
||||
|
||||
13
res/cardsfolder/v/vesuva.txt
Normal file
13
res/cardsfolder/v/vesuva.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
Name:Vesuva
|
||||
ManaCost:no cost
|
||||
Types:Land
|
||||
Text:no text
|
||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ChooseLand | Static$ True | TriggerDescription$ You may have CARDNAME enter the battlefield tapped as a copy of any land on the battlefield.
|
||||
SVar:ChooseLand:AB$ ChooseCard | Cost$ 0 | Defined$ You | Amount$ 1 | Choices$ Land.Other | SubAbility$ DBCopy | RememberChosen$ True
|
||||
SVar:DBCopy:DB$ Clone | Defined$ Remembered | IntoPlayTapped$ True | SubAbility$ DBCleanup
|
||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||
SVar:Rarity:Rare
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/vesuva.jpg
|
||||
SetInfo:TSP|Rare|http://magiccards.info/scans/en/ts/281.jpg
|
||||
Oracle:You may have Vesuva enter the battlefield tapped as a copy of any land on the battlefield.
|
||||
End
|
||||
@@ -580,7 +580,10 @@ public final class AbilityFactoryClone {
|
||||
stateToCopy = cardToCopy.getCurState();
|
||||
}
|
||||
|
||||
CardFactoryUtil.copyState(cardToCopy, stateToCopy, tgtCard, "Cloned");
|
||||
CardFactoryUtil.copyState(cardToCopy, stateToCopy, tgtCard);
|
||||
// must call this before addAbilityFactoryAbilities so cloned added abilities are handled correctly
|
||||
addExtraCharacteristics(tgtCard, params, origSVars);
|
||||
CardFactoryUtil.addAbilityFactoryAbilities(tgtCard);
|
||||
for (int i = 0; i < tgtCard.getStaticAbilityStrings().size(); i++) {
|
||||
tgtCard.addStaticAbility(tgtCard.getStaticAbilityStrings().get(i));
|
||||
}
|
||||
@@ -588,21 +591,20 @@ public final class AbilityFactoryClone {
|
||||
tgtCard.setName(originalName);
|
||||
}
|
||||
|
||||
addExtraCharacteristics(tgtCard, params, origSVars);
|
||||
// If target is a flipped card, also copy the flipped
|
||||
// state.
|
||||
if (cardToCopy.isFlip()) {
|
||||
tgtCard.addAlternateState(CardCharactersticName.Flipped);
|
||||
tgtCard.setState(CardCharactersticName.Flipped);
|
||||
CardFactoryUtil.copyState(cardToCopy, CardCharactersticName.Flipped, tgtCard, "Cloned");
|
||||
CardFactoryUtil.copyState(cardToCopy, CardCharactersticName.Flipped, tgtCard);
|
||||
addExtraCharacteristics(tgtCard, params, origSVars);
|
||||
CardFactoryUtil.addAbilityFactoryAbilities(tgtCard);
|
||||
for (int i = 0; i < tgtCard.getStaticAbilityStrings().size(); i++) {
|
||||
tgtCard.addStaticAbility(tgtCard.getStaticAbilityStrings().get(i));
|
||||
}
|
||||
if (keepName) {
|
||||
tgtCard.setName(originalName);
|
||||
}
|
||||
|
||||
addExtraCharacteristics(tgtCard, params, origSVars);
|
||||
tgtCard.setFlip(true);
|
||||
|
||||
tgtCard.setState(CardCharactersticName.Original);
|
||||
@@ -651,14 +653,40 @@ public final class AbilityFactoryClone {
|
||||
if (params.containsKey("AddAbilities")) {
|
||||
for (final String s : Arrays.asList(params.get("AddAbilities").split(","))) {
|
||||
if (origSVars.containsKey(s)) {
|
||||
final AbilityFactory newAF = new AbilityFactory();
|
||||
//final AbilityFactory newAF = new AbilityFactory();
|
||||
final String actualAbility = origSVars.get(s);
|
||||
final SpellAbility grantedAbility = newAF.getAbility(actualAbility, tgtCard);
|
||||
tgtCard.addSpellAbility(grantedAbility);
|
||||
// final SpellAbility grantedAbility = newAF.getAbility(actualAbility, tgtCard);
|
||||
// tgtCard.addSpellAbility(grantedAbility);
|
||||
tgtCard.getIntrinsicAbilities().add(actualAbility);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// keywords to add to clone
|
||||
final ArrayList<String> keywords = new ArrayList<String>();
|
||||
if (params.containsKey("AddKeywords")) {
|
||||
keywords.addAll(Arrays.asList(params.get("AddKeywords").split(" & ")));
|
||||
// allow SVar substitution for keywords
|
||||
for (int i = 0; i < keywords.size(); i++) {
|
||||
final String k = keywords.get(i);
|
||||
if (origSVars.containsKey(k)) {
|
||||
keywords.add("\"" + k + "\"");
|
||||
keywords.remove(k);
|
||||
}
|
||||
if (keywords.get(i).startsWith("HIDDEN")) {
|
||||
tgtCard.addExtrinsicKeyword(keywords.get(i));
|
||||
}
|
||||
else {
|
||||
tgtCard.addIntrinsicKeyword(keywords.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set power of clone
|
||||
if (params.containsKey("IntoPlayTapped")) {
|
||||
tgtCard.setTapped(true);
|
||||
}
|
||||
|
||||
// set power of clone
|
||||
if (params.containsKey("SetPower")) {
|
||||
String rhs = params.get("SetPower");
|
||||
|
||||
@@ -3942,7 +3942,7 @@ public class CardFactoryUtil {
|
||||
* @param to
|
||||
* the to
|
||||
*/
|
||||
public static void copyState(final Card from, final CardCharactersticName stateToCopy, final Card to, final String type) {
|
||||
public static void copyState(final Card from, final CardCharactersticName stateToCopy, final Card to) {
|
||||
|
||||
// copy characteristics not associated with a state
|
||||
to.setCurSetCode(from.getCurSetCode());
|
||||
@@ -3969,33 +3969,6 @@ public class CardFactoryUtil {
|
||||
to.setTriggers(characteristics.getTriggers());
|
||||
to.setReplacementEffects(characteristics.getReplacementEffects());
|
||||
to.setStaticAbilityStrings(characteristics.getStaticAbilityStrings());
|
||||
|
||||
// copy activated abilities
|
||||
for (SpellAbility sa : characteristics.getSpellAbility()) {
|
||||
if (sa instanceof AbilityActivated) {
|
||||
SpellAbility newSA = ((AbilityActivated) sa).getCopy();
|
||||
if (newSA == null) {
|
||||
System.out.println("Uh-oh...");
|
||||
}
|
||||
newSA.setType(type);
|
||||
CardFactoryUtil.correctAbilityChainSourceCard(newSA, to);
|
||||
to.addSpellAbility(newSA);
|
||||
}
|
||||
}
|
||||
|
||||
// copy activated mana abilities
|
||||
for (SpellAbility sa : characteristics.getManaAbility()) {
|
||||
if (sa instanceof AbilityActivated) {
|
||||
SpellAbility newSA = ((AbilityActivated) sa).getCopy();
|
||||
if (newSA == null) {
|
||||
System.out.println("Uh-oh...");
|
||||
}
|
||||
newSA.setType(type);
|
||||
CardFactoryUtil.correctAbilityChainSourceCard(newSA, to);
|
||||
to.addSpellAbility(newSA);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void copySpellAbility(SpellAbility from, SpellAbility to) {
|
||||
|
||||
Reference in New Issue
Block a user