diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/FumikoTheLowblood.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/FumikoTheLowblood.java new file mode 100644 index 00000000000..a0cd2f7de2e --- /dev/null +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/FumikoTheLowblood.java @@ -0,0 +1,79 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.betrayersofkamigawa; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.AttackingCreatureCount; +import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect; +import mage.abilities.keyword.BushidoAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; + +/** + * + * @author LevelX2 + */ +public class FumikoTheLowblood extends CardImpl { + + public FumikoTheLowblood(UUID ownerId) { + super(ownerId, 104, "Fumiko the Lowblood", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}{R}"); + this.expansionSetCode = "BOK"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Samurai"); + + this.color.setRed(true); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // Fumiko the Lowblood has bushido X, where X is the number of attacking creatures. + this.addAbility(new BushidoAbility(new AttackingCreatureCount("the number of attacking creatures"))); + + // Creatures your opponents control attack each turn if able. + FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures your opponents control"); + filter.add(new ControllerPredicate(TargetController.OPPONENT)); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AttacksIfAbleAllEffect(filter))); + + } + + public FumikoTheLowblood(final FumikoTheLowblood card) { + super(card); + } + + @Override + public FumikoTheLowblood copy() { + return new FumikoTheLowblood(this); + } +} diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/TakenoSamuraiGeneral.java b/Mage.Sets/src/mage/sets/championsofkamigawa/TakenoSamuraiGeneral.java index fc54dbd9c45..18cf96d677e 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/TakenoSamuraiGeneral.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/TakenoSamuraiGeneral.java @@ -28,20 +28,25 @@ package mage.sets.championsofkamigawa; -import mage.constants.*; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.keyword.BushidoAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.permanent.Permanent; -import java.util.UUID; - /** * @author Loki */ @@ -57,6 +62,7 @@ public class TakenoSamuraiGeneral extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(3); this.addAbility(new BushidoAbility(2)); + // Each other Samurai creature you control gets +1/+1 for each point of bushido it has. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TakenoSamuraiGeneralEffect())); } @@ -115,8 +121,9 @@ class TakenoSamuraiGeneralEffect extends ContinuousEffectImpl { + + private final FilterCreaturePermanent filter; + + public AttacksIfAbleAllEffect(FilterCreaturePermanent filter) { + super(Duration.WhileOnBattlefield); + staticText = new StringBuilder(filter.getMessage()).append(" attack each turn if able").toString(); + this.filter = filter; + } + + public AttacksIfAbleAllEffect(final AttacksIfAbleAllEffect effect) { + super(effect); + this.filter = effect.filter; + } + + @Override + public AttacksIfAbleAllEffect copy() { + return new AttacksIfAbleAllEffect(this); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return filter.match(permanent, source.getSourceId(), source.getControllerId(), game); + } + + @Override + public boolean mustAttack(Game game) { + return true; + } + + @Override + public boolean mustBlock(Game game) { + return false; + } + +} diff --git a/Mage/src/mage/abilities/keyword/BushidoAbility.java b/Mage/src/mage/abilities/keyword/BushidoAbility.java index 3dcc226e349..fad5e3d0806 100644 --- a/Mage/src/mage/abilities/keyword/BushidoAbility.java +++ b/Mage/src/mage/abilities/keyword/BushidoAbility.java @@ -27,21 +27,37 @@ */ package mage.abilities.keyword; -import mage.constants.Duration; +import mage.abilities.Ability; import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.continious.BoostSourceEffect; +import mage.constants.Duration; +import mage.game.Game; public class BushidoAbility extends BlocksOrBecomesBlockedTriggeredAbility { - private int value; + + private DynamicValue value; + private String rule = null; public BushidoAbility(int value) { + this(new StaticValue(value)); + rule = new StringBuilder("Bushido ").append(value).toString(); + } + + public BushidoAbility(DynamicValue value) { super(new BoostSourceEffect(value, value, Duration.EndOfTurn), false); + if (rule == null) { + rule = new StringBuilder("{this} has bushido X, where X is ").append(value.getMessage()).toString(); + } + rule = new StringBuilder(rule).append(" (When this blocks or becomes blocked, it gets +").append(value.toString()).append("/+").append(value.toString()).append(" until end of turn.)").toString(); this.value = value; } public BushidoAbility(final BushidoAbility ability) { super(ability); this.value = ability.value; + this.rule = ability.rule; } @Override @@ -49,12 +65,12 @@ public class BushidoAbility extends BlocksOrBecomesBlockedTriggeredAbility { return new BushidoAbility(this); } - public int getValue() { - return value; + public int getValue(Ability source, Game game) { + return value.calculate(game, source); } @Override public String getRule() { - return "Bushido " + value + " (When this blocks or becomes blocked, it gets +" + value + "/+" + value + " until end of turn.)"; + return rule; } }