예제 #1
0
        // ========= internal ==========

        internal void Awake()
        {
            Instance = this;

            Ghost.Prepare();
            Skeleton.Prepare();

            Ghost.OnSpawn    += OnSpawn;
            Skeleton.OnSpawn += OnSpawn;
        }
예제 #2
0
        protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
        {
            if (SummonManager.Instance == null)
            {
                return;
            }

            bool armyOfDeathLearned = _affectedCharacter.Inventory.SkillKnowledge.IsItemLearned(8890108);

            int maxSummons = armyOfDeathLearned
                                ? NecromancerBase.settings.Summon_MaxSummons_WithArmyOfDeath
                                : NecromancerBase.settings.Summon_MaxSummons_NoArmyOfDeath;

            if (SummonManager.Instance.SummonedCharacters.ContainsKey(_affectedCharacter.UID))
            {
                var list      = SummonManager.Instance.SummonedCharacters[_affectedCharacter.UID];
                int toDestroy = list.Count - maxSummons;

                while (toDestroy >= 0)
                {
                    if (SummonManager.Instance.FindWeakestSummon(_affectedCharacter.UID) is Character summon)
                    {
                        SummonManager.DestroySummon(summon);
                    }

                    toDestroy--;
                }
            }

            // custom health cost for casting
            _affectedCharacter.Stats.UseBurntHealth = NecromancerBase.settings.Summon_BurnsHealth;
            float healthcost = NecromancerBase.settings.Summon_HealthCost * _affectedCharacter.Stats.MaxHealth;

            _affectedCharacter.Stats.ReceiveDamage(healthcost);
            _affectedCharacter.Stats.UseBurntHealth = true;

            // only host should do this
            if (!PhotonNetwork.isNonMasterClientInRoom)
            {
                bool insidePlagueAura = PlagueAuraProximityCondition.IsInsidePlagueAura(_affectedCharacter.transform.position);

                var template = insidePlagueAura ? SummonManager.Ghost : SummonManager.Skeleton;
                this.SLCharacter_UID = template.UID;

                CustomCharacters.Templates.TryGetValue(this.SLCharacter_UID, out m_charTemplate);

                this.ExtraRpcData = _affectedCharacter.UID.ToString();

                if (armyOfDeathLearned)
                {
                    for (int i = 0; i < NecromancerBase.settings.Summon_Summoned_Per_Cast_withArmyOfDeath; i++)
                    {
                        base.ActivateLocally(_affectedCharacter, _infos);
                    }
                }
                else
                {
                    base.ActivateLocally(_affectedCharacter, _infos);
                }
            }
        }
예제 #3
0
        protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
        {
            if (SummonManager.Instance == null)
            {
                return;
            }

            bool armyOfDeathLearned = _affectedCharacter.Inventory.SkillKnowledge.IsItemLearned(8890108);

            int MaxSummons = armyOfDeathLearned ? NecromancerBase.settings.Summon_MaxSummons_WithArmyOfDeath : NecromancerBase.settings.Summon_MaxSummons_NoArmyOfDeath;

            if (SummonManager.Instance.SummonedCharacters.ContainsKey(_affectedCharacter.UID))
            {
                var list = SummonManager.Instance.SummonedCharacters[_affectedCharacter.UID];
                int diff = MaxSummons - list.Count;

                if (armyOfDeathLearned)
                {
                    while (diff < NecromancerBase.settings.Summon_Summoned_Per_Cast_withArmyOfDeath)
                    {
                        if (SummonManager.Instance.FindWeakestSummon(_affectedCharacter.UID) is Character summon)
                        {
                            SummonManager.DestroySummon(summon);
                        }

                        diff++;
                    }
                }
                else
                {
                    if (list.Count == MaxSummons && SummonManager.Instance.FindWeakestSummon(_affectedCharacter.UID) is Character summon)
                    {
                        SummonManager.DestroySummon(summon);
                    }
                }
            }

            // custom health cost for casting
            _affectedCharacter.Stats.UseBurntHealth = NecromancerBase.settings.Summon_BurnsHealth;
            float healthcost = NecromancerBase.settings.Summon_HealthCost * _affectedCharacter.Stats.MaxHealth;

            _affectedCharacter.Stats.ReceiveDamage(healthcost);
            _affectedCharacter.Stats.UseBurntHealth = true;

            // only host should do this
            if (!PhotonNetwork.isNonMasterClientInRoom)
            {
                bool insidePlagueAura = PlagueAuraProximityCondition.IsInsidePlagueAura(_affectedCharacter.transform.position);

                if (armyOfDeathLearned)
                {
                    for (int i = 0; i < NecromancerBase.settings.Summon_Summoned_Per_Cast_withArmyOfDeath; i++)
                    {
                        var uid = UID.Generate().ToString();
                        SummonManager.Instance.SummonSpawn(_affectedCharacter, uid, insidePlagueAura);
                    }
                }
                else
                {
                    var uid = UID.Generate().ToString();
                    SummonManager.Instance.SummonSpawn(_affectedCharacter, uid, insidePlagueAura);
                }
            }
        }