mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fixed a bug that prevented the combat log from showing the most recently declared attacker.
This commit is contained in:
@@ -6,12 +6,12 @@
|
|||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -117,10 +117,10 @@ import forge.util.maps.MapOfLists;
|
|||||||
* <p>
|
* <p>
|
||||||
* Card class.
|
* Card class.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* Can now be used as keys in Tree data structures. The comparison is based
|
* Can now be used as keys in Tree data structures. The comparison is based
|
||||||
* entirely on id.
|
* entirely on id.
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@@ -195,7 +195,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
|
|
||||||
private boolean monstrous = false;
|
private boolean monstrous = false;
|
||||||
private int monstrosityNum = 0;
|
private int monstrosityNum = 0;
|
||||||
|
|
||||||
private boolean renowned = false;
|
private boolean renowned = false;
|
||||||
|
|
||||||
private boolean manifested = false;
|
private boolean manifested = false;
|
||||||
@@ -304,7 +304,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
}
|
}
|
||||||
public Card(final int id0, final IPaperCard paperCard0, final boolean allowCache, final Game game0) {
|
public Card(final int id0, final IPaperCard paperCard0, final boolean allowCache, final Game game0) {
|
||||||
super(id0);
|
super(id0);
|
||||||
|
|
||||||
game = game0;
|
game = game0;
|
||||||
if (id0 >= 0 && allowCache && game != null) {
|
if (id0 >= 0 && allowCache && game != null) {
|
||||||
game.addCard(id0, this);
|
game.addCard(id0, this);
|
||||||
@@ -454,7 +454,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
|
|
||||||
// flip and face-down don't overlap. That is there is no chance to turn face down a flipped permanent
|
// flip and face-down don't overlap. That is there is no chance to turn face down a flipped permanent
|
||||||
// and then any effect have it turn upface again and demand its former flip state to be restored
|
// and then any effect have it turn upface again and demand its former flip state to be restored
|
||||||
// Proof: Morph cards never have ability that makes them flip, Ixidron does not suppose cards to be turned face up again,
|
// Proof: Morph cards never have ability that makes them flip, Ixidron does not suppose cards to be turned face up again,
|
||||||
// Illusionary Mask affects cards in hand.
|
// Illusionary Mask affects cards in hand.
|
||||||
CardStateName oldState = getCurrentStateName();
|
CardStateName oldState = getCurrentStateName();
|
||||||
if (mode.equals("Transform") && isDoubleFaced()) {
|
if (mode.equals("Transform") && isDoubleFaced()) {
|
||||||
@@ -463,7 +463,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
}
|
}
|
||||||
CardStateName destState = oldState == CardStateName.Transformed ? CardStateName.Original : CardStateName.Transformed;
|
CardStateName destState = oldState == CardStateName.Transformed ? CardStateName.Original : CardStateName.Transformed;
|
||||||
return changeToState(destState);
|
return changeToState(destState);
|
||||||
|
|
||||||
} else if (mode.equals("Flip") && isFlipCard()) {
|
} else if (mode.equals("Flip") && isFlipCard()) {
|
||||||
CardStateName destState = oldState == CardStateName.Flipped ? CardStateName.Original : CardStateName.Flipped;
|
CardStateName destState = oldState == CardStateName.Flipped ? CardStateName.Original : CardStateName.Flipped;
|
||||||
return changeToState(destState);
|
return changeToState(destState);
|
||||||
@@ -562,6 +562,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
|
|
||||||
public void updateAttackingForView() {
|
public void updateAttackingForView() {
|
||||||
view.updateAttacking(this);
|
view.updateAttacking(this);
|
||||||
|
getGame().updateCombatForView();
|
||||||
}
|
}
|
||||||
public void updateBlockingForView() {
|
public void updateBlockingForView() {
|
||||||
view.updateBlocking(this);
|
view.updateBlocking(this);
|
||||||
@@ -616,7 +617,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
}
|
}
|
||||||
devouredCards.add(c);
|
devouredCards.add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void clearDevoured() {
|
public final void clearDevoured() {
|
||||||
devouredCards = null;
|
devouredCards = null;
|
||||||
}
|
}
|
||||||
@@ -630,7 +631,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
}
|
}
|
||||||
delvedCards.add(c);
|
delvedCards.add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void clearDelved() {
|
public final void clearDelved() {
|
||||||
delvedCards = null;
|
delvedCards = null;
|
||||||
}
|
}
|
||||||
@@ -941,7 +942,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
public final int getTotalCountersToAdd() {
|
public final int getTotalCountersToAdd() {
|
||||||
return countersAdded;
|
return countersAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setTotalCountersToAdd(int value) {
|
public final void setTotalCountersToAdd(int value) {
|
||||||
countersAdded = value;
|
countersAdded = value;
|
||||||
}
|
}
|
||||||
@@ -997,7 +998,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
if (powerBonusBefore != getPowerBonusFromCounters() || toughnessBonusBefore != getToughnessBonusFromCounters() || loyaltyBefore != getCurrentLoyalty()) {
|
if (powerBonusBefore != getPowerBonusFromCounters() || toughnessBonusBefore != getToughnessBonusFromCounters() || loyaltyBefore != getCurrentLoyalty()) {
|
||||||
getGame().fireEvent(new GameEventCardStatsChanged(this));
|
getGame().fireEvent(new GameEventCardStatsChanged(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
// play the Add Counter sound
|
// play the Add Counter sound
|
||||||
getGame().fireEvent(new GameEventCardCounters(this, counterType, oldValue == null ? 0 : oldValue.intValue(), newValue));
|
getGame().fireEvent(new GameEventCardCounters(this, counterType, oldValue == null ? 0 : oldValue.intValue(), newValue));
|
||||||
}
|
}
|
||||||
@@ -1742,7 +1743,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
|
|
||||||
// Give spellText line breaks for easier reading
|
// Give spellText line breaks for easier reading
|
||||||
sb.append(text.replaceAll("\\\\r\\\\n", "\r\n"));
|
sb.append(text.replaceAll("\\\\r\\\\n", "\r\n"));
|
||||||
|
|
||||||
// NOTE:
|
// NOTE:
|
||||||
if (sb.toString().contains(" (NOTE: ")) {
|
if (sb.toString().contains(" (NOTE: ")) {
|
||||||
sb.insert(sb.indexOf("(NOTE: "), "\r\n");
|
sb.insert(sb.indexOf("(NOTE: "), "\r\n");
|
||||||
@@ -2511,7 +2512,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
public Map<Long, CardChangedType> getChangedCardTypes() {
|
public Map<Long, CardChangedType> getChangedCardTypes() {
|
||||||
return Collections.unmodifiableMap(changedCardTypes);
|
return Collections.unmodifiableMap(changedCardTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Long, KeywordsChange> getChangedCardKeywords() {
|
public Map<Long, KeywordsChange> getChangedCardKeywords() {
|
||||||
return changedCardKeywords;
|
return changedCardKeywords;
|
||||||
}
|
}
|
||||||
@@ -2652,9 +2653,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Get the latest set Power and Toughness of this Card.
|
* Get the latest set Power and Toughness of this Card.
|
||||||
*
|
*
|
||||||
* @return the latest set Power and Toughness of this {@link Card} as the
|
* @return the latest set Power and Toughness of this {@link Card} as the
|
||||||
* left and right values of a {@link Pair}, respectively. A value of -1
|
* left and right values of a {@link Pair}, respectively. A value of -1
|
||||||
* means that particular property has not been set.
|
* means that particular property has not been set.
|
||||||
@@ -2794,7 +2795,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
public final int getNetToughness() {
|
public final int getNetToughness() {
|
||||||
return getNetToughnessBreakdown().getTotal();
|
return getNetToughnessBreakdown().getTotal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean toughnessAssignsDamage() {
|
public final boolean toughnessAssignsDamage() {
|
||||||
return getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.toughnessAssignsDamage)
|
return getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.toughnessAssignsDamage)
|
||||||
|| hasKeyword("CARDNAME assigns combat damage equal to its toughness rather than its power");
|
|| hasKeyword("CARDNAME assigns combat damage equal to its toughness rather than its power");
|
||||||
@@ -2954,7 +2955,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
public final boolean hasKeyword(String keyword) {
|
public final boolean hasKeyword(String keyword) {
|
||||||
return hasKeyword(keyword, currentState);
|
return hasKeyword(keyword, currentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean hasKeyword(String keyword, CardState state) {
|
public final boolean hasKeyword(String keyword, CardState state) {
|
||||||
if (keyword.startsWith("HIDDEN")) {
|
if (keyword.startsWith("HIDDEN")) {
|
||||||
keyword = keyword.substring(7);
|
keyword = keyword.substring(7);
|
||||||
@@ -3166,7 +3167,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
* Change a SVar due to a text change effect. Change is volatile and will be
|
* Change a SVar due to a text change effect. Change is volatile and will be
|
||||||
* reverted upon refreshing text changes (unless it is changed again at that
|
* reverted upon refreshing text changes (unless it is changed again at that
|
||||||
* time).
|
* time).
|
||||||
*
|
*
|
||||||
* @param key the SVar name.
|
* @param key the SVar name.
|
||||||
* @param value the new SVar value.
|
* @param value the new SVar value.
|
||||||
*/
|
*/
|
||||||
@@ -3516,7 +3517,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
return hasStartOfKeyword(keyword, currentState);
|
return hasStartOfKeyword(keyword, currentState);
|
||||||
}
|
}
|
||||||
public final boolean hasStartOfKeyword(String keyword, CardState state) {
|
public final boolean hasStartOfKeyword(String keyword, CardState state) {
|
||||||
CountKeywordVisitor visitor = new CountKeywordVisitor(keyword, true);
|
CountKeywordVisitor visitor = new CountKeywordVisitor(keyword, true);
|
||||||
visitKeywords(state, visitor);
|
visitKeywords(state, visitor);
|
||||||
return visitor.getCount() > 0;
|
return visitor.getCount() > 0;
|
||||||
}
|
}
|
||||||
@@ -3525,7 +3526,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
return hasStartOfUnHiddenKeyword(keyword, currentState);
|
return hasStartOfUnHiddenKeyword(keyword, currentState);
|
||||||
}
|
}
|
||||||
public final boolean hasStartOfUnHiddenKeyword(String keyword, CardState state) {
|
public final boolean hasStartOfUnHiddenKeyword(String keyword, CardState state) {
|
||||||
CountKeywordVisitor visitor = new CountKeywordVisitor(keyword, true);
|
CountKeywordVisitor visitor = new CountKeywordVisitor(keyword, true);
|
||||||
visitUnhiddenKeywords(state, visitor);
|
visitUnhiddenKeywords(state, visitor);
|
||||||
return visitor.getCount() > 0;
|
return visitor.getCount() > 0;
|
||||||
}
|
}
|
||||||
@@ -3560,7 +3561,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
return getAmountOfKeyword(k, currentState);
|
return getAmountOfKeyword(k, currentState);
|
||||||
}
|
}
|
||||||
public final int getAmountOfKeyword(final String k, CardState state) {
|
public final int getAmountOfKeyword(final String k, CardState state) {
|
||||||
CountKeywordVisitor visitor = new CountKeywordVisitor(k);
|
CountKeywordVisitor visitor = new CountKeywordVisitor(k);
|
||||||
visitKeywords(state, visitor);
|
visitKeywords(state, visitor);
|
||||||
return visitor.getCount();
|
return visitor.getCount();
|
||||||
}
|
}
|
||||||
@@ -3619,7 +3620,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !testFailed;
|
return !testFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Takes arguments like Blue or withFlying
|
// Takes arguments like Blue or withFlying
|
||||||
@Override
|
@Override
|
||||||
@@ -6037,7 +6038,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the total damage done by card this turn (after prevention and redirects).
|
* Gets the total damage done by card this turn (after prevention and redirects).
|
||||||
*
|
*
|
||||||
* @return the damage done to player p this turn
|
* @return the damage done to player p this turn
|
||||||
*/
|
*/
|
||||||
public final int getTotalDamageDoneBy() {
|
public final int getTotalDamageDoneBy() {
|
||||||
@@ -6668,7 +6669,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -6682,7 +6683,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
public void visit(String kw) {
|
public void visit(String kw) {
|
||||||
keywords.add(kw);
|
keywords.add(kw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getKeywords() {
|
public List<String> getKeywords() {
|
||||||
return keywords;
|
return keywords;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,9 @@
|
|||||||
package forge.game.card;
|
package forge.game.card;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import forge.ImageKeys;
|
import forge.ImageKeys;
|
||||||
import forge.card.CardEdition;
|
import forge.card.*;
|
||||||
import forge.card.CardRarity;
|
|
||||||
import forge.card.CardRules;
|
|
||||||
import forge.card.CardStateName;
|
|
||||||
import forge.card.CardType;
|
|
||||||
import forge.card.CardTypeView;
|
|
||||||
import forge.card.ColorSet;
|
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
import forge.game.Direction;
|
import forge.game.Direction;
|
||||||
import forge.game.GameEntityView;
|
import forge.game.GameEntityView;
|
||||||
@@ -31,6 +17,12 @@ import forge.trackable.TrackableObject;
|
|||||||
import forge.trackable.TrackableProperty;
|
import forge.trackable.TrackableProperty;
|
||||||
import forge.trackable.Tracker;
|
import forge.trackable.Tracker;
|
||||||
import forge.util.collect.FCollectionView;
|
import forge.util.collect.FCollectionView;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class CardView extends GameEntityView {
|
public class CardView extends GameEntityView {
|
||||||
private static final long serialVersionUID = -3624090829028979255L;
|
private static final long serialVersionUID = -3624090829028979255L;
|
||||||
@@ -144,7 +136,7 @@ public class CardView extends GameEntityView {
|
|||||||
}
|
}
|
||||||
void updateAttacking(Card c) {
|
void updateAttacking(Card c) {
|
||||||
Combat combat = c.getGame().getCombat();
|
Combat combat = c.getGame().getCombat();
|
||||||
set(TrackableProperty.Attacking, combat == null ? false : combat.isAttacking(c));
|
set(TrackableProperty.Attacking, combat != null && combat.isAttacking(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBlocking() {
|
public boolean isBlocking() {
|
||||||
@@ -152,7 +144,7 @@ public class CardView extends GameEntityView {
|
|||||||
}
|
}
|
||||||
void updateBlocking(Card c) {
|
void updateBlocking(Card c) {
|
||||||
Combat combat = c.getGame().getCombat();
|
Combat combat = c.getGame().getCombat();
|
||||||
set(TrackableProperty.Blocking, combat == null ? false : combat.isBlocking(c));
|
set(TrackableProperty.Blocking, combat != null && combat.isBlocking(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPhasedOut() {
|
public boolean isPhasedOut() {
|
||||||
@@ -434,7 +426,7 @@ public class CardView extends GameEntityView {
|
|||||||
if (isInZone(EnumSet.of(ZoneType.Battlefield, ZoneType.Stack, ZoneType.Sideboard)) && getController().equals(viewer)) {
|
if (isInZone(EnumSet.of(ZoneType.Battlefield, ZoneType.Stack, ZoneType.Sideboard)) && getController().equals(viewer)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (getController().isOpponentOf(viewer) && getCurrentState().getOpponentMayLook()) {
|
if (getController().isOpponentOf(viewer) && getCurrentState().getOpponentMayLook()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -861,7 +853,7 @@ public class CardView extends GameEntityView {
|
|||||||
String rulesText = null;
|
String rulesText = null;
|
||||||
|
|
||||||
if (type.isVanguard() && rules != null) {
|
if (type.isVanguard() && rules != null) {
|
||||||
rulesText = "Hand Modifier: " + rules.getHand() +
|
rulesText = "Hand Modifier: " + rules.getHand() +
|
||||||
"\r\nLife Modifier: " + rules.getLife();
|
"\r\nLife Modifier: " + rules.getLife();
|
||||||
}
|
}
|
||||||
set(TrackableProperty.RulesText, rulesText);
|
set(TrackableProperty.RulesText, rulesText);
|
||||||
|
|||||||
Reference in New Issue
Block a user