Esempio n. 1
0
                public void OnReceived()
                {
                    if (NetworkServer.active)
                    {
                        return;
                    }
                    GameObject obj = Util.FindNetworkObject(objID);

                    if (obj)
                    {
                        MysticsItemsDeathCeremonyMark controller = obj.GetComponent <MysticsItemsDeathCeremonyMark>();
                        if (controller)
                        {
                            controller.markTimer = markTimer;
                        }
                    }
                }
Esempio n. 2
0
        private void GenericGameEvents_OnHitEnemy(DamageInfo damageInfo, MysticsRisky2UtilsPlugin.GenericCharacterInfo attackerInfo, MysticsRisky2UtilsPlugin.GenericCharacterInfo victimInfo)
        {
            if (!damageInfo.procChainMask.HasProc(ProcType.ChainLightning) && !damageInfo.rejected && attackerInfo.body && attackerInfo.inventory && victimInfo.body)
            {
                var component = victimInfo.body.GetComponent <MysticsItemsDeathCeremonyMark>();
                if (component)
                {
                    var itemCount = attackerInfo.inventory.GetItemCount(itemDef);
                    if (itemCount > 0 && damageInfo.procCoefficient > 0f && damageInfo.crit)
                    {
                        component.markTimer = duration;
                    }
                    foreach (var body in MysticsItemsDeathCeremonyMark.GetMarkedBodiesForTeam(victimInfo.teamIndex))
                    {
                        if (body != victimInfo.body && body.healthComponent && body.healthComponent.alive)
                        {
                            EffectData effectData = new EffectData
                            {
                                origin       = victimInfo.body.corePosition,
                                genericFloat = 0.2f
                            };
                            effectData.SetHurtBoxReference(body.gameObject);
                            EffectManager.SpawnEffect(damageShareOrbEffect, effectData, true);

                            DamageInfo markDamageInfo = new DamageInfo();
                            markDamageInfo.damage          = damageInfo.damage * Util.ConvertAmplificationPercentageIntoReductionPercentage(damage + damagePerStack * (itemCount - 1)) / 100f;
                            markDamageInfo.attacker        = attackerInfo.gameObject;
                            markDamageInfo.procCoefficient = canProc ? damageInfo.procCoefficient : 0f;
                            markDamageInfo.position        = body.corePosition;
                            markDamageInfo.crit            = damageInfo.crit;
                            markDamageInfo.damageType      = DamageType.Generic;
                            markDamageInfo.procChainMask   = damageInfo.procChainMask;
                            markDamageInfo.procChainMask.AddProc(ProcType.ChainLightning);
                            markDamageInfo.damageColorIndex = damageInfo.damageColorIndex;
                            body.healthComponent.TakeDamage(markDamageInfo);
                            GlobalEventManager.instance.OnHitEnemy(markDamageInfo, body.healthComponent.gameObject);
                        }
                    }
                }
            }
        }