Exemple #1
0
 public void OnInteractionBegin(Interactor activator)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.BarrelInteraction::OnInteractionBegin(RoR2.Interactor)' called on client");
         return;
     }
     if (!this.opened)
     {
         this.Networkopened = true;
         EntityStateMachine component = base.GetComponent <EntityStateMachine>();
         if (component)
         {
             component.SetNextState(new Opening());
         }
         CharacterBody component2 = activator.GetComponent <CharacterBody>();
         if (component2)
         {
             TeamIndex objectTeam = TeamComponent.GetObjectTeam(component2.gameObject);
             TeamManager.instance.GiveTeamMoney(objectTeam, (uint)this.goldReward);
         }
         this.CoinDrop();
         ExperienceManager.instance.AwardExperience(base.transform.position, activator.GetComponent <CharacterBody>(), (ulong)this.expReward);
     }
 }
Exemple #2
0
        // Token: 0x060015FC RID: 5628 RVA: 0x0005E580 File Offset: 0x0005C780
        private void FireImpactBlastAttack(Vector3 impactPosition)
        {
            BlastAttack blastAttack = new BlastAttack();

            blastAttack.baseDamage      = this.characterBody.damage * this.blastAttackDamageCoefficient;
            blastAttack.procCoefficient = this.blastAttackProcCoefficient;
            blastAttack.baseForce       = this.blastAttackForce;
            blastAttack.bonusForce      = Vector3.up * this.blastAttackBonusVerticalForce;
            blastAttack.crit            = Util.CheckRoll(this.characterBody.crit, this.characterBody.master);
            blastAttack.radius          = this.blastAttackRadius;
            blastAttack.damageType      = DamageType.PercentIgniteOnHit;
            blastAttack.falloffModel    = BlastAttack.FalloffModel.SweetSpot;
            blastAttack.attacker        = base.gameObject;
            blastAttack.teamIndex       = TeamComponent.GetObjectTeam(blastAttack.attacker);
            blastAttack.position        = impactPosition;
            blastAttack.Fire();
            if (NetworkServer.active)
            {
                EffectManager.SpawnEffect(this.blastAttackEffect, new EffectData
                {
                    origin = impactPosition,
                    scale  = this.blastAttackRadius
                }, true);
            }
        }
Exemple #3
0
        // Token: 0x060017C1 RID: 6081 RVA: 0x000711A0 File Offset: 0x0006F3A0
        private void FireMeatballs(Vector3 impactNormal, Vector3 impactPosition, Vector3 forward, int meatballCount, float meatballAngle, float meatballForce)
        {
            float   num        = 360f / (float)meatballCount;
            Vector3 normalized = Vector3.ProjectOnPlane(forward, impactNormal).normalized;
            Vector3 point      = Vector3.RotateTowards(impactNormal, normalized, meatballAngle * 0.017453292f, float.PositiveInfinity);

            for (int i = 0; i < meatballCount; i++)
            {
                Vector3 forward2 = Quaternion.AngleAxis(num * (float)i, impactNormal) * point;
                ProjectileManager.instance.FireProjectile(this.meatballProjectile, impactPosition, Util.QuaternionSafeLookRotation(forward2), base.gameObject, this.characterBody.damage * this.meatballDamageCoefficient, meatballForce, Util.CheckRoll(this.characterBody.crit, this.characterBody.master), DamageColorIndex.Default, null, -1f);
            }
            BlastAttack blastAttack = new BlastAttack();

            blastAttack.baseDamage      = this.characterBody.damage * this.blastAttackDamageCoefficient;
            blastAttack.procCoefficient = this.blastAttackProcCoefficient;
            blastAttack.baseForce       = this.blastAttackForce;
            blastAttack.bonusForce      = Vector3.up * this.blastAttackBonusVerticalForce;
            blastAttack.crit            = Util.CheckRoll(this.characterBody.crit, this.characterBody.master);
            blastAttack.radius          = this.blastAttackRadius;
            blastAttack.damageType      = DamageType.IgniteOnHit;
            blastAttack.falloffModel    = BlastAttack.FalloffModel.SweetSpot;
            blastAttack.attacker        = base.gameObject;
            blastAttack.teamIndex       = TeamComponent.GetObjectTeam(blastAttack.attacker);
            blastAttack.position        = impactPosition;
            blastAttack.Fire();
            if (NetworkServer.active)
            {
                EffectManager.instance.SpawnEffect(this.blastAttackEffect, new EffectData
                {
                    origin = impactPosition,
                    scale  = this.blastAttackRadius
                }, true);
            }
        }
Exemple #4
0
 // Token: 0x06000FE8 RID: 4072 RVA: 0x0004F9B9 File Offset: 0x0004DBB9
 private void OnTriggerEnter(Collider other)
 {
     if (NetworkServer.active && !this.gravitateTarget && TeamComponent.GetObjectTeam(other.gameObject) == this.teamFilter.teamIndex)
     {
         this.gravitateTarget = other.gameObject.transform;
     }
 }
        private void DetonateMeteor(Meteor meteor)
        {
            var effectData = new EffectData
            {
                origin = meteor.impactPosition
            };

            EffectManager.instance.SpawnEffect(impactEffectPrefab, effectData, true);

            var localGameObject = gameObject;

            new BlastAttack
            {
                inflictor        = localGameObject,
                baseDamage       = blastDamageCoefficient * ownerDamage,
                baseForce        = blastForce,
                canHurtAttacker  = true,
                crit             = isCrit,
                falloffModel     = BlastAttack.FalloffModel.Linear,
                attacker         = owner,
                bonusForce       = Vector3.zero,
                damageColorIndex = DamageColorIndex.Item,
                position         = meteor.impactPosition,
                procChainMask    = default(ProcChainMask),
                procCoefficient  = 1f,
                teamIndex        = TeamComponent.GetObjectTeam(localGameObject),          // Make sure meteor storm doesn't hurt friendlies
                radius           = blastRadius
            }.Fire();
        }
        // Token: 0x06000E57 RID: 3671 RVA: 0x00046B08 File Offset: 0x00044D08
        private void DoDamage()
        {
            if (this.pointsList.Count == 0)
            {
                return;
            }
            float   damage = this.damagePerSecond * this.updateInterval;
            Vector3 vector = this.pointsList[this.pointsList.Count - 1].position;
            HashSet <GameObject> hashSet   = new HashSet <GameObject>();
            TeamIndex            teamIndex = TeamIndex.Neutral;

            if (this.owner)
            {
                hashSet.Add(this.owner);
                teamIndex = TeamComponent.GetObjectTeam(this.owner);
            }
            for (int i = this.pointsList.Count - 2; i >= 0; i--)
            {
                Vector3      position  = this.pointsList[i].position;
                Vector3      direction = position - vector;
                RaycastHit[] array     = Physics.SphereCastAll(new Ray(vector, direction), this.radius, direction.magnitude, LayerIndex.entityPrecise.mask, QueryTriggerInteraction.UseGlobal);
                for (int j = 0; j < array.Length; j++)
                {
                    Collider collider = array[j].collider;
                    if (collider.gameObject)
                    {
                        HurtBox component = collider.GetComponent <HurtBox>();
                        if (component)
                        {
                            HealthComponent healthComponent = component.healthComponent;
                            if (healthComponent)
                            {
                                GameObject gameObject = healthComponent.gameObject;
                                if (!hashSet.Contains(gameObject))
                                {
                                    hashSet.Add(gameObject);
                                    if (TeamComponent.GetObjectTeam(gameObject) != teamIndex)
                                    {
                                        healthComponent.TakeDamage(new DamageInfo
                                        {
                                            position         = array[j].point,
                                            attacker         = this.owner,
                                            inflictor        = base.gameObject,
                                            crit             = false,
                                            damage           = damage,
                                            damageColorIndex = DamageColorIndex.Item,
                                            damageType       = DamageType.Generic,
                                            force            = Vector3.zero,
                                            procCoefficient  = 0f
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
                vector = position;
            }
        }
Exemple #7
0
 // Token: 0x06000BBC RID: 3004 RVA: 0x000395E8 File Offset: 0x000377E8
 private void OnTriggerStay(Collider other)
 {
     if (NetworkServer.active && this.alive && TeamComponent.GetObjectTeam(other.gameObject) == this.teamFilter.teamIndex)
     {
         CharacterBody component = other.GetComponent <CharacterBody>();
         if (component)
         {
             component.AddTimedBuff(this.buffIndex, this.buffDuration);
             UnityEngine.Object.Instantiate <GameObject>(this.pickupEffect, other.transform.position, Quaternion.identity);
             UnityEngine.Object.Destroy(this.baseObject);
         }
     }
 }
 // Token: 0x06000B1E RID: 2846 RVA: 0x0003738C File Offset: 0x0003558C
 private void OnTriggerStay(Collider other)
 {
     if (NetworkServer.active && this.alive && TeamComponent.GetObjectTeam(other.gameObject) == this.teamFilter.teamIndex)
     {
         SkillLocator component = other.GetComponent <SkillLocator>();
         if (component)
         {
             this.alive = false;
             component.ApplyAmmoPack();
             EffectManager.instance.SimpleEffect(this.pickupEffect, base.transform.position, Quaternion.identity, true);
             UnityEngine.Object.Destroy(this.baseObject);
         }
     }
 }
 // Token: 0x06000E84 RID: 3716 RVA: 0x00040728 File Offset: 0x0003E928
 private void OnTriggerStay(Collider other)
 {
     if (NetworkServer.active && this.alive)
     {
         TeamIndex objectTeam = TeamComponent.GetObjectTeam(other.gameObject);
         if (objectTeam == this.teamFilter.teamIndex)
         {
             this.alive = false;
             Vector3 position = base.transform.position;
             TeamManager.instance.GiveTeamMoney(objectTeam, (uint)this.goldReward);
             if (this.pickupEffectPrefab)
             {
                 EffectManager.SimpleEffect(this.pickupEffectPrefab, position, Quaternion.identity, true);
             }
             UnityEngine.Object.Destroy(this.baseObject);
         }
     }
 }
        // Token: 0x06000AEB RID: 2795 RVA: 0x00030364 File Offset: 0x0002E564
        private void FixedUpdate()
        {
            this.timer += Time.fixedDeltaTime;
            CharacterBody characterBody = null;
            float         num           = 0f;

            if (this.owner)
            {
                characterBody             = this.owner.GetComponent <CharacterBody>();
                num                       = (characterBody ? Mathf.Lerp(characterBody.radius * 0.5f, characterBody.radius * 6f, 1f - Mathf.Abs(-1f + 2f * this.timer / 8f)) : 0f);
                base.transform.position   = this.owner.transform.position;
                base.transform.localScale = new Vector3(num, num, num);
            }
            if (NetworkServer.active)
            {
                if (!this.owner)
                {
                    UnityEngine.Object.Destroy(base.gameObject);
                    return;
                }
                this.attackStopwatch += Time.fixedDeltaTime;
                if (characterBody && this.attackStopwatch >= 0.25f)
                {
                    this.attackStopwatch = 0f;
                    BlastAttack blastAttack = new BlastAttack();
                    blastAttack.attacker        = this.owner;
                    blastAttack.inflictor       = base.gameObject;
                    blastAttack.teamIndex       = TeamComponent.GetObjectTeam(blastAttack.attacker);
                    blastAttack.position        = base.transform.position;
                    blastAttack.procCoefficient = 0.1f;
                    blastAttack.radius          = num;
                    blastAttack.baseForce       = 0f;
                    blastAttack.baseDamage      = 1f * characterBody.damage;
                    blastAttack.bonusForce      = Vector3.zero;
                    blastAttack.crit            = false;
                    blastAttack.damageType      = DamageType.Generic;
                    blastAttack.Fire();
                }
                if (this.timer >= 8f)
                {
                    UnityEngine.Object.Destroy(base.gameObject);
                }
            }
        }
Exemple #11
0
 // Token: 0x0600102C RID: 4140 RVA: 0x000513EC File Offset: 0x0004F5EC
 private void OnTriggerStay(Collider other)
 {
     if (NetworkServer.active && this.alive && TeamComponent.GetObjectTeam(other.gameObject) == this.teamFilter.teamIndex)
     {
         CharacterBody component = other.GetComponent <CharacterBody>();
         if (component)
         {
             HealthComponent healthComponent = component.healthComponent;
             if (healthComponent)
             {
                 component.healthComponent.Heal(this.flatHealing + healthComponent.fullHealth * this.fractionalHealing, default(ProcChainMask), true);
                 EffectManager.instance.SpawnEffect(this.pickupEffect, new EffectData
                 {
                     origin = base.transform.position
                 }, true);
             }
             UnityEngine.Object.Destroy(this.baseObject);
         }
     }
 }
Exemple #12
0
 // Token: 0x060009C7 RID: 2503 RVA: 0x0002AABC File Offset: 0x00028CBC
 private void FixedUpdate()
 {
     if (NetworkServer.active)
     {
         this.refreshTimer -= Time.fixedDeltaTime;
         if (this.refreshTimer <= 0f)
         {
             this.overlapAttack = new OverlapAttack
             {
                 attacker    = base.gameObject,
                 inflictor   = base.gameObject,
                 hitBoxGroup = this.hitBoxGroup,
                 teamIndex   = TeamComponent.GetObjectTeam(base.gameObject)
             };
             this.refreshTimer = this.damageInterval;
         }
         this.overlapAttack.damage        = this.characterBody.damage * this.damagePerSecondCoefficient * this.damageInterval;
         this.overlapAttack.pushAwayForce = this.pushForcePerSecond * this.damageInterval;
         this.overlapAttack.damageType    = this.damageType;
         this.overlapAttack.Fire(null);
     }
 }
        // Token: 0x06000E5F RID: 3679 RVA: 0x00046EA4 File Offset: 0x000450A4
        private void OnKilled(DamageInfo damageInfo)
        {
            CharacterBody component = base.GetComponent <CharacterBody>();

            EffectManager.instance.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/CoinEmitter"), new EffectData
            {
                origin       = base.transform.position,
                genericFloat = this.goldReward,
                scale        = (component ? component.radius : 1f)
            }, true);
            if (damageInfo.attacker)
            {
                TeamComponent component2 = base.GetComponent <TeamComponent>();
                CharacterBody component3 = damageInfo.attacker.GetComponent <CharacterBody>();
                if (component3)
                {
                    CharacterMaster master     = component3.master;
                    TeamIndex       objectTeam = TeamComponent.GetObjectTeam(component3.gameObject);
                    TeamManager.instance.GiveTeamMoney(objectTeam, this.goldReward);
                    float num = 1f;
                    if (component2)
                    {
                        num = 1f + (TeamManager.instance.GetTeamLevel(component2.teamIndex) - 1f) * 0.3f;
                    }
                    ExperienceManager.instance.AwardExperience(base.transform.position, component3.GetComponent <CharacterBody>(), (ulong)((uint)(this.expReward * num)));
                }
                if (this.logUnlockableName != "" && Run.instance.selectedDifficulty > DifficultyIndex.Easy && Run.instance.CanUnlockableBeGrantedThisRun(this.logUnlockableName))
                {
                    CharacterBody component4 = base.GetComponent <CharacterBody>();
                    if (Util.CheckRoll((component4 && component4.isChampion) ? 3f : 1f, component3.master))
                    {
                        GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/LogPickup"), base.transform.position, UnityEngine.Random.rotation);
                        gameObject.GetComponentInChildren <UnlockPickup>().unlockableName = this.logUnlockableName;
                        gameObject.GetComponent <TeamFilter>().teamIndex = TeamIndex.Player;
                        NetworkServer.Spawn(gameObject);
                    }
                }
            }
        }
 // Token: 0x06001014 RID: 4116 RVA: 0x00050B28 File Offset: 0x0004ED28
 public void FixedUpdate()
 {
     if (NetworkServer.active)
     {
         if (this.body)
         {
             this.regenAccumulator += this.body.regen * Time.fixedDeltaTime;
         }
         if (this.regenAccumulator > 1f)
         {
             float num = Mathf.Floor(this.regenAccumulator);
             this.regenAccumulator -= num;
             this.Heal(num, default(ProcChainMask), false);
         }
         if (this.alive && this.regenAccumulator < -1f)
         {
             float num2 = Mathf.Ceil(this.regenAccumulator);
             this.regenAccumulator -= num2;
             this.Networkhealth     = this.health + num2;
             if (this.health <= 0f)
             {
                 this.Suicide(null);
             }
         }
         bool flag = this.shield == this.body.maxShield;
         if (this.body.outOfDanger)
         {
             this.Networkshield = this.shield + this.body.maxShield * 0.5f * Time.fixedDeltaTime;
         }
         this.Networkshield = Mathf.Min(this.shield, this.body.maxShield);
         if (this.shield == this.body.maxShield && !flag)
         {
             Util.PlaySound("Play_item_proc_personal_shield_end", base.gameObject);
         }
         if (this.devilOrbHealPool > 0f)
         {
             this.devilOrbTimer -= Time.fixedDeltaTime;
             if (this.devilOrbTimer <= 0f)
             {
                 this.devilOrbTimer += 0.1f;
                 float scale = 1f;
                 float num3  = this.fullCombinedHealth / 10f;
                 float num4  = 2.5f;
                 this.devilOrbHealPool -= num3;
                 DevilOrb devilOrb = new DevilOrb();
                 devilOrb.origin           = this.body.aimOriginTransform.position;
                 devilOrb.damageValue      = num3 * num4;
                 devilOrb.teamIndex        = TeamComponent.GetObjectTeam(base.gameObject);
                 devilOrb.attacker         = base.gameObject;
                 devilOrb.damageColorIndex = DamageColorIndex.Poison;
                 devilOrb.scale            = scale;
                 devilOrb.procChainMask.AddProc(ProcType.HealNova);
                 HurtBox hurtBox = devilOrb.PickNextTarget(devilOrb.origin, 40f);
                 if (hurtBox)
                 {
                     devilOrb.target = hurtBox;
                     devilOrb.isCrit = Util.CheckRoll(this.body.crit, this.body.master);
                     OrbManager.instance.AddOrb(devilOrb);
                 }
             }
         }
     }
     if (this.combatHealthbarTransform)
     {
         this.combatHealthTimer -= Time.fixedDeltaTime;
         if (this.combatHealthTimer <= 0f || !this.alive || this.body.HasBuff(BuffIndex.Cloak))
         {
             this.combatHealthTimer = 0f;
             UnityEngine.Object.Destroy(this.combatHealthbarTransform.gameObject);
         }
     }
     if (!this.alive && this.wasAlive)
     {
         this.wasAlive = false;
         base.BroadcastMessage("OnDeath", null, SendMessageOptions.DontRequireReceiver);
     }
 }
 // Token: 0x060010A6 RID: 4262 RVA: 0x00052F28 File Offset: 0x00051128
 private void FixedUpdate()
 {
     if (this.cachedOwnerInfo.gameObject != this.owner)
     {
         this.cachedOwnerInfo = new IcicleAuraController.OwnerInfo(this.owner);
     }
     this.UpdateRadius();
     this.UpdatePosition();
     if (NetworkServer.active)
     {
         if (!this.owner)
         {
             UnityEngine.Object.Destroy(base.gameObject);
             return;
         }
         for (int i = this.icicleLifetimes.Count - 1; i >= 0; i--)
         {
             List <float> list  = this.icicleLifetimes;
             int          index = i;
             list[index] -= Time.fixedDeltaTime;
             if (this.icicleLifetimes[i] <= 0f)
             {
                 this.icicleLifetimes.RemoveAt(i);
             }
         }
         this.NetworkfinalIcicleCount = Mathf.Min((this.icicleLifetimes.Count > 0) ? (2 + this.icicleLifetimes.Count) : 0, 5);
         this.attackStopwatch        += Time.fixedDeltaTime;
     }
     if (this.cachedOwnerInfo.characterBody)
     {
         if (this.finalIcicleCount > 0)
         {
             if (this.lastIcicleCount == 0)
             {
                 this.OnIciclesActivated();
             }
             if (this.lastIcicleCount < this.finalIcicleCount)
             {
                 this.OnIcicleGained();
             }
         }
         else if (this.lastIcicleCount > 0)
         {
             this.OnIciclesDeactivated();
         }
         this.lastIcicleCount = this.finalIcicleCount;
     }
     if (NetworkServer.active && this.cachedOwnerInfo.characterBody && this.finalIcicleCount > 0)
     {
         float num = 0f;
         if (this.cachedOwnerInfo.characterBody.inventory)
         {
             num = 0.5f + 0.5f * (float)this.cachedOwnerInfo.characterBody.inventory.GetItemCount(ItemIndex.Icicle);
         }
         if (this.attackStopwatch >= 0.25f)
         {
             this.attackStopwatch = 0f;
             BlastAttack blastAttack = new BlastAttack();
             blastAttack.attacker         = this.owner;
             blastAttack.inflictor        = base.gameObject;
             blastAttack.teamIndex        = TeamComponent.GetObjectTeam(blastAttack.attacker);
             blastAttack.position         = this.transform.position;
             blastAttack.procCoefficient  = 0.05f;
             blastAttack.radius           = this.actualRadius;
             blastAttack.baseForce        = 0f;
             blastAttack.baseDamage       = num * 0.25f * this.cachedOwnerInfo.characterBody.damage * (float)this.finalIcicleCount;
             blastAttack.bonusForce       = Vector3.zero;
             blastAttack.crit             = false;
             blastAttack.damageType       = DamageType.Generic;
             blastAttack.falloffModel     = BlastAttack.FalloffModel.None;
             blastAttack.damageColorIndex = DamageColorIndex.Item;
             blastAttack.Fire();
         }
     }
 }
        // Token: 0x060017BB RID: 6075 RVA: 0x00066F64 File Offset: 0x00065164
        public CharacterMaster Perform()
        {
            TeamIndex teamIndex;

            if (this.teamIndexOverride != null)
            {
                teamIndex = this.teamIndexOverride.Value;
            }
            else
            {
                if (!this.summonerBodyObject)
                {
                    Debug.LogErrorFormat("Cannot spawn master {0}: No team specified.", new object[]
                    {
                        this.masterPrefab
                    });
                    return(null);
                }
                teamIndex = TeamComponent.GetObjectTeam(this.summonerBodyObject);
            }
            if (!this.ignoreTeamMemberLimit)
            {
                TeamDef teamDef = TeamCatalog.GetTeamDef(teamIndex);
                if (teamDef == null)
                {
                    Debug.LogErrorFormat("Attempting to spawn master {0} on TeamIndex.None. Is this intentional?", new object[]
                    {
                        this.masterPrefab
                    });
                    return(null);
                }
                if (teamDef != null && teamDef.softCharacterLimit <= TeamComponent.GetTeamMembers(teamIndex).Count)
                {
                    return(null);
                }
            }
            CharacterBody   characterBody   = null;
            CharacterMaster characterMaster = null;

            if (this.summonerBodyObject)
            {
                characterBody = this.summonerBodyObject.GetComponent <CharacterBody>();
            }
            if (characterBody)
            {
                characterMaster = characterBody.master;
            }
            GameObject      gameObject = UnityEngine.Object.Instantiate <GameObject>(this.masterPrefab, this.position, this.rotation);
            CharacterMaster component  = gameObject.GetComponent <CharacterMaster>();

            component.teamIndex = teamIndex;
            if (this.loadout != null)
            {
                component.SetLoadoutServer(this.loadout);
            }
            CharacterMaster characterMaster2 = characterMaster;

            if (characterMaster2 && characterMaster2.minionOwnership.ownerMaster)
            {
                characterMaster2 = characterMaster2.minionOwnership.ownerMaster;
            }
            component.minionOwnership.SetOwner(characterMaster2);
            if (this.summonerBodyObject)
            {
                AIOwnership component2 = gameObject.GetComponent <AIOwnership>();
                if (component2)
                {
                    if (characterMaster)
                    {
                        component2.ownerMaster = characterMaster;
                    }
                    CharacterBody component3 = this.summonerBodyObject.GetComponent <CharacterBody>();
                    if (component3)
                    {
                        CharacterMaster master = component3.master;
                        if (master)
                        {
                            component2.ownerMaster = master;
                        }
                    }
                }
                BaseAI component4 = gameObject.GetComponent <BaseAI>();
                if (component4)
                {
                    component4.leader.gameObject = this.summonerBodyObject;
                }
            }
            Action <CharacterMaster> action = this.preSpawnSetupCallback;

            if (action != null)
            {
                action(component);
            }
            NetworkServer.Spawn(gameObject);
            component.Respawn(this.position, this.rotation, false);
            return(component);
        }