Merge pull request #8013 from weirddan455/wish

[AFR] Implemented Wish
This commit is contained in:
Oleg Agafonov 2021-07-21 20:53:41 +04:00 committed by GitHub
commit 81193148e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 673 additions and 233 deletions

View file

@ -1,15 +1,16 @@
package mage;
/**
* Used to identify specific actions/events and to be able to assign them to the
* correct watcher or other processing.
*
* @author LevelX2
*/
public enum MageIdentifier {
GisaAndGeralfWatcher,
KaradorGhostChieftainWatcher,
KessDissidentMageWatcher,
LurrusOfTheDreamDenWatcher,
MuldrothaTheGravetideWatcher
}
package mage;
/**
* Used to identify specific actions/events and to be able to assign them to the
* correct watcher or other processing.
*
* @author LevelX2
*/
public enum MageIdentifier {
GisaAndGeralfWatcher,
KaradorGhostChieftainWatcher,
KessDissidentMageWatcher,
LurrusOfTheDreamDenWatcher,
MuldrothaTheGravetideWatcher,
WishWatcher
}

View file

@ -0,0 +1,39 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.players.Player;
/**
* @author JayDi85
*/
public enum SideboardCardsYouControlCount implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player player = game.getPlayer(sourceAbility.getControllerId());
if (player == null) {
return 0;
}
return player.getSideboard().size();
}
@Override
public SideboardCardsYouControlCount copy() {
return instance;
}
@Override
public String toString() {
return "1";
}
@Override
public String getMessage() {
return "cards in your sideboard";
}
}

View file

@ -592,9 +592,14 @@ public class ContinuousEffects implements Serializable {
Map<String, String> keyChoices = new HashMap<>();
for (ApprovingObject approvingObject : possibleApprovingObjects) {
MageObject mageObject = game.getObject(approvingObject.getApprovingAbility().getSourceId());
keyChoices.put(approvingObject.getApprovingAbility().getId().toString(),
(approvingObject.getApprovingAbility().getRule(mageObject == null ? "" : mageObject.getName()))
+ (mageObject == null ? "" : " (" + mageObject.getIdName() + ")"));
String choiceKey = approvingObject.getApprovingAbility().getId().toString();
String choiceValue;
if (mageObject == null) {
choiceValue = approvingObject.getApprovingAbility().getRule();
} else {
choiceValue = mageObject.getIdName() + ": " + approvingObject.getApprovingAbility().getRule(mageObject.getName());
}
keyChoices.put(choiceKey, choiceValue);
}
Choice choicePermitting = new ChoiceImpl(true);
choicePermitting.setMessage("Choose the permitting object");

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common;
import java.util.Set;

View file

@ -0,0 +1,26 @@
package mage.abilities.hint.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.SideboardCardsYouControlCount;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.game.Game;
/**
* @author JayDi85
*/
public enum OpenSideboardHint implements Hint {
instance;
private static final Hint hint = new ValueHint("Cards in your sideboard", SideboardCardsYouControlCount.instance);
@Override
public String getText(Game game, Ability ability) {
return hint.getText(game, ability) + " (<i>Right click on battlefield to open player's sideboard at any time</i>)";
}
@Override
public Hint copy() {
return instance;
}
}

View file

@ -59,5 +59,6 @@ public enum PlayerAction {
HOLD_PRIORITY,
UNHOLD_PRIORITY,
VIEW_LIMITED_DECK,
VIEW_SIDEBOARD,
TOGGLE_RECORD_MACRO
}

View file

@ -3646,13 +3646,22 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
// check to play companion cards
// outside cards
if (fromAll || fromZone == Zone.OUTSIDE) {
// companion cards
for (Cards companionCards : game.getState().getCompanion().values()) {
for (Card card : companionCards.getCards(game)) {
getPlayableFromObjectAll(game, Zone.OUTSIDE, card, availableMana, playable);
}
}
// sideboard cards (example: Wish)
for (UUID sideboardCardId : this.getSideboard()) {
Card sideboardCard = game.getCard(sideboardCardId);
if (sideboardCard != null) {
getPlayableFromObjectAll(game, Zone.OUTSIDE, sideboardCard, availableMana, playable);
}
}
}
// check if it's possible to play the top card of a library