m |
m |
||
| Line 29: | Line 29: | ||
# `StartTargetingForSeek()`: Initiates the targeting process for the seek. | # `StartTargetingForSeek()`: Initiates the targeting process for the seek. | ||
# `GetAbilityTargets()`: Retrieves valid targets for the seek. | # `GetAbilityTargets()`: Retrieves valid targets for the seek. | ||
| + | # 'IsValidAbilityTarget`: Check valid target. | ||
# `DoSeek()`: Executes the seek action: | # `DoSeek()`: Executes the seek action: | ||
## `GameModel.RemoveDeck(ShadowEraCard card)`: Removes the card from the deck. | ## `GameModel.RemoveDeck(ShadowEraCard card)`: Removes the card from the deck. | ||
| Line 58: | Line 59: | ||
DoSeek(usedShadowEnergy: true); | DoSeek(usedShadowEnergy: true); | ||
} | } | ||
| + | // Handles the activation of the seek ability | ||
} | } | ||
| Line 75: | Line 77: | ||
} | } | ||
return true; | return true; | ||
| + | // Checks if the seek ability can be used | ||
} | } | ||
| Line 100: | Line 103: | ||
DeckListDisplay.abilityCard = parent; | DeckListDisplay.abilityCard = parent; | ||
DeckListDisplay.ShowDeck(GameModel.CurSide()); | DeckListDisplay.ShowDeck(GameModel.CurSide()); | ||
| + | // Initiates the targeting process for the seek | ||
} | } | ||
| Line 114: | Line 118: | ||
} | } | ||
return list; | return list; | ||
| + | // Retrieves valid targets for the seek. | ||
} | } | ||
private static bool IsValidAbilityTarget(ShadowEraCard check) | private static bool IsValidAbilityTarget(ShadowEraCard check) | ||
{ | { | ||
| − | return check.cardType == CardTypeEnum.Ally && check.cardSubType == CardSubTypeEnum.Aldmor; | + | return check.cardType == CardTypeEnum.Ally && check.cardSubType == CardSubTypeEnum.Aldmor; |
| + | // Check valid targets for ll041's ability example. | ||
} | } | ||
| Line 137: | Line 143: | ||
ShuffleOurDeck(); | ShuffleOurDeck(); | ||
targets.Clear(); | targets.Clear(); | ||
| + | // Executes the seek action | ||
} | } | ||
| Line 171: | Line 178: | ||
{ | { | ||
GameModel.ShuffleDeck(); | GameModel.ShuffleDeck(); | ||
| + | // Shuffles the deck after the seek is completed | ||
} | } | ||
</syntaxhighlight></small> | </syntaxhighlight></small> | ||


| |
|
|---|---|
|
|
| | |
| |
| | |
| This code is a collection of all the functions involved in the Seek mechanic, though it doesn't exist as a single block in any one file. | |
public override void OnUseAbility() { if (!isPartTwo) { if (!parent.IsDead()) { MoveToCastPosition(); GameModel.QueuePart2(parent); isPartTwo = true; } } else { isPartTwo = false; DoSeek(usedShadowEnergy: true); } // Handles the activation of the seek ability } public override bool CanUseAbility() { if (GameModel.isSimulating) { return false; } if (GameModel.DeckCount() == 0) { return false; } if (GameModel.HandCount() == GameModel.MaxHandSize()) { return false; } return true; // Checks if the seek ability can be used } public void StartTargetingForSeek() { ClearTargets(); MoveToCastPosition(); GameModel.UnhighlightCards(); GameModel.SetGameState(GameState.GameStateType.target); List<ShadowEraCard> abilityTargets = GetAbilityTargets(); for (int i = 0; i < GameModel.DeckCount(); i++) { ShadowEraCard deck = GameModel.GetDeck(i); if (abilityTargets.Contains(deck)) { GameModel.RemoveDeck(deck); i--; } } for (int j = 0; j < abilityTargets.Count; j++) { GameModel.AddDeck(abilityTargets[j]); } GameModel.HighlightCards(GetAbilityTargets()); DeckListDisplay.abilityCard = parent; DeckListDisplay.ShowDeck(GameModel.CurSide()); // Initiates the targeting process for the seek } public override List<ShadowEraCard> GetAbilityTargets() { List<ShadowEraCard> list = new List<ShadowEraCard>(); for (int i = 0; i < GameModel.DeckCount(); i++) { ShadowEraCard deck = GameModel.GetDeck(i); if (IsValidAbilityTarget(deck)) { list.Add(deck); } } return list; // Retrieves valid targets for the seek. } private static bool IsValidAbilityTarget(ShadowEraCard check) { return check.cardType == CardTypeEnum.Ally && check.cardSubType == CardSubTypeEnum.Aldmor; // Check valid targets for ll041's ability example. } public void DoSeek(bool usedShadowEnergy) { DeckListDisplay.CloseDeck(); if (targets.Count > 0 && GameModel.HandCount() < GameModel.MaxHandSize()) { GameModel.RemoveDeck(targets[0]); GameModel.ShowCardForPlayer(targets[0]); GameModel.AddHand(targets[0]); GameModel.OnSeek(targets[0]); } else { GameModel.OnSeek(null); } ShuffleOurDeck(); targets.Clear(); // Executes the seek action } public static void RemoveDeck(ShadowEraCard card) { // Code that handles removing a card from the deck } public static void ShowCardForPlayer(ShadowEraCard card) { if (!isSimulating && Gameplay.Instance != null) { Gameplay.Instance.UpdateHand(forceUpdate: true); Gameplay.Instance.ShowCard(card); Gameplay.Instance.BlockInput(2f); if (card.gameObject != null) { CoroutineManager.Start(_ShowCardForPlayer(card)); } } } public static void AddHand(ShadowEraCard card) { // Code that handles adding a card to the player's hand } public static void OnSeek(ShadowEraCard card) { // Handles additional effects or actions after the card is added to the hand } public void ShuffleOurDeck() { GameModel.ShuffleDeck(); // Shuffles the deck after the seek is completed } | |
Alan said: "Card effects take precedence over the game rules."`
|void PlayFaceDown(ShadowEraCard card, bool isSeeked) { if (isSeeked) { // Allow ShowCardForPlayer() to be invoked for Seeked cards ShowCardForPlayer(card); } else { // Keep the card face-down as usual (normal Trap behavior) KeepCardFaceDown(card); } } |