public static void CheckAndRegisterDeath(AbstractBattleUnit unit, AbstractBattleUnit nullableUnitThatKilledMe, AbstractCard cardUsedIfAny)
    {
        if (unit.HasDied)
        {
            /// stopping this from triggering more than once on a unit
            return;
        }

        if (unit.CurrentHp <= 0)
        {
            unit.HasDied = true;
            ActionManager.Instance.TriggerUnitKilledFeedback(unit);

            foreach (var effect in unit.StatusEffects)
            {
                effect.OnDeath(nullableUnitThatKilledMe, cardUsedIfAny);
            }

            BattleRules.TriggerProc(new CharacterDeathProc {
                CharacterDead = unit
            });

            foreach (var card in GameState.Instance.Deck.TotalDeckList)
            {
                if (card.Owner == unit)
                {
                    // we always exhaust all cards owned by dead people.
                    ActionManager.Instance.ExhaustCard(card);
                }
            }
        }
    }
    public void Slay(AbstractCard damageSource, AbstractBattleUnit target)
    {
        var slew = SlayInner(damageSource, target);

        if (slew)
        {
            BattleRules.TriggerProc(new LethalTriggerProc());
        }
    }
 public static void Sly(this AbstractCard card, Action thingToDo)
 {
     if (state.Deck.Hand.Count < 3)
     {
         thingToDo();
         BattleRules.TriggerProc(new SlyProc {
             TriggeringCardIfAny = card
         });
     }
 }
 public static void Inferno(this AbstractCard card, Action thingToDo)
 {
     var burningEnemy = state.EnemyUnitsInBattle.Any(enemy => !enemy.IsDead && enemy.HasStatusEffect <BurningStatusEffect>());
     {
         thingToDo();
         BattleRules.TriggerProc(new InfernoProc {
             TriggeringCardIfAny = card
         });
     }
 }
        public static void Brute(this AbstractCard card, Action thingToDo)
        {
            var cost3Card = state.Deck.Hand.FirstOrDefault(c => c.BaseEnergyCost() == 3);

            if (cost3Card != null)
            {
                thingToDo();
                BattleRules.TriggerProc(new BruteProc {
                    TriggeringCardIfAny = card
                });
            }
        }
Exemple #6
0
 public void ExhaustCard(AbstractCard protoCard, QueueingType queueingType = QueueingType.TO_BACK)
 {
     QueuedActions.DelayedActionWithCustomTrigger("ExhaustCard", () => {
         gameState.Deck.MoveCardToPile(protoCard, CardPosition.EXPENDED);
         ServiceLocator.GetCardAnimationManager().DisappearCard(protoCard, assumedToExistInHand: false, callbackWhenFinished: () =>
         {
             IsCurrentActionFinished = true;
         });
         BattleRules.TriggerProc(new ExhaustedCardProc {
             TriggeringCardIfAny = protoCard
         });
     }, queueingType);
 }
        public static void Liquidate(this AbstractCard card, Action thingToDo)
        {
            var firstRareCard = state.Deck.Hand.FirstOrDefault(item => item.Rarity == Rarity.RARE && item != card);

            if (firstRareCard != null)
            {
                thingToDo();

                action.ExhaustCard(firstRareCard);
                BattleRules.TriggerProc(new LiquidateProc {
                    TriggeringCardIfAny = card
                });
            }
        }
        public static void Sacrifice(this AbstractCard card, Action thingToDo)
        {
            var sacrificableCard = state.Deck.Hand.FirstOrDefault(item => item != card);

            if (sacrificableCard != null)
            {
                sacrificableCard.Action_Exhaust();
                action.ApplyStress(sacrificableCard.Owner, 6);
                BattleRules.TriggerProc(new SacrificeProc {
                    TriggeringCardIfAny = card
                });
                thingToDo();
            }
        }