Beispiel #1
0
 // Token: 0x0600051D RID: 1309 RVA: 0x0001476B File Offset: 0x0001296B
 public static Color FindColor(DamageColorIndex colorIndex)
 {
     if (colorIndex < DamageColorIndex.Default || colorIndex >= DamageColorIndex.Count)
     {
         return(Color.white);
     }
     return(DamageColor.colors[(int)colorIndex]);
 }
Beispiel #2
0
 private Color AddAdditionalColors(On.RoR2.DamageColor.orig_FindColor orig, DamageColorIndex colorIndex)
 {
     if (colorIndex < DamageColorIndex.Default || colorIndex >= DamageColorIndex.Count)
     {
         int extraValue = colorIndex - DamageColorIndex.Count;
         if (colorIndex >= DamageColorIndex.Count && extraValue <= additionalDamageColors.Length)
         {
             return(additionalDamageColors[extraValue]);
         }
         return(Color.white);
     }
     return(DamageColor.colors[(int)colorIndex]);
 }
Beispiel #3
0
 public static void ShowHealNumbers(DamageNumberManager.orig_SpawnDamageNumber orig,
                                    RoR2.DamageNumberManager self,
                                    float amount,
                                    Vector3 position,
                                    bool crit,
                                    TeamIndex teamIndex,
                                    DamageColorIndex damageColorIndex)
 {
     if (damageColorIndex == DamageColorIndex.Heal || damageColorIndex == DamageColorIndex.CritHeal)
     {
         if (!PlayerConfiguration.ShowHealNumbers.Value)
         {
             return;
         }
     }
     orig(self, amount, position, crit, teamIndex, damageColorIndex);
 }
Beispiel #4
0
        // Token: 0x060009E5 RID: 2533 RVA: 0x0002B160 File Offset: 0x00029360
        public void SetValues(GameObject victim, GameObject attacker, float damage, bool crit, DamageColorIndex damageColorIndex)
        {
            this.victimTeam   = TeamIndex.Neutral;
            this.attackerTeam = TeamIndex.Neutral;
            this.scale        = 1f;
            this.victim       = victim;
            this.attacker     = attacker;
            this.crit         = crit;
            this.baseColor    = DamageColor.FindColor(damageColorIndex);
            string text = Mathf.CeilToInt(Mathf.Abs(damage)).ToString();

            this.heal = (damage < 0f);
            if (this.heal)
            {
                damage = -damage;
                base.transform.parent = victim.transform;
                text                  = "+" + text;
                this.baseColor        = DamageColor.FindColor(DamageColorIndex.Heal);
                this.baseOutlineColor = this.baseColor * Color.gray;
            }
            if (victim)
            {
                TeamComponent component = victim.GetComponent <TeamComponent>();
                if (component)
                {
                    this.victimTeam = component.teamIndex;
                }
            }
            if (attacker)
            {
                TeamComponent component2 = attacker.GetComponent <TeamComponent>();
                if (component2)
                {
                    this.attackerTeam = component2.teamIndex;
                }
            }
            if (crit)
            {
                text += "!";
                this.baseOutlineColor = Color.red;
            }
            this.textMeshComponent.text = text;
            this.UpdateMagnitude();
        }
Beispiel #5
0
 // Token: 0x0600099D RID: 2461 RVA: 0x000309F2 File Offset: 0x0002EBF2
 public static void Write(this NetworkWriter writer, DamageColorIndex damageColorIndex)
 {
     writer.Write((byte)damageColorIndex);
 }
 // Token: 0x060017D8 RID: 6104 RVA: 0x00067B08 File Offset: 0x00065D08
 private static void PerformDamage(GameObject attacker, GameObject inflictor, float damage, bool isCrit, ProcChainMask procChainMask, float procCoefficient, DamageColorIndex damageColorIndex, DamageType damageType, Vector3 forceVector, float pushAwayForce, List <OverlapAttack.OverlapInfo> hitList)
 {
     for (int i = 0; i < hitList.Count; i++)
     {
         OverlapAttack.OverlapInfo overlapInfo = hitList[i];
         if (overlapInfo.hurtBox)
         {
             HealthComponent healthComponent = overlapInfo.hurtBox.healthComponent;
             if (healthComponent)
             {
                 DamageInfo damageInfo = new DamageInfo();
                 damageInfo.attacker         = attacker;
                 damageInfo.inflictor        = inflictor;
                 damageInfo.force            = forceVector + pushAwayForce * overlapInfo.pushDirection;
                 damageInfo.damage           = damage;
                 damageInfo.crit             = isCrit;
                 damageInfo.position         = overlapInfo.hitPosition;
                 damageInfo.procChainMask    = procChainMask;
                 damageInfo.procCoefficient  = procCoefficient;
                 damageInfo.damageColorIndex = damageColorIndex;
                 damageInfo.damageType       = damageType;
                 damageInfo.ModifyDamageInfo(overlapInfo.hurtBox.damageModifier);
                 healthComponent.TakeDamage(damageInfo);
                 GlobalEventManager.instance.OnHitEnemy(damageInfo, healthComponent.gameObject);
                 GlobalEventManager.instance.OnHitAll(damageInfo, healthComponent.gameObject);
             }
         }
     }
 }
Beispiel #7
0
        private void SuperMissileICBMLaunch(Vector3 position, CharacterBody attacker, ProcChainMask procChainMask, GameObject victim, float missileDamage, bool isCrit, GameObject projectilePrefab, DamageColorIndex damageColorIndex)
        {
            Vector3       initialDirection = Vector3.up + UnityEngine.Random.insideUnitSphere * 0.1f;
            float         force            = 200f;
            bool          addMissileProc   = true;
            int           num1             = characterBody.inventory?.GetItemCount(DLC1Content.Items.MoreMissile) ?? 0;
            float         num2             = Mathf.Max(1f, (1 + 0.5f * (num1 - 1)));
            InputBankTest component        = inputBank;
            ProcChainMask procChainMask1   = procChainMask;

            if (addMissileProc)
            {
                procChainMask1.AddProc(ProcType.Missile);
            }
            FireProjectileInfo fireProjectileInfo = new FireProjectileInfo()
            {
                projectilePrefab = projectilePrefab,
                position         = position,
                rotation         = Util.QuaternionSafeLookRotation(gunRay.direction),
                procChainMask    = procChainMask1,
                target           = victim,
                owner            = attacker.gameObject,
                damage           = missileDamage * num2,
                crit             = isCrit,
                force            = force,
                damageColorIndex = damageColorIndex
            };

            ProjectileManager.instance.FireProjectile(fireProjectileInfo);
            if (num1 <= 0)
            {
                return;
            }
            Vector3            axis = component ? component.aimDirection : attacker.transform.position;
            FireProjectileInfo fireProjectileInfo1 = fireProjectileInfo;

            fireProjectileInfo1.rotation         = Util.QuaternionSafeLookRotation(Quaternion.AngleAxis(45f, axis) * initialDirection);
            fireProjectileInfo1.projectilePrefab = sMissileExtraMissiles;
            fireProjectileInfo1.damage           = Modules.StaticValues.missileDamageCoefficient * damageStat;
            FireProjectileInfo fireProjectileInfo2 = fireProjectileInfo;

            fireProjectileInfo2.rotation         = Util.QuaternionSafeLookRotation(Quaternion.AngleAxis(-45f, axis) * initialDirection);
            fireProjectileInfo2.projectilePrefab = sMissileExtraMissiles;
            fireProjectileInfo2.damage           = Modules.StaticValues.missileDamageCoefficient * damageStat;
            ProjectileManager.instance.FireProjectile(fireProjectileInfo1);
            ProjectileManager.instance.FireProjectile(fireProjectileInfo2);
        }
Beispiel #8
0
 private void MissileUtils_FireMissile_MyKingdomForAStruct(On.RoR2.MissileUtils.orig_FireMissile_Vector3_CharacterBody_ProcChainMask_GameObject_float_bool_GameObject_DamageColorIndex_Vector3_float_bool orig, Vector3 position, CharacterBody attackerBody, ProcChainMask procChainMask, GameObject victim, float missileDamage, bool isCrit, GameObject projectilePrefab, DamageColorIndex damageColorIndex, Vector3 initialDirection, float force, bool addMissileProc)
 {
     ignoreMugs = true;
     orig(position, attackerBody, procChainMask, victim, missileDamage, isCrit, projectilePrefab, damageColorIndex, initialDirection, force, addMissileProc);
     ignoreMugs = false;
 }
Beispiel #9
0
 public static string GetDamageColorCode(DamageColorIndex damageColorIndex)
 {
     return("#" + ColorUtility.ToHtmlStringRGB(DamageColor.FindColor(damageColorIndex)));
 }
Beispiel #10
0
        public static string DamageColorize(this string text, DamageColorIndex damageColorIndex)
        {
            string colorCode = GetDamageColorCode(damageColorIndex);

            return($"<color={colorCode}>{text}</color>");
        }
        // Token: 0x060009F1 RID: 2545 RVA: 0x0002B5A8 File Offset: 0x000297A8
        public void SpawnDamageNumber(float amount, Vector3 position, bool crit, TeamIndex teamIndex, DamageColorIndex damageColorIndex)
        {
            Color a = DamageColor.FindColor(damageColorIndex);
            Color b = Color.white;

            if (teamIndex != TeamIndex.None)
            {
                if (teamIndex == TeamIndex.Monster)
                {
                    b = new Color(0.5568628f, 0.29411766f, 0.6039216f);
                }
            }
            else
            {
                b = Color.gray;
            }
            this.ps.Emit(new ParticleSystem.EmitParams
            {
                position             = position,
                startColor           = a * b,
                applyShapeToPosition = true
            }, 1);
            this.ps.GetCustomParticleData(this.customData, ParticleSystemCustomData.Custom1);
            this.customData[this.customData.Count - 1] = new Vector4(1f, 0f, amount, crit ? 1f : 0f);
            this.ps.SetCustomParticleData(this.customData, ParticleSystemCustomData.Custom1);
        }
 public JarBullet(float damage, DamageColorIndex damageColorIndex, DamageType damageType)
 {
     Damage           = damage;
     DamageColorIndex = damageColorIndex;
     DamageType       = damageType;
 }
Beispiel #13
0
        private void Longassname(On.RoR2.Projectile.ProjectileManager.orig_FireProjectile_GameObject_Vector3_Quaternion_GameObject_float_float_bool_DamageColorIndex_GameObject_float orig, RoR2.Projectile.ProjectileManager self, GameObject prefab, Vector3 position, Quaternion rotation, GameObject owner, float damage, float force, bool crit, DamageColorIndex damageColorIndex, GameObject target, float speedOverride)
        {
            var characterBody = owner.GetComponent <CharacterBody>();

            if (prefab.name == PrepWall.projectilePrefab.name && characterBody)
            {
                FireAmmo(characterBody, true);
            }
            orig(self, prefab, position, rotation, owner, damage, force, crit, damageColorIndex, target, speedOverride);
        }
Beispiel #14
0
 public static DotController.DotIndex RegisterDot(float interval, float damageCoef, DamageColorIndex colorIndex, BuffDef associatedBuff, CustomDotAddAction addAction, CustomDotUpdateAction updateAction)
 {
     return(RegisterDot(new DotController.DotDef
     {
         interval = interval,
         damageCoefficient = damageCoef,
         damageColorIndex = colorIndex,
         associatedBuff = associatedBuff
     }, addAction, updateAction));
 }
 private static void PerformDamage(GameObject attacker, GameObject inflictor, float damage, bool isCrit, ProcChainMask procChainMask, float procCoefficient, DamageColorIndex damageColorIndex, DamageType damageType, Vector3 forceVector, float pushAwayForce, float upwardsForce, List <ExtendedOverlapAttack.OverlapInfo> hitList)
 {
     for (int i = 0; i < hitList.Count; i++)
     {
         ExtendedOverlapAttack.OverlapInfo overlapInfo = hitList[i];
         if (overlapInfo.hurtBox)
         {
             HealthComponent healthComponent = overlapInfo.hurtBox.healthComponent;
             if (healthComponent)
             {
                 DamageInfo damageInfo = new DamageInfo();
                 damageInfo.attacker         = attacker;
                 damageInfo.inflictor        = inflictor;
                 damageInfo.force            = forceVector + pushAwayForce * overlapInfo.pushDirection;
                 damageInfo.damage           = damage;
                 damageInfo.crit             = isCrit;
                 damageInfo.position         = overlapInfo.hitPosition;
                 damageInfo.procChainMask    = procChainMask;
                 damageInfo.procCoefficient  = procCoefficient;
                 damageInfo.damageColorIndex = damageColorIndex;
                 damageInfo.damageType       = damageType;
                 if (healthComponent.gameObject.GetComponent <CharacterBody>().isFlying)
                 {
                     damageInfo.force += new Vector3(0f, upwardsForce, 0f);
                 }
                 if (NetworkServer.active)
                 {
                     //We're the server, and we can do whatever the fug we want with damage!
                     damageInfo.ModifyDamageInfo(overlapInfo.hurtBox.damageModifier);
                     healthComponent.TakeDamage(damageInfo);
                     GlobalEventManager.instance.OnHitEnemy(damageInfo, healthComponent.gameObject);
                     GlobalEventManager.instance.OnHitAll(damageInfo, healthComponent.gameObject);
                 }
                 else
                 {
                     if (ClientScene.ready)
                     {
                         //It's the hosts world, and we're just livin' in it.
                         ExtendedOverlapAttack.write.StartMessage(7595);
                         //Use our own cool channel, else, the game will not recongize it.
                         ExtendedOverlapAttack.write.Write(healthComponent.gameObject);
                         ExtendedOverlapAttack.WriteDamageInfo(ExtendedOverlapAttack.write, damageInfo);
                         ExtendedOverlapAttack.write.Write(healthComponent != null);
                         ExtendedOverlapAttack.write.FinishMessage();
                         ClientScene.readyConnection.SendWriter(ExtendedOverlapAttack.write, QosChannelIndex.defaultReliable.intVal);
                         //Always write on the default reliable intVal, for obvious reasons.
                     }
                 }
             }
         }
     }
 }
        public void FireProjectile(GameObject prefab, Vector3 position, Quaternion rotation, GameObject owner, float damage, float force, bool crit, DamageColorIndex damageColorIndex = DamageColorIndex.Default, GameObject target = null, float speedOverride = -1f)
        {
            FireProjectileInfo fireProjectileInfo = new FireProjectileInfo
            {
                projectilePrefab = prefab,
                position         = position,
                rotation         = rotation,
                owner            = owner,
                damage           = damage,
                force            = force,
                crit             = crit,
                damageColorIndex = damageColorIndex,
                target           = target,
                speedOverride    = speedOverride,
                fuseOverride     = -1f
            };

            this.FireProjectile(fireProjectileInfo);
        }