Fix Baldin, Century Herdmaster. Closes #9903 (#9907)

This commit is contained in:
PurpleCrowbar 2023-02-07 00:30:30 +00:00 committed by GitHub
parent 45eafed123
commit a0bd316f36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,10 +6,8 @@ import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ChooseOpponentEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessEffect;
import mage.cards.CardImpl;
@ -19,13 +17,8 @@ import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
/**
@ -51,7 +44,7 @@ public final class BaldinCenturyHerdmaster extends CardImpl {
// Hundred Hand SlapWhenever E. Honda, Sumo Champion attacks, up to one hundred target creatures each get +0/+X until end of turn, where X is the number of cards in your hand.
Ability ability = new AttacksTriggeredAbility(new BoostTargetEffect(
StaticValue.get(0), BaldinCenturyHerdmasterValue.instance, Duration.EndOfTurn
StaticValue.get(0), CardsInControllerHandCount.instance, Duration.EndOfTurn
).setText("up to one hundred target creatures each get +0/+X until end of turn, where X is the number of cards in your hand"));
ability.addTarget(new TargetCreaturePermanent(0, 100));
this.addAbility(ability.withFlavorWord("Hundred Hand Slap"));
@ -66,33 +59,3 @@ public final class BaldinCenturyHerdmaster extends CardImpl {
return new BaldinCenturyHerdmaster(this);
}
}
enum BaldinCenturyHerdmasterValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return Optional.ofNullable(game.getPlayer(
(UUID) game.getState().getValue(sourceAbility.getSourceId() + ChooseOpponentEffect.VALUE_KEY)
))
.filter(Objects::nonNull)
.map(Player::getHand)
.map(Set::size)
.orElse(0);
}
@Override
public BaldinCenturyHerdmasterValue copy() {
return this;
}
@Override
public String getMessage() {
return "";
}
@Override
public String toString() {
return "1";
}
}