beginning of upkeep triggered ability that has two effect...
Posted: 27 Sep 2017, 23:15
I'm trying to code Power Leak. My understanding of this card is that it always does damage in the range of 0 to 2 (or more if it is possible to mod the max?) depending on the target cards controller amount spent from 2 or more to 0 to prevent said damage. My first thought is to do this:
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DoIfCostPaid(new DamageAttachedControllerEffect(new IntMinusDynamicValue(2, new ManacostVariableValue())), new VariableManaCost(), "", false), TargetController.CONTROLLER_ATTACHED_TO, false));
However assuming all of that works correctly to assign the correct amount of damage to the target cards controller it doesn't account for the possibility that damage can't be prevented due to some other card effect. Which is the dilemma because the BeginningOfUpkeepTriggeredAbility needs to both do the damage and prevent the damage so that it correctly abides prevention rules and any other applicable rules. But it can only have one effect but two are needed.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DoIfCostPaid(new DamageAttachedControllerEffect(new IntMinusDynamicValue(2, new ManacostVariableValue())), new VariableManaCost(), "", false), TargetController.CONTROLLER_ATTACHED_TO, false));
However assuming all of that works correctly to assign the correct amount of damage to the target cards controller it doesn't account for the possibility that damage can't be prevented due to some other card effect. Which is the dilemma because the BeginningOfUpkeepTriggeredAbility needs to both do the damage and prevent the damage so that it correctly abides prevention rules and any other applicable rules. But it can only have one effect but two are needed.