private bool ShouldSwapCardSources(CardSource cardSource, ITrigger trigger = null) { var cardSources = cardSource.AssociatedCardSources.ToList(); CardSource thisCardSource = (from cs in cardSources where cs != null && cs.CardController == this select cs).LastOrDefault <CardSource>(); if (thisCardSource != null) { bool flag = this._copiedCard == (cardSource.CardController.CardWithoutReplacements); bool flag2 = (from cs in cardSources select cs.CardController).Contains(this); if (flag && flag2) { bool flag3 = cardSource.SourceLimitation != null; CardSource.Limitation?cardSourceLimitation = base.CardSourceLimitation; CardSource.Limitation limitation = CardSource.Limitation.BeforeDestroyed; if (cardSourceLimitation.GetValueOrDefault() == limitation & cardSourceLimitation != null) { thisCardSource.SourceLimitation = new CardSource.Limitation?(CardSource.Limitation.BeforeDestroyed); } else { cardSourceLimitation = base.CardSourceLimitation; limitation = CardSource.Limitation.AfterDestroyed; if (cardSourceLimitation.GetValueOrDefault() == limitation & cardSourceLimitation != null) { thisCardSource.SourceLimitation = new CardSource.Limitation?(CardSource.Limitation.AfterDestroyed); } } bool flag4 = thisCardSource.SourceLimitation != null; return(!flag3 || !flag4 || cardSource.SourceLimitation.Value == thisCardSource.SourceLimitation.Value); } } return(false); }
private bool ShouldSwapCardSources(CardSource cardSource, ITrigger trigger = null) { var cardSources = cardSource.AssociatedCardSources.ToList(); CardSource thisCardSource = (from cs in cardSources where cs != null && cs.CardController == this select cs).LastOrDefault <CardSource>(); if (thisCardSource != null) { bool isCardSourceMyCopiedCard = this.CopiedCard == (cardSource.CardController.CardWithoutReplacements); bool isAnyCardSourceMyself = cardSources.Any(cs => cs.CardController == this); if (isCardSourceMyCopiedCard && isAnyCardSourceMyself) { bool otherHasSourceLimitation = cardSource.SourceLimitation != null; CardSource.Limitation?cardSourceLimitation = base.CardSourceLimitation; CardSource.Limitation limitation = CardSource.Limitation.BeforeDestroyed; if (cardSourceLimitation.GetValueOrDefault() == limitation & cardSourceLimitation != null) { thisCardSource.SourceLimitation = CardSource.Limitation.BeforeDestroyed; } else { cardSourceLimitation = base.CardSourceLimitation; limitation = CardSource.Limitation.AfterDestroyed; if (cardSourceLimitation.GetValueOrDefault() == limitation & cardSourceLimitation != null) { thisCardSource.SourceLimitation = CardSource.Limitation.AfterDestroyed; } } bool thisHasSourceLimitation = thisCardSource.SourceLimitation != null; return(!otherHasSourceLimitation || !thisHasSourceLimitation || cardSource.SourceLimitation.Value == thisCardSource.SourceLimitation.Value); } } return(false); }