mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Fix crash related to ChangeTargets and SA/subSAs without a target. SubAbilities can now have their targets changed
This commit is contained in:
@@ -3,7 +3,8 @@ ManaCost:3 R
|
|||||||
Types:Instant
|
Types:Instant
|
||||||
A:SP$ ChooseType | Cost$ 3 R | Defined$ You | Type$ Card | SubAbility$ DBReveal | SpellDescription$ Choose a card type. Target opponent reveals his or her hand. Blood Oath deals 3 damage to that player for each card of the chosen type revealed this way.
|
A:SP$ ChooseType | Cost$ 3 R | Defined$ You | Type$ Card | SubAbility$ DBReveal | SpellDescription$ Choose a card type. Target opponent reveals his or her hand. Blood Oath deals 3 damage to that player for each card of the chosen type revealed this way.
|
||||||
SVar:DBReveal:DB$ RevealHand | RememberRevealed$ True | ValidTgts$ Opponent | TgtPrompt$ Select target opponent to reveal their hand | SubAbility$ DBDamage
|
SVar:DBReveal:DB$ RevealHand | RememberRevealed$ True | ValidTgts$ Opponent | TgtPrompt$ Select target opponent to reveal their hand | SubAbility$ DBDamage
|
||||||
SVar:DBDamage:DB$ DealDamage | Defined$ Targeted | NumDmg$ X | References$ X,Y
|
SVar:DBDamage:DB$ DealDamage | Defined$ Targeted | NumDmg$ X | References$ X,Y | SubAbility$ DBCleanup
|
||||||
|
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||||
SVar:X:SVar$Y/Times.3
|
SVar:X:SVar$Y/Times.3
|
||||||
SVar:Y:Remembered$Valid Card.ChosenType
|
SVar:Y:Remembered$Valid Card.ChosenType
|
||||||
SVar:RemAIDeck:True
|
SVar:RemAIDeck:True
|
||||||
|
|||||||
@@ -28,8 +28,15 @@ public class ChangeTargetsEffect extends SpellAbilityEffect {
|
|||||||
// If there isn't a Stack Instance, there isn't really a target
|
// If there isn't a Stack Instance, there isn't really a target
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Update targets, with a potential new target
|
|
||||||
si.updateTarget(sa.getActivatingPlayer().getController().chooseTargets(tgtSA));
|
SpellAbilityStackInstance changingTgtSI = si;
|
||||||
|
while(changingTgtSI != null) {
|
||||||
|
// Update targets, with a potential new target
|
||||||
|
SpellAbility changingTgtSA = changingTgtSI.getSpellAbility();
|
||||||
|
changingTgtSI.updateTarget(sa.getActivatingPlayer().getController().chooseTargets(changingTgtSA));
|
||||||
|
changingTgtSI = changingTgtSI.getSubInstace();
|
||||||
|
}
|
||||||
|
|
||||||
if (remember) {
|
if (remember) {
|
||||||
sa.getSourceCard().addRemembered(tgtSA.getSourceCard());
|
sa.getSourceCard().addRemembered(tgtSA.getSourceCard());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,6 +416,9 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Target chooseTargets(SpellAbility ability) {
|
public Target chooseTargets(SpellAbility ability) {
|
||||||
|
if (ability.getTarget() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Target oldTarget = new Target(ability.getTarget());
|
Target oldTarget = new Target(ability.getTarget());
|
||||||
TargetSelection select = new TargetSelection(ability);
|
TargetSelection select = new TargetSelection(ability);
|
||||||
ability.getTarget().resetTargets();
|
ability.getTarget().resetTargets();
|
||||||
|
|||||||
Reference in New Issue
Block a user