Beispiel #1
0
 internal BuffMessage(CharacterBody body, BuffIndex buff, Int32 stacks, Single duration)
 {
     this.body     = body;
     this.buff     = buff;
     this.stacks   = stacks;
     this.duration = duration;
 }
 public TimedBuffMessage(NetworkInstanceId targetId, BuffIndex buffIndex, int stacks, float duration)
 {
     this.targetId  = targetId;
     this.buffIndex = buffIndex;
     this.stacks    = stacks;
     this.duration  = duration;
 }
Beispiel #3
0
        public DamageInfo CalculateNewDamage(DamageInfo damageInfo)
        {
            //TODO: Replace the curseCount with a buff that can be displayed to user
            damageInfo.damage *= 1 + (curseMultiplier * curseCount);

            CharacterBody testBody = null;

            if (damageInfo.attacker)
            {
                testBody = damageInfo.attacker.GetComponent <CharacterBody>();
            }
            else if (damageInfo.inflictor)
            {
                testBody = damageInfo.inflictor.GetComponent <CharacterBody>();
            }

            //Try and capture the affix type of the attacker/inflictor
            foreach (AffixTracker tracker in affixTrackers)
            {
                //Set the curse flag if its a match
                if (testBody && testBody.isElite && testBody.HasBuff(tracker.buffIndex))
                {
                    mostRecentAttackIndex = tracker.buffIndex;
                    //Chat.AddMessage("Most Recent Damage Type Was : " + tracker.affixNameTag);
                    break;
                }
            }
            return(damageInfo);
        }
Beispiel #4
0
 public Imprint()
 {
     onAttrib += (tokenIdent, namePrefix) => {
         var attackBuffDef = new R2API.CustomBuff(new BuffDef {
             buffColor = Color.red,
             canStack  = false,
             isDebuff  = false,
             name      = namePrefix + "ImprintAttack",
             iconPath  = "@ClassicItems:Assets/ClassicItems/icons/Imprint_icon.png"
         });
         attackBuff = R2API.BuffAPI.Add(attackBuffDef);
         var speedBuffDef = new R2API.CustomBuff(new BuffDef {
             buffColor = Color.cyan,
             canStack  = false,
             isDebuff  = false,
             name      = namePrefix + "ImprintSpeed",
             iconPath  = "@ClassicItems:Assets/ClassicItems/icons/Imprint_icon.png"
         });
         speedBuff = R2API.BuffAPI.Add(speedBuffDef);
         var healBuffDef = new R2API.CustomBuff(new BuffDef {
             buffColor = Color.green,
             canStack  = false,
             isDebuff  = false,
             name      = namePrefix + "ImprintHeal",
             iconPath  = "@ClassicItems:Assets/ClassicItems/icons/Imprint_icon.png"
         });
         healBuff = R2API.BuffAPI.Add(healBuffDef);
     };
 }
        public override void SetupAttributes()
        {
            base.SetupAttributes();

            var markDebuffDef = new CustomBuff(new BuffDef {
                buffColor = Color.yellow,
                canStack  = false,
                isDebuff  = true,
                name      = modInfo.shortIdentifier + "HitListDebuff",
                iconPath  = "@ClassicItems:Assets/ClassicItems/icons/hitlist_debuff_icon.png"
            });

            markDebuff = BuffAPI.Add(markDebuffDef);

            var tallyBuffDef = new CustomBuff(new BuffDef {
                buffColor = Color.yellow,
                canStack  = true,
                isDebuff  = false,
                name      = modInfo.shortIdentifier + "HitListBuff",
                iconPath  = "@ClassicItems:Assets/ClassicItems/icons/hitlist_buff_icon.png"
            });

            tallyBuff = BuffAPI.Add(tallyBuffDef);

            var hitListTallyDef = new CustomItem(new ItemDef {
                hidden    = true,
                name      = modInfo.shortIdentifier + "INTERNALTally",
                tier      = ItemTier.NoTier,
                canRemove = false
            }, new ItemDisplayRuleDict(null));

            hitListTally = ItemAPI.Add(hitListTallyDef);
        }
Beispiel #6
0
        public HitList()
        {
            onAttrib += (tokenIdent, namePrefix) => {
                var markDebuffDef = new CustomBuff(new BuffDef {
                    buffColor = Color.yellow,
                    canStack  = false,
                    isDebuff  = true,
                    name      = namePrefix + "HitListDebuff",
                    iconPath  = "@ClassicItems:Assets/ClassicItems/icons/hitlist_debuff_icon.png"
                });
                markDebuff = BuffAPI.Add(markDebuffDef);

                var tallyBuffDef = new CustomBuff(new BuffDef {
                    buffColor = Color.yellow,
                    canStack  = true,
                    isDebuff  = false,
                    name      = namePrefix + "HitListBuff",
                    iconPath  = "@ClassicItems:Assets/ClassicItems/icons/hitlist_buff_icon.png"
                });
                tallyBuff = BuffAPI.Add(tallyBuffDef);

                var hitListTallyDef = new CustomItem(new ItemDef {
                    hidden    = true,
                    name      = namePrefix + "INTERNALTally",
                    tier      = ItemTier.NoTier,
                    canRemove = false
                }, new ItemDisplayRuleDict(null));
                hitListTally = ItemAPI.Add(hitListTallyDef);
            };
        }
Beispiel #7
0
            static void ReturnBuffList(CharacterBody body, ref string buffList, ref string debuffList)
            {
                BuffIndex buffIndex = (BuffIndex)0;
                BuffIndex buffCount = (BuffIndex)BuffCatalog.buffCount;

                while (buffIndex < buffCount)
                {
                    int  buffCount2 = body.GetBuffCount(buffIndex);
                    bool flag3      = buffCount2 > 0;
                    if (flag3)
                    {
                        BuffDef buffDef  = BuffCatalog.GetBuffDef(buffIndex);
                        string  @string  = Language.GetString(buffDef.name);
                        string  text5    = @string ?? "";
                        bool    canStack = buffDef.canStack;
                        if (canStack)
                        {
                            text5 += string.Format(" ({0})", buffCount2);
                        }
                        text5 += ", ";
                        bool isDebuff = buffDef.isDebuff;
                        if (isDebuff)
                        {
                            debuffList += text5;
                        }
                        else
                        {
                            buffList += text5;
                        }
                    }
                    buffIndex++;
                }
            }
Beispiel #8
0
 public Range(double lower, double upper, BuffIndex buff, int duration)
 {
     Lower    = lower;
     Upper    = upper;
     Buff     = buff;
     Duration = duration;
 }
Beispiel #9
0
        internal StaticCharge()
        {
            On.RoR2.HealthComponent.TakeDamage     += hook_HealthComponent_TakeDamage;
            On.RoR2.CharacterBody.RecalculateStats += hook_CharacterBody_RecalculateStats;

            var itemTemplate = new ItemTemplate();

            itemTemplate.name            = "Static Charge";
            itemTemplate.tier            = ItemTier.Tier2;
            itemTemplate.internalName    = "STATIC_CHARGE";
            itemTemplate.pickupText      = "Your critical strikes build up static charge to shock the next enemy to attack you.";
            itemTemplate.descriptionText = "Gain <style=cIsDamage>5% critical chance</style>. <style=cIsDamage>Critical strikes</style> grant you a stack of <style=cIsDamage>static charge</style>. The next time you are attacked, <style=cIsUtility>shock</style> the attacker, dealing <style=cIsDamage>5% <style=cStack>(+5% per stack)</style> damage</style> for each stack of <style=cIsDamage>static charge</style>.";
            itemTemplate.loreText        = "I can feel a buzz in the air... Don't get to close to me... ";

            Init(itemTemplate);

            var buffDef = new BuffDef()
            {
                name     = "Static Charge",
                iconPath = this.IconPath,
                isDebuff = false,
                canStack = true,
            };

            buffIndex = BuffAPI.Add(new CustomBuff(buffDef));
        }
Beispiel #10
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();
            var attackBuffDef = new R2API.CustomBuff(new BuffDef {
                buffColor = Color.red,
                canStack  = false,
                isDebuff  = false,
                name      = modInfo.shortIdentifier + "ImprintAttack",
                iconPath  = "@ClassicItems:Assets/ClassicItems/icons/Imprint_icon.png"
            });

            attackBuff = R2API.BuffAPI.Add(attackBuffDef);
            var speedBuffDef = new R2API.CustomBuff(new BuffDef {
                buffColor = Color.cyan,
                canStack  = false,
                isDebuff  = false,
                name      = modInfo.shortIdentifier + "ImprintSpeed",
                iconPath  = "@ClassicItems:Assets/ClassicItems/icons/Imprint_icon.png"
            });

            speedBuff = R2API.BuffAPI.Add(speedBuffDef);
            var healBuffDef = new R2API.CustomBuff(new BuffDef {
                buffColor = Color.green,
                canStack  = false,
                isDebuff  = false,
                name      = modInfo.shortIdentifier + "ImprintHeal",
                iconPath  = "@ClassicItems:Assets/ClassicItems/icons/Imprint_icon.png"
            });

            healBuff = R2API.BuffAPI.Add(healBuffDef);
        }
        public override void SetupAttributes()
        {
            if (ItemBodyModelPrefab == null)
            {
                ItemBodyModelPrefab = Resources.Load <GameObject>(modelResourcePath);
                var meshes = ItemBodyModelPrefab.GetComponentsInChildren <MeshRenderer>();
                meshes[2].material.SetFloat("_FillAmount", 0.28f);
                var wobble = meshes[2].gameObject.AddComponent <Wobble>();
                wobble.MaxWobble = 0.02f;
                displayRules     = GenerateItemDisplayRules();
            }

            base.SetupAttributes();
            var sipCooldownDebuff = new R2API.CustomBuff(
                new RoR2.BuffDef
            {
                buffColor = new Color(50, 0, 50),
                canStack  = false,
                isDebuff  = false,
                name      = "ATHRMAccursed Potion Sip Cooldown",
                iconPath  = "@Aetherium:Assets/Textures/Icons/AccursedPotionSipCooldownDebuffIcon.png"
            });

            AccursedPotionSipCooldownDebuff = R2API.BuffAPI.Add(sipCooldownDebuff);
        }
Beispiel #12
0
        public static void CCRemoveBuff(ConCommandArgs args)
        {
            if (args.Count == 0)
            {
                return;
            }

            string        buffName   = args[0];
            CharacterBody playerBody = string.IsNullOrEmpty(args[1])
                ? args[1].Convert <ulong>().GetNetworkUser()?.GetCurrentBody()
                : args.sender?.GetCurrentBody();

            try
            {
                BuffIndex buff = FindBuff(buffName);
                if (playerBody && buff != BuffIndex.None)
                {
                    playerBody.RemoveBuff(buff);
                }
                else if (!playerBody)
                {
                    throw new Exception("Invalid body");
                }
                else if (buff == BuffIndex.None)
                {
                    throw new Exception($"Invalid buff '{buffName}'");
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
            }
        }
Beispiel #13
0
        public static void CCGiveBuff(ConCommandArgs args)
        {
            if (args.Count == 0)
            {
                return;
            }

            string buffName = args[0];

            try
            {
                var       userBody = args.sender?.GetCurrentBody();
                BuffIndex buff     = FindBuff(buffName);
                if (userBody && buff != BuffIndex.None)
                {
                    userBody.AddBuff(buff);
                }
                else if (!userBody)
                {
                    throw new Exception("Invalid body");
                }
                else if (buff == BuffIndex.None)
                {
                    throw new Exception($"Invalid buff '{buffName}'");
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
            }
        }
Beispiel #14
0
            public override void Begin()
            {
                this.b = Main.RW_curseBurn;

                this.hitDetection = TriggerCallbackController.CreateSphere(this.blazeRadius, base.origin, true, LayerIndex.projectile);
                this.hitDetection.onTriggerEnter += this.ColliderEnter;
                this.hitDetection.onTriggerExit  += this.ColliderExit;

                this.duration = this.blazeTime;

                this.isActive = true;

                Vector3 tangent = Vector3.forward;

                Vector3.OrthoNormalize(ref this.normal, ref tangent);

                EffectData effectData = new EffectData
                {
                    origin       = base.origin,
                    genericFloat = base.duration,
                    rotation     = Quaternion.identity,
                    scale        = this.blazeRadius * 2f,
                    genericUInt  = this.skin,
                };

                EffectManager.SpawnEffect(Main.utilityIndicator, effectData, true);

                this.blazeResetInt = 1f / this.blazeFreq;
                this.bundleSendInt = 1f / this.blazeOrbBundleSendFreq;

                this.attackerBody = this.attacker.GetComponent <CharacterBody>();
                this.attackerBox  = this.attackerBody.mainHurtBox;
            }
 public void Deserialize(NetworkReader reader)
 {
     this.targetId  = reader.ReadNetworkId();
     this.buffIndex = reader.ReadBuffIndex();
     this.stacks    = reader.ReadInt32();
     this.duration  = reader.ReadSingle();
 }
        public void Init(MonsterVariantInfo variantInfo)
        {
            this.overrideName = variantInfo.overrideName;

            this.spawnRate = variantInfo.spawnRate;
            this.unique    = variantInfo.unique;

            this.tier       = variantInfo.variantTier;
            this.aiModifier = variantInfo.aiModifier;

            this.customInventory = variantInfo.customInventory;

            this.healthModifier      = variantInfo.healthMultiplier;
            this.moveSpeedModifier   = variantInfo.moveSpeedMultiplier;
            this.attackSpeedModifier = variantInfo.attackSpeedMultiplier;
            this.damageModifier      = variantInfo.damageMultiplier;
            this.armorModifier       = variantInfo.armorMultiplier;
            this.armorBonus          = variantInfo.armorBonus;

            this.meshReplacements     = variantInfo.meshReplacement;
            this.materialReplacements = variantInfo.materialReplacement;
            this.skillReplacements    = variantInfo.skillReplacement;
            this.sizeModifier         = variantInfo.sizeModifier;

            this.buff = variantInfo.buff;
        }
Beispiel #17
0
        public void CreateElite()
        {
            var eliteDef = new RoR2.EliteDef
            {
                name                = "Hypercharged",
                modifierToken       = "ARES_HYPERCHARGED",
                color               = Color.white,
                eliteEquipmentIndex = AffixEquipmentIndex
            };

            EliteIndex = EliteAPI.Add(new CustomElite(eliteDef, 2));
            LanguageAPI.Add(eliteDef.modifierToken, eliteDef.name + " {0}");

            EliteBuffDef.eliteIndex       = EliteIndex;
            EliteBuffIndex                = BuffAPI.Add(new CustomBuff(EliteBuffDef));
            AffixEquipmentDef.passiveBuff = EliteBuffIndex;

            EliteAffixCard = new EliteAffixCard
            {
                spawnWeight      = 0.5f,
                costMultiplier   = 30.0f,
                damageBoostCoeff = 2.0f,
                healthBoostCoeff = 4.5f,
                eliteOnlyScaling = 0.5f,
                eliteType        = EliteIndex
            };
            EsoLib.Cards.Add(EliteAffixCard);
        }
Beispiel #18
0
            public override void OnEnter()
            {
                base.OnEnter();

                Main.instance.RW_BlockSprintCrosshair.Add(base.characterBody);

                this.armorBuff = Main.RW_armorBuff;
                this.passive   = this.gameObject.GetComponent <WispPassiveController>();
                this.skin      = this.characterBody.skinIndex;
                this.aimAnim   = this.GetComponent <WispAimAnimationController>();

                this.minDuration  = baseMinDuration / this.attackSpeedStat;
                this.fireInterval = 1f / baseTickFreq;

                RoR2.Util.PlayScaledSound("Play_titanboss_R_laser_loop", this.gameObject, 0.5f);

                this.muzzle = this.GetModelTransform().Find("CannonPivot").Find("BeamParent");

                this.beamEffect = UnityEngine.Object.Instantiate <GameObject>(Main.specialBeam, this.muzzle.position, this.muzzle.rotation);
                this.beamEffect.GetComponent <BitSkinController>().Apply(WispBitSkin.GetWispSkin(this.skin));
                this.beamEffect.transform.parent = this.muzzle;
                this.beamEnd = this.beamEffect.transform.Find("End");
                //this.beamEndSub = this.beamEnd.Find( "Sub" );
                //this.beamEndSub.gameObject.SetActive( false );
                //Create the charge and beam effects
                this.pos = Vector3.zero;

                this.team = TeamComponent.GetObjectTeam(this.gameObject);

                this.characterBody.AddBuff(this.armorBuff);

                this.cameraTargetParams.idealLocalCameraPos = this.camPos1;
                this.characterMotor.useGravity = false;
            }
Beispiel #19
0
        // Token: 0x060021E3 RID: 8675 RVA: 0x00092614 File Offset: 0x00090814
        private void AllocateIcons()
        {
            int num = 0;

            if (this.source)
            {
                BuffIndex buffIndex = BuffIndex.Slow50;
                BuffIndex buffCount = (BuffIndex)BuffCatalog.buffCount;
                while (buffIndex < buffCount)
                {
                    if (this.source.HasBuff(buffIndex))
                    {
                        num++;
                    }
                    buffIndex++;
                }
            }
            if (num != this.buffIcons.Count)
            {
                while (this.buffIcons.Count > num)
                {
                    UnityEngine.Object.Destroy(this.buffIcons[this.buffIcons.Count - 1].gameObject);
                    this.buffIcons.RemoveAt(this.buffIcons.Count - 1);
                }
                while (this.buffIcons.Count < num)
                {
                    BuffIcon component = UnityEngine.Object.Instantiate <GameObject>(this.buffIconPrefab, this.rectTranform).GetComponent <BuffIcon>();
                    this.buffIcons.Add(component);
                }
                this.UpdateLayout();
            }
        }
Beispiel #20
0
        // Token: 0x060021E4 RID: 8676 RVA: 0x000926E8 File Offset: 0x000908E8
        private void UpdateLayout()
        {
            this.AllocateIcons();
            float width = this.rectTranform.rect.width;

            if (this.source)
            {
                Vector2   zero      = Vector2.zero;
                int       num       = 0;
                BuffIndex buffIndex = BuffIndex.Slow50;
                BuffIndex buffCount = (BuffIndex)BuffCatalog.buffCount;
                while (buffIndex < buffCount)
                {
                    if (this.source.HasBuff(buffIndex))
                    {
                        BuffIcon buffIcon = this.buffIcons[num];
                        buffIcon.buffIndex = buffIndex;
                        buffIcon.rectTransform.anchoredPosition = zero;
                        buffIcon.buffCount = this.source.GetBuffCount(buffIndex);
                        zero.x            += this.iconWidth;
                        buffIcon.UpdateIcon();
                        num++;
                    }
                    buffIndex++;
                }
            }
        }
Beispiel #21
0
        public static void ApplyBuff(this CharacterBody body,
                                     BuffIndex buff, int stacks = 1, float duration = -1f)
        {
            if (NetworkServer.active)
            {
                if (duration < 0f)
                {
                    body.SetBuffCount(buff, stacks);
                }
                else
                {
                    if (stacks < 0)
                    {
                        R2API.Logger.LogError("Cannot remove duration from a buff");
                        return;
                    }

                    for (int i = 0; i < stacks; ++i)
                    {
                        body.AddTimedBuff(buff, duration);
                    }
                }
            }
            else
            {
                new BuffMessage(body, buff, stacks, duration)
                .Send(NetworkDestination.Server);
            }
        }
Beispiel #22
0
 internal BuffMessage(CharacterBody body, BuffIndex buff, int stacks, float duration)
 {
     _body     = body;
     _buff     = buff;
     _stacks   = stacks;
     _duration = duration;
 }
Beispiel #23
0
 public static void _SetBuffCount(this CharacterBody body, BuffIndex buff, Int32 count)
 {
     if (NetworkServer.active)
     {
         body.SetBuffCount(buff, count);
     }
 }
Beispiel #24
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();

            var freezeStackDebuff = new CustomBuff(
                new BuffDef
            {
                name      = "Freezing",
                buffColor = new Color(10, 125, 125),
                canStack  = true,
                isDebuff  = true,
            });

            GungeonFreezeStackDebuff = BuffAPI.Add(freezeStackDebuff);

            var frozenDebuff = new CustomBuff(
                new BuffDef
            {
                name      = "Frozen!",
                buffColor = new Color(10, 255, 255),
                canStack  = false,
                isDebuff  = true,
            });

            GungeonFrozenDebuff = BuffAPI.Add(frozenDebuff);
        }
        public override void SetupAttributes()
        {
            if (ItemBodyModelPrefab == null)
            {
                ItemBodyModelPrefab = Resources.Load <GameObject>(modelResourcePath);
                displayRules        = GenerateItemDisplayRules();
            }

            base.SetupAttributes();
            var secondWindBuff = new R2API.CustomBuff(
                new BuffDef
            {
                canStack = false,
                isDebuff = false,
                name     = "SecondWindBuff",
                iconPath = "@SupplyDrop:Assets/Main/Textures/Icons/SecondWindBuffIcon.png"
            });

            SecondWindBuff = BuffAPI.Add(secondWindBuff);

            var windedDebuff = new R2API.CustomBuff(
                new BuffDef
            {
                canStack = false,
                isDebuff = true,
                name     = "WindedDebuff",
                iconPath = "@SupplyDrop:Assets/Main/Textures/Icons/WindedDebuffIcon.png"
            });

            WindedDebuff = BuffAPI.Add(windedDebuff);
        }
Beispiel #26
0
        public UnassumingTie()
        {
            modelPathName = "@SupplyDrop:Assets/Main/Models/Prefabs/TiePickUp.prefab";

            iconPathName = "@SupplyDrop:Assets/Main/Textures/Icons/TieIcon.png";

            onAttrib += (tokenIdent, namePrefix) =>
            {
                var secondWindBuff = new R2API.CustomBuff(
                    new BuffDef
                {
                    canStack = false,
                    isDebuff = false,
                    name     = namePrefix + "SecondWindBuff",
                    iconPath = "@SupplyDrop:Assets/Main/Textures/Icons/SecondWindBuffIcon.png"
                });
                SecondWindBuff = R2API.BuffAPI.Add(secondWindBuff);

                var windedDebuff = new R2API.CustomBuff(
                    new BuffDef
                {
                    canStack = false,
                    isDebuff = true,
                    name     = namePrefix + "WindedDebuff",
                    iconPath = "@SupplyDrop:Assets/Main/Textures/Icons/WindedDebuffIcon.png"
                });
                WindedDebuff = R2API.BuffAPI.Add(windedDebuff);
            };
        }
Beispiel #27
0
        public static void ApplyBuff(this CharacterBody body, BuffIndex buff, Int32 stacks = 1, Single duration = -1f)
        {
            if (NetworkServer.active)
            {
                if (duration < 0f)
                {
                    body.SetBuffCount(buff, body.GetBuffCount(buff) + stacks);
                }
                else
                {
                    if (stacks < 0)
                    {
                        Log.Error("Cannot remove duration from a buff");
                        return;
                    }

                    for (Int32 i = 0; i < stacks; ++i)
                    {
                        body.AddTimedBuff(buff, duration);
                    }
                }
            }
            else
            {
                new BuffMessage(body, buff, stacks, duration).Send(NetworkDestination.Server);
            }
        }
 // Token: 0x0600298F RID: 10639 RVA: 0x000AF1CE File Offset: 0x000AD3CE
 public int GetBuffCount(BuffIndex buffType)
 {
     if (!base.characterBody)
     {
         return(0);
     }
     return(base.characterBody.GetBuffCount(buffType));
 }
Beispiel #29
0
 // Token: 0x06000A36 RID: 2614 RVA: 0x000083C4 File Offset: 0x000065C4
 public static BuffDef GetBuffDef(BuffIndex buffIndex)
 {
     if (buffIndex < BuffIndex.Slow50 || buffIndex > BuffIndex.Count)
     {
         return(null);
     }
     return(BuffCatalog.buffDefs[(int)buffIndex]);
 }
Beispiel #30
0
            public override void Deserialize(NetworkReader reader)
            {
                // buff
                buff = (BuffIndex)Enum.Parse(typeof(BuffIndex), reader.ReadString());

                buffDuration = reader.ReadSingle();
                body         = reader.ReadGameObject().GetComponent <CharacterBody>();
            }