public override CardSource AskIfCardSourceIsReplaced(CardSource cardSource, GameAction gameAction = null,
                                                             ITrigger trigger = null)
        {
            if (cardSource == null || !cardSource.AllowReplacements || this._copiedCard == null ||
                !this._copiedCard.Equals(cardSource.Card) ||
                cardSource.AssociatedCardSources.All(acs => acs.Card != this.Card) ||
                !ShouldSwapCardSources(cardSource, trigger))
            {
                return(null);
            }

            CardSource newCardSource = (from cs in cardSource.AssociatedCardSources
                                        where cs.CardController == this
                                        select cs).LastOrDefault <CardSource>();

            if (newCardSource == null)
            {
                return(null);
            }

            if (newCardSource.AssociatedCardSources.All(cs => cs.CardController != cardSource.CardController))
            {
                newCardSource.AddAssociatedCardSource(cardSource);
            }

            cardSource.RemoveAssociatedCardSourcesWhere(cs => cs.CardController == this);

            return(newCardSource);
        }
Exemplo n.º 2
0
        public override void Resolve()
        {
            CardSource.BindedAction = null;

            if (IsCountered)
            {
                CardSource.PutIntoGraveyard();
                return;
            }

            foreach (AbilityActivation aa in spellAbilities.Where(sa => sa.IsComplete))
            {
                aa.Resolve();
            }

            //sumoning sickness
            if (CardSource.HasType(CardTypes.Creature) &&
                !CardSource.HasAbility(AbilityEnum.Haste))
            {
                CardSource.HasSummoningSickness = true;
            }

            CardGroupEnum dest = CardGroupEnum.InPlay;

            if (CardSource.HasType(CardTypes.Instant) ||
                CardSource.HasType(CardTypes.Sorcery))
            {
                dest = CardGroupEnum.Graveyard;
            }

            CardSource.ChangeZone(dest);

            MagicEngine.CurrentEngine.RaiseMagicEvent(new SpellEventArg(this));
            //MagicEngine.CurrentEngine.UpdateOverlays ();
        }
Exemplo n.º 3
0
        public static string GetString(this CardSource source)
        {
            switch (source)
            {
            case CardSource.Activity: return("Aktywność");

            case CardSource.Safari: return("Safari");

            case CardSource.Shop: return("Sklepik");

            case CardSource.GodIntervention: return("Czity");

            case CardSource.Api: return("Strona");

            case CardSource.Migration: return("Stara baza");

            case CardSource.PvE: return("Walki na boty");

            case CardSource.Daily: return("Karta+");

            case CardSource.Crafting: return("Tworzenie");

            case CardSource.PvpShop: return("Koszary");

            case CardSource.Figure: return("Figurka");

            default:
            case CardSource.Other: return("Inne");
            }
        }
        public override IEnumerator BeforeFlipCardImmediateResponse(FlipCardAction flip)
        {
            CardSource cardSource = flip.CardSource;

            if (cardSource == null && flip.ActionSource != null)
            {
                cardSource = flip.ActionSource.CardSource;
            }
            if (cardSource == null)
            {
                cardSource = base.GetCardSource();
            }

            if (!flip.CardToFlip.Card.IsFlipped)
            {
                IEnumerator coroutine = base.GameController.RemoveTarget(base.Card, cardSource: cardSource);
                if (base.UseUnityCoroutines)
                {
                    yield return(base.GameController.StartCoroutine(coroutine));
                }
                else
                {
                    base.GameController.ExhaustCoroutine(coroutine);
                }
            }
            yield break;
        }
        public static int ResolveSource(CardSource source, DungeonMaster DM, Character user,
                                        Position posTarget, Character charTarget)
        {
            switch (source)
            {
            case CardSource.TargetVitality:
                return(charTarget.Vitality.Value);

            case CardSource.TargetStamina:
                return(charTarget.Stamina.Value);

            case CardSource.TargetArmorCoverage:
                return(charTarget.ArmorCoverage);

            case CardSource.UserBaseAttack:
                return(user.WeaponAdvantage + user.Profeciency.Value);

            case CardSource.UserBaseDamage:
                return(user.Strength.Value + user.WeaponDamage);

            case CardSource.UserStrength:
                return(user.Strength.Value);

            default:
                break;
            }
            throw new NotImplementedException();
        }
Exemplo n.º 6
0
 /// <summary>
 /// 设置玩家所选的要加入构筑中的奖励卡牌
 /// </summary>
 /// <param name="cs"></param>
 public void SetRewardCardSource(CardSource cs)
 {
     if (cs)
     {
         resultInformation.cardSourceRward.Add(cs);
     }
 }
Exemplo n.º 7
0
        private List <CardData> loadMonsterSource()
        {
            CardSourceDataSet.MonsterDataTable _monsterTable = CardSource.GetInstance().MonsterTable;
            List <CardData> _listmonsterCard = new List <CardData>(_monsterTable.Count);

            Yugioh_AtemReturns.Database.CardSourceDataSet.DataSourceRow temp;
            for (int i = 0; i < _monsterTable.Count; i++)
            {
                temp = cardTable.FindById(_monsterTable[i].Id);
                _listmonsterCard.Add(new MonsterCardData(
                                         _monsterTable[i].Id,
                                         temp.Name,
                                         temp.Description,
                                         _monsterTable[i].IsEffect,
                                         _monsterTable[i].Attribute,
                                         _monsterTable[i].MonsterType,
                                         _monsterTable[i].Ability,
                                         _monsterTable[i].ATK,
                                         _monsterTable[i].DEF,
                                         _monsterTable[i].Level,
                                         _monsterTable[i].Rank,
                                         _monsterTable[i].PendulumScale));
            }
            return(_listmonsterCard);
        }
        public override Card AskIfCardIsReplaced(Card card, CardSource cardSource)
        {
            if (cardSource == null || !cardSource.AllowReplacements || this._copiedCard == null ||
                cardSource.CardController != this || card == base.CardWithoutReplacements)
            {
                return(null);
            }

            CardController cardController = cardSource.AssociatedCardSources.Select(cs => cs.CardController)
                                            .FirstOrDefault(cc => cc.CardWithoutReplacements == this._copiedCard);

            if (cardController == null)
            {
                return(null);
            }

            Card result = null;

            if (cardController.CharacterCardsWithoutReplacements.Contains(card))
            {
                result = base.CharacterCard;
            }
            else if (cardController.CardWithoutReplacements == card)
            {
                result = base.CardWithoutReplacements;
            }

            return(result);
        }
 public override Card AskIfCardIsReplaced(Card originalCard, CardSource effectSource)
 {
     if (effectSource.AllowReplacements && effectSource.Card != null && originalCard == this.CharacterCardWithoutReplacements && WasCardPlayedWithVigilar(effectSource.Card))
     {
         return(GameController.GetCardPropertyJournalEntryCard(effectSource.Card, VigilarKey));
     }
     return(null);
 }
Exemplo n.º 10
0
 public void ReceiveEvent(OptionSource option)
 {
     this.option  = option;
     canUseFlag   = true;
     selectedCard = null;
     targetCard   = null;
     OpenCraft(CraftMode.Upgrade);
 }
Exemplo n.º 11
0
 /// <summary>
 /// 接收传来的事件
 /// </summary>
 /// <param name="_event"></param>
 public void ReceiveEvent(CraftRoomEvent _event)
 {
     roomEvent    = _event;
     canUseFlag   = true;
     selectedCard = null;
     targetCard   = null;
     OpenCraft(CraftMode.Upgrade);
 }
Exemplo n.º 12
0
        private async Task ReadMagEncodeData()
        {
            MessageDialog insertCardDialog = null;

            viewModel.Track1Data = "";
            viewModel.Track2Data = "";
            viewModel.Track3Data = "";
            JobStatusControl.ClearLog();

            Console.SetOut(new TextBoxTextWriter(JobStatusControl.JobStatusLog));

            await printerManager.PerformAction("Reading mag encode data...", (zebraCardPrinter, connection) => {
                if (printerManager.IsPrinterReady(zebraCardPrinter, JobStatusControl))
                {
                    Console.WriteLine(); // Start logging on new line after printer ready check

                    CardSource cardSource = (CardSource)Enum.Parse(typeof(CardSource), viewModel.SelectedSource);

                    Dictionary <string, string> jobSettings = new Dictionary <string, string>();
                    jobSettings.Add(ZebraCardJobSettingNames.CARD_SOURCE, cardSource.ToString());
                    jobSettings.Add(ZebraCardJobSettingNames.CARD_DESTINATION, viewModel.SelectedDestination.ToString());

                    zebraCardPrinter.SetJobSettings(jobSettings);

                    if (cardSource == CardSource.ATM)
                    {
                        insertCardDialog = DialogHelper.ShowInsertCardDialog();
                    }

                    MagTrackData magTrackData = zebraCardPrinter.ReadMagData(DataSource.Track1 | DataSource.Track2 | DataSource.Track3, true);

                    if (string.IsNullOrEmpty(magTrackData.Track1) && string.IsNullOrEmpty(magTrackData.Track2) && string.IsNullOrEmpty(magTrackData.Track3))
                    {
                        Console.WriteLine("No data read from card.");
                    }

                    Application.Current.Dispatcher.Invoke(() => {
                        viewModel.Track1Data = magTrackData.Track1;
                        viewModel.Track2Data = magTrackData.Track2;
                        viewModel.Track3Data = magTrackData.Track3;
                    });
                }
            }, (exception) => {
                string errorMessage = $"Error reading mag encode data: {exception.Message}";
                MessageBoxHelper.ShowError(errorMessage);
                Console.WriteLine(errorMessage);
            });

            if (insertCardDialog != null)
            {
                insertCardDialog.Close();
            }

            StreamWriter streamWriter = new StreamWriter(Console.OpenStandardOutput());

            streamWriter.AutoFlush = true;
            Console.SetOut(streamWriter);
        }
Exemplo n.º 13
0
        private CardProvider()
        {
            cardTable = CardSource.GetInstance().DataSourceTable;

            listCardSource = new List <CardData>(cardTable.Count);
            listCardSource.AddRange((IEnumerable <CardData>) this.loadMonsterSource());
            listCardSource.AddRange((IEnumerable <CardData>) this.loadTrapSource());
            listCardSource.AddRange((IEnumerable <CardData>) this.loadSpellSource());
        }
        // todo make choose random not just first;
        public SoundPlaySetting GetBattleCryFor(Card card, CardSource cardSource)
        {
            var soundPlaySetting = _configManager.Config.SoundFiles.FirstOrDefault((sound) =>
            {
                return (sound.CardSource == CardSource.All || cardSource == sound.CardSource) && sound.CardId == card.Id;
            });

            return soundPlaySetting;
        }
Exemplo n.º 15
0
 public override bool?AskIfCardIsVisibleToCardSource(Card card, CardSource cardSource)
 {
     //check if card is from a hero and if AffectedCard is in play
     if (!this.IsAffectedCardInPlay() && card == base.Card && cardSource.Card.IsHero)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 16
0
        // todo make choose random not just first;
        public SoundPlaySetting GetBattleCryFor(Card card, CardSource cardSource)
        {
            var soundPlaySetting = _configManager.Config.SoundFiles.FirstOrDefault((sound) =>
            {
                return((sound.CardSource == CardSource.All || cardSource == sound.CardSource) && sound.CardId == card.Id);
            });

            return(soundPlaySetting);
        }
        public override bool?AskIfCardIsVisibleToCardSource(Card card, CardSource cardSource)
        {
            IEnumerable <Card> rooms = FindAllRoomsButThisOne();

            if (rooms.Contains(card) && cardSource.Card.Identifier != StSimeonsCatacombsInstructionsCardController.Identifier)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 18
0
    /// <summary>
    /// 返回随机出来的卡牌
    /// </summary>
    /// <param name="count"></param>
    /// <returns></returns>
    public List <CardSource> GetCardSourceInPool(int count)
    {
        List <CardSource> list = new List <CardSource>();

        for (int i = 0; i < count; i++)
        {
            CardSource cs = CardSourcePool[Random.Range(0, CardSourcePool.Count)];
            list.Add(cs);
        }
        return(list);
    }
Exemplo n.º 19
0
        private void OnPlay(Card card, CardSource cardSource)
        {
            var soundToPlay = _cardSoundPicker.GetBattleCryFor(card, cardSource);
            if(soundToPlay == null)
            {
                Hearthstone_Deck_Tracker.Logger.WriteLine("BattleCry SFX not found");
                return;
            }

            _soundBoard.Play(soundToPlay);
            Hearthstone_Deck_Tracker.Logger.WriteLine("BattleCry Sound Effect Triggered");
        }
Exemplo n.º 20
0
        private void OnPlay(Card card, CardSource cardSource)
        {
            var soundToPlay = _cardSoundPicker.GetBattleCryFor(card, cardSource);

            if (soundToPlay == null)
            {
                Hearthstone_Deck_Tracker.Utility.Logging.Log.Info("BattleCry SFX not found");
                return;
            }

            _soundBoard.Play(soundToPlay);
            Hearthstone_Deck_Tracker.Utility.Logging.Log.Info("BattleCry Sound Effect Triggered");
        }
Exemplo n.º 21
0
        protected override IEnumerator RunResponse(DealDamageAction dd, CardSource cardSource, params object[] otherObjects)
        {
            IEnumerator coroutine = this.GameController.GainHP(dd.Target, 4, cardSource: this.GetCardSource());

            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
        protected override IEnumerator PerformModifiedAction(CardSource cardSource)
        {
            // Deal up to 5 targets 2 sonic.
            IEnumerator coroutine = this.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(this.GameController, this.CharacterCard), 3, DamageType.Lightning, 5, false, 5, cardSource: cardSource);

            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
        protected virtual IEnumerator PerformModifiedAction(CardSource cardSource)
        {
            // Deal 1 target 1 infernal (as a base).
            IEnumerator coroutine = this.GameController.SelectTargetsAndDealDamage(this.DecisionMaker, new DamageSource(this.GameController, this.CharacterCard), 1, DamageType.Projectile, 1, false, 1, false, false, false, null, null, null, null, null, false, null, null, false, null, cardSource);

            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
        public IEnumerator MoveInsteadResponse(DestroyCardAction d)
        {
            CardSource actionCardSource = this.GetCardSource();

            if (d.PostDestroyDestinationCanBeChanged)
            {
                this.AddInhibitorException((GameAction ga) => (ga is MoveCardAction && (ga as MoveCardAction).CardSource == actionCardSource) || (ga is MessageAction && (ga as MessageAction).CardSource == actionCardSource));
                // Move into hand instead.
                d.SetPostDestroyDestination(this.HeroTurnTaker.Hand, showMessage: true, cardSource: actionCardSource);
                d.PostDestroyDestinationCanBeChanged = false;
                // Cannot remove inhibitor exception - the actual movement occurs afterwards as opposed to during an explicit coroutine. This should still be okay, functionally speaking - other areas also avoid removing inhibitor exceptions.
            }
            yield break;
        }
Exemplo n.º 25
0
        protected override IEnumerator PerformModifiedAction(CardSource cardSource)
        {
            // Deal all 1 melee.
            IEnumerator coroutine = this.DealDamage(this.CharacterCard, (Card c) => c.IsTarget, 2, DamageType.Melee);

            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
Exemplo n.º 26
0
    static void ApplyUpgradeList(CardData.Data data, CardSource source)
    {
        var tempList = new List <CardSource>();

        if (data.升级选项列表 != null)
        {
            foreach (var index in data.升级选项列表)
            {
                tempList.Add(cardDictionary[index]);
            }
        }
        source.ApplyUpgradeList(tempList);
        EditorUtility.SetDirty(source);
    }
        } protected IEnumerator MessageNoRamToAct(CardSource actingCard, string missingAction = "act")
        {
            IEnumerator coroutine = GameController.SendMessageAction($"The Ram is not in play, so it does not {missingAction}.", Priority.Medium, actingCard);

            if (base.UseUnityCoroutines)
            {
                yield return(base.GameController.StartCoroutine(coroutine));
            }
            else
            {
                base.GameController.ExhaustCoroutine(coroutine);
            }
            yield break;
        }
Exemplo n.º 28
0
        protected override IEnumerator RunResponse(DealDamageAction dd, CardSource cardSource, params object[] otherObjects)
        {
            IEnumerator coroutine;

            // Self Damage Response
            coroutine = this.DealDamage(dd.Target, dd.Target, 1, DamageType.Sonic, cardSource: cardSource);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
Exemplo n.º 29
0
        protected override IEnumerator RunResponse(DealDamageAction dd, CardSource cardSource, params object[] otherObjects)
        {
            IEnumerator coroutine;

            // Draw Response - Should target only characters, but generic sanity check is included.
            coroutine = this.DrawCard(dd.Target.Owner.ToHero());
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
Exemplo n.º 30
0
        protected override IEnumerator RunResponse(DealDamageAction dd, CardSource cardSource, params object[] otherObjects)
        {
            IEnumerator coroutine;

            // Deal damage response.
            coroutine = this.GameController.MakeDamageIrreducible(dd, cardSource: cardSource);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
        protected override IEnumerator RunResponse(DealDamageAction dd, CardSource cardSource, params object[] otherObjects)
        {
            IEnumerator coroutine;
            int         amountToSet = (int)otherObjects[0];
            ITrigger    trigger     = (ITrigger)otherObjects[1];

            coroutine = this.GameController.ReduceDamage(dd, dd.Amount - amountToSet, trigger, cardSource);
            if (this.UseUnityCoroutines)
            {
                yield return(this.GameController.StartCoroutine(coroutine));
            }
            else
            {
                this.GameController.ExhaustCoroutine(coroutine);
            }
        }
 public override bool?AskIfIsVillainTarget(Card card, CardSource cardSource)
 {
     Log.Debug("Mesmer Pendant's ask-if-is-villain-target fires");
     //it doesn't seem to
     if (cardSource != null && cardSource.Card == GetCardThisCardIsNextTo())
     {
         if (card.IsTarget && card.IsHero)
         {
             return(true);
         }
         if (card.IsTarget && card.IsVillain)
         {
             return(false);
         }
     }
     return(null);
 }