public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.Attacking)
     {
         if(VC ()
            && LimitBreak(4)
            && CanSoulBlast(9)
            && GetVanguard().IsVanguard()
            && GetDeck().Size() >= 2)
         {
             DisplayConfirmationWindow();
         }
     }
     else if(cs == CardState.DropZoneFromGC_NotMe)
     {
         if(VC ()
            && GetDefensor() == OwnerCard
            && ownerEffect.BelongsToClan("Genesis")
            && !GetBool(2))
         {
             cardToReturn = ownerEffect;
             SetBool(1);
             DisplayConfirmationWindow();
         }
     }
     else if(cs == CardState.EndGuard)
     {
         UnsetBool(2);
     }
 }
 public override void Auto(CardState cs, Card effectOwner)
 {
     if(cs == CardState.EndTurn)
     {
         SetAttackType(AttackType.NONE);
     }
 }
 public AbilityContainerExt(Card _card, CardState _cardState, int _idx, Card _effectOwner = null)
 {
     card = _card;
     cardState = _cardState;
     idx = _idx;
     effectOwner = _effectOwner;
 }
    public override void Auto(CardState cs, Card effectOwner)
    {
        if (cs == CardState.RideAboveIt)
        {
            if (VanguardIs("Gold Paladin"))
            {
                SetBool(1);
                Forerunner("Gold Paladin");
            }
        }
        else if (cs == CardState.AttackHits_NotMe)
        {
            Card tmp = OwnerCard.boostedUnit;

            if (tmp != null
                && GetAttacker() == tmp
                && GetDefensor().IsVanguard()
                && tmp.name.Contains("Liberator")
                && RC()
                && IsInSoul(CardIdentifier.BLASTER_BLADE_LIBERATOR)
                && OpenRC())
            {
                DisplayConfirmationWindow();
            }
        }
    }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.Attacking)
     {
         if(VC ()
            && LimitBreak(4)
            && CB(1)
            && NumUnits(delegate(Card c) { return c.IsStand(); }) > 0
            && Game.numBattle >= 4
            && GetDefensor().IsVanguard())
         {
             DisplayConfirmationWindow();
         }
     }
     else if(cs == CardState.AttackNotHit)
     {
         if(bExtraSkill)
         {
             if(VC()
                && GetDeck().Size() > 0
                && NumEnemyUnits(delegate(Card c) { return true; }) > 0)
             {
                 bActiveExtraSkill = true;
                 ShowAndDelay();
             }
         }
     }
     else if(cs == CardState.EndBattle)
     {
         bExtraSkill = false;
     }
 }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.BeginMain)
     {
         if(VC ()
            && GetDeck ().Size() > 0)
         {
             SetBool(1);
             StartEffect();
             ShowAndDelay();
         }
     }
     else if(cs == CardState.HelpZone_EndTurn)
     {
         StartEffect();
         ShowAndDelay();
         SetBool(2);
     }
     else if(cs == CardState.Attacking)
     {
         if(VC() &&
            NumUnitsDamage(delegate(Card c) { return c.BelongsToClan("Dark Irregulars"); }) >= 5)
         {
             DisplayConfirmationWindow();
         }
     }
 }
    public override void Auto(CardState cs, Card ownerEffect)
    {
        if(cs == CardState.Attacking)
        {
            if(GetDefensor().IsVanguard())
            {
                SetBool(1);
            }
        }
        else if(cs == CardState.EndBattle)
        {
            if(VC ()
               && LimitBreak(4)
               && CB(2)
               && IsInHand(OwnerCard.cardID)
               && GetBool(1)
               && NumUnitsInSoul(delegate(Card c) { return true; }) > 0)
            {
                DisplayConfirmationWindow();
            }

            UnsetBool(1);
        }
        else if(cs == CardState.IsBoosted)
        {
            if(VC ()
               && OwnerCard.IsBoostedBy.BelongsToClan("Pale Moon"))
            {
                IncreasePowerByBattle(OwnerCard, 3000);
            }
        }
    }
Beispiel #8
0
 /// <summary>
 /// Метод, возвращающий права для группы по умолчанию, в зависимости от карточки и её статуса
 /// </summary>
 /// <param name="Group">Группа</param>
 /// <returns></returns>
 private static AccessData GetGroupAccessData(SPWeb Web, SPGroup Group, SPListItem Item, CardState State, List<string> Companies)
 {
     AccessData result = new AccessData();
     switch (Item.ParentList.Title)
     {
         default: break;
         case GlobalConstants.ListNames.ControlMeasures:
             {
             }
             break;
         case GlobalConstants.ListNames.Request:
             {
             }
             break;
         case GlobalConstants.ListNames.Inbox:
             {
             }
             break;
         case GlobalConstants.ListNames.Outbox:
             {
             }
             break;
     }
     return result;
 }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.Attacking)
     {
         if(GetDefensor().IsVanguard()
            && NumUnits(delegate(Card c) { return true; }) > NumEnemyUnits(delegate(Card c) { return true; })
            && LimitBreak(4)
            && CB(1, delegate(Card c) { return c.name.Contains("Revenger"); })
            && VC())
         {
             bUseAuto1 = true;
             DisplayConfirmationWindow();
         }
     }
     else if(cs == CardState.BeginMain)
     {
         if(VC ()
            && NumUnits (delegate(Card c) { return c.BelongsToClan("Shadow Paladin"); }) > 0
            && NumEnemyUnits(delegate(Card c) { return true; }) > 0)
         {
             bUseAuto2 = true;
             DisplayConfirmationWindow();
         }
     }
 }
 public override void Auto(CardState cs, Card effectOwner)
 {
     if(cs == CardState.Attacking)
     {
         IncreasePowerByBattle(OwnerCard, 2000);
     }
 }
    public override void Auto(CardState cs, Card ownerEffect)
    {
        if(cs == CardState.EndBattle)
        {
            if(bCanUseAuto
               && bCanPaidAuto
               && VC ()
               && CB(1)
               && HandSize(delegate(Card c) { return c.BelongsToClan("Kagero"); }) > 0)
            {
                bCanPaidAuto = false;

                DisplayConfirmationWindow();
            }

            bCanUseAuto = false;
        }
        else if(cs == CardState.EndBattle)
        {
            bCanPaidAuto = true;
        }
        else if(cs == CardState.Attacking)
        {
            if(!GetDefensor().IsVanguard())
            {
                bCanUseAuto = true;
            }
        }
    }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.EndTurn)
     {
         UnsetBool(1);
     }
 }
 public override void Auto(CardState cs, Card effectOwner)
 {
     if(cs == CardState.Attacking)
     {
         if(VC ()
            && GetDefensor().IsVanguard()
            && LimitBreak(4)
            && Game.numBattle >= 4)
         {
             IncreasePowerByBattle(OwnerCard, 5000);
             SetBool(1);
         }
     }
     else if(cs == CardState.AttackHits)
     {
         if(GetBool(1) && CB (1))
         {
             UnsetBool(1);
             DisplayConfirmationWindow();
         }
     }
     else if(cs == CardState.EndBattle)
     {
         UnsetBool(1);
     }
 }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.RideAboveIt)
     {
         if(LimitBreak(4) && VanguardIs("Genesis"))
         {
             IncreasePowerByTurn(GetVanguard(), 10000);
             GetVanguard().unitAbilities.AddUnitObject(new OracleQueenHimikoExternEffect());
             if(NumUnits(delegate(Card c) { return c.BelongsToClan("Genesis"); }) > 0)
             {
                 StartEffect();
                 ShowAndDelay();
             }
         }
     }
     else if(cs == CardState.Attacking)
     {
         if(VC() && GetDeck().Size() > 0 && GetDefensor().IsVanguard())
         {
             StartEffect();
             ShowAndDelay();
             SetBool(1);
         }
     }
 }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.Attacking)
     {
         if(VC()
            && OwnerCard.GetPower() >= 13000)
         {
             SetBool(1);
         }
     }
     else if(cs == CardState.AttackHits)
     {
         if(VC()
            && GetDefensor().IsVanguard()
            && GetDeck().Size() > 0
            && HandSize(delegate(Card c) { return c.name.Contains("Dimensional Robo") && c.grade == 3; }) >= 2)
         {
             DisplayConfirmationWindow();
         }
     }
     else if(cs == CardState.EndBattle)
     {
         UnsetBool(1);
     }
 }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.EndTurn)
     {
         bCanUseAct1 = true;
     }
 }
 public void CheckHandEffects(CardState cs)
 {
     for(int i = 0; i < hand.Count; i++)
     {
         hand[i].unitAbilities.CheckAbilityOnHand(cs, hand[i]);
     }
 }
    public override void Auto(CardState cs, Card ownerEffect)
    {
        if(cs == CardState.Attacking)
        {
            unitAttacked = true;

            if(VC ()
               && CB (1))
            {
                SetBool(1);
                DisplayConfirmationWindow();
            }
        }
        else if(cs == CardState.EndBattle)
        {
            if(unitAttacked
               && VC ()
               && LimitBreak(4)
               && NumUnits (delegate(Card c) { return c.name.Contains("Revenger"); }) >= 3
               && HandSize(delegate(Card c) { return c.cardID == CardIdentifier.REVENGER__RAGING_FORM_DRAGON; }) > 0)
            {
                DisplayConfirmationWindow();
            }

            unitAttacked = false;
        }
    }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.EndTurn)
     {
         FromFieldToDeck(OwnerCard, true);
     }
 }
    public override void Auto(CardState cs, Card ownerEffect)
    {
        if(cs == CardState.Attacking)
        {
            if(RC() && GetDefensor().IsVanguard() && !GetBool(2))
            {
                SetBool(1);
            }

            ConfirmAttack();
        }
        else if(cs == CardState.EndBattle)
        {
            if(VanguardIs("Aqua Force") && GetBool(1))
            {
                IncreasePowerByTurn(OwnerCard, -5000);
                StandUnit(OwnerCard);
                SetBool(2);
            }

            UnsetBool(1);
        }
        else if(cs == CardState.EndTurn)
        {
            UnsetBool(2);
        }
    }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.Attacking)
     {
         if(VC ()
            && LimitBreak(4)
            && GetDefensor().IsVanguard())
         {
             ForEachUnitOnField(delegate(Card c) {
                 if(c.name.Contains("Sanctuary of Light"))
                 {
                     IncreasePowerByTurn(c, 3000);
                 }
             });
         }
     }
     else if(cs == CardState.Ride)
     {
         if(CB (2)
            && GetDeck().Size() > 0)
         {
             DisplayConfirmationWindow();
         }
     }
 }
    public override void Auto(CardState cs, Card ownerEffect)
    {
        if(cs == CardState.RideAboveIt)
        {
            Forerunner("Dark Irregulars");
        }
        else if(cs == CardState.Boost)
        {
            Card tmp = OwnerCard.boostedUnit;
            if(RC()
               && tmp.BelongsToClan("Dark Irregulars")
               && NumUnits (delegate(Card c) { return c.BelongsToClan("Dark Irregulars"); }) >= 6)
            {
                SetBool(2);
            }
        }
        else if(cs == CardState.EndBattle_NotMe)
        {
            if(GetBool (2)
               && GetDeck().Size() > 0)
            {
                SetBool(1);
                DisplayConfirmationWindow();
            }

            UnsetBool(2);
        }
    }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.Call_NotMe)
     {
         if(ownerEffect.name.Contains("Reverse")
            && NumEnemyUnits(delegate(Card c) { return true; }) > 0
            && bCanUseAUTO2)
         {
             bLockEnemyUnit = true;
             ShowAndDelay();
         }
     }
     else if(cs == CardState.EndTurn)
     {
         bCanUseAUTO2 = true;
     }
     else if(cs == CardState.BeginMain)
     {
         if(VC ()
            && LimitBreak(5)
            && NumEnemyUnits(delegate(Card c) { return c.IsLocked(); }, true, true) >= 5)
         {
             bUseAUTO1 = true;
             ShowAndDelay();
         }
     }
 }
    public override void Auto(CardState cs, Card ownerEffect)
    {
        if(cs == CardState.EndTurn)
        {
            bCanUseExtraAbility = false;
        }
        else if(cs == CardState.Attacking)
        {
            if(GetDefensor ().IsVanguard())
            {
                bCanActiveExtraAbility = true;
            }
        }
        else if(cs == CardState.EndBattle)
        {
            if(bCanUseExtraAbility
               && bCanActiveExtraAbility
               && VC()
               && HandSize(delegate(Card c) { return c.BelongsToClan("Kagero"); }) >= 2)
            {
                bExtAuto = true;
                DisplayConfirmationWindow();
            }

            bCanActiveExtraAbility = false;
        }
    }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.EndTurn)
     {
         MoveToSoul(OwnerCard);
     }
 }
    public override void Auto(CardState cs, Card ownerEffect)
    {
        if(cs == CardState.Attacking)
        {
            if(GetDefensor().IsVanguard())
            {
                SetBool(2);
            }
        }
        else if(cs == CardState.EndBattle)
        {
            if(GetBool(2)
               && GetBool(1)
               && VC ())
            {
                StandUnit(OwnerCard);
            }

            UnsetBool(2);
        }
        else if(cs == CardState.EndTurn)
        {
            UnsetBool(1);
        }
    }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.Attacking)
     {
         IncreasePowerByTurn(OwnerCard, 2000);
     }
 }
 public override void Auto(CardState cs, Card effectOwner)
 {
     if(cs == CardState.EndTurn)
     {
         _AuxBool = false;
     }
 }
    public override void Auto(CardState cs, Card effectOwner)
    {
        if(cs == CardState.Ride)
        {
            cardStorage.Clear();
            SetBool(2);

            if(Game.playerDeck.Size() >= 2)
            {
                StartEffect();

                cardStorage.Add(Game.playerDeck.GetByIndex(0));
                cardStorage.Add(Game.playerDeck.GetByIndex(1));

                _AuxList_Card = new List<Card>();
                _AuxList_Card.Add(Game.playerDeck.GetByIndex(0));
                _AuxList_Card.Add(Game.playerDeck.GetByIndex(1));

                BindFromDeck(_AuxList_Card);
            }
        }
        else if(cs == CardState.BeginMain)
        {
            SetBool(2);
        }
    }
 public override void Auto(CardState cs, Card ownerEffect)
 {
     if(cs == CardState.EndTurn)
     {
         ReturnToHand(OwnerCard);
     }
 }
Beispiel #31
0
    }     // TagToCardData(string inputText, Card card)

    // Inserts the footerValue into a string meant for the footer text
    private string InsertFooterValue(CardState cardState, string inputText)
    {
        string outputText     = inputText;                            // String to output
        string footerValueStr = cardState.footerValue.ToString("n0"); // The formatted footer value

        // While there's still ITALIC markdown left in input string
        while (outputText.IndexOf("<x>") >= 0)
        {
            // Set known index
            int index = outputText.IndexOf("<x>");
            // Remove markdown
            outputText = outputText.Remove(startIndex: index, count: 3);

            // If the value is a percentage, add a %
            if (cardState.percFlag)
            {
                footerValueStr = (footerValueStr + "%");
            }
            // If the value is a percentage, add a $
            if (cardState.moneyFlag)
            {
                footerValueStr = ("$" + footerValueStr);
            }

            // Add the appropriate operator to the string
            if (cardState.footerOpr == '+')
            {
                footerValueStr = ("+" + footerValueStr);
            }
            else if (cardState.footerOpr == '-')
            {
                footerValueStr = ("\u2013" + footerValueStr);
            }

            // Insert start tag
            outputText = outputText.Insert(startIndex: index, value: footerValueStr);
        }         // while ITALIC left

        return(outputText);
    }     // insertFooterValue()
Beispiel #32
0
    public virtual void SetPrivates(int id, int day, Biome biome, Character character, Instantiator instantiator)
    {
        SetPrivates();
        SceneManager.sceneLoaded += OnSceneLoad;
        _soundControler           = GameObject.Find(Constants.TagSoundControler).GetComponent <SoundControlerBhv>();
        _spriteRenderer           = GetComponent <SpriteRenderer>();
        _cacheSpriteRenderer      = transform.Find("Cache")?.GetComponent <SpriteRenderer>();
        _instantiator             = instantiator;
        _character     = character;
        _swipeSceneBhv = GameObject.Find(Constants.GoSceneBhvName).GetComponent <SwipeSceneBhv>();

        _initialPosition      = Constants.CardInitialPosition;
        _initialTouchPosition = _initialPosition;
        _likePosition         = new Vector3(6.0f, 0.0f);
        _dislikePosition      = new Vector3(-6.0f, 0.0f);
        _state          = CardState.Active;
        _rotateAngle    = -15.0f;
        _isReseting     = false;
        _hasMoved       = false;
        _isStretching   = false;
        _resetedScale   = new Vector3(1.0f, 1.0f, 1.0f);
        _pressedScale   = new Vector3(1.05f, 1.05f, 1.0f);
        _disabledScale  = new Vector3(0.95f, 0.95f, 1.0f);
        gameObject.name = "Card" + id;
        HandleSortingLayerAndOrder(id);
        _boxColliders2D      = gameObject.GetComponents <BoxCollider2D>();
        transform.localScale = _disabledScale;
        if (id == 0)
        {
            _cacheSpriteRenderer.enabled = true;
            foreach (BoxCollider2D box in _boxColliders2D)
            {
                box.enabled = false;
            }
        }
        else
        {
            _isStretching = true;
        }
    }
Beispiel #33
0
        public void play_a_card_from_turned_duelist_hand_damaging_other_duelist()
        {
            var maxMana             = 10;
            var targetDuelistHealth = 20;
            var duel = GivenADuel()
                       .WithId(DuelId)
                       .WithFirstDuelist(
                new DuelistBuilder()
                .WithDeck(new DeckBuilder().Empty())
                .WithHand(new HandBuilder().Empty())
                .WithMana(maxMana)
                .WithManaSlots(maxMana)
                .WithHealth(targetDuelistHealth)
                )
                       .WithSecondDuelist(
                new DuelistBuilder()
                .WithDeck(new DeckBuilder()
                          .WithCards(6, 1)
                          .WithCards(5, 2))
                .WithHand(new HandBuilder()
                          .WithCard(2)
                          .WithCard(2)
                          )
                .WithMana(maxMana)
                .WithManaSlots(maxMana)
                )
                       .WithTurn(SecondDuelistId)
                       .Build();

            var playedCard = new CardState(2, 2);

            duel.PlayCard(playedCard);

            var remainingCard = new CardState(2, 2);

            duel.State.SecondDuelist.Hand.Single().Should().Be(remainingCard);
            duel.State.SecondDuelist.Mana.Should().Be(maxMana - playedCard.ManaCost);
            duel.State.FirstDuelist.Health.Should().Be(targetDuelistHealth - playedCard.Damage);
        }
 public void OnRelease(MouseControls.GameZone i_zone)
 {
     if (i_zone == MouseControls.GameZone.Play && GameStateManager.instance.myPlayArea.transform.childCount <= 5)
     {
         currState = CardState.InPlay;
         GameStateManager.instance.HeldCard.transform.position = new Vector3(0.0f, 0.0f, 0.0f);
         transform.SetParent(GameStateManager.instance.myPlayArea.transform, false);
         GameStateManager.instance.SetHeldCard(null);
     }
     else if (i_zone == MouseControls.GameZone.MyDiscard && GameStateManager.instance.canDiscard)
     {
         GameStateManager.instance.MyDiscard.DiscardCard(card);
         Destroy(this.gameObject);
     }
     else
     {
         currState = CardState.InHand;
         GameStateManager.instance.HeldCard.transform.position = new Vector3(0.0f, 0.0f, 0.0f);
         transform.SetParent(GameStateManager.instance.myHand.transform, false);
         GameStateManager.instance.SetHeldCard(null);
     }
 }
Beispiel #35
0
    public void Rotate()
    {
        if (state == CardState.FaceDown)
        {
            Camera.main.audio.PlayOneShot(flipClick, 0.5f);
            state = CardState.RotatingLeft;
        }
        if (state == CardState.FaceUp)
        {
            if (!firstFlip)
            {
                Camera.main.audio.PlayOneShot(flipClick, 0.5f);
            }
            else
            {
                Camera.main.audio.PlayOneShot(allRotateSound, 0.3f);
                firstFlip = false;
            }

            state = CardState.RotatingRight;
        }
    }
 IEnumerator FromDeckToFaceUp()
 {
     HoverPreview.PreviewsAllowed = false;
     IsFlipActive        = true;
     CardStateChangeDone = false;
     transform.DORotate(new Vector3(0, 180, 0), time).OnUpdate(() =>
     {
         if (transform.rotation.eulerAngles.y >= 90)
         {
             cardFront.transform.rotation = Quaternion.Euler(Vector3.zero);
             cardState = CardState.FaceUp;
             Flip();
         }
     });
     for (float i = time; i >= 0; i -= Time.deltaTime)
     {
         yield return(0);
     }
     HoverPreview.PreviewsAllowed = true;
     CardStateChangeDone          = false;
     IsFlipActive = false;
 }
Beispiel #37
0
    } //called by the hand to pass a reference to said hand

    // Update is called once per frame
    protected virtual void Update()
    {
        //if idle, there is nothing to do.  If discarding, then DiscardCoroutine is doing the work
        if (state == CardState.idle || state == CardState.discarding)
        {
            return;
        }

        //calculate new position
        Vector2 newPosition = Vector2.MoveTowards(transform.localPosition,
                                                  targetLocation,
                                                  motionSpeed * Time.deltaTime);

        //move there
        transform.localPosition = newPosition;

        //go idle if reached target
        if (newPosition == targetLocation)
        {
            state = CardState.idle;
        }
    }
Beispiel #38
0
        public override void OnTriggerNow(List <CharacterState> targets)
        {
            foreach (var unit in targets)
            {
                if (unit.GetTeamType() == Team.Type.Monsters)
                {
                    Traverse.Create(unit).Field("_primaryStateInformation").Property <int>("AttackDamage").Value += power;
                    unit.StartCoroutine(ShowDelayedNotification(unit));

                    CardState spawnerCard = unit.GetSpawnerCard();
                    if (spawnerCard != null && !ProviderManager.SaveManager.PreviewMode && !unit.HasStatusEffect("cardless"))
                    {
                        CardAnimator.CardUpgradeAnimationInfo type = new CardAnimator.CardUpgradeAnimationInfo(spawnerCard, upgradeState);
                        CardAnimator.DoAddRecentCardUpgrade.Dispatch(type);
                        spawnerCard.GetTemporaryCardStateModifiers().AddUpgrade(upgradeState);
                        spawnerCard.UpdateCardBodyText();
                        ProviderManager.TryGetProvider <CardManager>(out CardManager cardManager);
                        cardManager?.RefreshCardInHand(spawnerCard);
                    }
                }
            }
        }
Beispiel #39
0
    private void Start()
    {
        Filter_Aligment(0);
        Filter_CardType(0);
        Sort_Order(0);
        Sort_Type(0);
        defaultPos = CardsParent.transform.position;
        List <CardState> CardStates = CardList.GetCardList();
        CardState        recomend   = null;

        foreach (CardState c in CardStates)
        {
            if (c == recomend)
            {
                continue;
            }
            AddCard(InitCard(c));
            recomend = c;
        }
        List = new List <Card>(Cards);
        SortUpdate();
    }
        static void Postfix(CardTooltipContainer __instance, CardState cardState, CardStateModifiers cardModifiers, CardStateModifiers tempCardModifiers, SaveManager saveManager)
        {
            // This generates additional generic tooltips for both the card and the character, hardcoded to this character to avoid conflicts
            if (cardState.GetID() != "e124d0b1-0c5e-4f6b-98a0-4b70faabf752")
            {
                return;
            }

            // This check will find cards that have upgrades already applied to them
            foreach (CardUpgradeState cardUpgrade in cardModifiers.GetCardUpgrades())
            {
                foreach (RoomModifierData roomModifier in cardUpgrade.GetRoomModifierUpgrades())
                {
                    if (roomModifier.GetRoomStateModifierClassName() == typeof(RoomStateModifierStartersConsumeRebate).AssemblyQualifiedName)
                    {
                        // Add tooltips for both Consume and Rebate (in that order)
                        __instance.InstantiateTooltip(CardTraitData.GetTraitCardTextLocalizationKey("CardTraitExhaustState"), TooltipDesigner.TooltipDesignType.Keyword)?.InitCardExplicitTooltip(CardTraitData.GetTraitCardTextLocalizationKey("CardTraitExhaustState"), CardTraitData.GetTraitTooltipTextLocalizationKey("CardTraitExhaustState"));
                        __instance.InstantiateTooltip("Rebate_TooltipTitle", TooltipDesigner.TooltipDesignType.Keyword)?.InitCardExplicitTooltip("Rebate_TooltipTitle", "Rebate_TooltipBody");
                    }
                }
            }

            // This check will find cards with temporary upgrades (ie. In the Dark Forge)
            foreach (CardUpgradeState cardUpgrade in tempCardModifiers.GetCardUpgrades())
            {
                foreach (RoomModifierData roomModifier in cardUpgrade.GetRoomModifierUpgrades())
                {
                    Trainworks.Trainworks.Log(BepInEx.Logging.LogLevel.All, "Found Temp RoomModifierData");
                    if (roomModifier.GetRoomStateModifierClassName() == typeof(RoomStateModifierStartersConsumeRebate).AssemblyQualifiedName)
                    {
                        Trainworks.Trainworks.Log(BepInEx.Logging.LogLevel.All, "Match!");
                        // Add tooltips for both Consume and Rebate (in that order)
                        __instance.InstantiateTooltip(CardTraitData.GetTraitCardTextLocalizationKey("CardTraitExhaustState"), TooltipDesigner.TooltipDesignType.Keyword)?.InitCardExplicitTooltip(CardTraitData.GetTraitCardTextLocalizationKey("CardTraitExhaustState"), CardTraitData.GetTraitTooltipTextLocalizationKey("CardTraitExhaustState"));
                        __instance.InstantiateTooltip("Rebate_TooltipTitle", TooltipDesigner.TooltipDesignType.Keyword)?.InitCardExplicitTooltip("Rebate_TooltipTitle", "Rebate_TooltipBody");
                    }
                }
            }
        }
 public bool Connect()
 {
     try
     {
         if (_canRead)
         {
             this._state = CardState.IsReady;
             _task       = Task.Factory.StartNew(() => ReadingThread(), TaskCreationOptions.LongRunning);
             return(true);
         }
         else
         {
             GetReady();
             Thread.Sleep(1000);
             if (_canRead)
             {
                 this._state = CardState.IsReady;
                 _task       = Task.Factory.StartNew(() => ReadingThread(), TaskCreationOptions.LongRunning);
             }
             return(true);
         }
     }
     catch
     {
         this._state = CardState.IsDisable;
         int retCode = ModWinsCard.SCardCancel(_context);
         if (retCode != ModWinsCard.SCARD_S_SUCCESS)
         {
             Console.WriteLine(string.Format("{0} cancel failed", this._info.SerialNumber));
         }
         retCode = ModWinsCard.SCardReleaseContext(_context);
         if (retCode != ModWinsCard.SCARD_S_SUCCESS)
         {
             Console.WriteLine(string.Format("{0} release failed", this._info.SerialNumber));
         }
         return(false);
     }
 }
Beispiel #42
0
    }     // mdToTag()

    // Converts a custom tag to Card Data
    // TODO: Expand the parser to dynamically generate most of the needed body text for cards,
    //	including frequent phrases and dynamically generated scope info text.
    private string TagToCardData(string inputText, CardState cardState)
    {
        string outputText = inputText;         // String to output

        // Processes an <r> tag
        while (outputText.IndexOf("<r>") >= 0)
        {
            int index = outputText.IndexOf("<r>");                       // Set known index
            outputText = outputText.Remove(startIndex: index, count: 3); // Remove tag
            outputText = outputText.Insert(startIndex: index, value: cardState.resource);
        }                                                                // while <r> left

        // Processes an <c> tag
        while (outputText.IndexOf("<c>") >= 0)
        {
            int index = outputText.IndexOf("<c>");                       // Set known index
            outputText = outputText.Remove(startIndex: index, count: 3); // Remove tag
            outputText = outputText.Insert(startIndex: index, value: cardState.category);
        }                                                                // while <c> left

        // Processes an <ts> tag
        while (outputText.IndexOf("<ts>") >= 0)
        {
            int index = outputText.IndexOf("<ts>");                      // Set known index
            outputText = outputText.Remove(startIndex: index, count: 4); // Remove tag
            outputText = outputText.Insert(startIndex: index, value: cardState.target);
        }                                                                // while <ts> left

        // // Processes an <tc> tag
        // while (outputText.IndexOf("<tc>") >= 0)
        // {
        //  int index = outputText.IndexOf("<tc>");                             // Set known index
        //  outputText = outputText.Remove(startIndex: index, count: 4);        // Remove tag
        //  outputText = outputText.Insert(startIndex: index, value: card.targetCategory);
        // } // while <tc> left

        return(outputText);
    }     // TagToCardData(string inputText, Card card)
Beispiel #43
0
    void Update()
    {
        if (m_CardState == CardState.showing1 && m_Transform.localScale.x <= 0f)
        {
            m_SpriteRenderer.sprite = cardTexture;
            m_CardState             = CardState.showing2;
        }
        else if (m_CardState == CardState.showing2 && m_Transform.localScale.x >= m_FullWidth)
        {
            m_CardState = CardState.shown;
        }
        else if (m_CardState == CardState.showing2)
        {
            m_Transform.localScale += new Vector3(flipSpeed, 0f);
        }
        else if (m_CardState == CardState.showing1)
        {
            m_Transform.localScale -= new Vector3(flipSpeed, 0f);
        }

        else if (m_CardState == CardState.hiding1 && m_Transform.localScale.x <= 0f)
        {
            m_SpriteRenderer.sprite = backTexture;
            m_CardState             = CardState.hiding2;
        }
        else if (m_CardState == CardState.hiding2 && m_Transform.localScale.x >= m_FullWidth)
        {
            m_CardState = CardState.hidden;
        }
        else if (m_CardState == CardState.hiding2)
        {
            m_Transform.localScale += new Vector3(flipSpeed, 0f);
        }
        else if (m_CardState == CardState.hiding1)
        {
            m_Transform.localScale -= new Vector3(flipSpeed, 0f);
        }
    }
Beispiel #44
0
    private void PlayerPlayWild()  //確認玩家是否出了黑色功能牌
    {
        GameObject   LastCard     = gameManager.IDtoGameobeject(gameManager.LastCardID);
        CardState    cardState    = LastCard.GetComponent <Card>().cardState;
        CardFunction cardFunction = LastCard.GetComponent <Card>().CardFunction;

        if (cardState == CardState.Played)
        {
            if (cardFunction == CardFunction.Wild || cardFunction == CardFunction.WildDrawFour)
            {
                gameManager.YouChooseColor = true;
                GameObject WildCard = Instantiate(Resources.Load <GameObject>("Prefabs/WildCard"));
                Destroy(GameObject.Find("CoverUp(Clone)"));
                WildCard.transform.localPosition = new Vector3(0, 0, 0);
                WildCard.GetComponent <SpriteRenderer>().sortingOrder = 1;

                for (int i = 0; i < 4; i++)
                {
                    gameManager.AddColorSelector(i);
                }
            }
        }
    }
Beispiel #45
0
        public IEnumerator ApplyConsume(CardState card)
        {
            yield return(new WaitForSeconds(0.01f));

            // Check and see if we're a starter card
            foreach (var clan in ProviderManager.SaveManager.GetAllGameData().GetAllClassDatas())
            {
                for (int i = 0; i < 2; i++)
                {
                    if (card.GetCardDataID() == clan.GetChampionData(i).starterCardData.GetID() && card.GetCardType() == CardType.Spell)
                    {
                        cardManager.AddTemporaryTraitToCard(card, new CardTraitData {
                            traitStateName = "CardTraitExhaustState"
                        });
                        cardManager.RefreshCardInHand(card);
                        card.RefreshCardBodyTextLocalization();
                        cardsWeHaveModified.Add(card);
                    }
                }
            }

            yield break;
        }
Beispiel #46
0
    public bool CanBought(CardState card)
    {
        if (card.Type == CardType.Hidden)
        {
            return(false);
        }
        var userState = GetUserState();

        if ((State.TurnOwner == userState.Name) && (card.Price <= userState.Power))
        {
            if (card.Type == CardType.Creature)
            {
                foreach (var tableCard in userState.TableSet)
                {
                    if (tableCard == null)
                    {
                        return(true);
                    }
                }
            }
        }
        return(false);
    }
Beispiel #47
0
    //"被攻撃時、相手の攻撃力を-3する"罠
    private static CardState AttackDebuffTrap()
    {
        CardState card = new CardState();

        card.cardName      = "竜の咆哮";
        card.cardName_Read = "りゅうのほうこう";
        card.cardType      = ObjectType.Trap;
        card.cardAligment  = CardAligment.All;
        card.Cost          = 3;
        card.text          = "攻撃された時、\n相手の攻撃力をー3する。";
        card.trigger       = TriggerType.TakeAttack;
        //card.Effect = null;
        card.cardSprite = Resources.Load <Sprite>(CardSprits.RyuuNoHoukou);

        EffectState estate = new EffectState(EffectType.AttackAdd, -3, 1, new Target(TargetType.enemy, CardZoneType.Unit, ObjectType.Player, true));
        CardEffect  e      = new PlayEffect();

        e.effectState.Add(estate);
        //
        card.Effect.Add(e);

        return(card);
    }
Beispiel #48
0
        private void AnimateTitle(CardState cardState)
        {
            var translationY = cardState == CardState.Expanded
                ? -1 * (MoviesHeader.Height + MoviesHeader.Margin.Top)
                : 0;

            var opacity = cardState == CardState.Expanded ? 0 : 1;

            var animation = new Animation();

            if (cardState == CardState.Expanded)
            {
                animation.Add(0.00, 0.25, new Animation(v => MoviesHeader.TranslationY = v, MoviesHeader.TranslationY, translationY));
                animation.Add(0.00, 0.25, new Animation(v => MoviesHeader.Opacity      = v, MoviesHeader.Opacity, opacity));
            }
            else
            {
                animation.Add(0.75, 1, new Animation(v => MoviesHeader.TranslationY = v, MoviesHeader.TranslationY, translationY));
                animation.Add(0.75, 1, new Animation(v => MoviesHeader.Opacity      = v, MoviesHeader.Opacity, opacity));
            }

            animation.Commit(this, "titleAnimation", length: 1000);
        }
Beispiel #49
0
    private static CardState Eruhu()
    {
        CardState card = new CardState();

        card.cardName      = "エルフの迎撃法";
        card.cardName_Read = "えるふのげいげきほう";
        card.cardType      = ObjectType.Trap;
        card.cardAligment  = CardAligment.All;
        card.Cost          = 1;
        card.text          = "相手のターン開始時、\nドラフトゾーンの全てカードを捨て札に送る。";
        card.trigger       = TriggerType.DraftStart;
        //card.Effect = null;
        card.cardSprite = null;// Resources.Load<Sprite>(CardSprits.Devil);

        EffectState estate = new EffectState(EffectType.CardDest, 0, 0, new Target(TargetType.enemy, CardZoneType.Draft, ObjectType.All, true));
        CardEffect  e      = new PlayEffect();

        e.effectState.Add(estate);
        //
        card.Effect.Add(e);

        return(card);
    }
Beispiel #50
0
    //"被攻撃時、相手の攻撃力を-1する"罠
    private static CardState Sikabanenotate()
    {
        CardState card = new CardState();

        card.cardName      = "屍の盾";
        card.cardName_Read = "しかばねのたて";
        card.cardType      = ObjectType.Trap;
        card.cardAligment  = CardAligment.All;
        card.Cost          = 0;
        card.text          = "攻撃された時、\n相手の攻撃力をー1する。";
        card.trigger       = TriggerType.TakeAttack;
        //card.Effect = null;
        card.cardSprite = Resources.Load <Sprite>(CardSprits.Sikabanenotate);

        EffectState estate = new EffectState(EffectType.AttackAdd, -1, 1, new Target(TargetType.enemy, CardZoneType.Unit, ObjectType.Player, true));
        CardEffect  e      = new PlayEffect();

        e.effectState.Add(estate);
        //
        card.Effect.Add(e);

        return(card);
    }
Beispiel #51
0
    private static CardState YerowDragonsArmer()
    {
        CardState card = new CardState();

        card.cardName        = "黄龍の鎧";
        card.cardName_Read   = "こうりゅうのよろい";
        card.cardType        = ObjectType.Support;
        card.cardAligment    = CardAligment.SowrdMan;
        card.Cost            = 6;
        card.trigger         = TriggerType.TurnStart;
        card.atk             = -3;
        card.text            = "攻撃力ー3\n次のターン開始時、\nこのカードを破壊。\nそのターンの攻撃力+4";
        card.cardSprite      = Resources.Load <Sprite>(CardSprits.YerowArmer);
        card.isSpriteOnFrame = true;

        TriggerEffect effect = new TriggerEffect();

        effect.TriggerType = TriggerType.OnDest;
        effect.effectState.Add(new EffectState(EffectType.AttackAdd, 4, 1, new Target(TargetType.friend, CardZoneType.Unit, ObjectType.Player, true)));
        card.Effect.Add(effect);

        return(card);
    }
Beispiel #52
0
        public override void OnCardDrawn(CardState thisCard, CardManager cardManager, PlayerManager playerManager, MonsterManager monsterManager)
        {
            if (upgrade == null)
            {
                var upgradeBuilder = new CardUpgradeDataBuilder
                {
                    HideUpgradeIconOnCard = true,
                };

                upgradeBuilder.StatusEffectUpgrades.AddRange(GetParamStatusEffects().ToList());

                upgrade = new CardUpgradeState();
                upgrade.Setup(upgradeBuilder.Build());
            }

            foreach (CardState item in cardManager.GetAllCards())
            {
                if (item.IsMonsterCard() && !item.GetTemporaryCardStateModifiers().HasUpgrade(upgrade))
                {
                    item.GetTemporaryCardStateModifiers().AddUpgrade(upgrade);
                }
            }
        }
Beispiel #53
0
    private void ComputerPlayWild() //幫助電腦玩家在出黑色功能牌後選取顏色
    {
        GameObject   LastCard     = gameManager.IDtoGameobeject(gameManager.LastCardID);
        CardState    cardState    = LastCard.GetComponent <Card>().cardState;
        CardFunction cardFunction = LastCard.GetComponent <Card>().CardFunction;

        int[]      LastCardManager = gameManager.CardIDManager(gameManager.LastCardID);
        int        LastCardColor   = LastCardManager[0];
        List <int> AvaliableColor  = new List <int>();

        if (cardState == CardState.Played)
        {
            if (cardFunction == CardFunction.Wild || cardFunction == CardFunction.WildDrawFour)
            {
                if (PlayerCards.Count != 0)
                {
                    for (int i = 0; i < PlayerCards.Count; i++)
                    {
                        int[] CardCard      = gameManager.CardIDManager(PlayerCards[i]);
                        int   CardCardColor = CardCard[0];
                        if (CardCardColor != 4 && CardCardColor != LastCardColor)
                        {
                            AvaliableColor.Add(CardCardColor);
                        }
                    }
                    int colorID = UnityEngine.Random.Range(0, AvaliableColor.Count);
                    gameManager.WildCardHasColor(AvaliableColor[colorID]);
                    AvaliableColor.Clear();
                }
                else
                {
                    int colorID = UnityEngine.Random.Range(0, 4);
                    gameManager.WildCardHasColor(colorID);
                }
            }
        }
    }
Beispiel #54
0
        private Animation CreateGradientAnimation(CardState cardState)
        {
            double start;
            double end;

            if (cardState == CardState.Expanded)
            {
                _gradientTransitionY = CardBackground.CanvasSize.Height;
                start = _gradientTransitionY;
                end   = -_gradientHeight;
            }
            else
            {
                _gradientTransitionY = -_gradientHeight;
                start = _gradientTransitionY;
                end   = CardBackground.CanvasSize.Height;
            }

            var gradientAnimation = new Animation(
                callback: v =>
            {
                _gradientTransitionY = (float)v;
                CardBackground.InvalidateSurface();
            },
                start: start,
                end: end,
                easing: Easing.Linear,
                finished: () =>
            {
                Color fontColor         = cardState == CardState.Expanded ? Color.Black : Color.White;
                HeroNameLabel.TextColor = fontColor;
                RealNameLabel.TextColor = fontColor;
            }
                );

            return(gradientAnimation);
        }
Beispiel #55
0
        private Animation CreateGradientAnimation(CardState cardState)
        {
            float animStart, animEnd;

            Debug.WriteLine($"Canvass height: {CardBackground.CanvasSize.Height}");
            if (cardState == CardState.Expanded)
            {
                _gradientTransitionY = CardBackground.CanvasSize.Height;
                animStart            = _gradientTransitionY;
                animEnd = -_gradientHeight;
            }
            else
            {
                _gradientTransitionY = -_gradientHeight;
                animStart            = -_gradientTransitionY;
                animEnd = CardBackground.CanvasSize.Height;
            }

            var anim = new Animation(
                callback: v =>
            {
                _gradientTransitionY = (float)v;
                CardBackground.InvalidateSurface();
            },
                start: animStart,
                end: animEnd,
                finished: () =>
            {
                var fontColor = cardState == CardState.Expanded ? Color.Black : Color.White;
                HeroNameLabelLine1.TextColor = fontColor;
                HeroNameLabelLine2.TextColor = fontColor;
                RealNameLabel.TextColor      = fontColor;
            }
                );

            return(anim);
        }
        public void Discard5_TargetDrawsSetAside()
        {
            // Arrange
            IDiscardableCardState       roundHand    = new CardState(1, 2);
            IList <IDiscardedCardState> roundDiscard = new List <IDiscardedCardState>();
            ITargetablePlayerState      targetPlayer = new PlayerState(Guid.Empty, roundDiscard, turnHand: null, roundHand: roundHand);
            ISetAsideCardState          setAsideCard = new CardState(0, 1);
            IList <IDrawableCardState>  deck         = new List <IDrawableCardState>();
            IList <ISetAsideCardState>  setAside     = new List <ISetAsideCardState>(new[] { setAsideCard });

            IDiscardableCardState discardableDeckCard = new CardState(2, 3);

            _cardStateFactory
            .Setup(csf => csf.Draw(setAsideCard))
            .Returns(discardableDeckCard);
            IDiscardedCardState discardedRoundCard = new CardState(3, 4);

            _cardStateFactory
            .Setup(csf => csf.Discard(roundHand))
            .Returns(discardedRoundCard);

            IDiscardableCardState dicardableSetAsideCard = new CardState(3, 4);
            var expected = dicardableSetAsideCard;

            _cardStateFactory
            .Setup(csf => csf.Draw(setAsideCard))
            .Returns(dicardableSetAsideCard);

            // Act
            CardEffectService service = this.CreateService();

            service.Discard5(targetPlayer, deck, setAside);
            var actual = targetPlayer.RoundHand;

            // Assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #57
0
    void OnMouseDown()
    {
        //  print("1");
        //if (!isopen)
        //{
        ////    print("2");
        //    if (isBlock == false)
        //    {
        //  //      print("3");
        //        if (!ischosen)
        //        {
        //    //        print("4");
        //            ischosen = true;
        //            LvlGen.setChosenCard(go);
        //        }
        //    }
        //}

        if (currentState == CardState.unblock)
        {
            currentState = CardState.open;
            LvlGen.setChosenCard(go);
        }
    }
 private void InitObjectState()
 {
     keyState                  = KeyState.InRiver;
     appleState                = AppleState.OnTheTree;
     blackRoseState            = BlackRoseState.InVase;
     cardState                 = CardState.OnTable;
     tissueState               = TissueState.OnTable;
     tableSheetState           = TableSheetState.OnTable;
     micPosition               = new Vector2(6.56f, -1f);
     scissorsPosition          = new Vector2(-5.43f, -2.1f);
     threadPosition            = new Vector2(10.86f, 3.095f);
     needlePosition            = new Vector2(9.305f, -1.414999f);
     globePosition             = new Vector2(8.65f, 0.535f);
     earBudState               = EarBudState.InShelf;
     basketState               = BasketState.InHand;
     diaryState                = DiaryState.InShelf;
     violinCaseState           = ViolinCaseState.Locked;
     currentPasswordViolinCase = "DAFUQ";
     ViolinState               = ViolinState.Enclosed;
     if (_inBagItems == null)
     {
         _inBagItems = new List <string>();
     }
 }
Beispiel #59
0
    private void OnMouseExit()
    {
        mouseOver = false;

        if (State == CardState.FREEZED || State == CardState.CLOSED || State == CardState.SELECTION || moving)
        {
            return;
        }

        animator.StopAllCoroutines();
        ResetPosition();
        transform.SetParent(defaultParent);

        if (State == CardState.HOVERED_A)
        {
            State = CardState.ACTIVE;
        }
        else if (State == CardState.HOVERED)
        {
            State = CardState.OPEN;
        }

        selected = false;
    }
 /// <summary>
 /// A function used to fire a card trigger, causing the effects of the corresponding trigger on the playedCard to be fired.
 /// </summary>
 /// <param name="cardTrigger">CardTrigger to be Fired</param>
 /// <param name="playedCard">Card to Fire Trigger on</param>
 /// <param name="roomIndex">Room to fire trigger in, -1 is current room</param>
 /// <param name="ignoreDeadInTargeting">Whether effect should ignore dead in targeting</param>
 /// <param name="triggeredCharacter">Character used for applying effects</param>
 /// <param name="fireCount">how many times the trigger fires</param>
 /// <param name="cardTriggerFiredCallback">Action to call after function is called</param>
 /// <returns></returns>
 public static void FireCardTriggers(CardTrigger cardTrigger, CardState playedCard, int roomIndex = -1, bool ignoreDeadInTargeting = true, CharacterState triggeredCharacter = null, int fireCount = 1, Action cardTriggerFiredCallback = null)
 {
     if (ProviderManager.TryGetProvider <CombatManager>(out CombatManager combatManager))
     {
         combatManager.StartCoroutine(
             (IEnumerator)AccessTools.Method(
                 typeof(CombatManager),
                 "FireCardTriggers"
                 )
             .Invoke(combatManager,
                     new object[7]
         {
             cardTrigger.GetEnum(),
             playedCard,
             roomIndex,
             ignoreDeadInTargeting,
             triggeredCharacter,
             fireCount,
             cardTriggerFiredCallback
         }
                     )
             );
     }
 }