예제 #1
0
            bool CanBeAppliedOn(Unit target)
            {
                if (target.HasAura(Spells.Impaled))
                {
                    return(false);
                }

                SpellEffectInfo effect = GetSpellInfo().GetEffect(target.GetMap().GetDifficultyID(), 0);

                if (effect != null)
                {
                    if (target.GetExactDist2d(GetOwner()) > effect.CalcRadius())
                    {
                        return(false);
                    }
                }

                Aura aur = target.GetAura(GetId());

                if (aur != null)
                {
                    if (aur.GetOwner() != GetOwner())
                    {
                        return(false);
                    }
                }

                return(true);
            }
예제 #2
0
    public void UpdateStats(SpellEffectInfo effectInfo, bool isFinal)
    {
        DivineDebug.Log("Update Stats for: ");
        DivineDebug.Log("CurrentHP: " + _currentStats.hp + " FinalHP: " + effectInfo.finalCharacterStats.hp + " IsFinal: " + isFinal);

        if ((effectInfo.isMultiPart && isFinal) || !effectInfo.isMultiPart)
        {
            _currentStats = effectInfo.finalCharacterStats;

            DivineDebug.Log("moniker " + moniker +
                            " hp: " + _currentStats.hp +
                            " shield: " + _currentStats.shield +
                            " damage: " + _currentStats.damage);

            charInfo.SetBaseStats(_currentStats.hp, _currentStats.maxHp, _currentStats.damage,
                                  _currentStats.shield, _currentStats.maxShield);
        }
        else
        {
            for (int i = 0; i < effectInfo.singleStatChanges.Count; i++)
            {
                switch (effectInfo.singleStatChanges[i].charStatChangeType)
                {
                case SpellSingleStatChangeType.None:
                    break;

                case SpellSingleStatChangeType.curHPValChange:
                    _currentStats.SetHP(_currentStats.hp + effectInfo.singleStatChanges[i].intVal);
                    break;

                case SpellSingleStatChangeType.curShieldValChange:
                    _currentStats.SetShield(_currentStats.shield + effectInfo.singleStatChanges[i].intVal);
                    break;

                case SpellSingleStatChangeType.curDamageValChange:
                    _currentStats.damage += effectInfo.singleStatChanges[i].intVal;
                    break;

                case SpellSingleStatChangeType.curFlagValChange:
                    _currentStats.flags = (BattleFlags)effectInfo.singleStatChanges[i].intVal;
                    break;

                default:
                    break;
                }
            }
        }

        DivineDebug.Log("After Update CurrentHP: " + _currentStats.hp +
                        " Shield: " + _currentStats.shield + " Flag: " + _currentStats.flags.ToString());

        ShowUpdatingStatsVisual(effectInfo);

        if (_curState == CharacterState.Idle && _currentStats.hp <= 0)
        {
            SetState_Dying(false);
        }

        _previousFlag = _currentStats.flags;
    }
    public void MakeAndAddSpellEffect(BtlCtrlCharacter target, SpellEffectOnChar effectOnChar,
                                      BtlCtrlCharacter.ChangeStatInfo changeStatInfo)
    {
        var statChanges = new List <SpellSingleStatChangeInfo>();

        if (Mathf.Abs(changeStatInfo.shieldChangeAmount) > 0)
        {
            statChanges.Add(new SpellSingleStatChangeInfo(
                                SpellSingleStatChangeType.curShieldValChange,
                                changeStatInfo.shieldChangeAmount));
        }

        if (Mathf.Abs(changeStatInfo.hpChangeAmount) > 0)
        {
            statChanges.Add(new SpellSingleStatChangeInfo(
                                SpellSingleStatChangeType.curHPValChange,
                                changeStatInfo.hpChangeAmount));
        }

        var stat = new BattleObjStats(target.hp,
                                      target.maxHp,
                                      damage,
                                      target.shield,
                                      target.maxShield);

        var effectInfo = new SpellEffectInfo(
            statChanges, target.id,
            effectOnChar,
            stat);

        _spellEffectInfoes.Add(effectInfo);
    }
예제 #4
0
        void OnTargetSelect(List <WorldObject> targets)
        {
            SpellEffectInfo eff2 = GetEffectInfo(2);

            if (eff2 == null)
            {
                return;
            }

            uint maxTargets = (uint)(eff2.CalcValue(GetCaster()) + 1); // adding 1 for explicit target unit

            if (targets.Count > maxTargets)
            {
                Unit explTarget = GetExplTargetUnit();

                // Sort targets so units with no atonement are first, then units who are injured, then oher units
                // Make sure explicit target unit is first
                targets.Sort((lhs, rhs) =>
                {
                    if (lhs == explTarget) // explTarget > anything: always true
                    {
                        return(1);
                    }
                    if (rhs == explTarget) // anything > explTarget: always false
                    {
                        return(-1);
                    }

                    return(MakeSortTuple(lhs).Equals(rhs) ? 1 : -1);
                });

                targets.Resize(maxTargets);
            }
        }
예제 #5
0
    private void ShowUpdatingStatsVisual(SpellEffectInfo spellEffectInfo)
    {
        switch (spellEffectInfo.effectOnCharacter)
        {
        case SpellEffectOnChar.Miss:
            _charVisual.charUI.newCharHUD.AddBuzz(BuzzType.Miss);
            return;

        case SpellEffectOnChar.Dodge:
            _charVisual.charUI.newCharHUD.AddBuzz(BuzzType.Dodge);
            return;

        case SpellEffectOnChar.SeriousDamage:
            _charVisual.charUI.newCharHUD.AddBuzz(BuzzType.Critical);
            break;
        }

        for (int i = 0; i < spellEffectInfo.singleStatChanges.Count; i++)
        {
            SpellSingleStatChangeInfo singleStatChange = spellEffectInfo.singleStatChanges[i];

            DivineDebug.Log("On Receive Damage" + singleStatChange.charStatChangeType.ToString() + "  " + singleStatChange.intVal);

            switch (singleStatChange.charStatChangeType)
            {
            case SpellSingleStatChangeType.curDamageValChange:
                ShowUI_StatChange_DMG(singleStatChange.intVal, spellEffectInfo.effectOnCharacter);
                break;
            }
        }

        ShowUI_StatChange_HpOrShield(spellEffectInfo.isMultiPart);
        Show_EffectForFlagChange(_currentStats.flags, spellEffectInfo.effectOnCharacter == SpellEffectOnChar.None);
    }
예제 #6
0
        public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, uint index, Unit caster)
        {
            // @todo possibly all negative auras immune?
            if (GetEntry() == 5925)
            {
                return(false);
            }

            SpellEffectInfo effect = spellInfo.GetEffect(GetMap().GetDifficultyID(), index);

            if (effect == null)
            {
                return(true);
            }

            switch (effect.ApplyAuraName)
            {
            case AuraType.PeriodicDamage:
            case AuraType.PeriodicLeech:
            case AuraType.ModFear:
            case AuraType.Transform:
                return(true);

            default:
                break;
            }

            return(base.IsImmunedToSpellEffect(spellInfo, index, caster));
        }
예제 #7
0
        void HandleOnHit(uint effIndex)
        {
            Unit caster = GetCaster();
            Unit target = GetHitUnit();

            int index = _orderedTargets.IndexOf(target.GetGUID());

            if (index == 0 && // only primary target triggers these benefits
                target.HasAuraState(AuraStateType.Frozen, GetSpellInfo(), caster))
            {
                // Thermal Void
                Aura thermalVoid = caster.GetAura(SpellIds.ThermalVoid);
                if (thermalVoid != null)
                {
                    SpellEffectInfo thermalVoidEffect = thermalVoid.GetSpellInfo().GetEffect(0);
                    if (thermalVoidEffect != null)
                    {
                        Aura icyVeins = caster.GetAura(SpellIds.IcyVeins);
                        if (icyVeins != null)
                        {
                            icyVeins.SetDuration(icyVeins.GetDuration() + thermalVoidEffect.CalcValue(caster) * Time.InMilliseconds);
                        }
                    }
                }

                // Chain Reaction
                if (caster.HasAura(SpellIds.ChainReactionDummy))
                {
                    caster.CastSpell(caster, SpellIds.ChainReaction, true);
                }
            }

            // put target index for chain value multiplier into EFFECT_1 base points, otherwise triggered spell doesn't know which damage multiplier to apply
            caster.CastCustomSpell(SpellIds.IceLanceTrigger, SpellValueMod.BasePoint1, index, target, true);
        }
예제 #8
0
파일: Totem.cs 프로젝트: Tithand/CypherCore
        public override bool IsImmunedToSpellEffect(SpellInfo spellInfo, SpellEffectInfo spellEffectInfo, WorldObject caster)
        {
            // @todo possibly all negative auras immune?
            if (GetEntry() == 5925)
            {
                return(false);
            }

            if (spellEffectInfo == null)
            {
                return(true);
            }

            switch (spellEffectInfo.ApplyAuraName)
            {
            case AuraType.PeriodicDamage:
            case AuraType.PeriodicLeech:
            case AuraType.ModFear:
            case AuraType.Transform:
                return(true);

            default:
                break;
            }

            return(base.IsImmunedToSpellEffect(spellInfo, spellEffectInfo, caster));
        }
예제 #9
0
    public void UpdateCharacterStats(StatsUpdateData statsUpdateData)
    {
        Character ch = _charsDic[statsUpdateData.ownerID];

        SpellEffectInfo spellEffectInf = new SpellEffectInfo(statsUpdateData.singleStatChanges
                                                             , statsUpdateData.ownerID, SpellEffectOnChar.None, statsUpdateData.finalStats);

        ch.UpdateStats(spellEffectInf, true);
    }
예제 #10
0
        public override bool Validate(SpellInfo spellInfo)
        {
            SpellEffectInfo effect2 = spellInfo.GetEffect(2);

            if (effect2 == null || effect2.IsEffect() || effect2.CalcValue() <= 0)
            {
                return(false);
            }
            return(true);
        }
예제 #11
0
        private float?Resolve(SpellEffectInfo spellEffectInfo)
        {
            switch (argumentType)
            {
            case SpellTooltipArgumentType.Value:
                return(spellEffectInfo.Value);

            default:
                return(null);
            }
        }
예제 #12
0
        public override bool Validate(SpellInfo spellInfo)
        {
            if (!ValidateSpellInfo(SpellIds.ArcaneMage, SpellIds.Reverberate))
            {
                return(false);
            }

            SpellEffectInfo damageEffect = spellInfo.GetEffect(1);

            return(damageEffect != null && damageEffect.IsEffect(SpellEffectName.SchoolDamage));
        }
예제 #13
0
        public override bool Load()
        {
            SpellInfo       spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.StaggerDamageAura, GetCastDifficulty());
            SpellEffectInfo effInfo   = spellInfo?.GetEffect(0);

            if (effInfo == null)
            {
                return(false);
            }

            _period = (float)effInfo.ApplyAuraPeriod;
            return(true);
        }
예제 #14
0
    private List <ActionData> MakeFightAction(WFightAction fightActions)
    {
        List <ActionData> actionList = new List <ActionData>();

        for (int n = 0; n < fightActions.f_acts.Length; n++)
        {
            WFightActionData fightAc = fightActions.f_acts[n];

            FightActionData fad = new FightActionData();

            var effectsInfo = new List <SpellEffectInfo>();

            AppearanceConfigData.MagicAppearanceData appearance;
            appearance = AppearanceConfigData.instance.GetMagicWithIndex(_battleLogic.GetCharacterWithID(fightAc.owner_id).moniker,
                                                                         fightAc.spell_index);
            fad.consumedActionPoint = fightAc.con_ap;
            fad.ownerID             = fightAc.owner_id;

            //if (appearance._multiplePartDamage != null && appearance._multiplePartDamage.Count > 0)
            //{
            //    effectsInfo = multipart(appearance._multiplePartDamage, effectsInfo);
            //}

            for (int i = 0; i < fightAc.spell_effect_info.Length; i++)
            {
                BattleObjStats finalStat = MakeBattleObject(fightAc.spell_effect_info[i].final_character_stats);

                List <SpellSingleStatChangeInfo> statChanges = MakeSingleStatChangeList(
                    fightAc.spell_effect_info[i].single_stat_changes);

                SpellEffectInfo effect = new SpellEffectInfo(statChanges,
                                                             fightAc.spell_effect_info[i].target_character_id,
                                                             fightAc.spell_effect_info[i].effect_on_character,
                                                             finalStat);
                effectsInfo.Add(effect);
            }

            fad.spellInfo = new SpellInfo(
                fightAc.spell_index,
                appearance._isInstant, appearance._dontShowToUser, appearance._needTargetToComeNear,
                appearance._spellName, appearance._cost, appearance._prefabName,
                fightAc.spell_type, appearance._damageType, appearance._spellImpact, effectsInfo);

            fad.spellInfo.generatedActionPoint = fightAc.gen_ap;
            fad.spellInfo.isCritical           = fightAc.is_critical;

            actionList.Add(fad);
        }

        return(actionList);
    }
        private float?Resolve(SpellEffectInfo spellEffectInfo)
        {
            switch (argumentType)
            {
            case SpellTooltipArgumentType.Value:
                return(spellEffectInfo.Value);

            case SpellTooltipArgumentType.Radius when spellEffectInfo.Targeting is SpellTargetingArea areaTargeting:
                return(areaTargeting.MaxRadius);

            default:
                return(null);
            }
        }
예제 #16
0
    private void SpellImpact()
    {
        float shakeRatio = 0;
        float freezeTime = 0.025f;

        //In taunt it can be null
        if (_currentAction.spellInfo == null)
        {
            return;
        }

        SpellEffectInfo effectOfSpell = _currentAction.spellInfo.spellEffectInfos[_currentAction.spellEffectIndex];

        switch (_currentAction.spellInfo.spellImpact)
        {
        case SpellImpactType.Low:
        {
            shakeRatio = .5f;
            freezeTime = 0.05f;
        }
        break;

        case SpellImpactType.High:
        {
            freezeTime = 0.07f;
            shakeRatio = 1f;
        }
        break;
        }

        if (!_currentAction.spellInfo.needTargetToComeNear)
        {
            freezeTime = 0;
        }

        if (effectOfSpell.effectOnCharacter == SpellEffectOnChar.SeriousDamage)
        {
            _currentAction.spellInfo.spellImpact = SpellImpactType.High;
        }

        if (shakeRatio == .5f)
        {
            MainCamera.instance.CameraShake(false);
        }
        else if (shakeRatio == 1f)
        {
            MainCamera.instance.CameraShake(true);
        }
    }
예제 #17
0
        void OnSuccessfulDispel(uint effIndex)
        {
            SpellEffectInfo effect = GetSpellInfo().GetEffect(1);

            if (effect != null)
            {
                Unit caster      = GetCaster();
                int  heal_amount = effect.CalcValue(caster);

                caster.CastCustomSpell(caster, SpellIds.DevourMagicHeal, heal_amount, 0, 0, true);

                // Glyph of Felhunter
                Unit owner = caster.GetOwner();
                if (owner)
                {
                    if (owner.GetAura(SpellIds.GlyphOfDemonTraining) != null)
                    {
                        owner.CastCustomSpell(owner, SpellIds.DevourMagicHeal, heal_amount, 0, 0, true);
                    }
                }
            }
        }
예제 #18
0
        void HandleEffectHitTarget(uint effIndex)
        {
            Unit caster = GetCaster();

            if (caster.HasAura(SpellIds.Trinity))
            {
                return;
            }

            SpellEffectInfo effect3 = GetEffectInfo(3);

            if (effect3 == null)
            {
                return;
            }

            int durationPct = effect3.CalcValue(caster);

            if (caster.HasAura(SpellIds.Atonement))
            {
                caster.CastSpell(GetHitUnit(), SpellIds.AtonementTriggered, new CastSpellExtraArgs(SpellValueMod.DurationPct, durationPct).SetTriggerFlags(TriggerCastFlags.FullMask));
            }
        }
예제 #19
0
        void OnSuccessfulDispel(uint effIndex)
        {
            SpellEffectInfo effect = GetSpellInfo().GetEffect(1);

            if (effect != null)
            {
                Unit caster             = GetCaster();
                CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
                args.AddSpellMod(SpellValueMod.BasePoint0, effect.CalcValue(caster));

                caster.CastSpell(caster, SpellIds.DevourMagicHeal, args);

                // Glyph of Felhunter
                Unit owner = caster.GetOwner();
                if (owner)
                {
                    if (owner.GetAura(SpellIds.GlyphOfDemonTraining) != null)
                    {
                        owner.CastSpell(owner, SpellIds.DevourMagicHeal, args);
                    }
                }
            }
        }
예제 #20
0
 public override bool Load()
 {
     _spellInfoHeal   = Global.SpellMgr.GetSpellInfo(SpellIds.PrayerOfMendingHeal, Difficulty.None);
     _healEffectDummy = _spellInfoHeal.GetEffect(0);
     return(true);
 }
예제 #21
0
    private void StartAct_ReceiveSpell()
    {
        SpellEffectInfo effectOfSpell = _currentAction.spellInfo.spellEffectInfos[_currentAction.spellEffectIndex];

        DivineDebug.Log("ReceiveSpell: EffectOnCharacter: " + effectOfSpell.effectOnCharacter);

        string[]           an            = null;
        bool               shouldPlaySFX = false;
        CharacterAudioType sfxType       = CharacterAudioType.None;

        if (_currentAction.isDied)
        {
            an = _anims_LethalDamage;

            shouldPlaySFX = true;
            sfxType       = CharacterAudioType.die;
        }
        else
        {
            switch (effectOfSpell.effectOnCharacter)
            {
            case SpellEffectOnChar.NormalDamage:
                if (_currentAction.spellInfo.damageType == DamageType.High)
                {
                    an = _anims_ReceiveDamage_High;
                }
                else
                {
                    an = _anims_ReceiveDamage_Low;
                }
                break;

            case SpellEffectOnChar.SeriousDamage:
                an = _anims_ReceiveDamage_High;
                break;

            case SpellEffectOnChar.Appear:
                an = _anims_Appear;
                break;

            case SpellEffectOnChar.Nerf:
                an            = _anims_ReceiveNerf;
                shouldPlaySFX = true;
                sfxType       = CharacterAudioType.Nerf;
                break;

            case SpellEffectOnChar.Buff:
                an            = _anims_ReceiveBuff;
                shouldPlaySFX = true;
                sfxType       = CharacterAudioType.Buff;
                break;

            case SpellEffectOnChar.Miss:
                an = _anims_ReceiveBuff;
                break;

            case SpellEffectOnChar.Dodge:
                an = _anims_ReceiveBuff;
                break;

            case SpellEffectOnChar.Burn:
                an = _anims_ReceiveNerf;
                break;

            case SpellEffectOnChar.Fear:
                an = _anims_ReceiveNerf;
                break;

            case SpellEffectOnChar.Taunt:
                an = null;
                break;

            case SpellEffectOnChar.Prepare:
                an = _anims_Prepare;
                break;
            }
        }

        if (an != null)
        {
            PlayAnim(an);
            _curAnimTrackEntry.Complete += OnSpellReceiveAnimFinish;

            if (shouldPlaySFX)
            {
                _audioManager.PlayChar(moniker, sfxType);
            }
        }
        else
        {
            OnSpellReceiveAnimFinish(null);
        }

        SpellImpact();
    }
    private void UpdateSpellEffectList(SpellInfo spellInfo)
    {
        if (spellEffectList != null && ReferenceEquals(spellEffectList.list, spellInfo.Effects))
        {
            return;
        }

        spellEffectList = new ReorderableList(spellInfo.Effects, typeof(SpellEffectInfo), true, true, true, true);
        spellEffectList.drawHeaderCallback += delegate(Rect spellEffectRect) { GUI.Label(spellEffectRect, "Spell Effects"); };

        spellEffectList.drawElementCallback += delegate(Rect rect, int index, bool active, bool focused)
        {
            SpellEffectInfo drawnSpellEffectInfo    = balanceDefinition.SpellInfos[spellInfoIndex].Effects[index];
            string          spellEffectInfoTypeName = ObjectNames.NicifyVariableName(drawnSpellEffectInfo.EffectType.ToString());
            EditorGUI.LabelField(rect, $"Type: {spellEffectInfoTypeName} Value: {drawnSpellEffectInfo.Value}");

            if (active)
            {
                spellEffectIndex = index;
            }
        };

        spellEffectList.onAddDropdownCallback += delegate
        {
            var menu = new GenericMenu();
            foreach (Type effectType in typeof(SpellEffectInfo).Assembly.GetTypes().Where(type => typeof(SpellEffectInfo).IsAssignableFrom(type)))
            {
                if (effectType == typeof(SpellEffectInfo))
                {
                    continue;
                }

                string displayedEffectName = ObjectNames.NicifyVariableName(effectType.Name);
                menu.AddItem(new GUIContent("Add " + displayedEffectName), false, () =>
                {
                    string spellDirectory = SpellInfoPath + balanceDefinition.name + "/Spells/Effects/" + spellInfo.name + " Effects/";

                    if (!Directory.Exists(spellDirectory))
                    {
                        Directory.CreateDirectory(spellDirectory);
                    }

                    string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(spellDirectory + spellInfo.name + " Effect.asset");
                    var newEffectInfo       = (SpellEffectInfo)CreateInstance(effectType.Name);
                    AssetDatabase.CreateAsset(newEffectInfo, assetPathAndName);

                    balanceDefinition.SpellInfos[spellInfoIndex].Effects.Add(newEffectInfo);

                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh();
                    EditorUtility.SetDirty(target);
                });
            }
            menu.ShowAsContext();
        };

        spellEffectList.onRemoveCallback += delegate(ReorderableList list)
        {
            spellEffectIndex      = -1;
            cachedSpellInfoEditor = null;

            SpellEffectInfo removedSpellEffectInfo = balanceDefinition.SpellInfos[spellInfoIndex].Effects[list.index];
            balanceDefinition.SpellInfos[spellInfoIndex].Effects.Remove(removedSpellEffectInfo);
            AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(removedSpellEffectInfo));
            AssetDatabase.SaveAssets();
            EditorUtility.SetDirty(target);
        };
    }