mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Fixed Djinn Illuminatus giving Replicate to all spells.
This commit is contained in:
@@ -281,20 +281,30 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
public final void add(final SpellAbility sp) {
|
public final void add(final SpellAbility sp) {
|
||||||
FThreads.assertExecutedByEdt(false);
|
FThreads.assertExecutedByEdt(false);
|
||||||
SpellAbilityStackInstance si = null;
|
SpellAbilityStackInstance si = null;
|
||||||
|
final Card source = sp.getSourceCard();
|
||||||
|
Player activator = sp.getActivatingPlayer();
|
||||||
|
|
||||||
|
// if activating player slips through the cracks, assign activating
|
||||||
|
// Player to the controller here
|
||||||
|
if (null == activator) {
|
||||||
|
sp.setActivatingPlayer(source.getController());
|
||||||
|
activator = sp.getActivatingPlayer();
|
||||||
|
System.out.println(source.getName() + " - activatingPlayer not set before adding to stack.");
|
||||||
|
}
|
||||||
|
|
||||||
if (sp.isManaAbility()) { // Mana Abilities go straight through
|
if (sp.isManaAbility()) { // Mana Abilities go straight through
|
||||||
AbilityUtils.resolve(sp);
|
AbilityUtils.resolve(sp);
|
||||||
//sp.resolve();
|
//sp.resolve();
|
||||||
sp.resetOnceResolved();
|
sp.resetOnceResolved();
|
||||||
game.getGameLog().add(GameLogEntryType.MANA, sp.getSourceCard() + " - " + sp.getDescription());
|
game.getGameLog().add(GameLogEntryType.MANA, source + " - " + sp.getDescription());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp.isSpell()) {
|
if (sp.isSpell()) {
|
||||||
sp.getSourceCard().setController(sp.getActivatingPlayer(), 0);
|
source.setController(activator, 0);
|
||||||
Spell spell = (Spell) sp;
|
Spell spell = (Spell) sp;
|
||||||
if (spell.isCastFaceDown()) {
|
if (spell.isCastFaceDown()) {
|
||||||
sp.getSourceCard().turnFaceDown();
|
source.turnFaceDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,14 +314,6 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if activating player slips through the cracks, assign activating
|
|
||||||
// Player to the controller here
|
|
||||||
if (null == sp.getActivatingPlayer()) {
|
|
||||||
sp.setActivatingPlayer(sp.getSourceCard().getController());
|
|
||||||
System.out.println(sp.getSourceCard().getName() + " - activatingPlayer not set before adding to stack.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((sp instanceof AbilityTriggered) || (sp instanceof AbilityStatic)) {
|
if ((sp instanceof AbilityTriggered) || (sp instanceof AbilityStatic)) {
|
||||||
// TODO: make working triggered ability
|
// TODO: make working triggered ability
|
||||||
sp.resolve();
|
sp.resolve();
|
||||||
@@ -319,49 +321,47 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
//GuiDisplayUtil.updateGUI();
|
//GuiDisplayUtil.updateGUI();
|
||||||
} else {
|
} else {
|
||||||
for (OptionalCost s : sp.getOptionalCosts()) {
|
for (OptionalCost s : sp.getOptionalCosts()) {
|
||||||
sp.getSourceCard().addOptionalCostPaid(s);
|
source.addOptionalCostPaid(s);
|
||||||
}
|
}
|
||||||
if (sp.isCopied()) {
|
if (sp.isCopied()) {
|
||||||
si = this.push(sp);
|
si = this.push(sp);
|
||||||
} else {
|
} else {
|
||||||
if (sp.isMultiKicker()) {
|
if (sp.isMultiKicker()) {
|
||||||
final Player activating = sp.getActivatingPlayer();
|
|
||||||
final Cost costMultikicker = new Cost(sp.getMultiKickerManaCost(), false);
|
final Cost costMultikicker = new Cost(sp.getMultiKickerManaCost(), false);
|
||||||
|
|
||||||
boolean hasPaid = false;
|
boolean hasPaid = false;
|
||||||
do {
|
do {
|
||||||
int mkMagnitude = sp.getSourceCard().getKickerMagnitude();
|
int mkMagnitude = source.getKickerMagnitude();
|
||||||
String prompt = String.format("Multikicker for %s\r\nTimes Kicked: %d\r\n", sp.getSourceCard(), mkMagnitude );
|
String prompt = String.format("Multikicker for %s\r\nTimes Kicked: %d\r\n", source, mkMagnitude );
|
||||||
hasPaid = activating.getController().payManaOptional(sp.getSourceCard(), costMultikicker, sp, prompt, ManaPaymentPurpose.Multikicker);
|
hasPaid = activator.getController().payManaOptional(source, costMultikicker, sp, prompt, ManaPaymentPurpose.Multikicker);
|
||||||
if( hasPaid )
|
if( hasPaid )
|
||||||
sp.getSourceCard().addMultiKickerMagnitude(1);
|
source.addMultiKickerMagnitude(1);
|
||||||
} while( hasPaid );
|
} while( hasPaid );
|
||||||
}
|
}
|
||||||
|
|
||||||
// The ability is added to stack HERE
|
// The ability is added to stack HERE
|
||||||
si = this.push(sp);
|
si = this.push(sp);
|
||||||
|
|
||||||
if (sp.isSpell() && (sp.getSourceCard().hasStartOfKeyword("Replicate")
|
if (sp.isSpell() && (source.hasStartOfKeyword("Replicate")
|
||||||
|| Iterables.any(sp.getActivatingPlayer().getCardsIn(ZoneType.Battlefield),
|
|| ((source.isInstant() || source.isSorcery()) && Iterables.any(activator.getCardsIn(ZoneType.Battlefield),
|
||||||
CardPredicates.hasKeyword("Each instant and sorcery spell you cast has replicate. The replicate cost is equal to its mana cost.")))) {
|
CardPredicates.hasKeyword("Each instant and sorcery spell you cast has replicate. The replicate cost is equal to its mana cost."))))) {
|
||||||
int magnitude = 0;
|
int magnitude = 0;
|
||||||
// TODO: convert multikicker/replicate support in abCost so this
|
// TODO: convert multikicker/replicate support in abCost so this
|
||||||
// doesn't happen here
|
// doesn't happen here
|
||||||
|
|
||||||
final Player activating = sp.getActivatingPlayer();
|
|
||||||
final Cost costReplicate = new Cost(sp.getPayCosts().getTotalMana(), false);
|
final Cost costReplicate = new Cost(sp.getPayCosts().getTotalMana(), false);
|
||||||
boolean hasPaid = false;
|
boolean hasPaid = false;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
String prompt = String.format("Replicate for %s\r\nTimes Replicated: %d\r\n", sp.getSourceCard(), magnitude);
|
String prompt = String.format("Replicate for %s\r\nTimes Replicated: %d\r\n", source, magnitude);
|
||||||
hasPaid = activating.getController().payManaOptional(sp.getSourceCard(), costReplicate, sp, prompt, ManaPaymentPurpose.Replicate);
|
hasPaid = activator.getController().payManaOptional(source, costReplicate, sp, prompt, ManaPaymentPurpose.Replicate);
|
||||||
if( hasPaid )
|
if( hasPaid )
|
||||||
magnitude++;
|
magnitude++;
|
||||||
} while( hasPaid );
|
} while( hasPaid );
|
||||||
|
|
||||||
for (int i = 0; i < magnitude; i++) {
|
for (int i = 0; i < magnitude; i++) {
|
||||||
SpellAbility copy = CardFactory.copySpellAbilityAndSrcCard(sp.getSourceCard(), sp.getSourceCard(), sp, false);
|
SpellAbility copy = CardFactory.copySpellAbilityAndSrcCard(source, sp.getSourceCard(), sp, false);
|
||||||
activating.getController().playSpellAbilityForFree(copy, true);
|
activator.getController().playSpellAbilityForFree(copy, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user