* Kusari-Gama - Fixed trigger occurs but no damage is dealt (fixes #2154).

This commit is contained in:
LevelX2 2016-08-06 12:43:16 +02:00
parent 286dc55396
commit 5b5c13c137
2 changed files with 15 additions and 17 deletions

View file

@ -64,7 +64,7 @@ public class KusariGama extends CardImpl {
this.subtype.add("Equipment");
// Equipped creature has "{2}: This creature gets +1/+0 until end of turn."
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1,0, Duration.EndOfTurn), new GenericManaCost(2));
Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new GenericManaCost(2));
Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.EQUIPMENT);
effect.setText("Equipped creature has \"{2}: This creature gets +1/+0 until end of turn.\"");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
@ -144,22 +144,20 @@ class KusariGamaDamageEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Integer damage = (Integer) this.getValue("damageAmount");
if (damage != null && damage.intValue() > 0) {
if (damage != null && damage > 0) {
UUID damagedCreatureId = (UUID) this.getValue("damagedCreatureId");
Permanent creature = game.getPermanent(damagedCreatureId);
if (creature == null) {
creature = (Permanent) game.getLastKnownInformation(damagedCreatureId, Zone.BATTLEFIELD);
}
if (creature != null) {
for (UUID blockerId : game.getCombat().getBlockers()) {
if (!blockerId.equals(damagedCreatureId)) {
Permanent blockingCreature = game.getPermanent(blockerId);
if (blockingCreature != null && blockingCreature.getControllerId().equals(creature.getControllerId())) {
blockingCreature.damage(damage, source.getSourceId(), game, false, true);
}
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), creature.getControllerId(), game)) {
if (!permanent.getId().equals(damagedCreatureId)) {
permanent.damage(damage, source.getSourceId(), game, false, true);
}
}
}
return true;
}
return false;
}

View file

@ -23,26 +23,26 @@ public class KusariGamaTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Kusari-Gama");
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
addCard(Zone.BATTLEFIELD, playerA, "Sylvan Advocate"); // 2/3 vigilance {1}{G}
addCard(Zone.BATTLEFIELD, playerB, "Wall of Omens"); // 0/4 {1}{W}
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 2); // 2/2 {1}{W}
addCard(Zone.BATTLEFIELD, playerB, "Hill Giant"); // 3/3 {3}{R}
activateAbility(1, PhaseStep.BEGIN_COMBAT, playerA, "Equip {3}", "Sylvan Advocate");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {3}", "Sylvan Advocate");
attack(1, playerA, "Sylvan Advocate");
block(1, playerB, "Wall of Omens", "Sylvan Advocate");
setStopAt(1, PhaseStep.END_COMBAT);
execute();
assertPermanentCount(playerA, "Kusari-Gama", 1);
assertPermanentCount(playerA, "Kusari-Gama", 1);
assertPermanentCount(playerB, "Wall of Omens", 1);
assertPermanentCount(playerB, "Hill Giant", 1);
Permanent wallPerm = getPermanent("Wall of Omens", playerB);
Permanent giantPerm = getPermanent("Hill Giant", playerB);
Permanent giantPerm = getPermanent("Hill Giant", playerB);
Assert.assertEquals("Wall of Omens should have 2 damage dealt to it", 2, wallPerm.getDamage());
Assert.assertEquals("Hill Giant should have 2 damage dealt to it", 2, giantPerm.getDamage());
Assert.assertEquals("Hill Giant should have 2 damage dealt to it", 2, giantPerm.getDamage());
assertGraveyardCount(playerB, "Silvercoat Lion", 2);
}
}