mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Merge branch 'trackerRevealLKI' into 'master'
PlayerControllerHuman: fix reveal on LKI card list See merge request core-developers/forge!2848
This commit is contained in:
@@ -546,11 +546,16 @@ public class Game {
|
||||
}
|
||||
|
||||
public Card findByView(CardView view) {
|
||||
if (view == null) {
|
||||
return null;
|
||||
}
|
||||
CardIdVisitor visit = new CardIdVisitor(view.getId());
|
||||
if (ZoneType.Stack.equals(view.getZone())) {
|
||||
visit.visitAll(getStackZone());
|
||||
} else {
|
||||
} else if (view.getController() != null && view.getZone() != null) {
|
||||
visit.visitAll(getPlayer(view.getController()).getZone(view.getZone()));
|
||||
} else { // fallback if view doesn't has controller or zone set for some reason
|
||||
forEachCardInGame(visit);
|
||||
}
|
||||
return visit.getFound();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ import forge.game.zone.ZoneType;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.PaperCard;
|
||||
import forge.trackable.TrackableProperty;
|
||||
import forge.trackable.Tracker;
|
||||
import forge.util.*;
|
||||
import forge.util.collect.FCollection;
|
||||
import forge.util.collect.FCollectionView;
|
||||
@@ -304,11 +305,14 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* @see IPaperCard
|
||||
*/
|
||||
public Card(final int id0, final IPaperCard paperCard0, final Game game0) {
|
||||
this(id0, paperCard0, game0, game0 == null ? null : game0.getTracker());
|
||||
}
|
||||
public Card(final int id0, final IPaperCard paperCard0, final Game game0, final Tracker tracker0) {
|
||||
super(id0);
|
||||
|
||||
game = game0;
|
||||
paperCard = paperCard0;
|
||||
view = new CardView(id0, game == null ? null : game.getTracker());
|
||||
view = new CardView(id0, tracker0);
|
||||
currentState = new CardState(view.getCurrentState(), this);
|
||||
states.put(CardStateName.Original, currentState);
|
||||
view.updateChangedColorWords(this);
|
||||
|
||||
@@ -206,7 +206,7 @@ public final class CardUtil {
|
||||
.build()
|
||||
);
|
||||
|
||||
final Card newCopy = new Card(in.getId(), in.getPaperCard(), in.getGame());
|
||||
final Card newCopy = new Card(in.getId(), in.getPaperCard(), in.getGame(), null);
|
||||
newCopy.setSetCode(in.getSetCode());
|
||||
newCopy.setOwner(in.getOwner());
|
||||
newCopy.setController(in.getController(), 0);
|
||||
|
||||
@@ -876,7 +876,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
try {
|
||||
clone = (SpellAbility) clone();
|
||||
clone.id = lki ? id : nextId();
|
||||
clone.view = new SpellAbilityView(clone);
|
||||
clone.view = new SpellAbilityView(clone, lki || host.getGame() == null ? null : host.getGame().getTracker());
|
||||
|
||||
// don't use setHostCard to not trigger the not copied parts yet
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import forge.game.card.CardView;
|
||||
import forge.game.card.IHasCardView;
|
||||
import forge.trackable.TrackableObject;
|
||||
import forge.trackable.TrackableProperty;
|
||||
import forge.trackable.Tracker;
|
||||
|
||||
public class SpellAbilityView extends TrackableObject implements IHasCardView {
|
||||
private static final long serialVersionUID = 2514234930798754769L;
|
||||
@@ -25,7 +26,10 @@ public class SpellAbilityView extends TrackableObject implements IHasCardView {
|
||||
}
|
||||
|
||||
SpellAbilityView(final SpellAbility sa) {
|
||||
super(sa.getId(), sa.getHostCard() == null || sa.getHostCard().getGame() == null ? null : sa.getHostCard().getGame().getTracker());
|
||||
this(sa, sa.getHostCard() == null || sa.getHostCard().getGame() == null ? null : sa.getHostCard().getGame().getTracker());
|
||||
}
|
||||
SpellAbilityView(final SpellAbility sa, Tracker tracker) {
|
||||
super(sa.getId(), tracker);
|
||||
updateHostCard(sa);
|
||||
updateDescription(sa);
|
||||
updatePromptIfOnlyPossibleAbility(sa);
|
||||
|
||||
@@ -747,12 +747,16 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reveal(final CardCollectionView cards, final ZoneType zone, final Player owner, final String message) {
|
||||
reveal(CardView.getCollection(cards), zone, PlayerView.get(owner), message);
|
||||
public void reveal(final CardCollectionView cards, final ZoneType zone, final Player owner, String message) {
|
||||
reveal(cards, zone, PlayerView.get(owner), message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reveal(final List<CardView> cards, final ZoneType zone, final PlayerView owner, String message) {
|
||||
reveal(getCardList(cards), zone, owner, message);
|
||||
}
|
||||
|
||||
protected void reveal(final CardCollectionView cards, final ZoneType zone, final PlayerView owner, String message) {
|
||||
if (StringUtils.isBlank(message)) {
|
||||
message = localizer.getMessage("lblLookCardInPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase());
|
||||
} else {
|
||||
@@ -760,8 +764,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
final String fm = MessageUtil.formatMessage(message, getLocalPlayerView(), owner);
|
||||
if (!cards.isEmpty()) {
|
||||
tempShowCards(getCardList(cards));
|
||||
getGui().reveal(fm, cards);
|
||||
tempShowCards(cards);
|
||||
getGui().reveal(fm, CardView.getCollection(cards));
|
||||
endTempShowCards();
|
||||
} else {
|
||||
getGui().message(MessageUtil.formatMessage(localizer.getMessage("lblThereNoCardInPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase()),
|
||||
|
||||
Reference in New Issue
Block a user