mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +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")) {
|
||||
if (card.getEffectSource() != null) {
|
||||
sas.addAll(card.getEffectSource().getSpellAbilities());
|
||||
if (card.getEffectSourceAbility() != null) {
|
||||
sas.add(card.getEffectSourceAbility().getRootAbility());
|
||||
}
|
||||
}
|
||||
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) {
|
||||
final Card host = sa.getHostCard();
|
||||
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);
|
||||
|
||||
@@ -378,8 +378,9 @@ public abstract class SpellAbilityEffect {
|
||||
}
|
||||
|
||||
// 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 Card hostCard = sa.getHostCard();
|
||||
final Game game = hostCard.getGame();
|
||||
final Card eff = new Card(game.nextCardId(), game);
|
||||
eff.setTimestamp(game.getNextTimestamp());
|
||||
@@ -404,7 +405,7 @@ public abstract class SpellAbilityEffect {
|
||||
eff.setColor(hostCard.determineColor().getColor());
|
||||
}
|
||||
eff.setImmutable(true);
|
||||
eff.setEffectSource(hostCard);
|
||||
eff.setEffectSource(sa);
|
||||
|
||||
return eff;
|
||||
}
|
||||
@@ -440,7 +441,7 @@ public abstract class SpellAbilityEffect {
|
||||
// build an Effect with that infomation
|
||||
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) {
|
||||
eff.addRemembered(cards);
|
||||
}
|
||||
|
||||
@@ -174,10 +174,12 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("Epic")) {
|
||||
copy.getHostCard().removeIntrinsicKeyword("Epic");
|
||||
SpellAbility sub = copy;
|
||||
while (sub.getSubAbility() != null) {
|
||||
while (sub.getSubAbility() != null && !sub.hasParam("Epic")) {
|
||||
sub = sub.getSubAbility();
|
||||
}
|
||||
sub.getParent().setSubAbility(null);
|
||||
if (sub != null) {
|
||||
sub.getParent().setSubAbility(sub.getSubAbility());
|
||||
}
|
||||
}
|
||||
|
||||
copies.add(copy);
|
||||
|
||||
@@ -116,7 +116,7 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
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
|
||||
if (effectSVars != null) {
|
||||
|
||||
@@ -286,7 +286,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
||||
final Player controller = sa.getActivatingPlayer();
|
||||
final String name = hostCard.getName() + "'s Effect";
|
||||
final String image = hostCard.getImageKey();
|
||||
final Card eff = createEffect(hostCard, controller, name, image);
|
||||
final Card eff = createEffect(sa, controller, name, image);
|
||||
|
||||
eff.addRemembered(c);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public abstract class RegenerateBaseEffect extends SpellAbilityEffect {
|
||||
|
||||
// create Effect for Regeneration
|
||||
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);
|
||||
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
|
||||
private Card encoding, cloneOrigin, haunting, effectSource, pairedWith, meldedWith;
|
||||
|
||||
private SpellAbility effectSourceAbility = null;
|
||||
|
||||
private GameEntity entityAttachedTo = null;
|
||||
|
||||
private GameEntity mustAttackEntity = null;
|
||||
@@ -5609,12 +5611,24 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
|
||||
public Card getEffectSource() {
|
||||
if (effectSourceAbility != null) {
|
||||
return effectSourceAbility.getHostCard();
|
||||
}
|
||||
return effectSource;
|
||||
}
|
||||
|
||||
public SpellAbility getEffectSourceAbility() {
|
||||
return effectSourceAbility;
|
||||
}
|
||||
|
||||
public void setEffectSource(Card src) {
|
||||
effectSource = src;
|
||||
}
|
||||
|
||||
public void setEffectSource(SpellAbility sa) {
|
||||
effectSourceAbility = sa;
|
||||
}
|
||||
|
||||
public boolean isStartsGameInPlay() {
|
||||
return startsGameInPlay;
|
||||
}
|
||||
|
||||
@@ -3906,14 +3906,14 @@ public class CardFactoryUtil {
|
||||
// Epic does modify existing SA, and does not add new one
|
||||
|
||||
// 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);
|
||||
|
||||
card.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("EpicCantBeCast", "Mode$ CantBeCast | ValidCard$ Card | Caster$ You | EffectZone$ Command | Description$ For the rest of the game, you can't cast spells.");
|
||||
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.");
|
||||
card.setSVar("EpicCopy", "DB$ CopySpellAbility | Defined$ EffectSource | Epic$ True");
|
||||
newSA.setSVar("EpicCopy", "DB$ CopySpellAbility | Defined$ EffectSource | Epic$ True");
|
||||
|
||||
final SpellAbility origSA = card.getFirstSpellAbility();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user