示例#1
0
 // Aetherium: https://github.com/KomradeSpectre/AetheriumMod/blob/6f35f9d8c57f4b7fa14375f620518e7c904c8287/Aetherium/Items/AccursedPotion.cs#L344-L358
 public static void AddBuffAndDot(BuffDef buff, float duration, int stackCount, RoR2.CharacterBody body)
 {
     RoR2.DotController.DotIndex index = (RoR2.DotController.DotIndex)Array.FindIndex(RoR2.DotController.dotDefs, (dotDef) => dotDef.associatedBuff == buff);
     for (int y = 0; y < stackCount; y++)
     {
         if (index != RoR2.DotController.DotIndex.None)
         {
             RoR2.DotController.InflictDot(body.gameObject, body.gameObject, index, duration, 0.25f);
         }
         else
         {
             body.AddTimedBuffAuthority(buff.buffIndex, duration);
         }
     }
 }
        /// <summary>
        /// Finds the associated DotController from a buff, if applicable.
        /// </summary>
        /// <param name="buff">The buff to check all dots against.</param>
        /// <returns>A dotindex of the DotController the target buff is associated with, else, it will return an invalid index.</returns>
        public static DotController.DotIndex FindAssociatedDotForBuff(BuffDef buff)
        {
            RoR2.DotController.DotIndex index = (RoR2.DotController.DotIndex)Array.FindIndex(RoR2.DotController.dotDefs, (dotDef) => dotDef.associatedBuff == buff);

            return(index);
        }