mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
Improved target messages for users: added extra hints;
Applied Biomancy - added target's choose hints;
This commit is contained in:
parent
91a3328907
commit
ff5839860e
5 changed files with 52 additions and 49 deletions
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.player.human;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.*;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
|
@ -18,8 +15,6 @@ import mage.cards.decks.Deck;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.*;
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_RESET_ALL;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterAttackingCreature;
|
||||
import mage.filter.common.FilterBlockingCreature;
|
||||
|
@ -42,16 +37,21 @@ import mage.target.Target;
|
|||
import mage.target.TargetAmount;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetAttackingCreature;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.common.TargetAttackingCreature;
|
||||
import mage.target.common.TargetDefender;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.ManaUtil;
|
||||
import mage.util.MessageToClient;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_RESET_ALL;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class HumanPlayer extends PlayerImpl {
|
||||
|
@ -341,7 +341,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
|
||||
replacementEffectChoice.getChoices().clear();
|
||||
replacementEffectChoice.setKeyChoices(rEffects);
|
||||
|
||||
|
||||
// Check if there are different ones
|
||||
int differentChoices = 0;
|
||||
String lastChoice = "";
|
||||
|
@ -511,6 +511,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
|
||||
prepareForResponse(game);
|
||||
if (!isExecutingMacro()) {
|
||||
// hmm
|
||||
game.fireSelectTargetEvent(getId(), new MessageToClient(target.getMessage(), getRelatedObjectName(source, game)), possibleTargets, required, getOptions(target, null));
|
||||
}
|
||||
waitForResponse(game);
|
||||
|
@ -782,9 +783,9 @@ public class HumanPlayer extends PlayerImpl {
|
|||
if (!skippedAtLeastOnce
|
||||
|| (playerId.equals(game.getActivePlayerId())
|
||||
&& !controllingPlayer
|
||||
.getUserData()
|
||||
.getUserSkipPrioritySteps()
|
||||
.isStopOnAllEndPhases())) {
|
||||
.getUserData()
|
||||
.getUserSkipPrioritySteps()
|
||||
.isStopOnAllEndPhases())) {
|
||||
skippedAtLeastOnce = true;
|
||||
if (passWithManaPoolCheck(game)) {
|
||||
return false;
|
||||
|
@ -876,9 +877,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
}
|
||||
}
|
||||
return result;
|
||||
} else if (response.getManaType() != null) {
|
||||
return false;
|
||||
}
|
||||
} else return response.getManaType() == null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1126,8 +1125,8 @@ public class HumanPlayer extends PlayerImpl {
|
|||
if (passedAllTurns
|
||||
|| passedUntilEndStepBeforeMyTurn
|
||||
|| (!getControllingPlayersUserData(game)
|
||||
.getUserSkipPrioritySteps()
|
||||
.isStopOnDeclareAttackersDuringSkipAction()
|
||||
.getUserSkipPrioritySteps()
|
||||
.isStopOnDeclareAttackersDuringSkipAction()
|
||||
&& (passedTurn
|
||||
|| passedTurnSkipStack
|
||||
|| passedUntilEndOfTurn
|
||||
|
@ -1146,7 +1145,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
}
|
||||
options.put(Constants.Option.POSSIBLE_ATTACKERS, (Serializable) possibleAttackers);
|
||||
if (!possibleAttackers.isEmpty()) {
|
||||
options.put(Constants.Option.SPECIAL_BUTTON, (Serializable) "All attack");
|
||||
options.put(Constants.Option.SPECIAL_BUTTON, "All attack");
|
||||
}
|
||||
|
||||
prepareForResponse(game);
|
||||
|
@ -1304,7 +1303,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
/**
|
||||
* Selects a defender for an attacker and adds the attacker to combat
|
||||
*
|
||||
* @param defenders - list of possible defender
|
||||
* @param defenders - list of possible defender
|
||||
* @param attackerId - UUID of attacker
|
||||
* @param game
|
||||
* @return
|
||||
|
@ -1364,8 +1363,8 @@ public class HumanPlayer extends PlayerImpl {
|
|||
filter.add(new ControllerIdPredicate(defendingPlayerId));
|
||||
if (game.getBattlefield().count(filter, null, playerId, game) == 0
|
||||
&& !getControllingPlayersUserData(game)
|
||||
.getUserSkipPrioritySteps()
|
||||
.isStopOnDeclareBlockerIfNoneAvailable()) {
|
||||
.getUserSkipPrioritySteps()
|
||||
.isStopOnDeclareBlockerIfNoneAvailable()) {
|
||||
return;
|
||||
}
|
||||
while (!abort) {
|
||||
|
|
|
@ -24,11 +24,11 @@ public final class AppliedBiomancy extends CardImpl {
|
|||
|
||||
// • Target creature gets +1/+1 until end of turn.
|
||||
this.getSpellAbility().addEffect(new BoostTargetEffect(1, 1));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent().withChooseHint("gets +1/+1 until end of turn"));
|
||||
|
||||
// • Return target creature to its owner's hand.
|
||||
Mode mode = new Mode(new ReturnToHandTargetEffect());
|
||||
mode.addTarget(new TargetCreaturePermanent());
|
||||
mode.addTarget(new TargetCreaturePermanent().withChooseHint("return to its owner's hand"));
|
||||
this.getSpellAbility().addMode(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package mage.abilities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class Mode implements Serializable {
|
||||
|
@ -53,7 +53,14 @@ public class Mode implements Serializable {
|
|||
}
|
||||
|
||||
public void addTarget(Target target) {
|
||||
this.addTarget(target, false);
|
||||
}
|
||||
|
||||
public void addTarget(Target target, Boolean addChooseHintFromEffect) {
|
||||
targets.add(target);
|
||||
if (addChooseHintFromEffect) {
|
||||
target.withChooseHint(this.getEffects().getText(this));
|
||||
}
|
||||
}
|
||||
|
||||
public Effects getEffects() {
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
|
||||
package mage.target;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
@ -12,8 +7,12 @@ import mage.filter.Filter;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public interface Target extends Serializable {
|
||||
|
@ -30,7 +29,7 @@ public interface Target extends Serializable {
|
|||
* controls if it will be checked, if the target can be targeted from source
|
||||
*
|
||||
* @param notTarget true = do not check for protection, false = check for
|
||||
* protection
|
||||
* protection
|
||||
*/
|
||||
void setNotTarget(boolean notTarget);
|
||||
|
||||
|
@ -136,4 +135,5 @@ public interface Target extends Serializable {
|
|||
// used for cards like Spellskite
|
||||
void setTargetAmount(UUID targetId, int amount, Game game);
|
||||
|
||||
Target withChooseHint(String chooseHint);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
|
||||
package mage.target;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
|
@ -23,6 +12,8 @@ import mage.game.events.GameEvent.EventType;
|
|||
import mage.players.Player;
|
||||
import mage.util.RandomUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
@ -45,6 +36,7 @@ public abstract class TargetImpl implements Target {
|
|||
protected UUID abilityController = null; // only used if target controller != ability controller
|
||||
|
||||
protected int targetTag; // can be set if other target check is needed (AnotherTargetPredicate)
|
||||
protected String chooseHint = null; // UI choose hints after target name
|
||||
|
||||
@Override
|
||||
public abstract TargetImpl copy();
|
||||
|
@ -72,6 +64,7 @@ public abstract class TargetImpl implements Target {
|
|||
this.targetController = target.targetController;
|
||||
this.abilityController = target.abilityController;
|
||||
this.targetTag = target.targetTag;
|
||||
this.chooseHint = target.chooseHint;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,12 +94,11 @@ public abstract class TargetImpl implements Target {
|
|||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
// UI choose message
|
||||
String suffix = "";
|
||||
// if (targetController != null) {
|
||||
// // Hint for the selecting player that the targets must be valid from the point of the ability controller
|
||||
// // e.g. select opponent text may be misleading otherwise
|
||||
// suffix = " (target controlling!)";
|
||||
// }
|
||||
if (this.chooseHint != null) {
|
||||
suffix = " (" + this.chooseHint + ")";
|
||||
}
|
||||
if (getMaxNumberOfTargets() != 1) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Select ").append(targetName);
|
||||
|
@ -401,7 +393,7 @@ public abstract class TargetImpl implements Target {
|
|||
for (int K = minK; K <= maxK; K++) {
|
||||
// get the combination by index
|
||||
// e.g. 01 --> AB , 23 --> CD
|
||||
int combination[] = new int[K];
|
||||
int[] combination = new int[K];
|
||||
|
||||
// position of current index
|
||||
// if (r = 1) r*
|
||||
|
@ -544,4 +536,9 @@ public abstract class TargetImpl implements Target {
|
|||
rememberZoneChangeCounter(targetId, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Target withChooseHint(String chooseHint) {
|
||||
this.chooseHint = chooseHint;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue