Esempio n. 1
0
 public void ShowPreviewWater(int value, ValueModifier modifier)
 {
     if (null != m_elementaryPointsCounter)
     {
         m_elementaryPointsCounter.ShowPreviewWater(value, modifier);
     }
 }
Esempio n. 2
0
 public void PreviewActionPoints(int value, ValueModifier modifier)
 {
     if (null != m_actionPointCounter)
     {
         m_actionPointCounter.ShowPreview(value, modifier);
     }
 }
Esempio n. 3
0
    /// Decrements the health by the specified amount
    /// Returns true if the entity dies on hit
    public bool Hit(float damage)
    {
        float newHealth = this.health - damage;

        if (newHealth > 0)
        {
            // play sound effect
            if (ValueModifier.TryGetModifier(this).randomSounds)
            {
                SoundManager.i.SetPitch("Quack", Random.Range(0.75f, 0.9f));
                SoundManager.i.PlayOnce("Quack");
                SoundManager.i.SetPitch("Quack", 1);
            }
            else
            {
                SoundManager.i.PlayOnce(this.hurtSoundName);
            }

            // set health values
            this.health = newHealth;
            return(false);
        }
        else
        {
            health = 0;
            if (destroyOnDeath)
            {
                Destroy(gameObject);
            }

            return(true);
        }
    }
    public static ValueModifier Default()
    {
        ValueModifier x = new ValueModifier();

        x.SetDefaults();
        return(x);
    }
    public void AddModifier(ValueModifier m)
    {
        if (modifiers == null)
            modifiers = new List<ValueModifier> ();

        modifiers.Add (m);
    }
Esempio n. 6
0
        protected override void OnDelayedAttachAsMain(Character target)
        {
            int goalWeight = info.Kwmc.ShowWeightLevel().ToInt();
            int diff       = goalWeight - (int)targetKnockdownWeightStats.BakedFloatValue;

            weightModifier = targetKnockdownWeightStats.AddModifier(StatsModifierOperator.Addition, diff);
        }
Esempio n. 7
0
 public void PreviewReservePoints(int value, ValueModifier modifier)
 {
     if (null != m_reservePointCounter)
     {
         m_reservePointCounter.ShowPreview(value, modifier);
     }
 }
Esempio n. 8
0
        private void ModifyStats()
        {
            bool found;

            stats = targetStatsComponent.CharacterStats.FindStats(statsType, out found);
            if (found)
            {
                float         value         = CalculateValue();
                ValueModifier valueModifier = stats.AddModifier(info.Smc.ShowStatsModifierOperator(), value);
                valueModifiers.Add(valueModifier);
            }

            for (int kIndex = 0; kIndex < info.Smc.extras.Count; kIndex++)
            {
                StatsModifierValue smv = info.Smc.extras[kIndex];
                bool  extraFound;
                Stats extraStats = targetStatsComponent.CharacterStats.FindStats(smv.ShowStatsType(), out extraFound);
                if (extraFound)
                {
                    float         extraValue         = smv.statsModifierValue * powerScale;
                    ValueModifier extraValueModifier = extraStats.AddModifier(smv.ShowOperator(), extraValue);
                    if (extraValueModifiers.Count - 1 < kIndex)
                    {
                        extraValueModifiers.Add(new List <ValueModifier>());
                    }
                    extraValueModifiers[kIndex].Add(extraValueModifier);
                }
            }
        }
        private void ModifyMovementSpeed()
        {
            float finalPercentage = info.Msmc.percentage * powerScale;

            valueModifier = targetMovementComponent.ConfigData.speedStats.AddModifier(
                StatsModifierOperator.Percentage, finalPercentage
                );
        }
 public override void PopulateFromJson(JObject jsonObject)
 {
     base.PopulateFromJson(jsonObject);
     m_caracSelector = ICaracIdSelectorUtils.FromJsonProperty(jsonObject, "caracSelector");
     m_modifier      = (ValueModifier)Serialization.JsonTokenValue <int>(jsonObject, "modifier", 1);
     m_value         = DynamicValue.FromJsonProperty(jsonObject, "value");
     m_source        = ISingleEntitySelectorUtils.FromJsonProperty(jsonObject, "source");
 }
Esempio n. 11
0
    void Start()
    {
        // apply health modifier
        maxHealth *= Mathf.Max(ValueModifier.TryGetModifier(this).health, ValueModifier.MIN_VALUE);

        // initialize values
        health = maxHealth;
    }
Esempio n. 12
0
 public void AddModifier(ValueModifier m)
 {
     if (modifiers == null)
     {
         modifiers = new List <ValueModifier>();
     }
     modifiers.Add(m);
 }
 public void AddModifier(ValueModifier modifier)
 {
     if (_modifiers == null)
     {
         _modifiers = new List <ValueModifier>();
     }
     _modifiers.Add(modifier);
 }
 public static ValueModifier TryGetModifier(Component obj)
 {
     try {
         ValueModifier modifier = obj.GetComponentInParent <ModifierContainer>().modifier;
         return(modifier);
     } catch {
         return(ValueModifier.Default());
     }
 }
Esempio n. 15
0
    public static void ResetState()
    {
        enemyModifier  = ValueModifier.Default();
        playerModifier = ValueModifier.Default();
        arenaModifier  = ValueModifier.Default();

        score       = 0;
        waveCounter = 1;
    }
 protected override void OnDelayedAttachAsMain(Character target)
 {
     knockbackWeightValueModifier = knockbackWeightStats.AddModifier(
         StatsModifierOperator.Addition, -WeightLevelMethods.ConvertDeltaLevelToDeltaValue(info.Config.weightIncrement)
         );
     knockdownWeightValueModifier = knockdownWeightStats.AddModifier(
         StatsModifierOperator.Addition, -WeightLevelMethods.ConvertDeltaLevelToDeltaValue(info.Config.weightIncrement)
         );
 }
Esempio n. 17
0
 public override void PopulateFromJson(JObject jsonObject)
 {
     base.PopulateFromJson(jsonObject);
     m_counterType           = (CaracId)Serialization.JsonTokenValue <int>(jsonObject, "counterType", 20);
     m_modifier              = (ValueModifier)Serialization.JsonTokenValue <int>(jsonObject, "modifier", 1);
     m_value                 = DynamicValue.FromJsonProperty(jsonObject, "value");
     m_source                = ISingleEntitySelectorUtils.FromJsonProperty(jsonObject, "source");
     m_canAddWithoutPriorSet = Serialization.JsonTokenValue <bool>(jsonObject, "canAddWithoutPriorSet", false);
     m_maximumValue          = Serialization.JsonTokenValue <int?>(jsonObject, "maximumValue", (int?)null);
 }
Esempio n. 18
0
 public void ChangePopulation(ValueModifier modifier, int amt)
 {
     if (modifier == ValueModifier.Increase)
     {
         Debug.Log($"{modifier.ToString()} {amt}");
     }
     else
     {
         // gamemaster variable - amt
     }
 }
Esempio n. 19
0
    void PickEnemyModifier()
    {
        // get modifier
        GameObject obj = enemyModifierOptions[Random.Range(0, enemyModifierOptions.Count)];

        enemyModifier = obj.GetComponent <ModifierContainer>().modifier;

        // set sprite
        enemySlot.sprite = enemyModifier.icon;
        enemySlot.gameObject.SetActive(true);
    }
Esempio n. 20
0
    void PickPlayerModifier()
    {
        // get modifier
        GameObject obj = playerModifierOptions[Random.Range(0, playerModifierOptions.Count)];

        playerModifier = obj.GetComponent <ModifierContainer>().modifier;

        // set sprite
        playerSlot.sprite = playerModifier.icon;
        playerSlot.gameObject.SetActive(true);
    }
Esempio n. 21
0
    void PickArenaModifier()
    {
        // get modifier
        GameObject obj = arenaModifierOptions[Random.Range(0, arenaModifierOptions.Count)];

        arenaModifier = obj.GetComponent <ModifierContainer>().modifier;

        // set sprite
        arenaSlot.sprite = arenaModifier.icon;
        arenaSlot.gameObject.SetActive(true);
    }
Esempio n. 22
0
 public void AddModifier(ValueModifier vm)
 {
     if (vm == null)
     {
         return;
     }
     if (modifiers == null)
     {
         modifiers = new List<ValueModifier>();
     }
     modifiers.Add(vm);
 }
    public void MergeModifier(ValueModifier other)
    {
        if (other.speed > MIN_VALUE)
        {
            this.speed *= other.speed;
        }
        if (other.health > MIN_VALUE)
        {
            this.health *= other.health;
        }
        if (other.damage > MIN_VALUE)
        {
            this.damage *= other.damage;
        }
        if (other.scale > MIN_VALUE)
        {
            this.scale *= other.scale;
        }

        if (other.hats != null)
        {
            if (this.hats != null)
            {
                this.hats.AddRange(other.hats);
            }
            else
            {
                this.hats = other.hats;
            }
        }

        this.randomSounds = other.randomSounds;

        if (type == ModifierType.incremental)
        {
            if (other.leftWeapon != WeaponType.none)
            {
                this.leftWeapon = other.leftWeapon;
            }
            if (other.rightWeapon != WeaponType.none)
            {
                this.rightWeapon = other.rightWeapon;
            }
        }
        else if (type == ModifierType.temporary)
        {
            this.leftWeapon  = other.leftWeapon;
            this.rightWeapon = other.rightWeapon;
        }

        this.arena = other.arena;
    }
Esempio n. 24
0
        protected override void OnDelayedAttachAsMain(Character target)
        {
            targetStatusModifierStats = targetStatsComponent.CharacterStats.FindStats(StatsType.StatusModifier);
            Stats targetShockDmgDownScaleStats = targetStatsComponent.CharacterStats.FindStats(StatsType.ShockDmgDownScale);
            Stats casterShockDmgUpScaleStats   = casterStatsComponent.CharacterStats.FindStats(StatsType.ShockDmgUpScale);

            statusModifierValueModifier = targetStatusModifierStats.AddModifier(
                StatsModifierOperator.Addition,
                info.Smc.bonusDmg
                * (1 + targetShockDmgDownScaleStats.BakedFloatValue)
                * (1 + casterShockDmgUpScaleStats.BakedFloatValue)
                );
        }
Esempio n. 25
0
            public IncreaseLyingDuration(UnpredictableDurationLifetime subLifetime, float duration, Entity targetEntity)
            {
                this.subLifetime = subLifetime;
                this.duration    = duration;
                StatsComponent sc = targetEntity.GetComponent <StatsComponent>();
                bool           found;

                extraLying = sc.CharacterStats.FindStats(StatsType.ExtraLyingDuration, out found);
                if (found)
                {
                    vm = extraLying.AddModifier(StatsModifierOperator.Addition, duration);
                }
            }
Esempio n. 26
0
    void LateUpdate()
    {
        // apply scale modifier
        ValueModifier modifier = GetComponentInParent <ModifierContainer>().modifier;
        float         newScale = Mathf.Max(modifier.scale, ValueModifier.MIN_VALUE);

        if (scale != newScale)
        {
            _previousScale = scale;
            Vector3 currentScale = transform.localScale / scale;

            scale = newScale;
            transform.localScale = currentScale * scale;
        }
    }
Esempio n. 27
0
        public AddPlayerModifier(Player player, PlayerModifier modifierType, ValueModifier modifier)
        {
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }
            else if (modifier == null)
            {
                throw new ArgumentNullException("modifier");
            }

            Player = player;
            ModifierType = modifierType;
            Modifier = modifier;
        }
Esempio n. 28
0
        public void Unstack()
        {
            ValueModifier valueModifier = valueModifiers[valueModifiers.Count - 1];

            valueModifiers.Remove(valueModifier);
            stats.RemoveModifier(valueModifier);

            foreach (List <ValueModifier> childExtras in extraValueModifiers)
            {
                ValueModifier valueModifierOfExtra = childExtras[childExtras.Count - 1];
                childExtras.Remove(valueModifierOfExtra);
                stats.RemoveModifier(valueModifierOfExtra);
            }
            DecreaseStackCount();
        }
    protected override void ThrottledUpdate()
    {
        WeaponType left = ValueModifier.TryGetModifier(this).leftWeapon;

        if (left != previousLeft)
        {
            previousLeft = left;
            SwitchWeapon(left, LeftHand);
        }

        WeaponType right = ValueModifier.TryGetModifier(this).rightWeapon;

        if (right != previousRight)
        {
            previousRight = right;
            SwitchWeapon(right, RightHand);
        }
    }
Esempio n. 30
0
        public void StackValue(Modifier newOne)
        {
            StatsInfo     statsInfoFromNewOne = (StatsInfo)newOne.Cookies()[0];
            ValueModifier valueModifier       = stats.AddModifier(
                statsInfoFromNewOne.Smc.ShowStatsModifierOperator(),
                ((StatsModifier)newOne).CalculateValue()
                );

            valueModifiers.Add(valueModifier);

            for (int kIndex = 0; kIndex < statsInfoFromNewOne.Smc.extras.Count; kIndex++)
            {
                StatsModifierValue extra         = statsInfoFromNewOne.Smc.extras[kIndex];
                ValueModifier      extraModifier = stats.AddModifier(
                    extra.ShowOperator(), extra.statsModifierValue * powerScale
                    );
                if (extraValueModifiers.Count - 1 < kIndex)
                {
                    extraValueModifiers.Add(new List <ValueModifier>());
                }
                extraValueModifiers[kIndex].Add(extraModifier);
            }
        }
Esempio n. 31
0
        protected override void OnDelayedAttachAsMain(Character target)
        {
            target.InterruptChannelingSkill();

            targetAnimationComponent.Animation.PlayAnimation(info.Smc.startupAnim, 1, PlayMethod.Play, 0);
            targetAnimationComponent.Animation.JumpToFrame(info.Smc.jumpFrame);

            if (targetMovementComponent.ConfigData.isFallable)
            {
                float gravity = targetMovementComponent.Gravity;
                for (int kIndex = 0; kIndex < targetMovementComponent.MovementRequests.Count; kIndex++)
                {
                    Request     r           = targetMovementComponent.MovementRequests[kIndex];
                    RequestType requestType = r.ShowRequestType();
                    if (requestType == RequestType.StationaryJump ||
                        requestType == RequestType.MovingJump)
                    {
                        gravity = ((StationaryJumpRequest)r).GroundingGravity;
                    }
                }
                FallRequest fallRequest = new FallRequest(
                    gravity, targetMovementComponent.Velocity.magnitude
                    );
                targetMovementComponent.AddMovementRequest(fallRequest);
            }

            targetStatusModifierStats = targetStatsComponent.CharacterStats.FindStats(StatsType.StatusModifier);
            Stats targetWakeDmgDownScaleStats = targetStatsComponent.CharacterStats.FindStats(StatsType.WakeDmgDownScale);
            Stats casterWakeDmgUpScaleStats   = casterStatsComponent.CharacterStats.FindStats(StatsType.WakeDmgUpScale);

            statusModifierValueModifier = targetStatusModifierStats.AddModifier(
                StatsModifierOperator.Addition,
                info.Smc.bonusDmg
                * (1 + targetWakeDmgDownScaleStats.BakedFloatValue)
                * (1 + casterWakeDmgUpScaleStats.BakedFloatValue)
                );
        }
 private int Compare(ValueModifier x, ValueModifier y)
 {
     return(x.SortOrder.CompareTo(y.SortOrder));
 }
Esempio n. 33
0
 int Compare(ValueModifier x, ValueModifier y)
 {
     return(x.sortOrder.CompareTo(y.sortOrder));
 }
Esempio n. 34
0
 int Compare(ValueModifier x, ValueModifier y)
 {
     return x.sortOrder.CompareTo(y.sortOrder);
 }