public static void LoadSkill() { Sprite punchSprite = RogueUtilities.ConvertToSprite(RedMod.Properties.Resources.punch); CustomAbility saitamaPunch = RogueLibs.CreateCustomAbility("saitamaPunch", punchSprite, true, new CustomNameInfo("Saitamas punch"), new CustomNameInfo("Just one punch is enough"), item => { }); saitamaPunch.OnPressed = (item, agent) => { if (item.invItemCount > 0) // is recharging { agent.gc.audioHandler.Play(agent, "CantDo"); } else { agent.Say("HAHAHA"); agent.SetStrength(999); agent.wallDestroyDetector.EnableIfPossible(); agent.inventory.buffDisplay.specialAbilitySlot.MakeNotUsable(); // make special ability slot half-transparent item.invItemCount = 100; // 100 x 0.13f = 13 seconds to recharge // or you can replace 100 with 13, and 0.13 with 1 to make it simpler } }; saitamaPunch.RechargeInterval = (item, agent) => item.invItemCount > 0 ? new WaitForSeconds(0f) : null; saitamaPunch.Recharge = (item, agent) => { if (item.invItemCount > 0 && agent.statusEffects.CanRecharge()) { // if can recharge item.invItemCount--; if (item.invItemCount == 0) // ability recharged { agent.statusEffects.CreateBuffText("Recharged", agent.objectNetID); agent.gc.audioHandler.Play(agent, "Recharge"); agent.inventory.buffDisplay.specialAbilitySlot.MakeUsable(); // make special ability slot fully visible } } }; }
public static void LoadSkill() { Sprite skillSprite = RogueUtilities.ConvertToSprite(RedMod.Properties.Resources.questionmark); CustomAbility skill = RogueLibs.CreateCustomAbility("neuralyzer", skillSprite, true, new CustomNameInfo("Neuralyzer"), new CustomNameInfo("It has the ability to wipe the mind of anybody who sees the flash."), item => { }); skill.Available = true; skill.CostInCharacterCreation = 9; skill.OnPressed = (item, agent) => { if (item.invItemCount > 0) // is recharging { agent.gc.audioHandler.Play(agent, "CantDo"); } else { flash(Utils.getMyNetid()); agent.inventory.buffDisplay.specialAbilitySlot.MakeNotUsable(); // make special ability slot half-transparent item.invItemCount = 4; // 100 x 0.13f = 13 seconds to recharge // or you can replace 100 with 13, and 0.13 with 1 to make it simpler } }; skill.RechargeInterval = (item, agent) => item.invItemCount > 0 ? new WaitForSeconds(1f) : null; skill.Recharge = (item, agent) => { if (item.invItemCount > 0 && agent.statusEffects.CanRecharge()) { // if can recharge item.invItemCount--; if (item.invItemCount == 0) // ability recharged { agent.statusEffects.CreateBuffText("Recharged", agent.objectNetID); agent.gc.audioHandler.Play(agent, "Recharge"); agent.inventory.buffDisplay.specialAbilitySlot.MakeUsable(); // make special ability slot fully visible } } }; }
public static void LoadSkill() { Sprite skillSprite = RogueUtilities.ConvertToSprite(RedMod.Properties.Resources.questionmark); CustomAbility skill = RogueLibs.CreateCustomAbility("skillid", skillSprite, true, new CustomNameInfo("Name"), new CustomNameInfo("Description"), item => { }); skill.OnPressed = (item, agent) => { if (item.invItemCount > 0) // is recharging { agent.gc.audioHandler.Play(agent, "CantDo"); } else { agent.inventory.buffDisplay.specialAbilitySlot.MakeNotUsable(); // make special ability slot half-transparent item.invItemCount = 100; // 100 x 0.13f = 13 seconds to recharge // or you can replace 100 with 13, and 0.13 with 1 to make it simpler } }; skill.RechargeInterval = (item, agent) => item.invItemCount > 0 ? new WaitForSeconds(0f) : null; skill.Recharge = (item, agent) => { if (item.invItemCount > 0 && agent.statusEffects.CanRecharge()) { // if can recharge item.invItemCount--; if (item.invItemCount == 0) // ability recharged { agent.statusEffects.CreateBuffText("Recharged", agent.objectNetID); agent.gc.audioHandler.Play(agent, "Recharge"); agent.inventory.buffDisplay.specialAbilitySlot.MakeUsable(); // make special ability slot fully visible } } }; }
public static bool Prefix(ES_TriggerFogSphere __instance) { CustomAbility customAbility = __instance.m_enemyAgent.GetComponent <CustomAbility>(); if (customAbility == null) { return(true); } if (customAbility.Activated == false) { return(customAbility.Trigger()); } //This needs to be changed somehow //if (!ConfigManager.CustomIDs.Contains(__instance.m_enemyAgent.EnemyDataID)) return true; //__instance.m_fogSphereAbility.DoTrigger(); // //ES_StateEnum endState = ConfigManager.GetEndState(__instance.m_enemyAgent.EnemyDataID); //__instance.m_machine.ChangeState((int)endState); return(false); }
/// <summary> /// Unregisters a <see cref="CustomAbility"/>. /// </summary> /// <param name="ability">The <see cref="CustomAbility"/> to be unregistered.</param> public static void Unregister(this CustomAbility ability) => ability.TryUnregister();
public static void LoadSkill() { Sprite questionmarkSprite = RogueUtilities.ConvertToSprite(RedMod.Properties.Resources.questionmark); CustomAbility randomAbility = RogueLibs.CreateCustomAbility("randomAbility", questionmarkSprite, true, new CustomNameInfo("Random Ability"), new CustomNameInfo("???"), item => { }); randomAbility.OnPressed = (item, agent) => { RedNetwork redNetwork = GameController.gameController.playerAgent.objectMult.gameObject.AddComponent(typeof(RedNetwork)) as RedNetwork; if (item.invItemCount > 0) // is recharging { agent.gc.audioHandler.Play(agent, "CantDo"); } else { thisAgent = agent; RandomEffect(); //InvItem newItem3 = GameController.gameController.playerAgent.inventory.AddItem("Giantizer", 2); /*List<Agent> players = new List<Agent>(); * foreach (Agent a in GameController.gameController.playerAgentList) * { * * players.Add(a); * Debug.Log("NetId: "+ a.objectNetID); * GameController.gameController.playerAgent.GetComponent<RedNetwork>().AddStatusEffectOthers("Giant", true, GameController.gameController.playerAgent, a, GameController.gameController.playerAgent.objectMult.IsFromClient(), true, -1); * //a.statusEffects.AddStatusEffect("Invisible", true, GameController.gameController.playerAgent, a.objectNetID, false, -1); * //GameController.gameController.playerAgent.statusEffects.AddStatusEffectSpecial("Invisible", a, GameController.gameController.playerAgent, false); * //a.gameObject.GetComponent<NetworkIdentity>().AssignClientAuthority(this.GetComponent<NetworkIdentity>().connectionToClient); * //a.objectMultAgent.CallCmdAddStatusEffectSpecial("Invisible", GameController.gameController.playerAgent.objectNetID, true, false, -1); * * }*/ //GameController.gameController.playerAgent.objectMultAgent.CallCmdAddStatusEffect("Invisible", GameController.gameController.playerAgent.objectNetID, true, false, -1); //GameController.gameController.playerAgent.statusEffects.AddStatusEffect("Invisible", true, GameController.gameController.playerAgent, GameController.gameController.playerAgent.objectNetID, false, -1); //GameController.gameController.hostPlayer.objectMultAgent.CallRpcAddStatusEffect("Invisible", GameController.gameController.hostPlayer.objectNetID,true, GameController.gameController.hostPlayer.objectMultAgent.IsFromClient(), false, -1); //GameController.gameController.playerAgent.objectMultAgent.AddStatusEffect("Invisible", true, GameController.gameController.playerAgent, GameController.gameController.hostPlayer.objectMultAgent.IsFromClient(), true, -1); agent.inventory.buffDisplay.specialAbilitySlot.MakeNotUsable(); // make special ability slot half-transparent item.invItemCount = 100; // 100 x 0.13f = 13 seconds to recharge // or you can replace 100 with 13, and 0.13 with 1 to make it simpler } }; randomAbility.RechargeInterval = (item, agent) => item.invItemCount > 0 ? new WaitForSeconds(0.01f) : null; randomAbility.Recharge = (item, agent) => { if (item.invItemCount > 0 && agent.statusEffects.CanRecharge()) { // if can recharge item.invItemCount--; if (item.invItemCount == 0) // ability recharged { agent.statusEffects.CreateBuffText("Recharged", agent.objectNetID); agent.gc.audioHandler.Play(agent, "Recharge"); agent.inventory.buffDisplay.specialAbilitySlot.MakeUsable(); // make special ability slot fully visible } } }; }