mirror of
https://github.com/correl/mage.git
synced 2024-12-28 11:14:13 +00:00
impl Hinata Dawn-Crowned (#8652)
* impl Hinta Dawn-Crowned * small optimization by passing the num targets directly to the reduce/inc cost function * refactor for brevity * refactor for DRY
This commit is contained in:
parent
9fd7ec82d3
commit
1c3d5d088d
2 changed files with 123 additions and 0 deletions
122
Mage.Sets/src/mage/cards/h/HinataDawnCrowned.java
Normal file
122
Mage.Sets/src/mage/cards/h/HinataDawnCrowned.java
Normal file
|
@ -0,0 +1,122 @@
|
|||
package mage.cards.h;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Arketec
|
||||
*/
|
||||
public final class HinataDawnCrowned extends CardImpl {
|
||||
|
||||
public HinataDawnCrowned(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{R}{W}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.KIRIN);
|
||||
this.subtype.add(SubType.SPIRIT);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Trample
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
|
||||
// Spells you cast cost {1} less to cast for each target.
|
||||
this.addAbility(new SimpleStaticAbility(new HinataDawnCrownedOwnEffect()));
|
||||
|
||||
// Spells your opponents cast cost {1} more to cast for each target
|
||||
this.addAbility(new SimpleStaticAbility(new HinataDawnCrownedOpponentsEffect()));
|
||||
}
|
||||
|
||||
private HinataDawnCrowned(final HinataDawnCrowned card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HinataDawnCrowned copy() {
|
||||
return new HinataDawnCrowned(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HinataDawnCrownedOwnEffect extends CostModificationEffectImpl {
|
||||
|
||||
HinataDawnCrownedOwnEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Neutral, CostModificationType.REDUCE_COST);
|
||||
staticText = "Spells you cast cost {1} less to cast for each target";
|
||||
}
|
||||
|
||||
private HinataDawnCrownedOwnEffect(HinataDawnCrownedOwnEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HinataDawnCrownedOwnEffect copy() {
|
||||
return new HinataDawnCrownedOwnEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
CardUtil.reduceCost(abilityToModify, HinataDawnCrownedEffectUtility.getTargetCount(game, abilityToModify));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
return abilityToModify instanceof SpellAbility
|
||||
&& abilityToModify.isControlledBy(source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
||||
class HinataDawnCrownedOpponentsEffect extends CostModificationEffectImpl {
|
||||
|
||||
HinataDawnCrownedOpponentsEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Neutral, CostModificationType.INCREASE_COST);
|
||||
staticText = "Spells your opponents cast cost {1} more to cast for each target";
|
||||
}
|
||||
|
||||
private HinataDawnCrownedOpponentsEffect(HinataDawnCrownedOpponentsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HinataDawnCrownedOpponentsEffect copy() {
|
||||
return new HinataDawnCrownedOpponentsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
CardUtil.increaseCost(abilityToModify, HinataDawnCrownedEffectUtility.getTargetCount(game, abilityToModify));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
return abilityToModify instanceof SpellAbility
|
||||
&& !abilityToModify.isControlledBy(source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
||||
final class HinataDawnCrownedEffectUtility
|
||||
{
|
||||
public static int getTargetCount(Game game, Ability abilityToModify)
|
||||
{
|
||||
return (int)(game.inCheckPlayableState() ?
|
||||
CardUtil.getAllPossibleTargets(abilityToModify, game).stream().count():
|
||||
CardUtil.getAllSelectedTargets(abilityToModify, game).stream().count());
|
||||
}
|
||||
}
|
|
@ -108,6 +108,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Heir of the Ancient Fang", 191, Rarity.COMMON, mage.cards.h.HeirOfTheAncientFang.class));
|
||||
cards.add(new SetCardInfo("Hidetsugu, Devouring Chaos", 99, Rarity.RARE, mage.cards.h.HidetsuguDevouringChaos.class));
|
||||
cards.add(new SetCardInfo("High-Speed Hoverbike", 247, Rarity.UNCOMMON, mage.cards.h.HighSpeedHoverbike.class));
|
||||
cards.add(new SetCardInfo("Hinata, Dawn-Crowned", 222, Rarity.RARE, mage.cards.h.HinataDawnCrowned.class));
|
||||
cards.add(new SetCardInfo("Historian's Wisdom", 192, Rarity.UNCOMMON, mage.cards.h.HistoriansWisdom.class));
|
||||
cards.add(new SetCardInfo("Hotshot Mechanic", 16, Rarity.UNCOMMON, mage.cards.h.HotshotMechanic.class));
|
||||
cards.add(new SetCardInfo("Imperial Moth", 4, Rarity.COMMON, mage.cards.i.ImperialMoth.class));
|
||||
|
|
Loading…
Reference in a new issue