mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Added attacker to canBlock method.
This commit is contained in:
parent
7edffebb5d
commit
42812541b9
11 changed files with 24 additions and 15 deletions
|
@ -160,12 +160,15 @@ public class MageBook extends JComponent {
|
|||
final String _set = set;
|
||||
tab.setObserver(new Command() {
|
||||
public void execute() {
|
||||
currentPage = 0;
|
||||
currentSet = _set;
|
||||
pageLeft.setVisible(false);
|
||||
pageRight.setVisible(false);
|
||||
addSetTabs();
|
||||
showCards();
|
||||
if (currentSet != _set || currentPage != 0) {
|
||||
AudioManager.playAnotherTab();
|
||||
currentPage = 0;
|
||||
currentSet = _set;
|
||||
pageLeft.setVisible(false);
|
||||
pageRight.setVisible(false);
|
||||
addSetTabs();
|
||||
showCards();
|
||||
}
|
||||
}
|
||||
});
|
||||
currentPanel.add(tab, JLayeredPane.DEFAULT_LAYER + count++, 0);
|
||||
|
|
|
@ -26,6 +26,7 @@ public class AudioManager {
|
|||
audioManager = new AudioManager();
|
||||
audioManager.nextPageClip = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPrevPage.wav"); //sounds better than OnNextPage
|
||||
audioManager.prevPageClip = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPrevPage.wav");
|
||||
audioManager.anotherTabClip = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnNextPage.wav");
|
||||
audioManager.nextPhaseClip = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnNextPhase.wav");
|
||||
audioManager.endTurnClip = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnEndTurn.wav");
|
||||
audioManager.tapPermanentClip = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnTapPermanent.wav");
|
||||
|
@ -51,6 +52,10 @@ public class AudioManager {
|
|||
checkAndPlayClip(getManager().prevPageClip);
|
||||
}
|
||||
|
||||
public static void playAnotherTab() {
|
||||
checkAndPlayClip(getManager().anotherTabClip);
|
||||
}
|
||||
|
||||
public static void playNextPhase() {
|
||||
checkAndPlayClip(getManager().nextPhaseClip);
|
||||
}
|
||||
|
@ -146,6 +151,7 @@ public class AudioManager {
|
|||
|
||||
private Clip nextPageClip = null;
|
||||
private Clip prevPageClip = null;
|
||||
private Clip anotherTabClip = null;
|
||||
private Clip nextPhaseClip = null;
|
||||
private Clip endTurnClip = null;
|
||||
private Clip tapPermanentClip = null;
|
||||
|
|
|
@ -106,7 +106,7 @@ class JuggernautEffect extends CantBlockSourceEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
||||
return !blocker.getSubtype().contains("Wall");
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class PacifismEffect extends RestrictionEffect<PacifismEffect> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class CantBlockEffect extends RestrictionEffect<CantBlockEffect> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
||||
return !blocker.getAbilities().containsKey(CantBlockAbility.getInstance().getId());
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public abstract class RestrictionEffect<T extends RestrictionEffect<T>> extends
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class CantBlockSourceEffect extends RestrictionEffect<CantBlockSourceEffe
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class FlyingEffect extends RestrictionEffect<FlyingEffect> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
||||
if (blocker.getAbilities().containsKey(FlyingAbility.getInstance().getId()) || blocker.getAbilities().containsKey(ReachAbility.getInstance().getId()))
|
||||
return true;
|
||||
return false;
|
||||
|
|
|
@ -72,7 +72,7 @@ class LandwalkEffect extends RestrictionEffect<LandwalkEffect> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
||||
return game.getBattlefield().countAll(filter, blocker.getControllerId()) == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class UnblockableEffect extends RestrictionEffect<UnblockableEffect> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent blocker, Game game) {
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -584,7 +584,7 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
|
|||
Permanent attacker = game.getPermanent(attackerId);
|
||||
//20101001 - 509.1b
|
||||
for (RestrictionEffect effect: game.getContinuousEffects().getApplicableRestrictionEffects(attacker, game)) {
|
||||
if (!effect.canBlock(this, game))
|
||||
if (!effect.canBlock(attacker, this, game))
|
||||
return false;
|
||||
}
|
||||
if (attacker.hasProtectionFrom(this))
|
||||
|
|
Loading…
Reference in a new issue