public void NextTurn() { em.TriggerEvent(new EventTurnEnd(tm.GetCurrentCharacter())); tm.GetCurrentCharacter().EndTurn(); // Run end-of-turn function for current character. tm.NextCharacter(); // Switch characters. this.numCardsPlayedThisTurn = 0; this.cardsPlayedThisTurn.Clear(); tm.GetCurrentCharacter().StartTurn(); // Run start-of-turn function for new character. em.TriggerEvent(new EventTurnStart(tm.GetCurrentCharacter())); if (tm.GetCurrentCharacter().FACTION == FactionType.ENEMY) // TODO: AI coding, but for now just call this function over again. { foreach (EnemyIntent intent in enemy.intents) { intent.Resolve(); } this.NextTurn(); } else { AbstractEnemy enemy = (AbstractEnemy)tm.GetOtherCharacter(tm.GetCurrentCharacter()); enemy.CalculateIntents(); foreach (EnemyIntent intent in enemy.intents) { Debug.Log($"The enemy intends to play {intent.cardToPlay} on {intent.argumentTargeted}"); } renderer.Redraw(); this.round += 1; } }
// Clean up should be done in the EndNegotiationLost/EndNegotiationWon functions. // Get the player and enemy from the turn manager. Deep-copy their permadecks to their draw pile. public void StartNegotiation(RenderNegotiation renderer, AbstractEnemy enemyChar, RewardType rewardsOnWin = RewardType.NORMAL) { this.player = (GameState.mainChar == null) ? new PlayerDeckard() : GameState.mainChar; // null check for player - if null, use Deckard as base this.enemy = (enemyChar == null) ? new TestEnemy() : this.enemy; // null check for enemy - if null, use TestEnemy as base this.rewardsOnWin = rewardsOnWin; tm.AddToTurnList(player); tm.AddToTurnList(enemy); this.renderer = renderer; em.ClearAllSubscribers(); em.SubscribeToEvent(this, EventType.CARD_PLAYED); // Subscribe to CARD_PLAYED event to perform all post-card play processing (ambience shift, adjusting global values, etc.) em.SubscribeToEvent(this, EventType.ARGUMENT_DESTROYED); // Subscribe to ARGUMENT_DESTROYED event to perform enemy intent recalculations whenever an argument is destroyed Debug.Log("NegotiationManager.cs: Performing deep copy of deck contents for enemy and player."); DeepCopyDeck(player); DeepCopyDeck(enemy); this.player.curAP = player.maxAP; this.enemy.curAP = enemy.maxAP; this.enemy.coreArgument.curHP = this.enemy.coreArgument.maxHP; player.Draw(5); enemy.Draw(5); player.coreArgument.TriggerOnDeploy(); enemy.coreArgument.TriggerOnDeploy(); em.TriggerEvent(new EventTurnStart(tm.GetCurrentCharacter())); Debug.Log("Negotiation begins!"); enemy.CalculateIntents(); // foreach(EnemyIntent intent in enemy.intents){ // Debug.Log($"The enemy intends to play {intent.cardToPlay} on {intent.argumentTargeted}"); // } }