コード例 #1
0
ファイル: ExampleItemMod.cs プロジェクト: Jarlyk/ItemLib
        public static CustomElite TestElite()
        {
            LoadAssets();

            var eliteDef = new EliteDef
            {
                modifierToken = "Cloaky",
                color         = new Color32(255, 105, 180, 255)
            };
            var equipDef = new EquipmentDef
            {
                cooldown         = 10f,
                pickupModelPath  = "",
                pickupIconPath   = "",
                nameToken        = "Cloaky",
                pickupToken      = "Cloaky",
                descriptionToken = "Cloaky",
                canDrop          = false,
                enigmaCompatible = false
            };
            var buffDef = new BuffDef
            {
                buffColor = eliteDef.color,
                canStack  = false
            };

            var equip = new CustomEquipment(equipDef, _prefab, _icon, _itemDisplayRules);
            var buff  = new CustomBuff("Affix_Cloaky", buffDef, null);
            var elite = new CustomElite("Cloaky", eliteDef, equip, buff, 1);

            return(elite);
        }
コード例 #2
0
ファイル: Buffs.cs プロジェクト: swuff-star/HenryMod
        internal static void RegisterBuffs()
        {
            // fix the buff catalog to actually register our buffs
            IL.RoR2.BuffCatalog.Init += FixBuffCatalog;

            armorBuff = AddNewBuff("HenryArmorBuff", Resources.Load <Sprite>("Textures/BuffIcons/texBuffGenericShield"), Color.white, false, false);
        }
コード例 #3
0
ファイル: Buffs.cs プロジェクト: Mico27/RoR2-TTGL-Mod
 internal static void RegisterBuffs()
 {
     maxSpiralPowerBuff = AddNewBuff("MaxSpiralPowerBuff", "texBuffSpiralIcon", Color.green, false, false, false);
     maxSpiralPowerDeBuff = AddNewBuff("MaxSpiralPowerDeBuff", "texBuffSpiralIcon", Color.red, false, true, true);
     canopyBuff = AddNewBuff("CanopyBuff", "texCanopyBuffIcon", new Color(1.0f,0.8f,0.8f), false, false, false);
     kaminaBuff = AddNewBuff("KaminaBuff", "texKaminaBuffIcon", Color.white, true, false, false);
 }
コード例 #4
0
        private void RW_EditEnrageBuff()
        {
            BuffDef enrage = BuffCatalog.GetBuffDef(BuffIndex.EnrageAncientWisp);

            enrage.buffColor = new Color(0.5f, 0.1f, 0.7f, 1f);
            enrage.iconPath  = "Textures/BuffIcons/texMovespeedBuffIcon";
        }
コード例 #5
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();

            headsetBuff            = ScriptableObject.CreateInstance <BuffDef>();
            headsetBuff.buffColor  = new Color(0.5f, 0.575f, 0.95f);
            headsetBuff.canStack   = true;
            headsetBuff.isDebuff   = false;
            headsetBuff.name       = "TKSATHeadset";
            headsetBuff.iconSprite = Addressables.LoadAssetAsync <Sprite>("RoR2/Base/ShockNearby/texBuffTeslaIcon.tif")
                                     .WaitForCompletion();
            ContentAddition.AddBuffDef(headsetBuff);

            var achiNameToken = $"ACHIEVEMENT_TKSAT_{name.ToUpper(System.Globalization.CultureInfo.InvariantCulture)}_NAME";
            var achiDescToken = $"ACHIEVEMENT_TKSAT_{name.ToUpper(System.Globalization.CultureInfo.InvariantCulture)}_DESCRIPTION";

            unlockable                 = ScriptableObject.CreateInstance <UnlockableDef>();
            unlockable.cachedName      = $"TkSat_{name}Unlockable";
            unlockable.sortScore       = 200;
            unlockable.achievementIcon = TinkersSatchelPlugin.resources.LoadAsset <Sprite>("Assets/TinkersSatchel/Textures/UnlockIcons/headsetIcon.png");
            ContentAddition.AddUnlockableDef(unlockable);
            LanguageAPI.Add(achiNameToken, "You Broke It");
            LanguageAPI.Add(achiDescToken, "Kill a boss with a maximum damage H3AD-5T v2 explosion.");
            itemDef.unlockableDef = unlockable;
        }
コード例 #6
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));
        }
コード例 #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++;
                }
            }
コード例 #8
0
        public static void Add()
        {
            maxHPDown = ScriptableObject.CreateInstance <BuffDef>();

            maxHPDown.name       = "Max HP Down";
            maxHPDown.isDebuff   = true;
            maxHPDown.canStack   = true;
            maxHPDown.iconSprite = EvaResources.HPDebuffIcon;

            maxHPDown.buffColor = Color.red;

            BetterAPI.Buffs.Add(maxHPDown);

            maxHPDownStage = ScriptableObject.CreateInstance <BuffDef>();

            maxHPDownStage.name       = "Stage Max HP Down";
            maxHPDownStage.isDebuff   = true;
            maxHPDownStage.canStack   = true;
            maxHPDownStage.iconSprite = EvaResources.HPDebuffIcon;

            maxHPDownStage.buffColor = Color.red;

            BetterAPI.Buffs.Add(maxHPDownStage);

            Stats.Health.collectMultipliers += Health_collectMultipliers;
            On.RoR2.Stage.BeginAdvanceStage += Stage_BeginAdvanceStage;

            On.RoR2.UI.BuffIcon.UpdateIcon += BuffIcon_UpdateIcon;
        }
コード例 #9
0
        // Token: 0x060021EA RID: 8682 RVA: 0x000927D4 File Offset: 0x000909D4
        public void Flash()
        {
            BuffDef buffDef = BuffCatalog.GetBuffDef(this.buffIndex);

            this.iconImage.color = Color.white;
            this.iconImage.CrossFadeColor(buffDef.buffColor, 0.25f, true, false);
        }
コード例 #10
0
 public Range(double lower, double upper, BuffDef buff, int duration)
 {
     Lower    = lower;
     Upper    = upper;
     Buff     = buff;
     Duration = duration;
 }
コード例 #11
0
ファイル: Buffs.cs プロジェクト: xoxfaby/BetterAPI
 public static void AddInfo(BuffDef buffDef, string nameToken = null, string descriptionToken = null)
 {
     buffInfos.TryGetValue(buffDef, out BuffInfo buffInfo);
     buffInfo.nameToken        = buffInfo.nameToken ?? nameToken;
     buffInfo.descriptionToken = buffInfo.descriptionToken ?? descriptionToken;
     AddInfo(buffDef, buffInfo);
 }
コード例 #12
0
ファイル: Buffs.cs プロジェクト: xoxfaby/BetterAPI
        public static BuffDef Add(BuffTemplate buffTemplate, String contentPackIdentifier = null)
        {
            contentPackIdentifier = contentPackIdentifier ?? Assembly.GetCallingAssembly().GetName().Name;
            if (!ContentPacks.assemblyDict.ContainsKey(contentPackIdentifier))
            {
                ContentPacks.assemblyDict[contentPackIdentifier] = Assembly.GetCallingAssembly();
            }
            BuffDef buffDef = ScriptableObject.CreateInstance <BuffDef>();

            buffDef.name        = buffTemplate.internalName;
            buffDef.buffColor   = buffTemplate.buffColor ?? buffDef.buffColor;
            buffDef.canStack    = buffTemplate.canStack ?? buffDef.canStack;
            buffDef.eliteDef    = buffTemplate.eliteDef ?? buffDef.eliteDef;
            buffDef.isCooldown  = buffTemplate.isCooldown ?? buffDef.isCooldown;
            buffDef.isDebuff    = buffTemplate.isDebuff ?? buffDef.isDebuff;
            buffDef.iconSprite  = buffTemplate.iconSprite ?? buffDef.iconSprite;
            buffDef.isHidden    = buffTemplate.isHidden ?? buffDef.isHidden;
            buffDef.m_CachedPtr = buffTemplate.m_CachedPtr ?? buffDef.m_CachedPtr;
            buffDef.startSfx    = buffTemplate.startSfx ?? buffDef.startSfx;
            String nameToken        = $"ARTIFACT_{buffTemplate.internalName.ToUpper()}_NAME";
            String descriptionToken = $"ARTIFACT_{buffTemplate.internalName.ToUpper()}_DESC";

            Languages.AddTokenString(nameToken, buffTemplate.name);
            Languages.AddTokenString(descriptionToken, buffTemplate.description);

            AddInfo(buffDef, nameToken, descriptionToken);

            return(Add(buffDef, contentPackIdentifier));
        }
コード例 #13
0
        public DivinationDistillate() : base()
        {
            const string cShield = "<style=cIsHealing>shield</style>";
            const string cHealth = "<style=cIsHealing>health</style>";

            Cooldown   = 30;
            Name       = new TokenValue("HC_LUCKJUICE", "Divination Distillate");
            PickupText = new TokenValue("HC_LUCKJUICE_PICKUP",
                                        $"<style=cIsHealing>Heal</style> both {cHealth} and {cShield} for a short period of time. <style=cIsUtility>Luck</style> increased while active.");
            Description = new TokenValue("HC_LUCKJUICE_DESC",
                                         $"Heal both {cHealth} and {cShield} for {DistillateDuration} seconds. Effects stops at full {cHealth} and full {cShield}." +
                                         $" While under effect, your <style=cIsUtility>luck</style> is greatly increased.");
            Lore = new TokenValue("HC_LUCKJUICE_LORE",
                                  "Knowledge is fermented in pain and loss\nDistilled with reflection\nTo quench the thirst of those\nWho dream of enlightenment\n\nOpportunity is ripened in risk and rain\nRefined in a single moment\nTo fuel the hunger of those\nWho crave for avarice\n\n<i>Divination Distillate's model, effect and lore are deratives of Grinding Gear Games' version.</i>");
            var cbuff = new CustomBuff(
                name: "HC_LUCKJUICE_BUFF",
                iconPath: HarbCratePlugin.assetPrefix + "Assets/HarbCrate/DivDistillate/texBuffLuck",
                buffColor: Color.Lerp(Color.red, Color.yellow, 0.5f),
                canStack: false,
                isDebuff: false
                );

            BuffAPI.Add(cbuff);
            DistillateBuff = cbuff.BuffDef;
            IsLunar        = false;
            IsEnigmaCompat = false;
            AssetPath      = HarbCratePlugin.assetPrefix + "Assets/HarbCrate/DivDistillate/LuckJuice.prefab";
            SpritePath     = HarbCratePlugin.assetPrefix + "Assets/HarbCrate/DivDistillate/luckjuice.png";
            DefaultScale  *= 21;
            SetupDisplayRules();
        }
コード例 #14
0
ファイル: ItemAPI.cs プロジェクト: xiaoxiao921/R2API
        public CustomEquipment(string name, string nameToken,
                               string descriptionToken, string loreToken,
                               string pickupToken,
                               Sprite pickupIconSprite, GameObject pickupModelPrefab,
                               float cooldown,
                               bool canDrop,
                               bool enigmaCompatible,
                               bool isBoss, bool isLunar,
                               BuffDef passiveBuffDef,
                               UnlockableDef unlockableDef,
                               ColorCatalog.ColorIndex colorIndex   = ColorCatalog.ColorIndex.Equipment,
                               bool appearsInMultiPlayer            = true, bool appearsInSinglePlayer = true,
                               ItemDisplayRuleDict?itemDisplayRules = null)
        {
            EquipmentDef = ScriptableObject.CreateInstance <EquipmentDef>();
            EquipmentDef.appearsInMultiPlayer  = appearsInMultiPlayer;
            EquipmentDef.appearsInSinglePlayer = appearsInSinglePlayer;
            EquipmentDef.canDrop           = canDrop;
            EquipmentDef.colorIndex        = colorIndex;
            EquipmentDef.cooldown          = cooldown;
            EquipmentDef.descriptionToken  = descriptionToken;
            EquipmentDef.enigmaCompatible  = enigmaCompatible;
            EquipmentDef.isBoss            = isBoss;
            EquipmentDef.isLunar           = isLunar;
            EquipmentDef.loreToken         = loreToken;
            EquipmentDef.name              = name;
            EquipmentDef.nameToken         = nameToken;
            EquipmentDef.passiveBuffDef    = passiveBuffDef;
            EquipmentDef.pickupIconSprite  = pickupIconSprite;
            EquipmentDef.pickupModelPrefab = pickupModelPrefab;
            EquipmentDef.pickupToken       = pickupToken;
            EquipmentDef.unlockableDef     = unlockableDef;

            ItemDisplayRules = itemDisplayRules;
        }
コード例 #15
0
 /// <summary>
 /// Safely removes a buff from the target character body
 /// </summary>
 /// <param name="buffToRemove">The buff you want to safely remove</param>
 /// <param name="body">The body you safely want to remove a buff from.</param>
 public static void SafeRemoveBuff(BuffDef buffToRemove, CharacterBody body)
 {
     if (body && body.HasBuff(buffToRemove))
     {
         body.RemoveBuff(buffToRemove);
     }
 }
コード例 #16
0
 public override void SetupAttributes()
 {
     base.SetupAttributes();
     attackBuff            = ScriptableObject.CreateInstance <BuffDef>();
     attackBuff.buffColor  = Color.red;
     attackBuff.canStack   = false;
     attackBuff.isDebuff   = false;
     attackBuff.name       = modInfo.shortIdentifier + "ImprintAttack";
     attackBuff.iconSprite = ClassicItemsPlugin.resources.LoadAsset <Sprite>("Assets/ClassicItems/Textures/ClassicIcons/Imprint_icon.png");
     ContentAddition.AddBuffDef(attackBuff);
     speedBuff            = ScriptableObject.CreateInstance <BuffDef>();
     speedBuff.buffColor  = Color.cyan;
     speedBuff.canStack   = false;
     speedBuff.isDebuff   = false;
     speedBuff.name       = modInfo.shortIdentifier + "ImprintSpeed";
     speedBuff.iconSprite = ClassicItemsPlugin.resources.LoadAsset <Sprite>("Assets/ClassicItems/Textures/ClassicIcons/Imprint_icon.png");
     ContentAddition.AddBuffDef(speedBuff);
     healBuff            = ScriptableObject.CreateInstance <BuffDef>();
     healBuff.buffColor  = Color.green;
     healBuff.canStack   = false;
     healBuff.isDebuff   = false;
     healBuff.name       = modInfo.shortIdentifier + "ImprintHeal";
     healBuff.iconSprite = ClassicItemsPlugin.resources.LoadAsset <Sprite>("Assets/ClassicItems/Textures/ClassicIcons/Imprint_icon.png");
     ContentAddition.AddBuffDef(healBuff);
 }
コード例 #17
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();

            statusBuff            = ScriptableObject.CreateInstance <BuffDef>();
            statusBuff.buffColor  = new Color(0.35f, 0.15f, 0.65f);
            statusBuff.canStack   = true;
            statusBuff.isDebuff   = false;
            statusBuff.name       = "TKSATOrderedArmor";
            statusBuff.iconSprite = Addressables.LoadAssetAsync <Sprite>("RoR2/Base/Common/texBuffGenericShield.tif")
                                    .WaitForCompletion();
            ContentAddition.AddBuffDef(statusBuff);

            itemDef.requiredExpansion = Addressables.LoadAssetAsync <ExpansionDef>("RoR2/DLC1/Common/DLC1.asset")
                                        .WaitForCompletion();

            On.RoR2.ItemCatalog.SetItemRelationships += (orig, providers) => {
                var isp = ScriptableObject.CreateInstance <ItemRelationshipProvider>();
                isp.relationshipType = DLC1Content.ItemRelationshipTypes.ContagiousItem;
                isp.relationships    = new[] { new ItemDef.Pair {
                                                   itemDef1 = GoldenGear.instance.itemDef,
                                                   itemDef2 = itemDef
                                               } };
                orig(providers.Concat(new[] { isp }).ToArray());
            };
        }
コード例 #18
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();

            markDebuff            = ScriptableObject.CreateInstance <BuffDef>();
            markDebuff.buffColor  = Color.yellow;
            markDebuff.canStack   = false;
            markDebuff.isDebuff   = true;
            markDebuff.name       = modInfo.shortIdentifier + "HitListDebuff";
            markDebuff.iconSprite = ClassicItemsPlugin.resources.LoadAsset <Sprite>("Assets/ClassicItems/Textures/ClassicIcons/hitlist_debuff_icon.png");
            ContentAddition.AddBuffDef(markDebuff);

            tallyBuff            = ScriptableObject.CreateInstance <BuffDef>();
            tallyBuff.buffColor  = Color.yellow;
            tallyBuff.canStack   = true;
            tallyBuff.isDebuff   = false;
            tallyBuff.name       = modInfo.shortIdentifier + "HitListBuff";
            tallyBuff.iconSprite = ClassicItemsPlugin.resources.LoadAsset <Sprite>("Assets/ClassicItems/Textures/ClassicIcons/hitlist_buff_icon.png");
            ContentAddition.AddBuffDef(tallyBuff);

            hitListTally                  = ScriptableObject.CreateInstance <ItemDef>();
            hitListTally.hidden           = true;
            hitListTally.name             = modInfo.shortIdentifier + "INTERNALTally";
            hitListTally.deprecatedTier   = ItemTier.NoTier;
            hitListTally.canRemove        = false;
            hitListTally.nameToken        = "";
            hitListTally.pickupToken      = "";
            hitListTally.loreToken        = "";
            hitListTally.descriptionToken = "";
            ItemAPI.Add(new CustomItem(hitListTally, new ItemDisplayRuleDict()));
        }
コード例 #19
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();

            loomBuff            = ScriptableObject.CreateInstance <BuffDef>();
            loomBuff.buffColor  = Color.white;
            loomBuff.canStack   = true;
            loomBuff.isDebuff   = false;
            loomBuff.name       = "TKSATLoomBuff";
            loomBuff.iconSprite = TinkersSatchelPlugin.resources.LoadAsset <Sprite>("Assets/TinkersSatchel/Textures/MiscIcons/loomBuffIcon.png");
            ContentAddition.AddBuffDef(loomBuff);

            itemDef.requiredExpansion = Addressables.LoadAssetAsync <ExpansionDef>("RoR2/DLC1/Common/DLC1.asset")
                                        .WaitForCompletion();

            On.RoR2.ItemCatalog.SetItemRelationships += (orig, providers) => {
                var isp = ScriptableObject.CreateInstance <ItemRelationshipProvider>();
                isp.relationshipType = DLC1Content.ItemRelationshipTypes.ContagiousItem;
                isp.relationships    = new[] { new ItemDef.Pair {
                                                   itemDef1 = Skein.instance.itemDef,
                                                   itemDef2 = itemDef
                                               } };
                orig(providers.Concat(new[] { isp }).ToArray());
            };
        }
コード例 #20
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();

            speedBuff            = ScriptableObject.CreateInstance <BuffDef>();
            speedBuff.buffColor  = Color.white;
            speedBuff.canStack   = true;
            speedBuff.isDebuff   = false;
            speedBuff.name       = "TKSATSkeinSpeed";
            speedBuff.iconSprite = TinkersSatchelPlugin.resources.LoadAsset <Sprite>("Assets/TinkersSatchel/Textures/MiscIcons/skeinSpeedBuffIcon.png");
            ContentAddition.AddBuffDef(speedBuff);

            resistBuff            = ScriptableObject.CreateInstance <BuffDef>();
            resistBuff.buffColor  = Color.white;
            resistBuff.canStack   = true;
            resistBuff.isDebuff   = false;
            resistBuff.name       = "TKSATSkeinResist";
            resistBuff.iconSprite = TinkersSatchelPlugin.resources.LoadAsset <Sprite>("Assets/TinkersSatchel/Textures/MiscIcons/skeinResistBuffIcon.png");
            ContentAddition.AddBuffDef(resistBuff);

            var achiNameToken = $"ACHIEVEMENT_TKSAT_{name.ToUpper(System.Globalization.CultureInfo.InvariantCulture)}_NAME";
            var achiDescToken = $"ACHIEVEMENT_TKSAT_{name.ToUpper(System.Globalization.CultureInfo.InvariantCulture)}_DESCRIPTION";

            unlockable                 = ScriptableObject.CreateInstance <UnlockableDef>();
            unlockable.cachedName      = $"TkSat_{name}Unlockable";
            unlockable.sortScore       = 200;
            unlockable.achievementIcon = TinkersSatchelPlugin.resources.LoadAsset <Sprite>("Assets/TinkersSatchel/Textures/UnlockIcons/skeinIcon.png");
            ContentAddition.AddUnlockableDef(unlockable);
            LanguageAPI.Add(achiNameToken, "Phenomenal Cosmic Power");
            LanguageAPI.Add(achiDescToken, "Complete all 4 Item Set achievements from Tinker's Satchel.");
            itemDef.unlockableDef = unlockable;
        }
コード例 #21
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();

            var captainSD = LegacyResourcesAPI.Load <SkillDef>("SkillDefs/CaptainBody/CaptainSkillUsedUp");

            disabledSkillDef = SkillUtil.CloneSkillDef(captainSD);
            disabledSkillDef.skillNameToken               = "TKSAT_DISABLED_SKILL_NAME";
            disabledSkillDef.skillDescriptionToken        = "TKSAT_DISABLED_SKILL_DESCRIPTION";
            disabledSkillDef.dontAllowPastMaxStocks       = false;
            disabledSkillDef.beginSkillCooldownOnSkillEnd = true;

            ContentAddition.AddSkillDef(disabledSkillDef);

            tauntDebuff            = ScriptableObject.CreateInstance <BuffDef>();
            tauntDebuff.buffColor  = Color.white;
            tauntDebuff.canStack   = false;
            tauntDebuff.isDebuff   = true;
            tauntDebuff.name       = "TKSATTaunt";
            tauntDebuff.iconSprite = Addressables.LoadAssetAsync <Sprite>("RoR2/Base/Common/MiscIcons/texAttackIcon.png")
                                     .WaitForCompletion();
            ContentAddition.AddBuffDef(tauntDebuff);

            R2API.Networking.NetworkingAPI.RegisterMessageType <ServerTimedSkillDisable.MsgApply>();
            R2API.Networking.NetworkingAPI.RegisterMessageType <ServerTimedSkillDisable.MsgRemove>();
        }
コード例 #22
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();

            var achiNameToken = $"ACHIEVEMENT_TKSAT_{name.ToUpper(System.Globalization.CultureInfo.InvariantCulture)}_NAME";
            var achiDescToken = $"ACHIEVEMENT_TKSAT_{name.ToUpper(System.Globalization.CultureInfo.InvariantCulture)}_DESCRIPTION";

            unlockable                 = ScriptableObject.CreateInstance <UnlockableDef>();
            unlockable.cachedName      = $"TkSat_{name}Unlockable";
            unlockable.sortScore       = 200;
            unlockable.achievementIcon = TinkersSatchelPlugin.resources.LoadAsset <Sprite>("Assets/TinkersSatchel/Textures/UnlockIcons/deadManSwitchIcon.png");
            ContentAddition.AddUnlockableDef(unlockable);
            LanguageAPI.Add(achiNameToken, "Nine Lives");
            LanguageAPI.Add(achiDescToken, "Survive falling to low health 9 times in the same run (must return to above 50% health each time).");
            itemDef.unlockableDef = unlockable;

            deadManSwitchBuff            = ScriptableObject.CreateInstance <BuffDef>();
            deadManSwitchBuff.buffColor  = Color.red;
            deadManSwitchBuff.canStack   = false;
            deadManSwitchBuff.isDebuff   = false;
            deadManSwitchBuff.isCooldown = true;
            deadManSwitchBuff.name       = "TKSATDeadManSwitch";
            deadManSwitchBuff.iconSprite = TinkersSatchelPlugin.resources.LoadAsset <Sprite>("Assets/TinkersSatchel/Textures/MiscIcons/deadManSwitchBuff.png");
            ContentAddition.AddBuffDef(deadManSwitchBuff);
        }
コード例 #23
0
ファイル: Buffs.cs プロジェクト: Flux0s/HenryMod
        internal static void RegisterBuffs()
        {
            // fix the buff catalog to actually register our buffs
            IL.RoR2.BuffCatalog.Init += FixBuffCatalog; // remove this hook after next ror2 update as it will have been fixed

            armorBuff = AddNewBuff("HenryArmorBuff", Resources.Load <Sprite>("Textures/BuffIcons/texBuffGenericShield"), Color.white, false, false);
        }
コード例 #24
0
        public static void BuffTeam(GameObject passenger, BuffDef buffDef, float duration, float durationSelf = -1)
        {
            var characterBody = passenger.GetComponent <CharacterBody>();

            if (!characterBody)
            {
                return;
            }
            if (durationSelf == -1)
            {
                durationSelf = duration;
            }
            TeamComponent[] array = UnityEngine.Object.FindObjectsOfType <TeamComponent>();
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i].teamIndex == characterBody.teamComponent.teamIndex)
                {
                    var teamBody = array[i].GetComponent <CharacterBody>();
                    if (teamBody == characterBody)
                    {
                        teamBody.AddTimedBuff(buffDef, durationSelf);
                        continue;
                    }
                    teamBody.AddTimedBuff(buffDef, duration);
                }
            }
        }
コード例 #25
0
        internal static void Init()
        {
            ContentManager.collectContentPackProviders += AddCustomContent;

            artifactCR                           = ScriptableObject.CreateInstance <ArtifactDef>();
            artifactCR.nameToken                 = "ARTIFACT_CRCORE_NAME";
            artifactCR.descriptionToken          = "ARTIFACT_CRCORE_DESC";
            artifactCR.unlockableDef             = null;
            artifactCR.smallIconSelectedSprite   = Assets.artifactChampionOn;
            artifactCR.smallIconDeselectedSprite = Assets.artifactChampionOff;
            artifactCR.pickupModelPrefab         = GameObject.CreatePrimitive(PrimitiveType.Cube);
            ContentPack.artifactDefs.Add(new ArtifactDef[] { artifactCR });


            voidDebuffDef            = ScriptableObject.CreateInstance <BuffDef>();
            voidDebuffDef.name       = "CRVoidDebuff";
            voidDebuffDef.buffColor  = new Color32(255, 100, 150, 255);
            voidDebuffDef.canStack   = false;
            voidDebuffDef.iconSprite = Resources.Load <Sprite>("textures/bufficons/texBuffNullifyStackIcon");
            voidDebuffDef.isDebuff   = true;
            Debug.Log("Initalized Buff: " + voidDebuffDef.name);

            protectionBuffDef            = ScriptableObject.CreateInstance <BuffDef>();
            protectionBuffDef.name       = "CRVoidProtectionBuff";
            protectionBuffDef.buffColor  = new Color32(100, 30, 255, 255);
            protectionBuffDef.canStack   = false;
            protectionBuffDef.iconSprite = Resources.Load <Sprite>("textures/bufficons/texBuffNullifiedIcon");
            protectionBuffDef.isDebuff   = false;
            Debug.Log("Initalized Buff: " + protectionBuffDef.name);

            ContentPack.buffDefs.Add(new BuffDef[] { protectionBuffDef, voidDebuffDef });

            ContentPack.entityStateTypes.Add(new Type[] { typeof(RiftBaseState), typeof(RiftOffState), typeof(RiftOnState), typeof(RiftCompleteState) });
        }
コード例 #26
0
 public static void AddBuffStacks(CharacterBody characterBody, BuffDef buffDef, int stacks = 1)
 {
     for (int i = 0; i < stacks; i++)
     {
         characterBody.AddBuff(buffDef);
     }
 }
コード例 #27
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();
            rewindStateType = ContentAddition.AddEntityState <RewindState>(out _);
            R2API.Networking.NetworkingAPI.RegisterMessageType <MsgRewind>();

            blacklistedSkills = new[] {
                LegacyResourcesAPI.Load <RoR2.Skills.SkillDef>("SkillDefs/CaptainBody/CallSupplyDropHealing"),
                LegacyResourcesAPI.Load <RoR2.Skills.SkillDef>("SkillDefs/CaptainBody/CallSupplyDropHacking"),
                LegacyResourcesAPI.Load <RoR2.Skills.SkillDef>("SkillDefs/CaptainBody/CallSupplyDropShocking"),
                LegacyResourcesAPI.Load <RoR2.Skills.SkillDef>("SkillDefs/CaptainBody/CallSupplyDropEquipmentRestock"),
                LegacyResourcesAPI.Load <RoR2.Skills.SkillDef>("SkillDefs/CaptainBody/CaptainSkillUsedUp"),
                LegacyResourcesAPI.Load <RoR2.Skills.SkillDef>("SkillDefs/CaptainBody/CaptainCancelDummy")
            };

            rewindBuff            = ScriptableObject.CreateInstance <BuffDef>();
            rewindBuff.buffColor  = Color.white;
            rewindBuff.canStack   = true;
            rewindBuff.isDebuff   = false;
            rewindBuff.isCooldown = true;
            rewindBuff.name       = "TKSATRewind";
            rewindBuff.iconSprite = TinkersSatchelPlugin.resources.LoadAsset <Sprite>("Assets/TinkersSatchel/Textures/MiscIcons/rewindBuffIcon.png");
            ContentAddition.AddBuffDef(rewindBuff);

            if (Compat_ClassicItems.enabled)
            {
                LanguageAPI.Add("TKSAT_REWIND_CI_EMBRYO_APPEND", "\n<style=cStack>Beating Embryo: 50% chance to not consume stock.</style>");
                Compat_ClassicItems.RegisterEmbryoHook(equipmentDef, "TKSAT_REWIND_CI_EMBRYO_APPEND", () => "TKSAT.CausalCamera");
            }
        }
コード例 #28
0
        internal static BuffDef GetBuff(string buffName)
        {
            BuffDef def = Assets.mainAssetBundle.LoadAsset <BuffDef>(buffName);

            buffs.Add(def);

            return(def);
        }
コード例 #29
0
        private static void RepulsionArmorAsItem()
        {
            LanguageAPI.Add("REPULSIONARMOR_NAME_TOKEN", "Repulsion Armor");
            LanguageAPI.Add("REPULSIONARMOR_PICKUP_TOKEN", "After taking damage, reflect all attacks for seconds.");
            LanguageAPI.Add("REPULSIONARMOR_DESCRIPTION_TOKEN", "After <style=cIsUtility>6</style> hits <style=cIsHealing>Increase 500 armors</style> for <style=cIsUtility>3</style> <style=cStack>(+1 per stack)</style> seconds.");
            LanguageAPI.Add("REPULSIONARMOR_LORE_TOKEN", @"- Shipping Method:  High Priority / Fragile
- Order Details :  Prototype repulsion armor: it doesn't quite work as advertised. The protective shielding will activate, but only after... repeated triggers. You'll have to get hit a lot of times before it activates. We have tried increasing the sensitivity, but it lead to the armor triggering from simple movements. We will send an improved prototype next month.
");
            LanguageAPI.Add("REPULSIONARMOR_NAME_TOKEN", "斥力装甲", "zh-CN");
            LanguageAPI.Add("REPULSIONARMOR_PICKUP_TOKEN", "受到伤害后,在几秒内降低受到的攻击。", "zh-CN");
            LanguageAPI.Add("REPULSIONARMOR_DESCRIPTION_TOKEN", "受到<style=cIsUtility>6</style>次攻击后,增加<style=cIsHealing>500护甲</style>, 持续<style=cIsUtility>3秒</style> <style=cStack>(每层增加1秒)</style>。", "zh-CN");
            LanguageAPI.Add("REPULSIONARMOR_LORE_TOKEN", "运输方式:高优先级 / 脆弱\r\n商品细节:原型排斥装甲:它并没有像宣传的那样起作用。保护性屏蔽将被激活,但仅在...反复触发后才能激活。在激活之前,您必须被击中很多次。我们已经尝试提高灵敏度,但是它会导致装甲由简单的动作触发。我们将在下个月发送改进的原型。", "zh-CN");

            ItemDef RepulsionArmorDef = new ItemDef
            {
                name             = "REPULSIONARMOR_NAME_TOKEN",
                pickupIconPath   = IconPath,
                pickupModelPath  = PrefabPath,
                nameToken        = "REPULSIONARMOR_NAME_TOKEN",
                pickupToken      = "REPULSIONARMOR_PICKUP_TOKEN",
                descriptionToken = "REPULSIONARMOR_DESCRIPTION_TOKEN",
                loreToken        = "REPULSIONARMOR_LORE_TOKEN",
                tier             = ItemTier.Tier3,
                tags             = new ItemTag[]
                {
                    ItemTag.Healing,
                    ItemTag.Utility
                }
            };

            ItemDisplayRule[] DisplayRules       = null;
            CustomItem        RepulsionArmorItem = new CustomItem(RepulsionArmorDef, DisplayRules);

            RepulsionArmorItemIndex = ItemAPI.Add(RepulsionArmorItem);

            BuffDef RepulsionArmorStackbuffDef = new BuffDef
            {
                iconPath   = BuffIconPath,
                canStack   = true,
                eliteIndex = EliteIndex.None,
                isDebuff   = false,
                name       = "RepulsionArmorStackbuff"
            };

            RepulsionArmorStackbuff = BuffAPI.Add(new CustomBuff(RepulsionArmorStackbuffDef));

            BuffDef RepulsionArmorArmorbuffDef = new BuffDef
            {
                iconPath   = "Textures/BuffIcons/texBuffGenericShield",
                buffColor  = new Color(0.9137255f, 0.37254903f, 0.1882353f),
                canStack   = false,
                eliteIndex = EliteIndex.None,
                isDebuff   = false,
                name       = "RepulsionArmorArmorbuff"
            };

            RepulsionArmorArmorbuff = BuffAPI.Add(new CustomBuff(RepulsionArmorArmorbuffDef));
        }
コード例 #30
0
 // Grabs all the buffDefs in your content pack for reference in code
 // Order should be the same as the SerializedContentPack BuffDefs list.
 private static void CollectBuffs()
 {
     fireBuff      = GetBuff("ManipulatorSwitchFireBuff");
     lightningBuff = GetBuff("ManipulatorSwitchLightningBuff");
     iceBuff       = GetBuff("ManipulatorSwitchIceBuff");
     jetBuff       = GetBuff("ManipulatorJetpackBuff");
     chillDebuff   = GetBuff("ManipulatorChillDebuff");
     chillCooldown = GetBuff("ManipulatorChillCooldown");
 }
コード例 #31
0
        List<LoaderError> LoadTextures (BuffDef def)
        {
            var ret = new List<LoaderError>();

            var t = def.GetTexture();
            if (t == null)
            {
                ret.Add(new LoaderError(def.Mod, "GetTexture return value is null for BuffDef " + def + "."));
                return ret;
            }

            Main.buffTexture[def.Type] = def.GetTexture();

            return ret;
        }
コード例 #32
0
        List<LoaderError> CheckTextures(BuffDef def)
        {
            var ret = new List<LoaderError>();

            if (def.GetTexture == null)
                ret.Add(new LoaderError(def.Mod, "GetTexture of BuffDef " + def + " is null."));

            return ret;
        }
コード例 #33
0
        internal void FillVanilla()
        {
            FillingVanilla = true;

            int id = 0;

            var def = new BuffDef(String.Empty);
            def.InternalName = String.Empty;

            DefsByType.Add(id, def);
            VanillaDefsByName.Add(String.Empty, def);

            var byDisplayName = new Dictionary<string, BuffDef>();

            for (id = MinVanillaID; id < MaxVanillaID; id++)
            {
                if (id == 0)
                    continue;

                var index = Array.IndexOf(IDValues, id);
                if (index == -1)
                    continue;

                def = new BuffDef(Main.buffName[id], null, () => Main.buffTexture[id]);

                DefsByType.Add(id, def);
                VanillaDefsByName.Add(IDNames[index], def);

                var n = Main.buffName[id];
                if (!byDisplayName.ContainsKey(n) && !VanillaDefsByName.ContainsKey(n))
                    byDisplayName.Add(n, def);

                def.Mod = PrismApi.VanillaInfo;

                CopyEntityToDef(id, def); // TEntityDef is a class -> dictionary entries are updated, too

                def.InternalName = IDNames[index];
            }

            foreach (var kvp in byDisplayName)
                if (!VanillaDefsByName.ContainsKey(kvp.Key))
                    VanillaDefsByName.Add(kvp.Key, kvp.Value);

            FillingVanilla = false;
        }
コード例 #34
0
 void CopySetProperties(BuffDef def)
 {
     Main.buffNoSave       [def.Type] = def.DoesNotSave       ;
     Main.buffNoTimeDisplay[def.Type] = def.HideTimeDisplay   ;
     Main.debuff           [def.Type] = def.IsDebuff          ;
     Main.lightPet         [def.Type] = def.IsLightPet        ;
     Main.vanityPet        [def.Type] = def.IsVanityPet       ;
     Main.meleeBuff        [def.Type] = def.IsWeaponImbuement ;
     Main.persistentBuff   [def.Type] = def.PersistsAfterDeath;
     Main.buffTip          [def.Type] = def.Tooltip           ;
     Main.pvpBuff          [def.Type] = def.WorksInPvP        ;
 }
コード例 #35
0
        void CopyEntityToDef(int id, BuffDef def)
        {
            def.Type = id;

            def.DoesNotSave        = Main.buffNoSave       [id];
            def.HideTimeDisplay    = Main.buffNoTimeDisplay[id];
            def.IsDebuff           = Main.debuff           [id];
            def.IsLightPet         = Main.lightPet         [id];
            def.IsVanityPet        = Main.vanityPet        [id];
            def.IsWeaponImbuement  = Main.meleeBuff        [id];
            def.PersistsAfterDeath = Main.persistentBuff   [id];
            def.Tooltip            = Main.buffTip          [id];
            def.WorksInPvP         = Main.pvpBuff          [id];
        }