public void AttemptPlayCardFromHand(AbstractCard logicalCard, AbstractBattleUnit target, QueueingType queueingType = QueueingType.TO_BACK ) { QueuedActions.DelayedActionWithCustomTrigger("Attempt play card from hand: " + logicalCard.Name, () => { IsCurrentActionFinished = true; if (logicalCard != null) { if (!logicalCard.CanPlay(target).Playable) { Shout(logicalCard.Owner, logicalCard.CanPlay(target).ReasonUnplayable); } else { RunCardEvocationSpecialEffects(logicalCard, target); logicalCard.PlayCardFromHandIfAble_Action(target); } } else { throw new System.Exception("Could not deploy card! None selected."); } CheckIsBattleOver(); }, queueingType); }
public void EvokeCardEffect(AbstractCard card, AbstractBattleUnit target, QueueingType queuingType = QueueingType.TO_BACK) { QueuedActions.DelayedActionWithCustomTrigger("Evoke card effect", () => { RunCardEvocationSpecialEffects(card, target); card.EvokeCardEffect(target); } ); }
// I should probably stop using the action manager for campaign actions public void PromptCardReward(AbstractBattleUnit soldier) { var soldierClass = soldier.SoldierClass; soldier.NumberCardRewardsEligibleFor--; var cardsThatCanBeSelected = soldierClass.GetCardRewardChoices(); QueuedActions.DelayedActionWithCustomTrigger("Choose New Card For Deck", () => { CardRewardScreen.Instance.Show(cardsThatCanBeSelected, soldier); }); }
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 void AttackUnitForDamage(AbstractBattleUnit targetUnit, AbstractBattleUnit sourceUnit, int baseDamageDealt, AbstractCard cardPlayed) { Require.NotNull(targetUnit); QueuedActions.DelayedActionWithCustomTrigger("AttackUnitForDamage_ShakeUnit", () => { if (targetUnit.IsDead || sourceUnit.IsDead) { // do nothing if it's already dead IsCurrentActionFinished = true; return; } targetUnit.CorrespondingPrefab.gameObject.AddComponent <ShakePrefab>(); var shakePrefab = targetUnit.CorrespondingPrefab.gameObject.GetComponent <ShakePrefab>(); shakePrefab.Begin(() => { IsCurrentActionFinished = true; }); targetUnit.CorrespondingPrefab.FlickerFeedbacks.PlayFeedbacks(); BattleRules.ProcessDamageWithCalculatedModifiers(sourceUnit, targetUnit, cardPlayed, baseDamageDealt); }); }
public void DamageUnitNonAttack(AbstractBattleUnit targetUnit, AbstractBattleUnit nullableSourceUnit, int baseDamageDealt) { if (targetUnit == null) { return; } QueuedActions.DelayedActionWithCustomTrigger("DamageUnitNonAttack_ShakeUnit", () => { if (targetUnit.IsDead) { // do nothing if it's already dead IsCurrentActionFinished = true; return; } targetUnit.CorrespondingPrefab.gameObject.AddComponent <ShakePrefab>(); var shakePrefab = targetUnit.CorrespondingPrefab.gameObject.GetComponent <ShakePrefab>(); shakePrefab.Begin(() => { IsCurrentActionFinished = true; }); targetUnit.CorrespondingPrefab.FlickerFeedbacks.PlayFeedbacks(); BattleRules.ProcessDamageWithCalculatedModifiers(nullableSourceUnit, targetUnit, nullableCardPlayed: null, baseDamage: baseDamageDealt, isAttack: false); }); }
public void AddToBack(BasicDelayedAction action) { QueuedActions.DelayedActionWithCustomTrigger(action.ActionId, action.onStart, queueingType: QueueingType.TO_BACK); }
public void AddToFront(BasicDelayedAction action) { QueuedActions.DelayedActionWithCustomTrigger(action.ActionId, action.onStart, queueingType: QueueingType.TO_FRONT); }