Beispiel #1
0
 void AssignAnEffect()
 {
     if (effectType == EffectType.Positive)
     {
         if (UnityEngine.Random.Range(1, 11) <= 4)
         {
             effectName = EffectName.Shield;
         }
         else
         {
             effectName = EffectName.TimeDelay;
         }
     }
     else
     {
         if (UnityEngine.Random.Range(1, 3) == 1)
         {
             effectName = EffectName.Toxin;
         }
         else
         {
             effectName = EffectName.Chaos;
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Metoda ta musi być wywołana dopiero po wywołaniu konstruktora oraz InitializeComponent z klasy dziedziczącej, inicjalizuje kontrolki na samym początku
        /// </summary>
        protected void Init()
        {
            page = effect.EffectsCount;
            groupBoxProporties.Size = new Size(groupBoxProporties.Size.Width, this.Size.Height - groupBoxProporties.Location.Y - 30);
            labelDesc.Text          = Description;

            if (effect.EffectsCount > 0)
            {
                groupBoxProporties.Text = ProportiesName + " " + page + "/" + effect.EffectsCount;
                if (effect.EffectsCount > 1)
                {
                    buttonPrevious.Enabled = true;
                }

                panelNoEffect.Visible = false;
                UpdateControls();
            }
            else
            {
                panelNoEffect.BringToFront();
                panelNoEffect.Visible    = true;
                buttonAddEcho.Text       = "Dodaj " + EffectName.ToLower();
                buttonNext.Enabled       = false;
                buttonDeleteEcho.Enabled = false;
            }

            Text = EffectName;
        }
Beispiel #3
0
    public void CheckSpawnIcon(EffectType type)
    {
        //TODO add traits icons
        foreach (StatusIcon si in icons)
        {
            if (si.type == type)//if icon exists, no need to spawn
            {
                //TODO add animation for updating status
                return;
            }
        }
        StatusIcon icon = Instantiate <StatusIcon>(prefab, transform);

        icon.manager = this;
        icon.type    = type;
        if (type == EffectType.baseClass)
        {
            icon.SetImage(SpriteLibrary.GetStatusSprite(unit.stats.GetClassName()));
        }
        else
        {
            icon.SetImage(SpriteLibrary.GetStatusSprite(EffectName.ToString(type)));
        }
        icon.SetPosition(icons.Count);
        icons.Add(icon);
    }
Beispiel #4
0
        private void RestoreIcons()
        {
            if (buffList.Count == 0)
            {
                return;
            }

            fxIconCount = 0;
            foreach (string id in buffList.Keys)
            {
                fxName = (EffectName)Enum.Parse(typeof(EffectName), id);
                fxIconSpawner.Spawn(id, fxIconCount, fxIconDB.GetSprite(fxName));
                float fxDuration    = float.Parse(effectDB.GetEffectStat(EffectStat.Duration, fxName));
                float fillPercent   = buffList[id][1] / fxDuration;
                float timeRemaining = fxDuration - buffList[id][1];
                fxIconSpawner.UpdateIconFill(id, fillPercent, timeRemaining);

                if (effectDB.GetEffectStat(EffectStat.EffectType, fxName) == "Stat Over Time")
                {
                    coBuffList[fxID] = StartCoroutine(BuffOverTime(fxDuration));
                }

                fxIconCount += 1;
            }
        }
Beispiel #5
0
        public void BuffSelf(string ID)
        {
            if (!isBattleActive)
            {
                return;
            }

            fxID   = ID;
            fxName = (EffectName)Enum.Parse(typeof(EffectName), ID);
            string buffType = effectDB.GetEffectStat(EffectStat.EffectType, fxName);

            switch (buffType)
            {
            case "Stat Over Time":
                BuffStatOverTime();
                break;

            case "Base Boost":
                BuffStat();
                break;

            case "Atk Boost":
                BuffStat();
                break;

            default:
                Debug.Log("Error with Effect " + fxName + " - ID: " + ID);
                break;
            }
        }
Beispiel #6
0
    /// <summary>
    /// Get one of the values of the EffectValues array.
    /// </summary>
    /// <param name="effectName">EffectName asociated to the effect value.</param>
    /// <returns></returns>
    public float GetEffectValue(EffectName effectName)
    {
        int index = System.Array.IndexOf(
            array: Effects,
            value: effectName);

        return(GetEffectValue(index));
    }
 private PowerPoint.Shape AddPicture(string imageFile, EffectName effectName)
 {
     PowerPoint.Shape imageShape = Shapes.AddPicture(imageFile,
                                                     MsoTriState.msoFalse, MsoTriState.msoTrue, 0,
                                                     0);
     ChangeName(imageShape, effectName);
     return(imageShape);
 }
Beispiel #8
0
 private void ResolveEffectName(Table.Table Table)
 {
     if (!EffectName.IsNullOrWhiteSpace() && Table.Effects.Contains(EffectName))
     {
         Effect = Table.Effects[EffectName];
     }
     ;
 }
 private PowerPoint.Shape AddPicture(string imageFile, EffectName effectName)
 {
     var imageShape = Shapes.AddPicture(imageFile,
         MsoTriState.msoFalse, MsoTriState.msoTrue, 0,
         0);
     ChangeName(imageShape, effectName);
     return imageShape;
 }
Beispiel #10
0
 public void addEffect(EffectName effectName, float damage, float time)
 {
     if (!hasEffekt[(int)effectName])
     {
         effectDamage[(int)effectName]   = damage;
         effectTimeLeft[(int)effectName] = time;
         hasEffekt[(int)effectName]      = true;
         effectGameObjects[(int)effectName].SetActive(true);
         StartCoroutine(applyEffect(effectName));
     }
 }
Beispiel #11
0
        public void BuffItemEffect(EffectName newFX)
        {
            fxID   = newFX.ToString();
            fxName = newFX;
            BuffStat();
            float fxDuration    = float.Parse(effectDB.GetEffectStat(EffectStat.Duration, fxName));
            float fillPercent   = buffList[fxID][1] / fxDuration;
            float timeRemaining = fxDuration - buffList[fxID][1];

            fxIconSpawner.UpdateIconFill(fxID, fillPercent, timeRemaining);
        }
Beispiel #12
0
 private void RemoveTemporaryBuffs()
 {
     foreach (var key in buffList.Keys)
     {
         fxName = (EffectName)Enum.Parse(typeof(EffectName), key);
         if (float.Parse(effectDB.GetEffectStat(EffectStat.Persistent, fxName)) < 1)
         {
             removeIDs.Add(key);
         }
     }
     RemoveBuffs();
 }
Beispiel #13
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (int)SoundType;
         hashCode = (hashCode * 397) ^ StartVerse;
         hashCode = (hashCode * 397) ^ EndVerse;
         hashCode = (hashCode * 397) ^ (EffectName != null ? EffectName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UserSpecifiesLocation.GetHashCode();
         return(hashCode);
     }
 }
 public Target(
     AbilityName name,
     TurnPhase turnPhase,
     string displayName,
     string description,
     int distance,
     EffectName effect,
     IList <Research>?researchNeeded = null,
     EndsAt?cooldown = null) : base(name, $"{nameof(Ability)}.{nameof(Target)}", turnPhase, researchNeeded ?? new List <Research>(), true, displayName, description, cooldown)
 {
     Distance = distance;
     Effect   = effect;
 }
    public void PlayEffect(EffectName effectName, Vector3 pos, float lifetime = 1f)
    {
        GameObject clone = (GameObject)Instantiate(effectPrefabArray[(int)effectName], pos + adjust[effectName], Quaternion.identity);
        lastPlayEffect = clone;
        Destroy(clone, lifetime);
        Debugger.Log(effectName.ToString());

        //Play effect's sound
        if (AudioManager.HaveAudio(effectName.ToString())) {
            AudioManager.AudioName effectAudio = (AudioManager.AudioName)System.Enum.Parse(typeof(AudioManager.AudioName), effectName.ToString());
            AudioManager.PlaySound(effectAudio);
        }
    }
Beispiel #16
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = EffectName != null?EffectName.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ EffectDuration.GetHashCode();
                hashCode = (hashCode * 397) ^ EffectPower.GetHashCode();
                hashCode = (hashCode * 397) ^ EffectRate.GetHashCode();
                hashCode = (hashCode * 397) ^ IsDecaying.GetHashCode();
                hashCode = (hashCode * 397) ^ StatIndex;
                hashCode = (hashCode * 397) ^ (TargetStats != null ? TargetStats.GetHashCode() : 0);
                return(hashCode);
            }
        }
Beispiel #17
0
    IEnumerator applyEffect(EffectName effectName)
    {
        int   num_of_damages = (int)(effectTimeLeft[(int)effectName] / effectDamageTime[(int)effectName]);
        float singel_damage  = effectDamage[(int)effectName] / num_of_damages;

        for (int i = 0; i < num_of_damages; i++)
        {
            if (hasEffekt[(int)effectName])
            {
                yield return(new WaitForSeconds(effectDamageTime[(int)effectName]));

                doDamage(singel_damage);
            }
        }
        removeEffekt(effectName);
    }
Beispiel #18
0
        public IEnumerable <bool> GetAtkBooleanModifiers(AttackType atkType, AttackStat attackStat)
        {
            if (buffList.Count == 0)
            {
                yield return(false);
            }

            bool result = false;

            //Run through each active buff
            foreach (string id in buffList.Keys)
            {
                EffectName effect = (EffectName)Enum.Parse(typeof(EffectName), id);
                // Check if effect type boosts Attack, otherwise desired EffectStats aren't assigned
                if (effectDB.GetEffectStat(EffectStat.EffectType, effect) == "Atk Boost")
                {
                    // Skip if not a boolean buff value
                    if (int.Parse(effectDB.GetEffectStat(EffectStat.Additive, effect)) != 2)
                    {
                        continue;
                    }

                    // Get affected skill list and compare with the provided AtkType
                    string fxAttackTypes = effectDB.GetEffectStat(EffectStat.AtkTypesAffected, effect);
                    if (fxAttackTypes == "All" || fxAttackTypes.Contains(atkType.ToString()))
                    {
                        string fxAttackStats = effectDB.GetEffectStat(EffectStat.AtkStatsAffected, effect);
                        // Compare the Effect stat to the provided stat
                        if (fxAttackStats.Contains(attackStat.ToString()))
                        {
                            // Check and assign value, then check if buff is consumed on activation
                            if (effectDB.GetEffectStat(EffectStat.AtkEffectValues, effect).ToLower() == "true")
                            {
                                result = true;
                            }
                            if (int.Parse(effectDB.GetEffectStat(EffectStat.Consumed, effect)) == 1)
                            {
                                removeIDs.Add(id);
                            }
                        }
                    }
                }
            }

            yield return(result);
        }
Beispiel #19
0
        public float[] GetStatEffectModifiers(Stat stat)
        {
            if (buffList.Count == 0)
            {
                return new float[] { 0, 0 }
            }
            ;

            float[] result = new float[] { 0, 0 };
            //Run through each active buff
            foreach (string id in buffList.Keys)
            {
                EffectName effect = (EffectName)Enum.Parse(typeof(EffectName), id);

                // Check if effect type boosts Stats, otherwise desired EffectStats aren't assigned
                if (effectDB.GetEffectStat(EffectStat.EffectType, effect) != "Base Boost")
                {
                    continue;
                }

                // Split Additive entry based for mixed base boosts
                string[] fxAdditiveData = effectDB.GetEffectStat(EffectStat.Additive, effect).Split(new char[] { ',' });
                string[] fxBaseStats    = effectDB.GetEffectStat(EffectStat.StatsAffected, effect).Split(new char[] { ',' });
                string[] fxValueData    = effectDB.GetEffectStat(EffectStat.EffectValues, effect).Split(new char[] { ',' });

                for (int i = 0; i < fxAdditiveData.Length; i++)
                {
                    // Compare the Effect stat to the provided stat
                    if (fxBaseStats[i] == stat.ToString())
                    {
                        // Check and assign value, then check if buff is consumed on activation
                        float fxVal = float.Parse(fxValueData[i]);
                        fxVal *= buffList[id][0];
                        // Store result in percentage or additive slot of array
                        result[int.Parse(fxAdditiveData[i])] += fxVal;
                        if (int.Parse(effectDB.GetEffectStat(EffectStat.Consumed, effect)) == 1)
                        {
                            removeIDs.Add(id);
                        }
                        break;
                    }
                }
            }

            return(result);
        }
Beispiel #20
0
        public IEnumerable <float[]> GetAtkStatModifiers(AttackType atkType, AttackStat attackStat)
        {
            if (buffList.Count == 0)
            {
                yield return new float[] { 0, 0 }
            }
            ;

            float[] result = new float[] { 0, 0 };
            //Run through each active buff
            foreach (string id in buffList.Keys)
            {
                EffectName effect = (EffectName)Enum.Parse(typeof(EffectName), id);

                // Check if effect type boosts Attack, otherwise desired EffectStats aren't assigned
                if (effectDB.GetEffectStat(EffectStat.EffectType, effect) == "Atk Boost")
                {
                    // Skip if buff value is a bool
                    int modType = int.Parse(effectDB.GetEffectStat(EffectStat.Additive, effect));
                    if (modType == 2)
                    {
                        continue;
                    }

                    // Get affected skill list and compare with the provided AtkType
                    string fxAttackTypes = effectDB.GetEffectStat(EffectStat.AtkTypesAffected, effect);
                    if (fxAttackTypes == "All" || fxAttackTypes.Contains(atkType.ToString()))
                    {
                        string fxAttackStats = effectDB.GetEffectStat(EffectStat.AtkStatsAffected, effect);
                        // Compare the Effect stat to the provided stat
                        if (fxAttackStats.Contains(attackStat.ToString()))
                        {
                            // Check and assign value, then check if buff is consumed on activation
                            result[modType] += float.Parse(effectDB.GetEffectStat(EffectStat.AtkEffectValues, effect));
                            if (int.Parse(effectDB.GetEffectStat(EffectStat.Consumed, effect)) == 1 && !removeIDs.Contains(id))
                            {
                                removeIDs.Add(id);
                            }
                        }
                    }
                }
            }

            yield return(result);
        }
Beispiel #21
0
 //Will remove all the effects of that EffectName (e.g. all BURN)
 public void RemoveEffectsByID(EffectName id, bool triggerOnLeaveEffect)
 {
     if (existingEffectTypes.Contains(id))
     {
         //existingEffectTypes.Remove (code);
         for (int i = 0; i < existingEffects.Count; i++)
         {
             //Looping through all CombatEffects in List to find one that matches the type; highly INEFFICIENT
             if (existingEffects[i].id == id)
             {
                 if (triggerOnLeaveEffect && existingEffects[i]._onLeaveEffect != null)
                 {
                     existingEffects[i]._onLeaveEffect(this);
                 }
                 existingEffects.RemoveAt(i);
                 //hasBuffListChanged = true;
                 //RebuildExistingEffectTypesList();
             }
         }
     }
 }
Beispiel #22
0
 public override int GetHashCode()
 {
     return(EffectName.GetHashCode());
 }
 public void SetEffectName(string id)
 {
     fxName = (EffectName)Enum.Parse(typeof(EffectName), id);
     BuildEffectTooltips();
 }
Beispiel #24
0
 public static void ChangeName(PowerPoint.Shape shape, EffectName effectName, string shapeNamePrefix)
 {
     shape.Name = shapeNamePrefix + "_" + effectName + "_" + Guid.NewGuid().ToString().Substring(0, 7);
 }
 public static void ChangeName(PowerPoint.Shape shape, EffectName effectName, string shapeNamePrefix)
 {
     shape.Name = shapeNamePrefix + "_" + effectName + "_" + Guid.NewGuid().ToString().Substring(0, 7);
 }
        public string GetEffectStat(EffectStat stat, EffectName effectName)
        {
            BuildLookup();

            return(effectLookup[effectName][stat]);
        }
Beispiel #27
0
        public Sprite GetSprite(EffectName fxName)
        {
            BuildLookup();

            return(lookupTable[fxName]);
        }
Beispiel #28
0
 void removeEffekt(EffectName effectName)
 {
     hasEffekt[(int)effectName] = false;
     effectGameObjects[(int)effectName].SetActive(false);
 }
 // Usually checks searched area for a condition on resulted targets, could have more applications in the future
 public ResultValidator(EffectName effect, IList <Condition> conditions) : base(conditions, $"{nameof(Validator)}.{nameof(ResultValidator)}")
 {
     Effect = effect;
 }
Beispiel #30
0
 public void BuffItemEffect(string id)
 {
     fxID   = id;
     fxName = (EffectName)Enum.Parse(typeof(EffectName), id);
     BuffStat();
 }
 /// <summary>
 /// change the shape name, so that they can be managed (eg delete) by name easily
 /// </summary>
 /// <param name="shape"></param>
 /// <param name="effectName"></param>
 private static void ChangeName(PowerPoint.Shape shape, EffectName effectName)
 {
     ShapeUtil.ChangeName(shape, effectName, ShapeNamePrefix);
 }
 public int GetId(EffectName name, int heroId)
 {
     return((int)name * 10 + heroId);
 }
Beispiel #33
0
 /// <summary>
 /// change the shape name, so that they can be managed (eg delete) by name easily
 /// </summary>
 /// <param name="shape"></param>
 /// <param name="effectName"></param>
 private static void ChangeName(PowerPoint.Shape shape, EffectName effectName)
 {
     ShapeUtil.ChangeName(shape, effectName, ShapeNamePrefix);
 }
 public static bool IsEffectName(this CombatLogEvent @event, EffectName name)
 {
     return @event.EffectName?.EntityId == (long)name;
 }