- Added the static ability MayLookAt.

- Enabled card detail panel when choosing a face down card that you may look at.
- Added Bane Alley Broker.
This commit is contained in:
Sloth
2013-05-06 20:41:04 +00:00
parent 7a550cb4ba
commit 1123e18ca4
8 changed files with 124 additions and 8 deletions

2
.gitattributes vendored
View File

@@ -749,6 +749,7 @@ res/cardsfolder/b/balustrade_spy.txt -text
res/cardsfolder/b/bamboozle.txt -text
res/cardsfolder/b/bandage.txt svneol=native#text/plain
res/cardsfolder/b/bane_alley_blackguard.txt -text
res/cardsfolder/b/bane_alley_broker.txt -text
res/cardsfolder/b/bane_of_the_living.txt svneol=native#text/plain
res/cardsfolder/b/banefire.txt -text
res/cardsfolder/b/baneful_omen.txt -text
@@ -14031,6 +14032,7 @@ src/main/java/forge/card/staticability/StaticAbilityCantTarget.java -text
src/main/java/forge/card/staticability/StaticAbilityContinuous.java svneol=native#text/plain
src/main/java/forge/card/staticability/StaticAbilityCostChange.java -text
src/main/java/forge/card/staticability/StaticAbilityETBTapped.java -text
src/main/java/forge/card/staticability/StaticAbilityMayLookAt.java -text
src/main/java/forge/card/staticability/StaticAbilityPreventDamage.java svneol=native#text/plain
src/main/java/forge/card/staticability/package-info.java svneol=native#text/plain
src/main/java/forge/card/trigger/Trigger.java svneol=native#text/plain

View File

@@ -0,0 +1,16 @@
Name:Bane Alley Broker
ManaCost:1 U B
Types:Creature Human Rogue
Text:no text
PT:0/3
A:AB$ Draw | Cost$ T | NumCards$ 1 | SubAbility$ DBExile | SpellDescription$ Draw a card, then exile a card from your hand face down.
SVar:DBExile:DB$ ChangeZone | Origin$ Hand | Destination$ Exile | ChangeType$ Card | ChangeNum$ 1 | ExileFaceDown$ True | Mandatory$ True | RememberChanged$ True
S:Mode$ MayLookAt | Affected$ Card.IsRemembered | Player$ You | AffectedZone$ Exile | Description$ You may look at cards exiled with CARDNAME.
A:AB$ ChooseCard | Cost$ U B T | Defined$ You | Amount$ 1 | Mandatory$ True | AILogic$ AtLeast1 | ChoiceTitle$ Choose a card to put into your hand | Choices$ Card.IsRemembered | ChoiceZone$ Exile | SubAbility$ MoveChosen | SpellDescription$ Return a card exiled with CARDNAME to its owner's hand.
SVar:MoveChosen:DB$ ChangeZone | Origin$ Exile | Destination$ Hand | Defined$ ChosenCard
T:Mode$ ChangesZone | Origin$ Exile | Destination$ Any | Static$ True | ValidCard$ Card.IsRemembered | Execute$ DBForget
SVar:DBForget:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | Static$ True | ValidCard$ Card.Self | Execute$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
Oracle:{T}: Draw a card, then exile a card from your hand face down.\nYou may look at cards exiled with Bane Alley Broker.\n{U}{B}, {T}: Return a card exiled with Bane Alley Broker to its owner's hand.
SetInfo:GTC Uncommon

View File

@@ -8298,6 +8298,24 @@ public class Card extends GameEntity implements Comparable<Card> {
return true;
}
public boolean canBeSeenBy(final Player p) {
final GameState game = this.getGame();
if (getController().equals(p) && hasKeyword("You may look at this card.")) {
return true;
}
if (getController().isOpponentOf(p) && hasKeyword("Your opponent may look at this card.")) {
return true;
}
for (Card host : game.getCardsIn(ZoneType.Battlefield)) {
final ArrayList<StaticAbility> staticAbilities = host.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {
if (stAb.applyAbility("MayLookAt", this, p)) {
return true;
}
}
}
return false;
}
CardRules cardRules;
public CardRules getRules() {

View File

@@ -287,11 +287,11 @@ public class StaticAbility {
* the mode
* @param card
* the card
* @param activator
* @param player
* the activator
* @return true, if successful
*/
public final boolean applyAbility(final String mode, final Card card, final Player activator) {
public final boolean applyAbility(final String mode, final Card card, final Player player) {
// don't apply the ability if it hasn't got the right mode
if (!this.params.get("Mode").equals(mode)) {
@@ -303,11 +303,15 @@ public class StaticAbility {
}
if (mode.equals("CantBeCast")) {
return StaticAbilityCantBeCast.applyCantBeCastAbility(this, card, activator);
return StaticAbilityCantBeCast.applyCantBeCastAbility(this, card, player);
}
if (mode.equals("CantPlayLand")) {
return StaticAbilityCantBeCast.applyCantPlayLandAbility(this, card, activator);
return StaticAbilityCantBeCast.applyCantPlayLandAbility(this, card, player);
}
if (mode.equals("MayLookAt")) {
return StaticAbilityMayLookAt.applyMayLookAtAbility(this, card, player);
}
return false;

View File

@@ -0,0 +1,66 @@
/*
* Forge: Play Magic: the Gathering.
* Copyright (C) 2011 Forge Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.card.staticability;
import java.util.HashMap;
import forge.Card;
import forge.game.GameState;
import forge.game.player.Player;
import forge.game.zone.ZoneType;
/**
* The Class StaticAbility_CantBeCast.
*/
public class StaticAbilityMayLookAt {
/**
* TODO Write javadoc for this method.
*
* @param stAb
* a StaticAbility
* @param card
* the card
* @param activator
* the player
* @return true, if successful
*/
public static boolean applyMayLookAtAbility(final StaticAbility stAb, final Card card, final Player player) {
final HashMap<String, String> params = stAb.getMapParams();
final Card hostCard = stAb.getHostCard();
if (params.containsKey("Affected")
&& !card.isValid(params.get("Affected").split(","), hostCard.getController(), hostCard)) {
return false;
}
if (params.containsKey("Player") && player != null
&& !player.isValid(params.get("Player"), hostCard.getController(), hostCard)) {
return false;
}
if (params.containsKey("AffectedZone")) {
ZoneType zone = card.getGame().getZoneOf(card).getZoneType();
if (!ZoneType.listValueOf(params.get("AffectedZone")).contains(zone)) {
return false;
}
}
return true;
}
}

View File

@@ -666,6 +666,8 @@ public class AiController {
options = CardLists.getValidCards(options, "Permanent.YouCtrl,Permanent.tapped", host.getController(), host);
}
choice = ComputerUtilCard.getBestAI(options);
} else {
choice = ComputerUtilCard.getBestAI(options);
}
return choice;

View File

@@ -18,7 +18,10 @@ import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import forge.Card;
import forge.CardCharacteristicName;
import forge.FThreads;
import forge.Singletons;
import forge.card.cardfactory.CardFactory;
import forge.gui.match.CMatchUI;
import forge.item.InventoryItem;
@@ -118,7 +121,14 @@ public class GuiChoose {
@Override
public void valueChanged(final ListSelectionEvent ev) {
if (list.getSelectedValue() instanceof Card) {
CMatchUI.SINGLETON_INSTANCE.setCard((Card) list.getSelectedValue());
Card card = (Card) list.getSelectedValue();
if (card.isFaceDown()) {
if (card.canBeSeenBy(Singletons.getControl().getLobby().getGuiPlayer().getPlayer(card.getGame()))) {
card = CardFactory.copyCard(card);
card.setState(CardCharacteristicName.Original);
}
}
CMatchUI.SINGLETON_INSTANCE.setCard(card);
GuiUtils.clearPanelSelections();
GuiUtils.setPanelSelection((Card) list.getSelectedValue());

View File

@@ -54,9 +54,7 @@ class ZoneAction extends ForgeAction {
for (Card crd : choices) {
Card toAdd = crd;
if (crd.isFaceDown()) {
boolean ctrldByUiPlayer = crd.getController().getLobbyPlayer() == Singletons.getControl().getLobby().getGuiPlayer();
boolean canSee = ctrldByUiPlayer && crd.hasKeyword("You may look at this card.") || crd.hasKeyword("Your opponent may look at this card.");
if (canSee) {
if (crd.canBeSeenBy(Singletons.getControl().getLobby().getGuiPlayer().getPlayer(crd.getGame()))) {
toAdd = CardFactory.copyCard(crd);
toAdd.setState(CardCharacteristicName.Original);
} else {