attach: rework attaching names

This commit is contained in:
Hanmac
2018-11-23 22:24:57 +01:00
parent 3b283b14a7
commit d0857ad696
3 changed files with 8 additions and 8 deletions

View File

@@ -442,22 +442,22 @@ public class CardView extends GameEntityView {
return get(TrackableProperty.EncodedCards);
}
public GameEntityView getAttaching() {
return get(TrackableProperty.Attaching);
public GameEntityView getAttachingEntity() {
return get(TrackableProperty.AttachingEntity);
}
void updateAttaching(Card c) {
set(TrackableProperty.Attaching, GameEntityView.get(c.getAttachingEntity()));
set(TrackableProperty.AttachingEntity, GameEntityView.get(c.getAttachingEntity()));
}
public CardView getAttachingCard() {
GameEntityView enchanting = getAttaching();
GameEntityView enchanting = getAttachingEntity();
if (enchanting instanceof CardView) {
return (CardView) enchanting;
}
return null;
}
public PlayerView getAttachingPlayer() {
GameEntityView enchanting = getAttaching();
GameEntityView enchanting = getAttachingEntity();
if (enchanting instanceof PlayerView) {
return (PlayerView) enchanting;
}

View File

@@ -43,7 +43,7 @@ public enum TrackableProperty {
NamedCard(TrackableTypes.StringType),
PlayerMayLook(TrackableTypes.PlayerViewCollectionType, FreezeMode.IgnoresFreeze),
PlayerMayLookTemp(TrackableTypes.PlayerViewCollectionType, FreezeMode.IgnoresFreeze),
Attaching(TrackableTypes.GameEntityViewType),
AttachingEntity(TrackableTypes.GameEntityViewType),
EncodedCards(TrackableTypes.CardViewCollectionType),
GainControlTargets(TrackableTypes.CardViewCollectionType),
CloneOrigin(TrackableTypes.CardViewType),

View File

@@ -99,7 +99,7 @@ public class VField extends FContainer {
};
private boolean tryStackCard(CardView card, List<CardView> cardsOfType) {
if (card.isAttached()) {
if (card.isAttachedByCards()) {
return false; //can stack with enchanted or equipped card
}
if (card.getCurrentState().isCreature() && !card.isToken()) {
@@ -107,7 +107,7 @@ public class VField extends FContainer {
}
final String cardName = card.getCurrentState().getName();
for (CardView c : cardsOfType) {
if (!c.isAttached() &&
if (!c.isAttachedByCards() &&
cardName.equals(c.getCurrentState().getName()) &&
card.hasSameCounters(c) &&
card.isToken() == c.isToken()) { //don't stack tokens on top of non-tokens