Fixed Champion of Lambholt - gave ability only to itself. +1 test passed.

This commit is contained in:
magenoxx 2012-06-03 19:50:17 +04:00
parent 7445876ec5
commit 153a5df2a5
2 changed files with 9 additions and 5 deletions

View file

@ -89,7 +89,7 @@ class ChampionOfLambholtEffect extends RestrictionEffect<ChampionOfLambholtEffec
@Override @Override
public boolean applies(Permanent permanent, Ability source, Game game) { public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null && permanent.equals(sourcePermanent)) { if (sourcePermanent != null) {
return true; return true;
} }
return false; return false;
@ -98,7 +98,11 @@ class ChampionOfLambholtEffect extends RestrictionEffect<ChampionOfLambholtEffec
@Override @Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) { public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
if (attacker != null && blocker != null) { if (attacker != null && blocker != null) {
return blocker.getPower().getValue() > attacker.getPower().getValue(); Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null) {
return attacker.getControllerId().equals(sourcePermanent.getControllerId())
&& blocker.getPower().getValue() > attacker.getPower().getValue();
}
} }
return true; return true;
} }

View file

@ -187,13 +187,13 @@ public class AttackBlockRestrictionsTest extends CardTestPlayerBase {
// non flying vs. flying // non flying vs. flying
attack(2, playerB, "Elite Vanguard"); attack(2, playerB, "Elite Vanguard");
block(2, playerA, "Angelic Wall", "Elite Vanguard"); block(2, playerA, "Angelic Wall", "Elite Vanguard"); // can't block
// non flying vs. non flying // non flying vs. non flying
attack(2, playerB, "Arbor Elf"); attack(2, playerB, "Arbor Elf");
block(2, playerA, "Llanowar Elves", "Arbor Elf"); block(2, playerA, "Llanowar Elves", "Arbor Elf"); // can block
// flying vs. flying // flying vs. flying
attack(2, playerB, "Assault Griffin"); attack(2, playerB, "Assault Griffin");
block(2, playerA, "Air Elemental", "Assault Griffin"); block(2, playerA, "Air Elemental", "Assault Griffin"); // can block
setStopAt(2, Constants.PhaseStep.END_TURN); setStopAt(2, Constants.PhaseStep.END_TURN);
execute(); execute();