

Automatically position and scale status bars above the player's default health bar. No need to worry about other mods adding overlapping information above the player, so long as you are both using this system!
// Create and add a second health bar above the player
var statusBar = new GameObject("Status Bar", typeof(CustomHealthBar)).GetComponent<CustomHealthBar>();
player.AddStatusIndicator(statusBar.gameObject);
When registering a card you can set a custom two character abbreviation to be displayed in the card bar, simply do the following:
CustomCard.BuildCard<ExampleCard>(c => c.SetAbbreviation("Ex"));
PlayerHookSimply extend PlayerHook to define your custom behaviors then attach it to a player.
public class ExampleHooks : PlayerHook
{
override void OnJump()
{
UnityEngine.Debug.Log("Player jumped!");
}
public override IEnumerator OnBattleStart(IGameModeHandler gameModeHandler)
{
yield return new WaitForSeconds(5f);
UnityEngine.Debug.Log("The battle started 5 seconds ago!");
}
}
SimpleCardMake a card with fewer lines by extending SimpleCard instead of CustomCard!
using UnityEngine;
using ModsPlus;
public class ExampleCard : SimpleCard
{
public override CardDetails Details => new CardDetails
{
Title = "Example Card",
Description = "Your first effect card",
ModName = "<Your Mod ID>",
Art = Assets.YourCoolArt,
Rarity = CardInfo.Rarity.Common,
Theme = CardThemeColor.CardThemeColorType.TechWhite
};
public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
{
statModifiers.health = 0.5f;
gun.damage = 2f;
}
protected override void Added(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
Debug.Log("Card added to the player!");
}
protected override void Removed(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
Debug.Log("Card removed from the player!");
}
}
CardEffect wrapperDo you find yourself writing the same boilerplate over and over when defining cards that attach a MonoBehaviour to the player?
Are you tired of writing the same code for registering and deregistering actions (such as Block::BlockAction or Gun::ShootProjectileAction) repeatedly?
If so, then this is the library for you.
All actions will be automatically registered and deregistered when the card is added or removed, so you can focus on your cool features!
using UnityEngine;
using ModsPlus;
public class ExampleCard : CustomEffectCard<ExampleEffect>
{
public override CardDetails Details => new CardDetails
{
Title = "Example Card",
Description = "Your first effect card",
ModName = "<Your Mod ID>",
Art = Assets.YourCoolArt,
Rarity = CardInfo.Rarity.Common,
Theme = CardThemeColor.CardThemeColorType.TechWhite
};
}
public class ExampleEffect : CardEffect
{
public override void OnBlock(BlockTrigger.BlockTriggerType trigger)
{
Debug.Log("[ExampleEffect] Player blocked!");
}
public override void OnShoot(GameObject projectile)
{
Debug.Log("[ExampleEffect] Player fired a shot!");
}
}
Once defined you can register this card as you normally would:
CustomCard.BuildCard<ExampleCard>();
For additional overrides check your IDE's auto-complete, or view the source code
This interface allows you to easily create selectors on players and react when the user clicks one (think Cards+ "Adware" or "Quickhack" abilities for reference)
/* make selectors on a specific player */
int playerID; // ID of any specific player
var targets = PlayerManager.instance.players.Where(p => p.playerID == playerID);
PlayerSelector.InstantiateOn(Assets.SingleTargetSelector, targets, selectedPlayer =>
{
Debug.Log($"Friendly with ID {selectedPlayer.playerID} selected!");
});
/* make selectors on friends */
PlayerSelector.InstantiateOnFriendlies(Assets.FriendlySelector, selectedPlayer =>
{
Debug.Log($"Friendly with ID {selectedPlayer.playerID} selected!");
});
/* make selectors on enemies */
PlayerSelector.InstantiateOnEnemies(Assets.EnemySelector, selectedPlayer =>
{
Debug.Log($"Enemy with ID {selectedPlayer.playerID} selected!");
});
The GameObject provided to the utility will be instantiated as a child of each target. It can contain any effects (particles, etc.) you wish, but must have some type of Collider3D on it for clicks to be detected
This component provides a wrapper around the base game's HealthBar class, giving you full control of the values to display and when to update them.
GameObject target; // any GameObject you wish to add a health bar to
float startingHp = 100;
float startingMaxHp = 100;
// create the health bar
var healthBar = target.AddComponent<CustomHealthBar>();
// set initial values
healthBar.SetValues(startingHp, startingMaxHp);
// take 10 damage
healthBar.CurrentHealth -= 10;
OnPlayerPickStart and OnPlayerPickEnd respectivelyAddStatusIndicator extension method for PlayerCustomHealthBar color can now be easily customizedCardInfo for setting a custom abbreviation to be displayed in the CardBarButtonVisibleFrom extension methods to PlayerAwake method in PlayerHook overridableStatChanges serializable by the Unity inspectorPlayerHook classMaxHealth changes using StatManager not properly scaling current healthOnBulletHit and OnBulletHitCoroutine events to CardEffectStatManager using the wrong stat for jump countCardEffectStatManager beta for simple-inline declaration of ReversibleEffectsSimpleCard