mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +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
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class KusariGamaTest extends CardTestPlayerBase {
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue