IEnumerator CancelRevealchaosToken(RevealChaosTokenAction revealChaosToken) { yield return(new AnimationCardAction(ThisCard, isBuffEvent: true, audioClip: ThisCard.Effect2).RunNow()); revealChaosToken.IsActionCanceled = true; revealChaosToken.SkillTest.IsWin = revealChaosToken.SkillTest.TotalInvestigatorValue >= revealChaosToken.SkillTest.TotalTestValue; }
IEnumerator RevealOtherToken(RevealChaosTokenAction revealToken) { revealToken.IsActionCanceled = true; List <ChaosTokenComponent> tokens = new List <ChaosTokenComponent>(); List <CardEffect> allTokens = new List <CardEffect>(); for (int i = 0; i < 2; i++) { ChaosTokenComponent token = AllComponents.ChaosBag.RandomChaosToken(); tokens.Add(token); allTokens.Add(new CardEffect( card: ThisCard, effect: () => ChoosingToken(token), type: EffectType.Choose, name: "Elegir este token", investigatorImageCardInfoOwner: ThisCard.VisualOwner)); yield return(AllComponents.ChaosBag.DropToken(token)); yield return(new WaitUntil(token.RigidBody.IsSleeping)); } MultiCastAction multiCast = new MultiCastAction(allTokens, isOptionalChoice: false); for (int i = 0; i < 2; i++) { CardComponent card = multiCast.ListCardsEffect[i].Card; card.CardTools.TokensBox.SetActive(false); card.CardTools.HideFrontCard(true); card.CardTools.ChangeGlowImage(AllComponents.CardBuilder.TokenGlow, Vector3.one); originalTokenPosition[i] = tokens[i].transform.position; tokens[i].transform.SetParent(card.transform); tokens[i].RigidBody.isKinematic = true; tokens[i].GetComponent <MeshCollider>().enabled = false; DOTween.Sequence().Append(tokens[i].transform.DOLocalMove(Vector3.zero, timeAnimation)) .Join(tokens[i].transform.DOScale(0.3f, timeAnimation)) .Join(tokens[i].transform.DOLocalRotate(new Vector3(180, 0, 0), timeAnimation)); tokens[i].gameObject.layer = 8; } yield return(multiCast.RunNow()); IEnumerator ChoosingToken(ChaosTokenComponent tokenSelected) { for (int i = 0; i < 2; i++) { tokens[i].AudioSource.enabled = true; tokens[i].transform.SetParent(AllComponents.ChaosBag.transform); DOTween.Sequence().Append(tokens[i].transform.DOMove(originalTokenPosition[i], timeAnimation)) .Join(tokens[i].transform.DOScale(1f, timeAnimation)).SetId("DualTokens"); tokens[i].RigidBody.isKinematic = false; tokens[i].GetComponent <MeshCollider>().enabled = true; tokens[i].gameObject.layer = 0; } yield return(new WaitWhile(() => DOTween.IsTweening("DualTokens"))); revealToken.SkillTest.TokenThrow = tokenSelected; yield return(AllComponents.ChaosBag.ReturnToken(tokens.Find(t => t != tokenSelected))); } }
IEnumerator ChangingToken(RevealChaosTokenAction revealChaosToken) { effectUsed = true; yield return(new ReturnChaosTokenAction(revealChaosToken.Token).RunNow()); SkillTest skillTest = revealChaosToken.SkillTest; yield return(new RevealChaosTokenAction(ref skillTest).RunNow()); }
IEnumerator ChangingTokenToFail(RevealChaosTokenAction revealChaosToken) { ChaosTokenComponent oldToken = revealChaosToken.Token; revealChaosToken.Token = AllComponents.ChaosBag.tokenList.Find(t => t.Type == ChaosTokenType.Fail); yield return(new ReturnChaosTokenAction(oldToken).RunNow()); SkillTest skillTest = revealChaosToken.SkillTest; yield return(new RevealChaosTokenAction(ref skillTest, revealChaosToken.Token).RunNow()); }
bool RevealChaosTokenExtraEffect(RevealChaosTokenAction revealChaosTokenAction) { if (!attackingWithThiscard) { return(false); } attackingWithThiscard = false; if (!((ChaosTokenType.Cultist | ChaosTokenType.Kthulu | ChaosTokenType.Skull | ChaosTokenType.Tablet | ChaosTokenType.Fail).HasFlag(revealChaosTokenAction.Token.Type))) { return(false); } return(true); }
protected override void EndGameAction(GameAction gameAction) { if (gameAction is RevealChaosTokenAction revealChaos && ChangeChaosToken(revealChaos)) { this.revealChaos = revealChaos; revealChaos.ChooseCardOptionalAction.ChosenCardEffects.Add(playFromHand = PlayFromHand); } if (gameAction is SkillTestActionComplete skillTestComplete && CheckResetChaosToken(skillTestComplete)) { chaosToken.Value = chaosToken.Type == ChaosTokenType.Basic ? oldValue : null; //Autorefresh chaosToken = null; } }
bool CheckChaosToken(RevealChaosTokenAction throwChaosToken) { if (!effectToExecuteIOnlyOne) { return(false); } if (throwChaosToken.SkillTest != thisSkillTest) { return(false); } if (!((ChaosTokenType.Cultist | ChaosTokenType.Kthulu | ChaosTokenType.Skull | ChaosTokenType.Tablet | ChaosTokenType.Fail).HasFlag(throwChaosToken.SkillTest.TokenThrow.Type))) { return(false); } return(true); }
bool ChangeChaosToken(RevealChaosTokenAction revealChaos) { if (!CheckPlayedFromHand()) { return(false); } if (revealChaos.Token.Value >= 0) { return(false); } if (ThisCard.VisualOwner != GameControl.ActiveInvestigator) { return(false); } return(true); }
bool ChangeToken(RevealChaosTokenAction revealChaosToken) { if (!ThisCard.IsInPlay) { return(false); } if (GameControl.ActiveInvestigator != ThisCard.VisualOwner) { return(false); } if (revealChaosToken.Token.Type != ChaosTokenType.Win) { return(false); } return(true); }
bool CheckFilterToCancel(RevealChaosTokenAction revealToken) => revealToken.IsActionCanceled;
bool CheckBateIsBroken(RevealChaosTokenAction revealChaosToken) { if (revealChaosToken.SkillTest != skillTestThisFight) return false; if (!(ChaosTokenType.Skull | ChaosTokenType.Fail).HasFlag(revealChaosToken.Token.Type)) return false; return true; }