From 614d0d491adf91cc73d3fef073f6961f652bf5f7 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 18 Aug 2015 13:01:48 +0200 Subject: [PATCH] * Hail of Arrows - Fixed that no damage was dealt. --- .../sets/saviorsofkamigawa/HailOfArrows.java | 5 ++-- .../effects/common/DamageMultiEffect.java | 23 ++++++++----------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/HailOfArrows.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/HailOfArrows.java index 337d1870e76..23e8f6e6058 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/HailOfArrows.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/HailOfArrows.java @@ -34,7 +34,7 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.filter.common.FilterAttackingCreature; -import mage.target.common.TargetAttackingCreature; +import mage.target.common.TargetCreaturePermanentAmount; /** * @@ -46,10 +46,9 @@ public class HailOfArrows extends CardImpl { super(ownerId, 11, "Hail of Arrows", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{X}{W}"); this.expansionSetCode = "SOK"; - // Hail of Arrows deals X damage divided as you choose among any number of target attacking creatures. this.getSpellAbility().addEffect(new DamageMultiEffect(new ManacostVariableValue())); - this.getSpellAbility().addTarget(new TargetAttackingCreature(0, Integer.MAX_VALUE, new FilterAttackingCreature(), true)); + this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(new ManacostVariableValue(), new FilterAttackingCreature())); } public HailOfArrows(final HailOfArrows card) { diff --git a/Mage/src/mage/abilities/effects/common/DamageMultiEffect.java b/Mage/src/mage/abilities/effects/common/DamageMultiEffect.java index 0ee8bdf7275..61baaaa19d6 100644 --- a/Mage/src/mage/abilities/effects/common/DamageMultiEffect.java +++ b/Mage/src/mage/abilities/effects/common/DamageMultiEffect.java @@ -1,16 +1,16 @@ /* * 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 @@ -20,21 +20,20 @@ * 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.abilities.effects.common; import java.util.UUID; -import mage.constants.Outcome; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -71,12 +70,11 @@ public class DamageMultiEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { if (source.getTargets().size() > 0) { Target multiTarget = source.getTargets().get(0); - for (UUID target: multiTarget.getTargets()) { + for (UUID target : multiTarget.getTargets()) { Permanent permanent = game.getPermanent(target); if (permanent != null) { permanent.damage(multiTarget.getTargetAmount(target), source.getSourceId(), game, false, true); - } - else { + } else { Player player = game.getPlayer(target); if (player != null) { player.damage(multiTarget.getTargetAmount(target), source.getSourceId(), game, false, true); @@ -92,9 +90,6 @@ public class DamageMultiEffect extends OneShotEffect { if (staticText != null && !staticText.isEmpty()) { return staticText; } - StringBuilder sb = new StringBuilder(); - sb.append("{source} deals ").append(amount.toString()); - sb.append(" damage divided as you choose among any number of target ").append(mode.getTargets().get(0).getTargetName()); - return sb.toString(); + return "{source} deals " + amount.toString() + " damage divided as you choose among any number of target " + mode.getTargets().get(0).getTargetName(); } }