Ejemplo n.º 1
0
        private static CastValidity ComputeCastValidity(ICastableStatus status)
        {
            PrecomputedData precomputedData = status.GetDefinition()?.precomputedData;
            FightStatus     local           = FightStatus.local;

            if (precomputedData != null && local != null)
            {
                PlayerStatus     player           = local.GetLocalPlayer();
                HeroStatus       heroStatus       = player.heroStatus;
                WeaponDefinition weaponDefinition = (WeaponDefinition)heroStatus.definition;
                if (precomputedData.checkNumberOfSummonings)
                {
                    int num            = local.EnumerateEntities((SummoningStatus s) => s.ownerId == player.id).Count();
                    int valueWithLevel = weaponDefinition.maxSummoningsOnBoard.GetValueWithLevel(heroStatus.level);
                    if (num >= valueWithLevel)
                    {
                        return(CastValidity.TOO_MANY_SUMMONING);
                    }
                }
                if (precomputedData.checkNumberOfMechanisms)
                {
                    int num2            = local.EnumerateEntities((MechanismStatus s) => s.ownerId == player.id).Count();
                    int valueWithLevel2 = weaponDefinition.maxMechanismsOnBoard.GetValueWithLevel(heroStatus.level);
                    if (num2 >= valueWithLevel2)
                    {
                        return(CastValidity.TOO_MANY_MECHANISM);
                    }
                }
            }
            return(CastValidity.SUCCESS);
        }
Ejemplo n.º 2
0
        private IEnumerator ShowPlaying(ICastableStatus item, CastableDragNDropElement dnd, CellObject cell)
        {
            dnd.get_gameObject().SetActive(true);
            CastHighlight cellHighlight = m_factory.CreateCastHighlight(item, cell.highlight.get_transform());
            Vector3       worldPosition = FightUIRework.WorldToUIWorld(cell.highlight.get_transform().get_parent().get_position());
            Tween         tween         = dnd.PlayCastImmediate(worldPosition, m_fightUICanvas.get_transform());

            while (tween.get_active() && !TweenExtensions.IsComplete(tween))
            {
                yield return(null);
            }
            yield return((object)new WaitForTime(m_castingModeParameters.opponentPlayingDuration));

            m_factory.DestroyCellHighlight(cellHighlight);
            yield return((object)new WaitForTime(m_castingModeParameters.opponentCastPlayingDuration));

            Tween endCastImmediate = dnd.EndCastImmediate();

            while (endCastImmediate.get_active() && !TweenExtensions.IsComplete(endCastImmediate))
            {
                yield return(null);
            }
            dnd.get_gameObject().SetActive(false);
        }
Ejemplo n.º 3
0
 public FightValueProvider([NotNull] ICastableStatus castableStatus)
     : this(new CastableFightValueProvider(castableStatus))
 {
 }
Ejemplo n.º 4
0
 public CastableFightValueProvider([NotNull] ICastableStatus source)
     : base(source.GetDefinition().precomputedData.dynamicValueReferences, source.level)
 {
     m_source = source;
 }