mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[CMR] Implemented Hamza, Guardian of Arashin
This commit is contained in:
parent
cff67085b7
commit
5a58ea0602
2 changed files with 110 additions and 0 deletions
109
Mage.Sets/src/mage/cards/h/HamzaGuardianOfArashin.java
Normal file
109
Mage.Sets/src/mage/cards/h/HamzaGuardianOfArashin.java
Normal file
|
@ -0,0 +1,109 @@
|
|||
package mage.cards.h;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.effects.common.cost.SpellCostReductionForEachSourceEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class HamzaGuardianOfArashin extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledCreaturePermanent("creature you control with a +1/+1 counter on it");
|
||||
|
||||
static {
|
||||
filter.add(CounterType.P1P1.getPredicate());
|
||||
}
|
||||
|
||||
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
|
||||
private static final Hint hint = new ValueHint("Creatures you control with +1/+1 counter on them", xValue);
|
||||
|
||||
public HamzaGuardianOfArashin(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{W}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.ELEPHANT);
|
||||
this.subtype.add(SubType.WARRIOR);
|
||||
this.power = new MageInt(5);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
// This spell costs {1} less to cast for each creature you control with a +1/+1 counter on it.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.ALL, new SpellCostReductionForEachSourceEffect(1, xValue)
|
||||
).addHint(hint));
|
||||
|
||||
// Creature spells you cast cost {1} less to cast for each creature you control with a +1/+1 counter on it.
|
||||
this.addAbility(new SimpleStaticAbility(new HamzaGuardianOfArashinEffect(xValue)));
|
||||
}
|
||||
|
||||
private HamzaGuardianOfArashin(final HamzaGuardianOfArashin card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HamzaGuardianOfArashin copy() {
|
||||
return new HamzaGuardianOfArashin(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HamzaGuardianOfArashinEffect extends CostModificationEffectImpl {
|
||||
|
||||
private final DynamicValue xValue;
|
||||
|
||||
HamzaGuardianOfArashinEffect(DynamicValue xValue) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
staticText = "Creature spells you cast cost {1} less to cast " +
|
||||
"for each creature you control with a +1/+1 counter on it";
|
||||
this.xValue = xValue;
|
||||
}
|
||||
|
||||
private HamzaGuardianOfArashinEffect(HamzaGuardianOfArashinEffect effect) {
|
||||
super(effect);
|
||||
this.xValue = effect.xValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
int amount = xValue.calculate(game, source, this);
|
||||
if (amount > 0) {
|
||||
CardUtil.adjustCost((SpellAbility) abilityToModify, amount);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (!(abilityToModify instanceof SpellAbility)) {
|
||||
return false;
|
||||
}
|
||||
Card sourceCard = game.getCard(abilityToModify.getSourceId());
|
||||
return sourceCard != null
|
||||
&& abilityToModify.isControlledBy(source.getControllerId())
|
||||
&& sourceCard.isCreature();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HamzaGuardianOfArashinEffect copy() {
|
||||
return new HamzaGuardianOfArashinEffect(this);
|
||||
}
|
||||
}
|
|
@ -201,6 +201,7 @@ public final class CommanderLegends extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Growth Spiral", 446, Rarity.COMMON, mage.cards.g.GrowthSpiral.class));
|
||||
cards.add(new SetCardInfo("Guildless Commons", 351, Rarity.UNCOMMON, mage.cards.g.GuildlessCommons.class));
|
||||
cards.add(new SetCardInfo("Halana, Kessig Ranger", 231, Rarity.UNCOMMON, mage.cards.h.HalanaKessigRanger.class));
|
||||
cards.add(new SetCardInfo("Hamza, Guardian of Arashin", 278, Rarity.UNCOMMON, mage.cards.h.HamzaGuardianOfArashin.class));
|
||||
cards.add(new SetCardInfo("Harmonize", 427, Rarity.UNCOMMON, mage.cards.h.Harmonize.class));
|
||||
cards.add(new SetCardInfo("Haunted Cloak", 313, Rarity.COMMON, mage.cards.h.HauntedCloak.class));
|
||||
cards.add(new SetCardInfo("Hero's Blade", 314, Rarity.UNCOMMON, mage.cards.h.HerosBlade.class));
|
||||
|
|
Loading…
Reference in a new issue