Beispiel #1
0
        public static Status CreateStatus(StatusObject statusObject)
        {
            Status result = null;

            switch (statusObject.statusType)
            {
            case StatusType.None:
                break;

            case StatusType.Damage:
                result = new StatusDamage(statusObject);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }
    public void Apply(GameObject hitObject)
    {
        GameObject        effect              = Instantiate(statusEffect.effectObject, hitObject.transform);
        StatusDamage      statusDamage        = effect.GetComponent <StatusDamage>();
        TaggedStatsHolder myTaggedStatsHolder = GetComponent <TaggedStatsHolder>();
        ProtectionClass   protection          = hitObject.GetComponent <ProtectionClass>();

        if (protection)
        {
            if (statusDamage && myTaggedStatsHolder)
            {
                TaggedStatsHolder taggedStatsHolder = effect.AddComponent <TaggedStatsHolder>();
                taggedStatsHolder.simpleStats.AddRange(myTaggedStatsHolder.simpleStats);
                taggedStatsHolder.taggedStats.AddRange(myTaggedStatsHolder.taggedStats);

                // apply DoT damage
                foreach (TaggedStatsHolder.TaggableStat taggableStat in taggedStatsHolder.taggedStats)
                {
                    if (taggableStat.tagList.Contains(Tags.AbilityTags.DoT))
                    {
                        taggableStat.tagList.Remove(Tags.AbilityTags.DoT);
                    }
                }
                // build damage stats if necessary
                foreach (DamageStatsHolder holder in effect.GetComponents <DamageStatsHolder>())
                {
                    holder.damageStats = DamageStats.buildDamageStats(holder, taggedStatsHolder);
                }
            }
            // add creation reference
            CreationReferences myReferences = GetComponent <CreationReferences>();
            if (myReferences)
            {
                CreationReferences references = effect.AddComponent <CreationReferences>();
                references.creator     = myReferences.creator;
                references.thisAbility = myReferences.thisAbility;
            }
            // add alignment
            AlignmentManager myAlignmentManager = GetComponent <AlignmentManager>();
            if (myAlignmentManager)
            {
                AlignmentManager alignmentManager = effect.AddComponent <AlignmentManager>();
                alignmentManager.alignment = myAlignmentManager.alignment;
            }
            // apply shock effect
            if (statusEffect.effectID == 13)
            {
                TaggedStatsHolder tsh = GetComponent <TaggedStatsHolder>();
                if (tsh)
                {
                    float      shockEffect = tsh.GetStatValue(Tags.Properties.IncreasedShockEffect);
                    BuffParent pb          = effect.GetComponent <BuffParent>();
                    if (shockEffect != 0 && pb)
                    {
                        foreach (TaggedStatsHolder.TaggableStat stat in pb.taggedStats)
                        {
                            stat.addedValue     *= (1 + shockEffect);
                            stat.increasedValue *= (1 + shockEffect);
                        }
                    }
                }
            }
            // apply
            protection.effectControl.AddEffect(effect, effect.GetComponent <StatusEffect>());
        }
    }
Beispiel #3
0
        public void AddDamageInstance(PSO2DamageInstance instance)
        {
            if (instance.TargetId == ID)
            {
                //we took damage from instance.SourceId
                _receivedDamageInstances.Add(instance);
                DamageTaken.AddDamage(instance);

                if (!_attackInfoList.ContainsKey("Damage Taken"))
                {
                    _attackInfoList.Add("Damage Taken", new AttackInfo("Damage Taken", 0));
                }
                _attackInfoList["Damage Taken"].AddDamageInstance(instance);
            }
            else if (instance.SourceId == ID)
            {
                //we dealt damage to instance.TargetId
                if (instance.IsAISDamage)
                {
                    AISDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.AIS))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsDarkBlastDamage)
                {
                    DarkBlastDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.DarkBlast))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsZanverseDamage)
                {
                    ZanverseDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.Zanverse))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsHeroFinishDamage)
                {
                    HeroTimeFinishDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.HTF))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsStatusDamage)
                {
                    StatusDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.Burn))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsPhotonDamage)
                {
                    PhotonDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.PWP))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsRideroidDamage)
                {
                    RideroidDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.Ride))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else if (instance.IsLaconiumDamage)
                {
                    LaconiumDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.LSW))
                    {
                        AddAttackInfo(instance);
                    }
                }
                else
                {
                    BasicDamage.AddDamage(instance);

                    if (trackersToSum.HasFlag(PSO2DamageTrackers.Basic))
                    {
                        AddAttackInfo(instance);
                    }
                }

                _damageInstances.Add(instance);

                if (instance.IsZanverseDamage) //only update ZV max hit if ZV is not separated
                {
                    if (trackersToSum.HasFlag(PSO2DamageTrackers.Zanverse))
                    {
                        UpdateMaxHit(instance);
                    }
                }
                else
                {
                    UpdateMaxHit(instance);
                }
            }
        }