mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
Fix #10631 (Forge, Neverwinter Charlatan)
This commit is contained in:
parent
809c02eb8d
commit
a5dbf30605
2 changed files with 12 additions and 7 deletions
|
|
@ -5,6 +5,7 @@ import mage.abilities.common.SacrificeAllTriggeredAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.MultipliedValue;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
|
|
@ -28,6 +29,7 @@ import java.util.UUID;
|
|||
public final class ForgeNeverwinterCharlatan extends CardImpl {
|
||||
|
||||
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(new FilterControlledPermanent(SubType.TREASURE));
|
||||
private static final DynamicValue twiceXValue = new MultipliedValue(xValue, 2);
|
||||
private static final Hint hint = new ValueHint("Treasures you control", xValue);
|
||||
|
||||
public ForgeNeverwinterCharlatan(UUID ownerId, CardSetInfo setInfo) {
|
||||
|
|
@ -47,7 +49,7 @@ public final class ForgeNeverwinterCharlatan extends CardImpl {
|
|||
|
||||
// Forge, Neverwinter Charlatan gets +2/+0 for each Treasure you control.
|
||||
this.addAbility(new SimpleStaticAbility(new BoostSourceEffect(
|
||||
xValue, StaticValue.get(0), Duration.WhileOnBattlefield
|
||||
twiceXValue, StaticValue.get(0), Duration.WhileOnBattlefield
|
||||
).setText("{this} gets +2/+0 for each Treasure you control")).addHint(hint));
|
||||
|
||||
// Whenever one or more players sacrifice one or more creatures, you create a tapped Treasure token. This ability triggers only once each turn.
|
||||
|
|
|
|||
|
|
@ -44,22 +44,25 @@ public class SacrificeAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
boolean sacrificed = false;
|
||||
switch (sacrificingPlayer) {
|
||||
case YOU:
|
||||
if (event.getPlayerId().equals(getControllerId())) {
|
||||
sacrificed = true;
|
||||
if (!event.getPlayerId().equals(getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case OPPONENT:
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
if (controller == null || controller.hasOpponent(event.getPlayerId(), game)) {
|
||||
sacrificed = true;
|
||||
if (controller == null || !controller.hasOpponent(event.getPlayerId(), game)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ANY:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
Permanent sacrificedPermanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
return sacrificed && filter.match(sacrificedPermanent, getControllerId(), this, game);
|
||||
return sacrificedPermanent != null && filter.match(sacrificedPermanent, getControllerId(), this, game);
|
||||
}
|
||||
|
||||
private String generateTriggerPhrase() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue