mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
Merge branch 'epicSplice' into 'master'
EffectSource: now they can know about the SpellAbility that did the Effect for Epic Closes #1101 See merge request core-developers/forge!1981
This commit is contained in:
@@ -1296,8 +1296,8 @@ public class AbilityUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (defined.equals("EffectSource")) {
|
else if (defined.equals("EffectSource")) {
|
||||||
if (card.getEffectSource() != null) {
|
if (card.getEffectSourceAbility() != null) {
|
||||||
sas.addAll(card.getEffectSource().getSpellAbilities());
|
sas.add(card.getEffectSourceAbility().getRootAbility());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (defined.equals("SourceFirstSpell")) {
|
else if (defined.equals("SourceFirstSpell")) {
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ public abstract class SpellAbilityEffect {
|
|||||||
protected static void addLeaveBattlefieldReplacement(final Card card, final SpellAbility sa, final String zone) {
|
protected static void addLeaveBattlefieldReplacement(final Card card, final SpellAbility sa, final String zone) {
|
||||||
final Card host = sa.getHostCard();
|
final Card host = sa.getHostCard();
|
||||||
final Game game = card.getGame();
|
final Game game = card.getGame();
|
||||||
final Card eff = createEffect(host, sa.getActivatingPlayer(), host.getName() + "'s Effect", host.getImageKey());
|
final Card eff = createEffect(sa, sa.getActivatingPlayer(), host.getName() + "'s Effect", host.getImageKey());
|
||||||
|
|
||||||
addLeaveBattlefieldReplacement(eff, zone);
|
addLeaveBattlefieldReplacement(eff, zone);
|
||||||
|
|
||||||
@@ -378,8 +378,9 @@ public abstract class SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create a basic template for Effect to be used somewhere else
|
// create a basic template for Effect to be used somewhere else
|
||||||
protected static Card createEffect(final Card hostCard, final Player controller, final String name,
|
protected static Card createEffect(final SpellAbility sa, final Player controller, final String name,
|
||||||
final String image) {
|
final String image) {
|
||||||
|
final Card hostCard = sa.getHostCard();
|
||||||
final Game game = hostCard.getGame();
|
final Game game = hostCard.getGame();
|
||||||
final Card eff = new Card(game.nextCardId(), game);
|
final Card eff = new Card(game.nextCardId(), game);
|
||||||
eff.setTimestamp(game.getNextTimestamp());
|
eff.setTimestamp(game.getNextTimestamp());
|
||||||
@@ -404,7 +405,7 @@ public abstract class SpellAbilityEffect {
|
|||||||
eff.setColor(hostCard.determineColor().getColor());
|
eff.setColor(hostCard.determineColor().getColor());
|
||||||
}
|
}
|
||||||
eff.setImmutable(true);
|
eff.setImmutable(true);
|
||||||
eff.setEffectSource(hostCard);
|
eff.setEffectSource(sa);
|
||||||
|
|
||||||
return eff;
|
return eff;
|
||||||
}
|
}
|
||||||
@@ -440,7 +441,7 @@ public abstract class SpellAbilityEffect {
|
|||||||
// build an Effect with that infomation
|
// build an Effect with that infomation
|
||||||
String name = host.getName() + "'s Effect";
|
String name = host.getName() + "'s Effect";
|
||||||
|
|
||||||
final Card eff = createEffect(host, controller, name, host.getImageKey());
|
final Card eff = createEffect(sa, controller, name, host.getImageKey());
|
||||||
if (cards != null) {
|
if (cards != null) {
|
||||||
eff.addRemembered(cards);
|
eff.addRemembered(cards);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,10 +174,12 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
|||||||
if (sa.hasParam("Epic")) {
|
if (sa.hasParam("Epic")) {
|
||||||
copy.getHostCard().removeIntrinsicKeyword("Epic");
|
copy.getHostCard().removeIntrinsicKeyword("Epic");
|
||||||
SpellAbility sub = copy;
|
SpellAbility sub = copy;
|
||||||
while (sub.getSubAbility() != null) {
|
while (sub.getSubAbility() != null && !sub.hasParam("Epic")) {
|
||||||
sub = sub.getSubAbility();
|
sub = sub.getSubAbility();
|
||||||
}
|
}
|
||||||
sub.getParent().setSubAbility(null);
|
if (sub != null) {
|
||||||
|
sub.getParent().setSubAbility(sub.getSubAbility());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copies.add(copy);
|
copies.add(copy);
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class EffectEffect extends SpellAbilityEffect {
|
|||||||
image = hostCard.getImageKey();
|
image = hostCard.getImageKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Card eff = createEffect(hostCard, controller, name, image);
|
final Card eff = createEffect(sa, controller, name, image);
|
||||||
|
|
||||||
// Grant SVars first in order to give references to granted abilities
|
// Grant SVars first in order to give references to granted abilities
|
||||||
if (effectSVars != null) {
|
if (effectSVars != null) {
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
|||||||
final Player controller = sa.getActivatingPlayer();
|
final Player controller = sa.getActivatingPlayer();
|
||||||
final String name = hostCard.getName() + "'s Effect";
|
final String name = hostCard.getName() + "'s Effect";
|
||||||
final String image = hostCard.getImageKey();
|
final String image = hostCard.getImageKey();
|
||||||
final Card eff = createEffect(hostCard, controller, name, image);
|
final Card eff = createEffect(sa, controller, name, image);
|
||||||
|
|
||||||
eff.addRemembered(c);
|
eff.addRemembered(c);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public abstract class RegenerateBaseEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
// create Effect for Regeneration
|
// create Effect for Regeneration
|
||||||
final Card eff = createEffect(
|
final Card eff = createEffect(
|
||||||
hostCard, sa.getActivatingPlayer(), hostCard.getName() + "'s Regeneration", hostCard.getImageKey());
|
sa, sa.getActivatingPlayer(), hostCard.getName() + "'s Regeneration", hostCard.getImageKey());
|
||||||
|
|
||||||
eff.addRemembered(list);
|
eff.addRemembered(list);
|
||||||
addForgetOnMovedTrigger(eff, "Battlefield");
|
addForgetOnMovedTrigger(eff, "Battlefield");
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
// if this card is attached or linked to something, what card is it currently attached to
|
// if this card is attached or linked to something, what card is it currently attached to
|
||||||
private Card encoding, cloneOrigin, haunting, effectSource, pairedWith, meldedWith;
|
private Card encoding, cloneOrigin, haunting, effectSource, pairedWith, meldedWith;
|
||||||
|
|
||||||
|
private SpellAbility effectSourceAbility = null;
|
||||||
|
|
||||||
private GameEntity entityAttachedTo = null;
|
private GameEntity entityAttachedTo = null;
|
||||||
|
|
||||||
private GameEntity mustAttackEntity = null;
|
private GameEntity mustAttackEntity = null;
|
||||||
@@ -5609,12 +5611,24 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Card getEffectSource() {
|
public Card getEffectSource() {
|
||||||
|
if (effectSourceAbility != null) {
|
||||||
|
return effectSourceAbility.getHostCard();
|
||||||
|
}
|
||||||
return effectSource;
|
return effectSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SpellAbility getEffectSourceAbility() {
|
||||||
|
return effectSourceAbility;
|
||||||
|
}
|
||||||
|
|
||||||
public void setEffectSource(Card src) {
|
public void setEffectSource(Card src) {
|
||||||
effectSource = src;
|
effectSource = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEffectSource(SpellAbility sa) {
|
||||||
|
effectSourceAbility = sa;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isStartsGameInPlay() {
|
public boolean isStartsGameInPlay() {
|
||||||
return startsGameInPlay;
|
return startsGameInPlay;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3906,14 +3906,14 @@ public class CardFactoryUtil {
|
|||||||
// Epic does modify existing SA, and does not add new one
|
// Epic does modify existing SA, and does not add new one
|
||||||
|
|
||||||
// Add the Epic effect as a subAbility
|
// Add the Epic effect as a subAbility
|
||||||
String dbStr = "DB$ Effect | Triggers$ EpicTrigger | SVars$ EpicCopy | StaticAbilities$ EpicCantBeCast | Duration$ Permanent";
|
String dbStr = "DB$ Effect | Triggers$ EpicTrigger | SVars$ EpicCopy | StaticAbilities$ EpicCantBeCast | Duration$ Permanent | Epic$ True";
|
||||||
|
|
||||||
final AbilitySub newSA = (AbilitySub) AbilityFactory.getAbility(dbStr.toString(), card);
|
final AbilitySub newSA = (AbilitySub) AbilityFactory.getAbility(dbStr.toString(), card);
|
||||||
|
|
||||||
card.setSVar("EpicCantBeCast", "Mode$ CantBeCast | ValidCard$ Card | Caster$ You | EffectZone$ Command | Description$ For the rest of the game, you can't cast spells.");
|
newSA.setSVar("EpicCantBeCast", "Mode$ CantBeCast | ValidCard$ Card | Caster$ You | EffectZone$ Command | Description$ For the rest of the game, you can't cast spells.");
|
||||||
card.setSVar("EpicTrigger", "Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ EpicCopy | TriggerDescription$ "
|
newSA.setSVar("EpicTrigger", "Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ EpicCopy | TriggerDescription$ "
|
||||||
+ "At the beginning of each of your upkeeps, copy " + card.toString() + " except for its epic ability.");
|
+ "At the beginning of each of your upkeeps, copy " + card.toString() + " except for its epic ability.");
|
||||||
card.setSVar("EpicCopy", "DB$ CopySpellAbility | Defined$ EffectSource | Epic$ True");
|
newSA.setSVar("EpicCopy", "DB$ CopySpellAbility | Defined$ EffectSource | Epic$ True");
|
||||||
|
|
||||||
final SpellAbility origSA = card.getFirstSpellAbility();
|
final SpellAbility origSA = card.getFirstSpellAbility();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user