/// <summary> /// Removes divine shield from the minion if it has it and buff's the blood knight /// </summary> /// <param name="minion">The minion to remove divine shield from</param> private void RemoveDivineShieldAndBuffBloodKnight(BaseMinion minion) { if (minion == null) return; if (!minion.HasDivineShield) return; minion.RemoveStatusEffects(MinionStatusEffects.DIVINE_SHIELD); this.TakeBuff(BATTLECRY_POWER, BATTLECRY_POWER); }
/// <summary> /// Removes divine shield from the minion if it has it and buff's the blood knight /// </summary> /// <param name="minion">The minion to remove divine shield from</param> private void RemoveDivineShieldAndBuffBloodKnight(BaseMinion minion) { if (minion == null) { return; } if (!minion.HasDivineShield) { return; } minion.RemoveStatusEffects(MinionStatusEffects.DIVINE_SHIELD); this.TakeBuff(BATTLECRY_POWER, BATTLECRY_POWER); }
public static void OnMinionPlaced(BaseMinion minionPlaced) { if (!_minionPlacedListeners.Any()) { return; } // Listeners for this are called in the order in which they are played on the baord var sortedListeners = _minionPlacedListeners.OrderBy(kvp => kvp.Item1.TimePlayed).ToList(); foreach (var handler in sortedListeners.Select(kvp => kvp.Item2)) { handler(minionPlaced); } }
public static void OnMinionPlayed(BaseMinion minionPlayed) { // If a tree falls in a forest without any one listening... if (!_minionPlayedListeners.Any()) { return; } // Listeners for this are called in the order in which they were played on the board var sortedListeners = _minionPlayedListeners.OrderBy(kvp => kvp.Item1.TimePlayed).ToList(); foreach (var handler in sortedListeners.Select(kvp => kvp.Item2)) { handler(minionPlayed); } }
// Use this for initialization void Start() { minion = gameObject.GetComponent<BaseMinion>(); if(minion == null) Debug.Log("ERROR: BaseMinion script not found in this game object!"); else { minion.initMinion(); Debug.Log("minion initialized of name: " + minion.minionName); } dest = transform.position; if (_gameMap == null) { _gameMap = Map.createMap (); } _curNode = -1; _curPath = new List<Node> (); }
/// <summary> /// Summons a minion onto the board /// </summary> /// <param name="minion">The minion to summon</param> /// <param name="subTarget">The sub target for this card, usually for targetting battle cry spells</param> /// <param name="gameboardPos">The position on the gameboard to place the card. A value of -1 means play it in the next available slot</param> /// <param name="cardEffect">The card effect to use</param> /// <param name="forceSummoned">Whether or not to force summon the minion, this means no battle cry effects</param> /// <param name="cardSource">Where, if any, should we remove the card from</param> public void SummonMinion(BaseMinion minion, IDamageableEntity subTarget, int gameboardPos = -1, CardEffect cardEffect = CardEffect.NONE, bool forceSummoned = false, ICollection <BaseCard> cardSource = null) { var gameState = GameEngine.GameState; if (cardSource != null) { if (!cardSource.Contains(minion)) { throw new InvalidOperationException(string.Format("Card source doesn't contain {0}", minion)); } cardSource.Remove(minion); } // Check if there are too many minions on the board var playZone = gameState.CurrentPlayerPlayZone; var playZoneCount = playZone.Count(slot => slot != null); if (playZoneCount >= Constants.MAX_CARDS_ON_BOARD) { throw new InvalidOperationException(string.Format("There are too many cards ({0}) in the playzone!", playZoneCount)); } int summonPosition = gameboardPos; if (gameboardPos == -1) { summonPosition = GameEngine.GameState.CurrentPlayerPlayZone.Count(card => card != null); } // If there is a card already in the target gameboard position, shift everything to the right and place it there if (playZone[summonPosition] != null) { for (int i = playZone.Count - 1; i > gameboardPos; i--) { playZone[i] = playZone[i - 1]; } } // Place the minion on the board playZone[summonPosition] = minion; // Set the time the card was played minion.TimePlayed = DateTime.Now; // Start the minion as exhausted unless it has charge if (!minion.HasCharge) { minion.ApplyStatusEffects(MinionStatusEffects.EXHAUSTED); } minion.ResetAttacksThisTurn(); // Remove mana from the player if (!forceSummoned) { this.Mana -= minion.CurrentManaCost; } // Call the card's card effect var multiCard = minion as IMultiCardEffectMinion; if (multiCard != null && !forceSummoned) { multiCard.UseCardEffect(cardEffect, subTarget); } // Fire minion placed event if (!forceSummoned) { GameEventManager.MinionPlaced(minion); } // Register deathrattle if applicable var deathrattleCard = minion as IDeathrattler; if (deathrattleCard != null) { deathrattleCard.RegisterDeathrattle(); } if (!forceSummoned) { // call the card's battlecry var battlecryCard = minion as IBattlecry; if (battlecryCard != null) { if (subTarget is BaseMinion && ((BaseMinion)subTarget).IsStealthed) { throw new InvalidOperationException("Can't target stealthed minions"); } battlecryCard.Battlecry(subTarget); } } // Fire card played event GameEventManager.MinionPlayed(minion); }
/// <summary> /// Removes all deathrattles registered by the source card. /// </summary> /// <param name="source">The triggering card</param> public static void UnregisterDeathrattle(BaseMinion source) { GameEngine.Deathrattles.Remove(source); }