mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Kusari-Gama - Fixed trigger occurs but no damage is dealt (fixes #2154).
This commit is contained in:
parent
286dc55396
commit
5b5c13c137
2 changed files with 15 additions and 17 deletions
|
@ -64,7 +64,7 @@ public class KusariGama extends CardImpl {
|
||||||
this.subtype.add("Equipment");
|
this.subtype.add("Equipment");
|
||||||
|
|
||||||
// Equipped creature has "{2}: This creature gets +1/+0 until end of turn."
|
// 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 effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.EQUIPMENT);
|
||||||
effect.setText("Equipped creature has \"{2}: This creature gets +1/+0 until end of turn.\"");
|
effect.setText("Equipped creature has \"{2}: This creature gets +1/+0 until end of turn.\"");
|
||||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
|
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
|
||||||
|
@ -144,22 +144,20 @@ class KusariGamaDamageEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Integer damage = (Integer) this.getValue("damageAmount");
|
Integer damage = (Integer) this.getValue("damageAmount");
|
||||||
if (damage != null && damage.intValue() > 0) {
|
if (damage != null && damage > 0) {
|
||||||
UUID damagedCreatureId = (UUID) this.getValue("damagedCreatureId");
|
UUID damagedCreatureId = (UUID) this.getValue("damagedCreatureId");
|
||||||
Permanent creature = game.getPermanent(damagedCreatureId);
|
Permanent creature = game.getPermanent(damagedCreatureId);
|
||||||
if (creature == null) {
|
if (creature == null) {
|
||||||
creature = (Permanent) game.getLastKnownInformation(damagedCreatureId, Zone.BATTLEFIELD);
|
creature = (Permanent) game.getLastKnownInformation(damagedCreatureId, Zone.BATTLEFIELD);
|
||||||
}
|
}
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
for (UUID blockerId : game.getCombat().getBlockers()) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), creature.getControllerId(), game)) {
|
||||||
if (!blockerId.equals(damagedCreatureId)) {
|
if (!permanent.getId().equals(damagedCreatureId)) {
|
||||||
Permanent blockingCreature = game.getPermanent(blockerId);
|
permanent.damage(damage, source.getSourceId(), game, false, true);
|
||||||
if (blockingCreature != null && blockingCreature.getControllerId().equals(creature.getControllerId())) {
|
|
||||||
blockingCreature.damage(damage, source.getSourceId(), game, false, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class KusariGamaTest extends CardTestPlayerBase {
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 2); // 2/2 {1}{W}
|
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 2); // 2/2 {1}{W}
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Hill Giant"); // 3/3 {3}{R}
|
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");
|
attack(1, playerA, "Sylvan Advocate");
|
||||||
block(1, playerB, "Wall of Omens", "Sylvan Advocate");
|
block(1, playerB, "Wall of Omens", "Sylvan Advocate");
|
||||||
setStopAt(1, PhaseStep.END_COMBAT);
|
setStopAt(1, PhaseStep.END_COMBAT);
|
||||||
|
|
Loading…
Reference in a new issue