Autoyield on effect on a card not overall; Add new method to generate the autoyield key to prepare for fix of effect ordering

This commit is contained in:
pfps
2017-01-07 15:52:24 +00:00
parent e90c0255e1
commit 5da185263e
5 changed files with 22 additions and 4 deletions

View File

@@ -581,6 +581,11 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
} }
} }
// key for autoyield - the card description (including number) plus the effect description
public String yieldKey() {
return getHostCard().toString() + ": " + toUnsuppressedString();
}
public String getStackDescription() { public String getStackDescription() {
String text = getHostCard().getView().getText(); String text = getHostCard().getView().getText();
if (stackDescription.equals(text)) { if (stackDescription.equals(text)) {

View File

@@ -44,7 +44,7 @@ public class StackItemView extends TrackableObject implements IHasCardView {
return get(TrackableProperty.Key); return get(TrackableProperty.Key);
} }
void updateKey(SpellAbilityStackInstance si) { void updateKey(SpellAbilityStackInstance si) {
set(TrackableProperty.Key, si.getSpellAbility(false).toUnsuppressedString()); set(TrackableProperty.Key, si.getSpellAbility(false).yieldKey());
} }
public int getSourceTrigger() { public int getSourceTrigger() {

View File

@@ -189,6 +189,16 @@ public class WrappedAbility extends Ability {
return sa.getView(); return sa.getView();
} }
// key for autoyield - if there is a trigger use its description as the wrapper now has triggering information in its description
@Override
public String yieldKey() {
if ( getTrigger() != null ) {
return getHostCard().toString() + ": " + getTrigger().toString();
} else {
return super.yieldKey();
}
}
@Override @Override
public String toUnsuppressedString() { public String toUnsuppressedString() {
return regtrig.toString(); return regtrig.toString();

View File

@@ -14,6 +14,9 @@ This release features most Commander 2016 cards scripted and ready to play. The
- Escape Key Functionality Change - - Escape Key Functionality Change -
Forge now does not allow the player to use the Escape key as a form of an "End Turn" shortcut by default in order to avoid situations when pressing Escape recklessly can lead to missing one's own turn or other dangerous and undesirable situations. However, if you prefer the old behavior, it can be reenabled using the "Use Escape Key To End Turn" option in Forge preferences. Forge now does not allow the player to use the Escape key as a form of an "End Turn" shortcut by default in order to avoid situations when pressing Escape recklessly can lead to missing one's own turn or other dangerous and undesirable situations. However, if you prefer the old behavior, it can be reenabled using the "Use Escape Key To End Turn" option in Forge preferences.
- Auto Yield Functionality Change -
Auto Yield is now done on a per-card basis, consistent with how it is presented in the GUI. For example, auto-yielding an Evolve effect in the stack only affects Evolve on the card for the effect, not Evolve on all cards.
- Quest Mode Updates and Fixes - - Quest Mode Updates and Fixes -
It is now possible to simulate random AI vs. AI match outcome instead of playing out all AI vs. AI matches and making the player watch them. AI decks with higher total card draft ranking value have a higher chance of "winning" a random simulated AI vs. AI match. This option is disabled by default and can be enabled in Quest Preferences (set the option "Simulate AI vs. AI Matches" to 1). When using a token to create a new quest draft tournament, the player will be shown the entry fee for the tournament and will be asked to confirm creating that tournament with the provided entry fee in mind. Quest mode has become more robust and resistant to quest data corruption. Non-tournament legal substandard cards (e.g. Conspiracies) will no longer be added to quest card pool from reward booster packs and possibly other sources to prevent persistent crashes (these cards had no possible use in quest mode anyway). Quest draft tournaments with sets that have no standard draft template in Forge (e.g. Commander, Conspiracy) will no longer be created in order to prevent the game crashing when trying to start a draft tournament. It is now possible to simulate random AI vs. AI match outcome instead of playing out all AI vs. AI matches and making the player watch them. AI decks with higher total card draft ranking value have a higher chance of "winning" a random simulated AI vs. AI match. This option is disabled by default and can be enabled in Quest Preferences (set the option "Simulate AI vs. AI Matches" to 1). When using a token to create a new quest draft tournament, the player will be shown the entry fee for the tournament and will be asked to confirm creating that tournament with the provided entry fee in mind. Quest mode has become more robust and resistant to quest data corruption. Non-tournament legal substandard cards (e.g. Conspiracies) will no longer be added to quest card pool from reward booster packs and possibly other sources to prevent persistent crashes (these cards had no possible use in quest mode anyway). Quest draft tournaments with sets that have no standard draft template in Forge (e.g. Commander, Conspiracy) will no longer be created in order to prevent the game crashing when trying to start a draft tournament.

View File

@@ -911,7 +911,7 @@ public class PlayerControllerHuman
} }
} else { } else {
final SpellAbility ability = stack.peekAbility(); final SpellAbility ability = stack.peekAbility();
if (ability != null && ability.isAbility() && getGui().shouldAutoYield(ability.toUnsuppressedString())) { if (ability != null && ability.isAbility() && getGui().shouldAutoYield(ability.yieldKey())) {
//avoid prompt for input if top ability of stack is set to auto-yield //avoid prompt for input if top ability of stack is set to auto-yield
try { try {
Thread.sleep(FControlGamePlayback.resolveDelay); Thread.sleep(FControlGamePlayback.resolveDelay);
@@ -1236,7 +1236,7 @@ public class PlayerControllerHuman
if (savedOrder == null || !sameOrder) { //prompt if no saved order for the current set of abilities or if the player wants to change the order if (savedOrder == null || !sameOrder) { //prompt if no saved order for the current set of abilities or if the player wants to change the order
orderedSAs = getGui().order("Select order for simultaneous abilities", "Resolve first", activePlayerSAs, null); orderedSAs = getGui().order("Select order for simultaneous abilities", "Resolve first", activePlayerSAs, null);
//save order to avoid needing to prompt a second time to order the same abilties //save order to avoid needing to prompt a second time to order the same abilities
savedOrder = new ArrayList<Integer>(activePlayerSAs.size()); savedOrder = new ArrayList<Integer>(activePlayerSAs.size());
for (SpellAbility sa : orderedSAs) { for (SpellAbility sa : orderedSAs) {
savedOrder.add(activePlayerSAs.indexOf(sa)); savedOrder.add(activePlayerSAs.indexOf(sa));