### Built-in Card Action Examples Source: https://context7.com/arefnue/nuedeck/llms.txt Reference implementations for standard Attack and Block actions. ```csharp // AttackAction - Deals damage modified by Strength public class AttackActionExample : CardActionBase { public override CardActionType ActionType => CardActionType.Attack; public override void DoAction(CardActionParameters actionParameters) { if (!actionParameters.TargetCharacter) return; var target = actionParameters.TargetCharacter; var self = actionParameters.SelfCharacter; // Calculate damage with Strength modifier var value = actionParameters.Value + self.CharacterStats.StatusDict[StatusType.Strength].StatusValue; target.CharacterStats.Damage(Mathf.RoundToInt(value)); if (FxManager != null) { FxManager.PlayFx(target.transform, FxType.Attack); FxManager.SpawnFloatingText(target.TextSpawnRoot, value.ToString()); } } } ``` ```csharp // BlockAction - Adds Block status modified by Dexterity public class BlockActionExample : CardActionBase { public override CardActionType ActionType => CardActionType.Block; public override void DoAction(CardActionParameters actionParameters) { var target = actionParameters.TargetCharacter ?? actionParameters.SelfCharacter; if (!target) return; var self = actionParameters.SelfCharacter; int blockValue = Mathf.RoundToInt( actionParameters.Value + self.CharacterStats.StatusDict[StatusType.Dexterity].StatusValue ); target.CharacterStats.ApplyStatus(StatusType.Block, blockValue); if (FxManager != null) FxManager.PlayFx(target.transform, FxType.Block); } } ``` -------------------------------- ### Initialize and Manage Card Piles with CollectionManager Source: https://context7.com/arefnue/nuedeck/llms.txt Demonstrates initializing the deck, drawing cards, accessing different card piles (draw, hand, discard, exhaust), and clearing piles. Call `SetGameDeck()` at combat start and `ClearPiles()` at combat end. ```csharp using NueGames.NueDeck.Scripts.Managers; using NueGames.NueDeck.Scripts.Data.Collection; using NueGames.NueDeck.Scripts.Card; using System.Collections.Generic; using UnityEngine; public class DeckController : MonoBehaviour { void Start() { CollectionManager collection = CollectionManager.Instance; // Initialize deck at combat start collection.SetGameDeck(); // Draw cards to hand collection.DrawCards(5); // Draw 5 cards // Access card piles List drawPile = collection.DrawPile; List handPile = collection.HandPile; List discardPile = collection.DiscardPile; List exhaustPile = collection.ExhaustPile; Debug.Log($ ``` -------------------------------- ### Accessing Encounter Information in C# Source: https://context7.com/arefnue/nuedeck/llms.txt Demonstrates how to access and iterate through stages, regular encounters, and boss encounters within EncounterData. Requires setup via Create > NueDeck > Containers > EncounterData. ```csharp using NueGames.NueDeck.Scripts.Data.Containers; using NueGames.NueDeck.Scripts.Data.Characters; using NueGames.NueDeck.Scripts.Enums; using System.Collections.Generic; using UnityEngine; // Create via: Create > NueDeck > Containers > EncounterData /* EncounterData Structure: - encounterRandomlyAtStage: If true, encounters are random; if false, sequential - enemyEncounterList: List of EnemyEncounterStage EnemyEncounterStage: - name: Stage name for editor - stageId: Numeric stage identifier - bossEncounterList: Boss fight encounters - enemyEncounterList: Regular encounters EnemyEncounter: - targetBackgroundType: Combat background to use - enemyList: List of EnemyCharacterData to spawn */ public class EncounterExample : MonoBehaviour { [SerializeField] private EncounterData encounterData; [SerializeField] private EnemyCharacterData goblin; [SerializeField] private EnemyCharacterData skeleton; [SerializeField] private EnemyCharacterData boss; void GetEncounterInfo() { // Check if encounters are random or sequential bool isRandom = encounterData.EncounterRandomlyAtStage; // Access stage list List stages = encounterData.EnemyEncounterList; foreach (EnemyEncounterStage stage in stages) { Debug.Log($"Stage {stage.StageId}: {stage.Name}"); // Regular encounters foreach (EnemyEncounter encounter in stage.EnemyEncounterList) { BackgroundTypes bg = encounter.TargetBackgroundType; List enemies = encounter.EnemyList; Debug.Log($" Encounter: {enemies.Count} enemies"); } // Boss encounters foreach (EnemyEncounter boss in stage.BossEncounterList) { Debug.Log($" Boss: {boss.EnemyList[0].CharacterName}"); } } // Get specific encounter int stageId = 0; int encounterId = 2; bool isFinalBoss = false; EnemyEncounter selectedEncounter = encounterData.GetEnemyEncounter( stageId, encounterId, isFinalBoss ); } void ProgressThroughEncounters() { GameManager game = GameManager.Instance; // Current progress int currentStage = game.PersistentGameplayData.CurrentStageId; int currentEncounter = game.PersistentGameplayData.CurrentEncounterId; bool isFinal = game.PersistentGameplayData.IsFinalEncounter; // Move to next encounter after victory game.NextEncounter(); // Set final encounter flag for boss game.PersistentGameplayData.IsFinalEncounter = true; // Change stage game.PersistentGameplayData.CurrentStageId = 1; game.PersistentGameplayData.CurrentEncounterId = 0; } } ``` -------------------------------- ### Manage Card Lifecycle and Combat Usage Source: https://context7.com/arefnue/nuedeck/llms.txt Demonstrates how to instantiate, configure, and execute card actions within the combat system. Requires access to GameManager and CombatManager instances. ```csharp using NueGames.NueDeck.Scripts.Card; using NueGames.NueDeck.Scripts.Data.Collection; using NueGames.NueDeck.Scripts.Characters; using System.Collections.Generic; using UnityEngine; public class CardUsageExample : MonoBehaviour { [SerializeField] private CardData cardData; [SerializeField] private Transform cardParent; void CreateAndUseCard() { // Build a card instance CardBase card = GameManager.Instance.BuildAndGetCard(cardData, cardParent); // Configure the card card.SetCard(cardData, isPlayable: true); // Access card state CardData data = card.CardData; bool isPlayable = card.IsPlayable; bool isInactive = card.IsInactive; // Not enough mana bool isExhausted = card.IsExhausted; // Update card text (reflects current modifiers) card.UpdateCardText(); // Set inactive state (grays out card when not enough mana) card.SetInactiveMaterialState(isInactive: true); } void PlayCardOnTarget(CardBase card, CharacterBase target) { CombatManager combat = CombatManager.Instance; // Use the card with combat context card.Use( self: combat.CurrentMainAlly, targetCharacter: target, allEnemies: combat.CurrentEnemiesList, allAllies: combat.CurrentAlliesList ); // Manual discard (normally handled by card system) card.Discard(); // Manual exhaust (removes card from combat) card.Exhaust(destroy: true); } } ``` -------------------------------- ### Initialize Game and Access Data with GameManager Source: https://context7.com/arefnue/nuedeck/llms.txt Accesses the GameManager singleton to retrieve gameplay settings, persistent data, and build card instances. Initializes game data and progresses to the next encounter. ```csharp using NueGames.NueDeck.Scripts.Managers; using NueGames.NueDeck.Scripts.Data.Collection; using UnityEngine; public class GameController : MonoBehaviour { void Start() { // Access the singleton instance GameManager gameManager = GameManager.Instance; // Get gameplay configuration settings int drawCount = gameManager.GameplayData.DrawCount; // Cards drawn per turn int maxMana = gameManager.GameplayData.MaxMana; // Maximum mana per turn int maxHandSize = gameManager.GameplayData.MaxCardOnHand; // Hand limit // Access persistent runtime data PersistentGameplayData persistentData = gameManager.PersistentGameplayData; int currentMana = persistentData.CurrentMana; int currentGold = persistentData.CurrentGold; int currentStage = persistentData.CurrentStageId; // Build a card instance from CardData ScriptableObject CardData attackCard = gameManager.GameplayData.AllCardsList[0]; Transform handTransform = FindObjectOfType().transform; CardBase newCard = gameManager.BuildAndGetCard(attackCard, handTransform); // Initialize a new game run gameManager.InitGameplayData(); gameManager.SetInitalHand(); // Progress to next encounter gameManager.NextEncounter(); } } ``` -------------------------------- ### Manage Cards in Hand with HandController Source: https://context7.com/arefnue/nuedeck/llms.txt Demonstrates adding, removing, and moving cards within the hand. Also shows how to enable, disable, and check the dragging state of cards. Assumes CardBase and GameManager are defined elsewhere. ```csharp using NueGames.NueDeck.Scripts.Collection; using NueGames.NueDeck.Scripts.Card; using System.Collections.Generic; using UnityEngine; public class HandExample : MonoBehaviour { [SerializeField] private HandController handController; void HandManagement() { // Access cards in hand List cardsInHand = handController.hand; Debug.Log($"Cards in hand: {cardsInHand.Count}"); // Add a card to hand (at end) CardBase newCard = GetCard(); handController.AddCardToHand(newCard); // Add card at specific index handController.AddCardToHand(newCard, index: 0); // Remove card from hand handController.RemoveCardFromHand(index: 0); // Move card within hand handController.MoveCardToIndex(currentIndex: 0, toIndex: 2); // Enable/disable card dragging handController.EnableDragging(); handController.DisableDragging(); // Check dragging state bool canDrag = handController.IsDraggingActive; } CardBase GetCard() { // Card creation example return GameManager.Instance.BuildAndGetCard( GameManager.Instance.GameplayData.AllCardsList[0], handController.drawTransform ); } void ConfigureHandLayout() { // HandController layout is configured in Inspector: // Card Settings: // - cardUprightWhenSelected: Stand card upright when hovered // - cardTilt: Tilt card based on mouse movement // Hand Settings: // - selectionSpacing: Space cards make for selected card // - curveStart/curveEnd: Bezier curve endpoints for hand arc // - handOffset: Position offset of hand area // - handSize: Size of valid hand area // References: // - discardTransform: Target for discard animation // - exhaustTransform: Target for exhaust animation // - drawTransform: Origin for draw animation // - selectableLayer: LayerMask for card selection // - targetLayer: LayerMask for play targets (enemies/allies) // - cam: Camera for raycasting } } ``` -------------------------------- ### Access Gameplay Settings Source: https://context7.com/arefnue/nuedeck/llms.txt Access static game settings like combat parameters, deck configurations, and player defaults from GameplayData. Ensure GameManager is initialized. ```csharp using NueGames.NueDeck.Scripts.Data.Settings; using NueGames.NueDeck.Scripts.Data.Collection; using NueGames.NueDeck.Scripts.Characters; using System.Collections.Generic; using UnityEngine; // Create GameplayData via: Create > NueDeck > Settings > GameplayData public class GameSettingsExample : MonoBehaviour { void AccessGameplaySettings() { GameManager game = GameManager.Instance; GameplayData settings = game.GameplayData; // Combat settings int cardsPerTurn = settings.DrawCount; // Default: 4 int maxMana = settings.MaxMana; // Default: 3 int handLimit = settings.MaxCardOnHand; // Maximum cards in hand // Deck settings DeckData startingDeck = settings.InitalDeck; List allCards = settings.AllCardsList; CardBase cardPrefab = settings.CardPrefab; // Player settings List startingAllies = settings.InitalAllyList; string defaultPlayerName = settings.DefaultName; bool useStages = settings.UseStageSystem; // Modifiers bool randomDeck = settings.IsRandomHand; int randomCardCount = settings.RandomCardCount; } void AccessRuntimeState() { PersistentGameplayData runtime = GameManager.Instance.PersistentGameplayData; // Mana management int currentMana = runtime.CurrentMana; int maxMana = runtime.MaxMana; runtime.CurrentMana = 2; // Set directly // Card selection state bool canSelect = runtime.CanSelectCards; bool canUse = runtime.CanUseCards; // Deck state List currentDeck = runtime.CurrentCardsList; int drawPerTurn = runtime.DrawCount; // Progression int gold = runtime.CurrentGold; int stageId = runtime.CurrentStageId; int encounterId = runtime.CurrentEncounterId; bool isFinalFight = runtime.IsFinalEncounter; // Party management List allies = runtime.AllyList; List healthData = runtime.AllyHealthDataList; // Modify runtime state runtime.CurrentGold += 50; // Gain gold runtime.DrawCount += 1; // Increase cards drawn per turn runtime.MaxMana += 1; // Increase mana // Add card to deck CardData newCard = GameManager.Instance.GameplayData.AllCardsList[0]; runtime.CurrentCardsList.Add(newCard); // Track ally health between combats runtime.SetAllyHealthData( id: "player_1", newCurrentHealth: 45, newMaxHealth: 80 ); } } ``` -------------------------------- ### Define Card Properties and Actions with CardData Source: https://context7.com/arefnue/nuedeck/llms.txt Shows how to access properties of a `CardData` ScriptableObject, such as name, cost, rarity, and sprite. Also demonstrates iterating through and accessing card action details like type, target, value, and delay. ```csharp using NueGames.NueDeck.Scripts.Data.Collection; using NueGames.NueDeck.Scripts.Enums; using UnityEngine; using System.Collections.Generic; // CardData ScriptableObject structure example: // [CreateAssetMenu(fileName = "Card Data", menuName = "NueDeck/Collection/Card")] /* Card Profile Settings: - id: Unique identifier string - cardName: Display name - manaCost: Mana required to play - cardSprite: Card artwork - rarity: Common, Uncommon, Rare, Legendary Action Settings: - usableWithoutTarget: Can be played without selecting a target - exhaustAfterPlay: Remove from deck after use - cardActionDataList: List of effects when played Each CardActionData contains: - cardActionType: Attack, Heal, Block, Draw, etc. - actionTargetType: Enemy, Ally, AllEnemies, AllAllies, RandomEnemy, RandomAlly - actionValue: Numeric value for the effect - actionDelay: Delay before action executes */ public class CardDataExample : MonoBehaviour { [SerializeField] private CardData exampleCard; void DisplayCardInfo() { // Access card properties string name = exampleCard.CardName; int cost = exampleCard.ManaCost; RarityType rarity = exampleCard.Rarity; Sprite artwork = exampleCard.CardSprite; bool canPlayWithoutTarget = exampleCard.UsableWithoutTarget; bool exhausts = exampleCard.ExhaustAfterPlay; // Access card actions List actions = exampleCard.CardActionDataList; foreach (CardActionData action in actions) { CardActionType type = action.CardActionType; ActionTargetType target = action.ActionTargetType; float value = action.ActionValue; float delay = action.ActionDelay; Debug.Log($"Action: {type}, Target: {target}, Value: {value}"); } // Update description dynamically (applies modifiers like Strength) exampleCard.UpdateDescription(); string description = exampleCard.MyDescription; } } ``` -------------------------------- ### Quadratic Bezier Curve Utilities Source: https://context7.com/arefnue/nuedeck/llms.txt Provides static methods for calculating points, tangents, and normals on a quadratic Bezier curve. Useful for animating elements along a curved path. ```csharp // Get point on quadratic bezier curve public static Vector3 GetCurvePoint(Vector3 a, Vector3 b, Vector3 c, float t) { t = Mathf.Clamp01(t); float oneMinusT = 1f - t; return (oneMinusT * oneMinusT * a) + (2f * oneMinusT * t * b) + (t * t * c); } ``` ```csharp // Get tangent (derivative) of curve public static Vector3 GetCurveTangent(Vector3 a, Vector3 b, Vector3 c, float t) { return 2f * (1f - t) * (b - a) + 2f * t * (c - b); } ``` ```csharp // Get normal perpendicular to curve public static Vector3 GetCurveNormal(Vector3 a, Vector3 b, Vector3 c, float t) { Vector3 tangent = GetCurveTangent(a, b, c, t); return Vector3.Cross(tangent, Vector3.forward); } ``` -------------------------------- ### Implement Custom Card Action Source: https://context7.com/arefnue/nuedeck/llms.txt Defines a new action type by inheriting from CardActionBase and implementing the required DoAction logic. ```csharp using NueGames.NueDeck.Scripts.Card; using NueGames.NueDeck.Scripts.Enums; using NueGames.NueDeck.Scripts.Managers; using UnityEngine; // Step 1: Add new action type to CardActionType enum // File: Scripts/Enums/CardActionType.cs /* public enum CardActionType { Attack, Heal, Block, IncreaseStrength, IncreaseMaxHealth, Draw, EarnMana, LifeSteal, Stun, Exhaust, PoisonAction // Add your new type } */ // Step 2: Create new action class namespace NueGames.NueDeck.Scripts.Card.CardActions { public class PoisonAction : CardActionBase { // Link to enum type public override CardActionType ActionType => CardActionType.PoisonAction; // Implement action logic public override void DoAction(CardActionParameters actionParameters) { // Validate target if (!actionParameters.TargetCharacter) return; // Get action parameters float value = actionParameters.Value; var target = actionParameters.TargetCharacter; var self = actionParameters.SelfCharacter; var cardData = actionParameters.CardData; var cardBase = actionParameters.CardBase; // Apply poison status target.CharacterStats.ApplyStatus( StatusType.Poison, Mathf.RoundToInt(value) ); // Play visual effects (access via inherited properties) if (FxManager != null) FxManager.PlayFx(target.transform, FxType.Poison); // Play sound effect if (AudioManager != null) AudioManager.PlayOneShot(cardData.AudioType); } } } ``` -------------------------------- ### Manage Character Health and Status Effects Source: https://context7.com/arefnue/nuedeck/llms.txt Demonstrates how to interact with the CharacterStats class to modify health, apply status effects, and subscribe to combat events. ```csharp using NueGames.NueDeck.Scripts.Characters; using NueGames.NueDeck.Scripts.Enums; using UnityEngine; using System.Collections.Generic; public class CharacterStatsExample : MonoBehaviour { void DemonstrateStats() { // CharacterStats is created when building a character // Example: new CharacterStats(maxHealth, characterCanvas) CombatManager combat = CombatManager.Instance; AllyBase player = combat.CurrentMainAlly; CharacterStats stats = player.CharacterStats; // Health management int maxHealth = stats.MaxHealth; int currentHealth = stats.CurrentHealth; bool isDead = stats.IsDeath; bool isStunned = stats.IsStunned; // Take damage (respects Block status) stats.Damage(10, canPierceArmor: false); // Take damage ignoring armor (e.g., poison) stats.Damage(5, canPierceArmor: true); // Heal (capped at max health) stats.Heal(15); // Increase max health stats.IncreaseMaxHealth(10); // Set specific health value stats.SetCurrentHealth(50); // Subscribe to events stats.OnDeath += () => Debug.Log("Character died!"); stats.OnHealthChanged += (current, max) => Debug.Log($"Health: {current}/{max}"); stats.OnHealAction += () => Debug.Log("Healed!"); stats.OnTakeDamageAction += () => Debug.Log("Took damage!"); stats.OnShieldGained += () => Debug.Log("Gained shield!"); } void DemonstrateStatusEffects() { CharacterStats stats = CombatManager.Instance.CurrentMainAlly.CharacterStats; // Access status dictionary Dictionary statuses = stats.StatusDict; // Available StatusTypes: None, Block, Poison, Strength, Dexterity, Stun // Apply status effect stats.ApplyStatus(StatusType.Strength, 3); // +3 Strength stats.ApplyStatus(StatusType.Block, 10); // +10 Block stats.ApplyStatus(StatusType.Poison, 5); // Apply 5 Poison stats.ApplyStatus(StatusType.Stun, 1); // Stun for 1 turn // Check status values StatusStats strengthStatus = stats.StatusDict[StatusType.Strength]; int strengthValue = strengthStatus.StatusValue; bool isActive = strengthStatus.IsActive; bool decreasesOverTurn = strengthStatus.DecreaseOverTurn; bool isPermanent = strengthStatus.IsPermanent; bool canNegativeStack = strengthStatus.CanNegativeStack; bool clearsNextTurn = strengthStatus.ClearAtNextTurn; // Clear specific status stats.ClearStatus(StatusType.Poison); // Clear all statuses stats.ClearAllStatus(); // Trigger all status effects (called at turn start) stats.TriggerAllStatus(); } } ``` -------------------------------- ### Implement Custom Enemy Actions Source: https://context7.com/arefnue/nuedeck/llms.txt Inherit from EnemyActionBase to define new enemy abilities. Ensure the action type is registered in the EnemyActionType enum before implementation. ```csharp using NueGames.NueDeck.Scripts.EnemyBehaviour; using NueGames.NueDeck.Scripts.Enums; using NueGames.NueDeck.Scripts.Managers; using UnityEngine; // Step 1: Add to EnemyActionType enum // File: Scripts/Enums/EnemyActionType.cs /* public enum EnemyActionType { Attack, Heal, Poison, Block, Debuff // Add new types here } */ // Step 2: Create action implementation namespace NueGames.NueDeck.Scripts.EnemyBehaviour.EnemyActions { public class EnemyDebuffAction : EnemyActionBase { public override EnemyActionType ActionType => EnemyActionType.Debuff; public override void DoAction(EnemyActionParameters actionParameters) { if (!actionParameters.TargetCharacter) return; var target = actionParameters.TargetCharacter; var self = actionParameters.SelfCharacter; var value = Mathf.RoundToInt(actionParameters.Value); // Apply weakness (negative strength) target.CharacterStats.ApplyStatus(StatusType.Strength, -value); if (FxManager != null) FxManager.PlayFx(target.transform, FxType.Debuff); } } // Built-in EnemyAttackAction example public class EnemyAttackActionExample : EnemyActionBase { public override EnemyActionType ActionType => EnemyActionType.Attack; public override void DoAction(EnemyActionParameters actionParameters) { if (!actionParameters.TargetCharacter) return; var target = actionParameters.TargetCharacter; var self = actionParameters.SelfCharacter; // Calculate damage with strength modifier var value = Mathf.RoundToInt( actionParameters.Value + self.CharacterStats.StatusDict[StatusType.Strength].StatusValue ); target.CharacterStats.Damage(value); if (FxManager != null) { FxManager.PlayFx(target.transform, FxType.Attack); FxManager.SpawnFloatingText(target.TextSpawnRoot, value.ToString()); } if (AudioManager != null) AudioManager.PlayOneShot(AudioActionType.Attack); } } } ``` -------------------------------- ### Manage Combat Flow and State with CombatManager Source: https://context7.com/arefnue/nuedeck/llms.txt Subscribes to combat turn events, accesses combat participants, and checks the current combat state. Highlights targets for card effects and manages mana. ```csharp using NueGames.NueDeck.Scripts.Managers; using NueGames.NueDeck.Scripts.Characters; using NueGames.NueDeck.Scripts.Enums; using UnityEngine; using System.Collections.Generic; public class CombatController : MonoBehaviour { void Start() { CombatManager combat = CombatManager.Instance; // Subscribe to turn events combat.OnAllyTurnStarted += HandleAllyTurnStart; combat.OnEnemyTurnStarted += HandleEnemyTurnStart; // Access current combat participants List enemies = combat.CurrentEnemiesList; List allies = combat.CurrentAlliesList; AllyBase mainPlayer = combat.CurrentMainAlly; // Check current combat state CombatStateType state = combat.CurrentCombatStateType; // States: PrepareCombat, AllyTurn, EnemyTurn, EndCombat // Get current encounter data EnemyEncounter encounter = combat.CurrentEncounter; // Highlight valid targets for card effects combat.HighlightCardTarget(ActionTargetType.Enemy); combat.HighlightCardTarget(ActionTargetType.AllEnemies); combat.HighlightCardTarget(ActionTargetType.Ally); // Remove highlights after card use combat.DeactivateCardHighlights(); // Gain mana during combat combat.IncreaseMana(1); } void HandleAllyTurnStart() { Debug.Log("Player turn started - cards drawn, mana restored"); } void HandleEnemyTurnStart() { Debug.Log("Enemy turn started - enemies execute actions"); } public void OnEndTurnButtonClicked() { // End player turn and trigger enemy turn CombatManager.Instance.EndTurn(); } } ``` -------------------------------- ### Accessing EnemyCharacterData Properties Source: https://context7.com/arefnue/nuedeck/llms.txt Demonstrates how to retrieve enemy stats, iterate through ability lists, and access action values from an EnemyCharacterData ScriptableObject. ```csharp using NueGames.NueDeck.Scripts.Data.Characters; using NueGames.NueDeck.Scripts.Data.Containers; using NueGames.NueDeck.Scripts.Enums; using NueGames.NueDeck.Scripts.Characters; using System.Collections.Generic; using UnityEngine; // Create via: Create > NueDeck > Characters > Enemy /* Enemy ScriptableObject Structure: CharacterDataBase (inherited): - characterID: Unique identifier - characterName: Display name - maxHealth: Starting health EnemyCharacterData specific: - enemyPrefab: Prefab to spawn in combat - followAbilityPattern: true = cycle through abilities, false = random - enemyAbilityList: List of EnemyAbilityData EnemyAbilityData structure: - name: Ability name for editor reference - intention: EnemyIntentionData (determines icon shown to player) - hideActionValue: Whether to show damage/block numbers - actionList: List of EnemyActionData to execute EnemyActionData structure: - actionType: Attack, Heal, Poison, Block - minActionValue: Minimum value (randomized) - maxActionValue: Maximum value (randomized) */ public class EnemyConfigExample : MonoBehaviour { [SerializeField] private EnemyCharacterData goblinData; void DisplayEnemyInfo() { // Basic info string id = goblinData.CharacterID; string name = goblinData.CharacterName; int health = goblinData.MaxHealth; EnemyBase prefab = goblinData.EnemyPrefab; // Get abilities List abilities = goblinData.EnemyAbilityList; foreach (EnemyAbilityData ability in abilities) { string abilityName = ability.Name; EnemyIntentionData intention = ability.Intention; EnemyIntentionType intentType = intention.EnemyIntentionType; // IntentionTypes: Attack, Defend, Buff, Debuff, Special List actions = ability.ActionList; foreach (EnemyActionData action in actions) { EnemyActionType actionType = action.ActionType; int value = action.ActionValue; // Randomized between min/max Debug.Log($"{abilityName}: {actionType} for {value}"); } } // Get ability based on pattern or random EnemyAbilityData nextAbility = goblinData.GetAbility(); EnemyAbilityData patternAbility = goblinData.GetAbility(usedAbilityCount: 2); } } ``` -------------------------------- ### Custom Enemy Implementation in C# Source: https://context7.com/arefnue/nuedeck/llms.txt Inherit from EnemyBase to create custom enemy types. Override methods like BuildCharacter, ActionRoutine, AttackRoutine, and OnDeath to define unique behaviors, animations, and effects. Ensure to handle base class calls and manage character stats and UI elements. ```csharp using NueGames.NueDeck.Scripts.Characters; using NueGames.NueDeck.Scripts.Data.Characters; using NueGames.NueDeck.Scripts.EnemyBehaviour; using System.Collections; using UnityEngine; // To create a new enemy type, inherit from EnemyBase namespace NueGames.NueDeck.Scripts.Characters.Enemies { public class CustomEnemy : EnemyBase { // EnemyBase provides: // - enemyCharacterData: ScriptableObject configuration // - enemyCanvas: UI for health/status/intention display // - NextAbility: The ability to execute this turn // - CharacterStats: Health and status management public override void BuildCharacter() { base.BuildCharacter(); // Custom initialization logic Debug.Log($"Spawned enemy: {EnemyCharacterData.CharacterName}"); } // Override action routines for custom behavior public override IEnumerator ActionRoutine() { // Check if stunned if (CharacterStats.IsStunned) yield break; // Hide intention icon during action EnemyCanvas.IntentImage.gameObject.SetActive(false); // Execute based on intention type if (NextAbility.Intention.EnemyIntentionType == EnemyIntentionType.Attack || NextAbility.Intention.EnemyIntentionType == EnemyIntentionType.Debuff) { yield return StartCoroutine(AttackRoutine(NextAbility)); } else { yield return StartCoroutine(BuffRoutine(NextAbility)); } } // Custom attack animation override protected override IEnumerator AttackRoutine(EnemyAbilityData targetAbility) { // Get random ally target var target = CombatManager.CurrentAlliesList.RandomItem(); // Move toward target var startPos = transform.position; var endPos = target.transform.position; // Animate movement (simplified) float timer = 0f; while (timer < 1f) { timer += Time.deltaTime * 5f; transform.position = Vector3.Lerp(startPos, endPos, timer); yield return null; } // Execute all actions in ability foreach (var action in targetAbility.ActionList) { EnemyActionProcessor.GetAction(action.ActionType) .DoAction(new EnemyActionParameters( action.ActionValue, target, this )); } // Return to start position timer = 0f; while (timer < 1f) { timer += Time.deltaTime * 5f; transform.position = Vector3.Lerp(endPos, startPos, timer); yield return null; } } protected override void OnDeath() { base.OnDeath(); // Custom death effects Debug.Log($"{EnemyCharacterData.CharacterName} was defeated!"); } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.