public override void SetupBehavior() { base.SetupBehavior(); GameObject engiMinePrefab = Resources.Load <GameObject>("prefabs/projectiles/EngiMine"); minePrefab = engiMinePrefab.InstantiateClone("FootMine", true); Object.Destroy(minePrefab.GetComponent <ProjectileDeployToOwner>()); GameObject engiMineGhostPrefab = Resources.Load <GameObject>("prefabs/projectileghosts/EngiMineGhost"); mineGhostPrefab = engiMineGhostPrefab.InstantiateClone("FootMineGhost", false); SkinnedMeshRenderer mesh = mineGhostPrefab.GetComponentInChildren <SkinnedMeshRenderer>(); mesh.material.color = Color.green; minePrefab.GetComponent <ProjectileController>().ghostPrefab = mineGhostPrefab; ProjectileAPI.Add(minePrefab); poisonBuff = ScriptableObject.CreateInstance <BuffDef>(); //poisonBuff.buffColor = new Color32(1, 121, 91, 255); poisonBuff.isDebuff = true; poisonBuff.canStack = true; poisonBuff.name = "CCIFootPoison"; poisonBuff.iconSprite = assetBundle.LoadAsset <Sprite>("Assets/ClassicItems/icons/footmine_buff_icon.png"); CustomBuff poisonCustomBuff = new CustomBuff(poisonBuff); BuffAPI.Add(poisonCustomBuff); DotController.DotDef poisonDotDef = new DotController.DotDef { interval = 1, damageCoefficient = 1, damageColorIndex = DamageColorIndex.Poison, associatedBuff = poisonBuff }; poisonDot = DotAPI.RegisterDotDef(poisonDotDef); if (Compat_ItemStats.enabled) { Compat_ItemStats.CreateItemStatDef(itemDef, ( (count, inv, master) => { return(baseDmg + (count - 1) * stackDmg); }, (value, inv, master) => { return($"Poison Damage/Second: {Pct(value, 1)}"); } ), ( (count, inv, master) => { return(baseTicks + (count - 1) * stackTicks); }, (value, inv, master) => { return($"Duration: {value} seconds"); } )); } }
private static void SetupModdedDots() { DotController.DotDef dotDef = new DotController.DotDef() { associatedBuff = OriginalPoisonBuff.BuffDef, damageCoefficient = OriginalPoisonDamageCoefficient, damageColorIndex = DamageColorIndex.Poison, interval = 0.333f }; DotController.DotStack dotStack = new DotController.DotStack() { }; DotAPI.CustomDotBehaviour customDotBehaviour = new DotAPI.CustomDotBehaviour(ApplyCustomPoison); OriginalPoisonDot = DotAPI.RegisterDotDef(dotDef, customDotBehaviour); }
internal static void RegisterBuffs() { siphonSelf = AddNewBuff("WispSiphonSelf", "textures/bufficons/texBuffBodyArmorIcon", Color.blue, false, false); siphonTarget = AddNewBuff("WispSiphonTarget", "textures/bufficons/texBuffBodyArmorIcon", Color.clear, false, true); Debug.Log("Registered siphon buffs"); sustainSelf = AddNewBuff("WispSustainSelf", "textures/bufficons/texBuffPowerIcon", Color.clear, false, false); sustainTarget = AddNewBuff("WispSustainTarget", "textures/bufficons/texBuffPowerIcon", Color.clear, false, false); Debug.Log("Registered sustain buffs"); haste = AddNewBuff("WispHaste", "Textures/BuffIcons/texBuffTempestSpeedIcon", Color.red, true, false); slow = AddNewBuff("WispSlow", "Textures/BuffIcons/texBuffCrippleIcon", Color.cyan, true, false); invigorate = AddNewBuff("WispInvigorate", "Textures/BuffIcons/texBuffRegenBoostIcon", Color.green, true, false); regenMinus = AddNewBuff("WispRegenMinus", "Textures/BuffIcons/texBuffWeakIcon", Color.magenta, true, true); degenDot = DotAPI.RegisterDotDef(.8f, 2f, DamageColorIndex.Bleed, regenMinus); }
//static internal BuffDef ThalliumBuff; private void CreateBuff() { ThalliumBuff = ScriptableObject.CreateInstance <BuffDef>(); ThalliumBuff.name = "Thallium Poisoning"; //ThalliumBuff.buffColor = Color.blue; ThalliumBuff.canStack = false; ThalliumBuff.isDebuff = true; ThalliumBuff.iconSprite = MainAssets.LoadAsset <Sprite>("Thallium.png"); CustomBuff thalliumBuff = new CustomBuff(ThalliumBuff); BuffAPI.Add(new CustomBuff(ThalliumBuff)); DotController.DotDef thalliumDotDef = new DotController.DotDef { interval = 0.5f, damageCoefficient = 1, damageColorIndex = DamageColorIndex.DeathMark, associatedBuff = ThalliumBuff }; poisonDot = DotAPI.RegisterDotDef(thalliumDotDef, (dotController, dotStack) => { CharacterBody attackerBody = dotStack.attackerObject.GetComponent <CharacterBody>(); if (attackerBody) { float damageMultiplier = dmgCoefficient + dmgStack * (GetCount(attackerBody) - 1); float poisonDamage = 0f; if (dotController.victimBody) { poisonDamage += dotController.victimBody.damage; } dotStack.damage = poisonDamage * damageMultiplier; } }); }
public override void SetupBehavior() { base.SetupBehavior(); poisonBuff = ScriptableObject.CreateInstance <BuffDef>(); //poisonBuff.buffColor = new Color32(66, 28, 82, 255); poisonBuff.canStack = false; poisonBuff.isDebuff = true; poisonBuff.name = "CCIThalliumPoison"; poisonBuff.iconSprite = assetBundle.LoadAsset <Sprite>("Assets/ClassicItems/Icons/thallium_buff_icon.png"); CustomBuff thalliumCustomBuff = new CustomBuff(poisonBuff); BuffAPI.Add(thalliumCustomBuff); DotController.DotDef thalliumDotDef = new DotController.DotDef { interval = .5f, damageCoefficient = 1, damageColorIndex = DamageColorIndex.DeathMark, associatedBuff = poisonBuff }; poisonDot = DotAPI.RegisterDotDef(thalliumDotDef, (dotController, dotStack) => { CharacterBody attackerBody = dotStack.attackerObject.GetComponent <CharacterBody>(); if (attackerBody) { float damageMultiplier = dmgCoefficient + dmgStack * (GetCount(attackerBody) - 1); float poisonDamage = 0f; if (dotController.victimBody) { poisonDamage += dotController.victimBody.damage; } dotStack.damage = poisonDamage * damageMultiplier; } }); if (Compat_ItemStats.enabled) { Compat_ItemStats.CreateItemStatDef(itemDef, ( (count, inv, master) => { return(Mathf.Min(procChance + stackChance * (count - 1), capChance)); }, (value, inv, master) => { return($"Poison Chance: {Pct(value, 0, 1)}"); } ), ( (count, inv, master) => { return(dmgCoefficient + (count - 1) * dmgStack); }, (value, inv, master) => { return($"Victim damage per second: {Pct(value, 0)}"); } ), ( (count, inv, master) => { return(duration); }, (value, inv, master) => { return($"Poison Duration: {value}"); } )); } if (Compat_BetterUI.enabled) { Compat_BetterUI.AddEffect(itemDef, procChance, stackChance, Compat_BetterUI.ChanceFormatter, Compat_BetterUI.LinearStacking, (value, extraStackValue, procCoefficient) => { return(Mathf.CeilToInt((capChance - value * procCoefficient) / (extraStackValue * procCoefficient)) + 1); }); } }
public override void OnLoad() { buffDef.name = "MysticsItems_MarwanAshBurnStrong"; buffDef.buffColor = new Color32(96, 245, 250, 255); buffDef.canStack = false; buffDef.isDebuff = false; buffDef.iconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Buffs/MarwanAshBurnSuper.png"); ashBurnEffectParams = new BurnEffectController.EffectParams { startSound = "Play_item_proc_igniteOnKill_Loop", stopSound = "Stop_item_proc_igniteOnKill_Loop", overlayMaterial = Main.AssetBundle.LoadAsset <Material>("Assets/Items/Marwan's Ash/matMarwanAshBurnOverlayStrong.mat"), fireEffectPrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Marwan's Ash/AshBurnVFXStrong.prefab") }; ashDotDef = new DotController.DotDef { associatedBuff = buffDef, damageCoefficient = 1f, damageColorIndex = ashDoTDamageColor, interval = 0.333f }; ashDotIndex = DotAPI.RegisterDotDef(ashDotDef, (self, dotStack) => { DotController.DotStack oldDotStack = self.dotStackList.FirstOrDefault(x => x.dotIndex == dotStack.dotIndex); if (oldDotStack != null) { self.RemoveDotStackAtServer(self.dotStackList.IndexOf(oldDotStack)); } var itemCount = 1; var attackerLevel = 1f; var damageMultiplier = 1f; var isPlayerTeam = false; if (dotStack.attackerObject) { var ashHelper = dotStack.attackerObject.GetComponent <Items.MarwanAsh1.MysticsItemsMarwanAshHelper>(); if (ashHelper) { itemCount = ashHelper.itemCount; } var attackerBody = dotStack.attackerObject.GetComponent <CharacterBody>(); if (attackerBody) { attackerLevel = attackerBody.level; if (attackerBody.damage != 0f) { damageMultiplier = dotStack.damage / attackerBody.damage / ashDotDef.damageCoefficient; } isPlayerTeam = attackerBody.teamComponent.teamIndex == TeamIndex.Player; } } var hpFractionDamage = (Items.MarwanAsh1.dotPercent / 100f + Items.MarwanAsh1.dotPercentPerLevel / 100f * (attackerLevel - (float)Items.MarwanAsh1.upgradeLevel12) * itemCount) * damageMultiplier; if (!isPlayerTeam) { hpFractionDamage = Mathf.Min(hpFractionDamage, Items.MarwanAsh1.enemyBurnDamageCap); } dotStack.damage = (self.victimHealthComponent ? self.victimHealthComponent.fullCombinedHealth * hpFractionDamage : 0) * ashDotDef.interval; }); On.RoR2.DotController.UpdateDotVisuals += DotController_UpdateDotVisuals; }