public void EndBattleTurn() { QueuedActions.ImmediateAction("EndBattleTurn", () => { turnEndActions.EndTurn(); }); }
public void AddStickerToCard(AbstractCard card, AbstractCardSticker stickerToAdd) { QueuedActions.ImmediateAction("AddStickerToCard", () => { card.AddSticker(stickerToAdd); }); }
public void Advance(AbstractBattleUnit unit) { QueuedActions.ImmediateAction("Advance", () => { unit.StatusEffects.Add(new AdvancedStatusEffect()); }); }
public void UpgradeCard(AbstractCard card) { QueuedActions.ImmediateAction("UpgradeCard", () => { card.Upgrade(); }); }
public void CheckIsBattleOver() { QueuedActions.ImmediateAction("CheckIsBattleOver", () => { BattleRules.CheckIsBattleOverAndIfSoSwitchScenes(); }); }
public void TickDownStatusEffect <T>(AbstractBattleUnit unit) where T : AbstractStatusEffect { QueuedActions.ImmediateAction("TickDownStatusEffect", () => { unit.TickDownStatusEffect <T>(); }); }
internal void CreateCardToBattleDeckDiscardPile(AbstractCard abstractCard, AbstractBattleUnit owner = null, CardCreationLocation location = CardCreationLocation.SHUFFLE, QueueingType queueingType = QueueingType.TO_BACK) { Require.NotNull(abstractCard); abstractCard.Owner = owner; QueuedActions.ImmediateAction("CreateCardToBattleDeckDiscardPile", () => { BattleRules.MarkCreatedCard(abstractCard, owner); if (location == CardCreationLocation.BOTTOM) { ServiceLocator.GameState().Deck.DiscardPile.Add(abstractCard); } else if (location == CardCreationLocation.TOP) { ServiceLocator.GameState().Deck.DiscardPile.AddToFront(abstractCard); } else if (location == CardCreationLocation.SHUFFLE) { ServiceLocator.GameState().Deck.DiscardPile.InsertIntoRandomLocation(abstractCard); } else { throw new Exception("gotta select a location"); } }, queueingType); }
/* * This doesn't really make sense anymore, since we're not doing this in combat. * public void PromptPossibleUpgradeOfCard(AbstractCard beforeCard, int? cost = null) * { * QueuedActions.ImmediateAction(() => * { * var afterCard = beforeCard.CopyCard(); * afterCard.Upgrade(); * CardModificationDisplayScreen.Instance.Show( * afterCard: afterCard, * beforeCard: beforeCard, * message: "Upgrade card?", * goldCost: cost * ); * }); * } */ public void RemoveStatusEffect <T>(AbstractBattleUnit unit) where T : AbstractStatusEffect { QueuedActions.ImmediateAction("RemoveStatusEffect", () => { unit.StatusEffects.RemoveAll(item => item.GetType() == typeof(T)); }); }
public void KillUnit(AbstractBattleUnit unit) { QueuedActions.ImmediateAction("KillUnit", () => { unit.CurrentHp = 0; BattleRules.CheckAndRegisterDeath(unit, null, null); }); }
public void DiscardCard(AbstractCard protoCard, QueueingType queueingType = QueueingType.TO_BACK) { QueuedActions.ImmediateAction("DiscardCard", () => { gameState.Deck.MoveCardToPile(protoCard, CardPosition.DISCARD); ServiceLocator.GetCardAnimationManager().MoveCardToDiscardPile(protoCard, assumedToExistInHand: false); }, queueingType); }
public void ChangeUnit(AbstractBattleUnit unit, Action <AbstractBattleUnit> action) { Require.NotNull(unit); QueuedActions.ImmediateAction("ChangeUnit", () => { action(unit); }); }
public void FallBack(AbstractBattleUnit unit) { QueuedActions.ImmediateAction("FallBack", () => { if (unit.HasStatusEffect <AdvancedStatusEffect>()) { unit.RemoveStatusEffect <AdvancedStatusEffect>(); } }); }
public void ApplyDefense(AbstractBattleUnit target, AbstractBattleUnit source, int baseQuantity) { QueuedActions.ImmediateAction("ApplyDefense", () => { target.CurrentBlock += BattleRules.GetDefenseApplied(source, target, baseQuantity); if (target.CurrentBlock < 0) { target.CurrentBlock = 0; } }); }
public void DiscardHand() { QueuedActions.ImmediateAction("DiscardHand", () => { var hand = ServiceLocator.GameState().Deck.Hand.ToList(); foreach (var card in hand) { DiscardCard(card); } }); }
public void DrawCards(int n = 1, QueueingType queueingType = QueueingType.TO_BACK, Action <List <AbstractCard> > performOnCards = null) { QueuedActions.ImmediateAction("DrawCards", () => { var cardsToPutInHand = deck.DrawNextNCards(n); ServiceLocator.GetCardAnimationManager().AddHypercardsToHand(cardsToPutInHand.Select(item => item.CreateHyperCard()).ToList()); if (performOnCards != null) { performOnCards(cardsToPutInHand); } }, queueingType); }
/// <summary> /// Rules for taunting: /// It sets all attacks getting made to the taunter. /// </summary> public void TauntEnemy(AbstractBattleUnit target, AbstractBattleUnit source) { QueuedActions.ImmediateAction("TauntEnemy", () => { var eligibleAttackIntents = target.CurrentIntents.Where(item => item is SingleUnitAttackIntent); foreach (var intent in eligibleAttackIntents) { // remove one unit from list (which should be all of them, since these are single-unit-attack-intents), add source intent.UnitsTargeted.RemoveAt(0); intent.UnitsTargeted.Add(source); } }); }
internal void CreateCardToHand(AbstractCard abstractCard, AbstractBattleUnit owner = null, QueueingType queueingType = QueueingType.TO_BACK) { Require.NotNull(abstractCard); abstractCard.Owner = owner; QueuedActions.ImmediateAction("CreateCardToHand", () => { BattleRules.MarkCreatedCard(abstractCard, owner); ServiceLocator.GameState().Deck.Hand.Add(abstractCard); ServiceLocator.GetCardAnimationManager().AddHypercardsToHand(new List <Card> { abstractCard.CreateHyperCard() }); }, queueingType); }
internal void PurgeCardFromDeck(AbstractCard card, QueueingType queueingType = QueueingType.TO_BACK) { Require.NotNull(card); QueuedActions.ImmediateAction("PurgeCardFromDeck", () => { var position = deck.PurgeCardFromDeck(card.Id); if (position == CardPosition.HAND) { // Animate dissolving var movement = ServiceLocator.GetCardAnimationManager().GetCardMovementBehavior(card); movement.DissolveAndDestroyCard(() => { }); ServiceLocator.GetCardAnimationManager().RemoveHypercardFromHand(card); } }, queueingType); }
public void AddCardToPersistentDeck(AbstractCard protoCard, AbstractBattleUnit unit, QueueingType queueingType = QueueingType.TO_BACK) { QueuedActions.ImmediateAction("AddCardToPersistentDeck", () => { var persistentDeckList = unit.CardsInPersistentDeck; if (persistentDeckList.Where(item => item.Id == protoCard.Id).Any()) { throw new Exception("Attempted to add card to deck that already had the same ID as a card in the deck already: " + protoCard.Name); } unit.AddCardToPersistentDeck(protoCard); Debug.Log("Added card to deck: " + protoCard.Name); // ServiceLocator.GetCardAnimationManager().RunCreateNewCardAndAddToDiscardPileAnimation(protoCard); //todo // Animate: Card created in center of screen, wait for a second, and shrinks while going down to the deck. }, queueingType); }
public void PerformAdvanceActionIfPossible(AbstractBattleUnit unit) { QueuedActions.ImmediateAction("PerformAdvanceActionIfPossible", () => { if (gameState.energy > 0) { gameState.energy--; } else { EnergyIcon.Instance.Flash(); Shout(unit, "Not enough energy!"); return; } unit.StatusEffects.Add(new AdvancedStatusEffect()); }); }
public void Shout(AbstractBattleUnit unit, string stuffToSay) { QueuedActions.ImmediateAction("Shout", () => { var speechBubbleText = unit.CorrespondingPrefab.SpeechBubbleText; var bubbleImg = unit.CorrespondingPrefab.SpeechBubble; bubbleImg.gameObject.AddComponent <AppearDisappearImageAnimationPrefab>(); var appearDisappearPrefab = bubbleImg.gameObject.GetComponent <AppearDisappearImageAnimationPrefab>(); appearDisappearPrefab.Begin(thingToDoAfterFadingIn: () => { speechBubbleText.gameObject.SetActive(true); speechBubbleText.SetText(stuffToSay); }, thingToDoBeforeFadingOut: () => { speechBubbleText.gameObject.SetActive(false); }); ParticleSystemSpawner.Instance.PlaceParticleSystem( ProtoParticleSystem.GreenSlash, unit.CorrespondingPrefab.transform as RectTransform ); }); }
public void ApplyStatusEffect(AbstractBattleUnit unit, AbstractStatusEffect attribute, int stacks = 1) { if (unit == null) { throw new Exception("No unit specified"); } if (attribute == null) { throw new Exception("No attribute specified"); } if (stacks == 0) { return; } QueuedActions.ImmediateAction("ApplyStatusEffect", () => { unit.ApplyStatusEffect(attribute, stacks); }); }
public void PushActionToBack(string nameOfAction, Action action) { QueuedActions.ImmediateAction("PushActionToBack_" + nameOfAction, action, QueueingType.TO_BACK); }
public void ForceSwapIntents_RightNow(AbstractBattleUnit target, List <AbstractIntent> newIntents) { QueuedActions.ImmediateAction("ForceSwapIntents", () => { target.CurrentIntents = newIntents; }); }
public void OnceFinished(Action action) { QueuedActions.ImmediateAction("OnceFinished", action); }
public void ForceSwapIntents_NextTurn(AbstractBattleUnit target, List <AbstractIntent> newIntents) { QueuedActions.ImmediateAction("ForceSwapIntents_NextTurn", () => { target.NextIntentOverride = newIntents; }); }