public async Task <VoidAppResult> EndTurn(Guid gameId, CancellationToken cancellationToken = default(CancellationToken)) { var game = await this.dbContext.Games.IncludeEntities().IncludeUserParticipations().SingleOrDefaultAsync(_ => _.Id == gameId, cancellationToken); if (game == null) { return(VoidAppResult.Error(ErrorPreset.OnLoadingData)); } var move = new Move { Date = DateTime.Now, Type = MoveType.EndTurn, Game = game, SourceEntity = game.Entities.Single(_ => _.User.Mail == this.loginManager.LoggedInUser.Mail && _ is Player) }; await this.dbContext.Moves.AddAsync(move, cancellationToken); var drawCardResult = await this.cardService.DrawCard(game, game.UserParticipations.SingleOrDefault(_ => _.Mail != this.loginManager.LoggedInUser.Mail).Mail, 2); if (drawCardResult.IsErrorResult) { return(drawCardResult); } await this.dbContext.SaveChangesAsync(cancellationToken); return(VoidAppResult.Success()); }
public async Task <VoidAppResult> Attack(Guid gameId, DtoAttackMove move, CancellationToken cancellationToken = default(CancellationToken)) { var game = await this.dbContext.Games.SingleOrDefaultAsync(_ => _.Id == gameId, cancellationToken); var attacker = await this.dbContext.GameCards.IncludeCards().SingleOrDefaultAsync(_ => _.Id == move.AttackerId); var target = await this.dbContext.GameCards.IncludeCards().SingleOrDefaultAsync(_ => _.Id == move.TargetId); if (game == null || attacker == null || target == null) { return(VoidAppResult.Error(ErrorPreset.OnLoadingData)); } var attackerDtoCardResult = await this.GetDtoCardsFromGameCards(new List <GameCard> { attacker }, gameId); if (attackerDtoCardResult.IsErrorResult) { return(attackerDtoCardResult.GetVoidAppResult()); } if (!attackerDtoCardResult.SuccessReturnValue.First().CanAttack) { return(VoidAppResult.Error(AppActionResultType.RuleError, "This card has already attacked in this turn.")); } var dbMove = new Move { Date = DateTime.Now, Game = game, Type = MoveType.Attack, SourceEntity = attacker, TargetEntities = new List <MoveTargetEntity> { new MoveTargetEntity { Entity = target } } }; target.Health -= attacker.Card.Attack + attacker.StatModifiersCount; attacker.Health -= target.Card.Attack + target.StatModifiersCount; if (attacker.Health <= 0) { attacker.CardLocation = CardLocation.OutOfPlay; } if (target.Health <= 0) { target.CardLocation = CardLocation.OutOfPlay; } await this.dbContext.Moves.AddAsync(dbMove, cancellationToken); await this.dbContext.SaveChangesAsync(cancellationToken); return(VoidAppResult.Success()); }
protected Task <VoidAppResult> ConfigureDtoEffect(CardEffect cardEffect, DtoEffect dtoEffect, string effectPrefix, string effectSuffix) { var parameters = JsonConvert.DeserializeObject <TargetingEffectParameters>(cardEffect.EffectParameters); dtoEffect.TargetsCount = parameters.TargetingType == TargetingType.NumberOfTargets ? Convert.ToInt32(parameters.TargetParameter) : 0; switch (parameters.TargetingType) { case TargetingType.Title: dtoEffect.Description = $"{effectPrefix}all cards with the title '{parameters.TargetParameter}'{effectSuffix}."; break; case TargetingType.CharacterName: dtoEffect.Description = $"{effectPrefix}all '{parameters.TargetParameter}'{effectSuffix}."; break; default: // TargetingType.NumberOfTargets dtoEffect.Description = $"{effectPrefix}{parameters.TargetParameter} cards{effectSuffix}."; break; } return(Task.FromResult(VoidAppResult.Success())); }
public async Task <VoidAppResult> InitializeGame(Game game) { foreach (var participation in game.UserParticipations) { var cards = new List <GameCard>(); foreach (var card in this.dbContext.Cards) { var cardResult = await this.CreateGameCard(card.Id, participation.User, card.IsLegendary? 1 : 7); if (cardResult.IsErrorResult) { return(cardResult.GetVoidAppResult()); } cards.AddRange(cardResult.SuccessReturnValue); game.Entities.AddRange(cardResult.SuccessReturnValue); } var handCardIndizes = new List <int>(); var random = new Random(); while (handCardIndizes.Count < 3) { var newIndex = random.Next(cards.Count); if (handCardIndizes.Contains(newIndex)) { continue; } cards[newIndex].CardLocation = CardLocation.Hand; handCardIndizes.Add(newIndex); } } return(VoidAppResult.Success()); }
public async Task <VoidAppResult> StartNewGame(DtoNewGameInfo newGameInfo, CancellationToken cancellationToken = default(CancellationToken)) { var opponent = await this.dbContext.Users.SingleOrDefaultAsync(_ => _.Mail == newGameInfo.OpponentMail.ToLower()); if (opponent == null) { var createOpponentResult = await this.loginManager.CreateUser(newGameInfo.OpponentMail, cancellationToken); if (createOpponentResult.IsErrorResult) { return(createOpponentResult.GetVoidAppResult()); } opponent = createOpponentResult.SuccessReturnValue; } var choices = ClassChoice.ChoicesFromClassTypes(newGameInfo.ClassTypes); var newGame = new Game { BeginDate = DateTime.Now, Status = GameStatus.InvitePending, UserParticipations = new List <UserParticipation> { new UserParticipation { User = this.loginManager.LoggedInUser, ClassChoices = choices }, new UserParticipation { User = opponent } }, Entities = new List <Entity> { new Player { Id = Guid.NewGuid(), Health = 20, User = this.loginManager.LoggedInUser }, new Player { Id = Guid.NewGuid(), Health = 20, User = opponent } } }; await this.cardService.InitializeGame(newGame); await this.dbContext.Games.AddAsync(newGame, cancellationToken); await this.dbContext.SaveChangesAsync(cancellationToken); return(VoidAppResult.Success()); }
public Task <VoidAppResult> ConfigureDtoEffect(CardEffect cardEffect, DtoEffect dtoEffect) { var parameters = JsonConvert.DeserializeObject <DrawCardsEffectParameters>(cardEffect.EffectParameters); dtoEffect.Name = "Draw cards"; dtoEffect.TargetsCount = 0; dtoEffect.Description = $"Draw {parameters.CardsCount} cards."; return(Task.FromResult(VoidAppResult.Success())); }
public async Task <VoidAppResult> AttackPlayer(Guid gameId, DtoAttackPlayerMove attackPlayerMove, CancellationToken cancellationToken = default(CancellationToken)) { var game = await this.dbContext.Games.IncludeUserParticipations().IncludeEntities().SingleOrDefaultAsync(_ => _.Id == gameId, cancellationToken); if (game == null) { return(VoidAppResult.Error(ErrorPreset.OnLoadingData)); } var currentTurnPlayerResult = await this.GetCurrentTurnPlayer(game, cancellationToken); if (currentTurnPlayerResult.IsErrorResult) { return(currentTurnPlayerResult.GetVoidAppResult()); } var currentTurnPlayer = currentTurnPlayerResult.SuccessReturnValue; if (currentTurnPlayer.Mail != this.loginManager.LoggedInUser.Mail) { return(VoidAppResult.Error(ErrorPreset.NotYourTurn)); } var attacker = await dbContext.GameCards.IncludeAll().SingleOrDefaultAsync(_ => _.Id == attackPlayerMove.AttackerId); var target = await dbContext.Players.Include(_ => _.User).SingleOrDefaultAsync(_ => _.User.Mail == this.loginManager.LoggedInUser.Mail); if (target == null || attacker == null) { return(VoidAppResult.Error(ErrorPreset.OnLoadingData)); } var attackerDtoCardResult = await this.GetDtoCardsFromGameCards(new List <GameCard> { attacker }, gameId); if (attackerDtoCardResult.IsErrorResult) { return(attackerDtoCardResult.GetVoidAppResult()); } if (!attackerDtoCardResult.SuccessReturnValue.First().CanAttack) { return(VoidAppResult.Error(AppActionResultType.RuleError, "This card has already attacked in this turn.")); } target.Health = -(attacker.Card.Attack + attacker.StatModifiersCount); if (target.Health <= 0) { game.Status = GameStatus.Finished; } await dbContext.SaveChangesAsync(); return(VoidAppResult.Success()); }
public async Task <VoidAppResult> ExecuteEffect(DtoEffectTargets effect, CardEffect cardEffect, Game game, User currentTurnPlayer, CancellationToken cancellationToken = default(CancellationToken)) { var parameters = JsonConvert.DeserializeObject <ChangeStatsEffectParameters>(cardEffect.EffectParameters); AppResult <List <GameCard> > targetsResult; switch (parameters.TargetingType) { case TargetingType.Title: targetsResult = await base.GetTargetsByTitle(effect, parameters, game); break; case TargetingType.CharacterName: targetsResult = await base.GetTargetsByCharacterName(effect, parameters, game); break; default: // TargetingType.NumberOfTargets targetsResult = await base.GetTargetsByIds(effect, parameters, game); break; } if (targetsResult.IsErrorResult) { return(targetsResult.GetVoidAppResult()); } var targets = targetsResult.SuccessReturnValue; if (targets.Any(_ => _.CardLocation != CardLocation.Board)) { return(VoidAppResult.Error(ErrorPreset.InvalidTargets)); } foreach (var target in targets) { target.Health += parameters.EffectStrength; target.StatModifiersCount += parameters.EffectStrength; if (target.Health <= 0) { target.CardLocation = CardLocation.OutOfPlay; } } return(VoidAppResult.Success()); }
public Task <VoidAppResult> DrawCard(Game game, string userMail, int cardsCount) { for (var i = 0; i < cardsCount; i++) { var cards = game.Entities.Select(_ => _ as GameCard) .Where(_ => _ != null && _.User.Mail == userMail && _.CardLocation == CardLocation.Cellar) .ToList(); if (cards.Count == 0) { return(Task.FromResult(VoidAppResult.Success())); } var drawnCardIndex = new Random().Next(cards.Count()); cards[drawnCardIndex].CardLocation = CardLocation.Hand; } return(Task.FromResult(VoidAppResult.Success())); }
public async Task <VoidAppResult> PlayCard(Guid gameId, DtoPlayCardMove move, CancellationToken cancellationToken = default(CancellationToken)) { var game = await this.dbContext.Games.IncludeUserParticipations().IncludeEntities().SingleOrDefaultAsync(_ => _.Id == gameId, cancellationToken); if (game == null) { return(VoidAppResult.Error(ErrorPreset.OnLoadingData)); } var currentTurnPlayerResult = await this.GetCurrentTurnPlayer(game, cancellationToken); if (currentTurnPlayerResult.IsErrorResult) { return(currentTurnPlayerResult.GetVoidAppResult()); } var currentTurnPlayer = currentTurnPlayerResult.SuccessReturnValue; var playedGameCard = await this.dbContext.GameCards.IncludeCards().SingleOrDefaultAsync(_ => _.Id == move.CardId); if (playedGameCard == null || playedGameCard.CardLocation != CardLocation.Hand) { return(VoidAppResult.Error(AppActionResultType.RuleError, "Selected card cannot be played.")); } if (currentTurnPlayer.Mail != this.loginManager.LoggedInUser.Mail) { return(VoidAppResult.Error(ErrorPreset.NotYourTurn)); } if (game.UserParticipations.All(_ => _.Mail != this.loginManager.LoggedInUser.Mail)) { return(VoidAppResult.Error(ErrorPreset.NotAParticipant)); } playedGameCard.CardLocation = CardLocation.Board; // Discard cards if (playedGameCard.Card.Cost != move.DiscardedCardIds.Count) { return(VoidAppResult.Error(AppActionResultType.RuleError, $"You must discard exactly {playedGameCard.Card.Cost} cards.")); } foreach (var entityId in move.DiscardedCardIds) { var gameCard = game.Entities.SingleOrDefault(_ => _.Id == entityId) as GameCard; if (gameCard == null || gameCard.CardLocation != CardLocation.Hand) { return(VoidAppResult.Error(AppActionResultType.RuleError, "The selected card cannot be discarded.")); } gameCard.CardLocation = CardLocation.OutOfPlay; } // Execute effects foreach (var effect in move.EffectTargets) { var executeEffectResult = await this.effectsService.ExecuteEffect(effect, game, currentTurnPlayer, cancellationToken); if (executeEffectResult.IsErrorResult) { return(executeEffectResult); } } await dbContext.SaveChangesAsync(cancellationToken); return(VoidAppResult.Success()); }
public async Task <VoidAppResult> JoinGame(DtoJoinGameInfo joinGameInfo, CancellationToken cancellationToken = default(CancellationToken)) { var game = await this.dbContext.Games.IncludeUserParticipations().IncludeEntities().SingleOrDefaultAsync(_ => _.Id == joinGameInfo.GameId); if (game == null) { return(VoidAppResult.Error(ErrorPreset.OnLoadingData)); } game.Status = GameStatus.InProgress; var playerParticipation = game.UserParticipations.Single(_ => _.Mail == this.loginManager.LoggedInUser.Mail); var opponentParticipation = game.UserParticipations.Single(_ => _.Mail != this.loginManager.LoggedInUser.Mail); playerParticipation.ClassChoices = ClassChoice.ChoicesFromClassTypes(joinGameInfo.ClassTypes); var classTypesCount = Enum.GetValues(typeof(ClassType)).Length; // Select first choice that was not identical for (var i = 1; i <= classTypesCount; i++) { playerParticipation.ClassType = playerParticipation.ClassChoices.Single(_ => _.Priority == i).ClassType; opponentParticipation.ClassType = opponentParticipation.ClassChoices.Single(_ => _.Priority == i).ClassType; if (opponentParticipation.ClassType != playerParticipation.ClassType) { break; } } // If all choices were identical, select random class for both if (playerParticipation.ClassType == opponentParticipation.ClassType) { var random = new Random(); do { playerParticipation.ClassType = (ClassType)random.Next(classTypesCount); opponentParticipation.ClassType = (ClassType)random.Next(classTypesCount); }while (playerParticipation.ClassType == opponentParticipation.ClassType); } // Add class bonuses switch (playerParticipation.ClassType) { case ClassType.Medium: var drawResult = await this.cardService.DrawCard(game, playerParticipation.Mail, 1); if (drawResult.IsErrorResult) { return(drawResult); } break; case ClassType.Slow: var stormlingResult = await this.cardService.GenerateStormling(playerParticipation.User); if (stormlingResult.IsErrorResult) { return(stormlingResult.GetVoidAppResult()); } game.Entities.Add(stormlingResult.SuccessReturnValue); break; } var currentTurnPlayerResult = await this.GetCurrentTurnPlayer(game, cancellationToken); if (currentTurnPlayerResult.IsErrorResult) { return(currentTurnPlayerResult.GetVoidAppResult()); } var drawCardResult = await this.cardService.DrawCard(game, currentTurnPlayerResult.SuccessReturnValue.Mail, 2); if (drawCardResult.IsErrorResult) { return(drawCardResult); } await dbContext.SaveChangesAsync(); return(VoidAppResult.Success()); }
public async Task <VoidAppResult> InitializeCards() { if (this.dbContext.Cards.Any()) { return(VoidAppResult.Success()); } var claus = new Character { Id = Guid.NewGuid(), Name = "Claus" }; var sepp = new Character { Id = Guid.NewGuid(), Name = "Sepp" }; var azgul = new Character { Id = Guid.NewGuid(), Name = "Azgul" }; var ison = new Character { Id = Guid.NewGuid(), Name = "Ison" }; var rink = new Character { Id = Guid.NewGuid(), Name = "Rink" }; var aiba = new Character { Id = Guid.NewGuid(), Name = "Aiba" }; var uni = new Character { Id = Guid.NewGuid(), Name = "Uni" }; var okika = new Character { Id = Guid.NewGuid(), Name = "Okika" }; var zorya = new Character { Id = Guid.NewGuid(), Name = "Zorya" }; var yorza = new Character { Id = Guid.NewGuid(), Name = "Yorza" }; var nono = new Character { Id = Guid.NewGuid(), Name = "Nono" }; var yuu = new Character { Id = Guid.NewGuid(), Name = "Yuu" }; var velza = new Character { Id = Guid.NewGuid(), Name = "Velza" }; var palutena = new Character { Id = Guid.NewGuid(), Name = "Palutena" }; var akuga = new Character { Id = Guid.NewGuid(), Name = "Akuga" }; var yerag = new Character { Id = Guid.NewGuid(), Name = "Yerag" }; var drahlget = new Character { Id = Guid.NewGuid(), Name = "Drahlget" }; var stormling = new Character { Id = Guid.NewGuid(), Name = "Stormling" }; await dbContext.Characters.AddRangeAsync(claus, sepp, azgul, ison, rink, aiba, uni, okika, zorya, yorza, yuu, velza, palutena, akuga, yerag, drahlget, stormling); var pawn = new Title { Id = Guid.NewGuid(), Name = "The pawn" }; var librarian = new Title { Id = Guid.NewGuid(), Name = "The librarian" }; var recruit = new Title { Id = Guid.NewGuid(), Name = "The recruit" }; var berserker = new Title { Id = Guid.NewGuid(), Name = "The berserker" }; var defender = new Title { Id = Guid.NewGuid(), Name = "The defender" }; var soldier = new Title { Id = Guid.NewGuid(), Name = "The soldier" }; var executioner = new Title { Id = Guid.NewGuid(), Name = "The executioner" }; var bard = new Title { Id = Guid.NewGuid(), Name = "The bard" }; var sergeant = new Title { Id = Guid.NewGuid(), Name = "The sergeant" }; var guardian = new Title { Id = Guid.NewGuid(), Name = "The guardian" }; var flameEmpress = new Title { Id = Guid.NewGuid(), Name = "The flame empress" }; var executer = new Title { Id = Guid.NewGuid(), Name = "The executer" }; var demonQueen = new Title { Id = Guid.NewGuid(), Name = "The demon queen" }; var holy = new Title { Id = Guid.NewGuid(), Name = "The holy" }; var sinner = new Title { Id = Guid.NewGuid(), Name = "The sinner" }; var undead = new Title { Id = Guid.NewGuid(), Name = "The undead" }; var monk = new Title { Id = Guid.NewGuid(), Name = "The monk" }; var fist = new Title { Id = Guid.NewGuid(), Name = "The fist" }; var leader = new Title { Id = Guid.NewGuid(), Name = "The leader" }; await dbContext.Titles.AddRangeAsync(pawn, librarian, recruit, berserker, defender, soldier, executioner, bard, sergeant, guardian, flameEmpress, executer, demonQueen, holy, sinner, undead, monk, fist, leader); await dbContext.Cards.AddRangeAsync(new Card { Id = Guid.NewGuid(), Cost = 1, Attack = 2, BaseHealth = 1, IsLegendary = false, Title = pawn, Character = claus }, new Card { Id = Guid.NewGuid(), Cost = 1, Attack = 1, BaseHealth = 2, IsLegendary = false, Title = pawn, Character = sepp }, new Card { Id = Guid.NewGuid(), Cost = 1, Attack = 0, BaseHealth = 2, IsLegendary = false, Title = librarian, Character = azgul, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.DrawCards, EffectParameters = JsonConvert.SerializeObject(new DrawCardsEffectParameters { CardsCount = 1 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 2, Attack = 2, BaseHealth = 3, IsLegendary = false, Title = recruit, Character = ison }, new Card { Id = Guid.NewGuid(), Cost = 2, Attack = 3, BaseHealth = 2, IsLegendary = false, Title = recruit, Character = rink }, new Card { Id = Guid.NewGuid(), Cost = 2, Attack = 1, BaseHealth = 4, IsLegendary = false, Title = recruit, Character = aiba }, new Card { Id = Guid.NewGuid(), Cost = 2, Attack = 4, BaseHealth = 1, IsLegendary = false, Title = berserker, Character = uni }, new Card { Id = Guid.NewGuid(), Cost = 2, Attack = 1, BaseHealth = 2, IsLegendary = false, Title = librarian, Character = okika, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.DrawCards, EffectParameters = JsonConvert.SerializeObject(new DrawCardsEffectParameters { CardsCount = 1 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 2, Attack = 1, BaseHealth = 3, IsLegendary = false, Title = defender, Character = zorya, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "1", EffectStrength = -1 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 3, Attack = 3, BaseHealth = 4, IsLegendary = false, Title = soldier, Character = sepp }, new Card { Id = Guid.NewGuid(), Cost = 3, Attack = 5, BaseHealth = 2, IsLegendary = false, Title = berserker, Character = yorza }, new Card { Id = Guid.NewGuid(), Cost = 3, Attack = 1, BaseHealth = 2, IsLegendary = false, Title = executioner, Character = aiba, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.Destroy, EffectParameters = JsonConvert.SerializeObject(new DestroyEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "1" }) } } }, new Card { Id = Guid.NewGuid(), Cost = 3, Attack = 2, BaseHealth = 1, IsLegendary = false, Title = executioner, Character = uni, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.Destroy, EffectParameters = JsonConvert.SerializeObject(new DestroyEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "1" }) } } }, new Card { Id = Guid.NewGuid(), Cost = 3, Attack = 3, BaseHealth = 3, IsLegendary = false, Title = bard, Character = okika, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "1", EffectStrength = 1 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 4, Attack = 3, BaseHealth = 4, IsLegendary = false, Title = sergeant, Character = nono, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.Title, TargetParameter = soldier.Name, EffectStrength = 1 }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.Title, TargetParameter = pawn.Name, EffectStrength = 1 }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.Title, TargetParameter = recruit.Name, EffectStrength = 1 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 4, Attack = 3, BaseHealth = 4, IsLegendary = false, Title = bard, Character = yuu, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "1", EffectStrength = 2 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 4, Attack = 3, BaseHealth = 2, IsLegendary = false, Title = executioner, Character = velza, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.Destroy, EffectParameters = JsonConvert.SerializeObject(new DestroyEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "1" }) } } }, new Card { Id = Guid.NewGuid(), Cost = 5, Attack = 4, BaseHealth = 7, IsLegendary = false, Title = guardian, Character = sepp }, new Card { Id = Guid.NewGuid(), Cost = 5, Attack = 5, BaseHealth = 4, IsLegendary = false, Title = librarian, Character = palutena, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.DrawCards, EffectParameters = JsonConvert.SerializeObject(new DrawCardsEffectParameters { CardsCount = 2 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 5, Attack = 3, BaseHealth = 4, IsLegendary = true, Title = flameEmpress, Character = akuga, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.Destroy, EffectParameters = JsonConvert.SerializeObject(new DestroyEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "4" }) } } }, new Card { Id = Guid.NewGuid(), Cost = 4, Attack = 2, BaseHealth = 3, IsLegendary = true, Title = executer, Character = akuga, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.CharacterName, TargetParameter = executioner.Name, EffectStrength = 3 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 4, Attack = 2, BaseHealth = 3, IsLegendary = true, Title = demonQueen, Character = akuga, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "1", EffectStrength = 1 }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.Destroy, EffectParameters = JsonConvert.SerializeObject(new DestroyEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "1" }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.DrawCards, EffectParameters = JsonConvert.SerializeObject(new DrawCardsEffectParameters { CardsCount = 1 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 3, Attack = 1, BaseHealth = 4, IsLegendary = true, Title = holy, Character = yerag, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "1", EffectStrength = 1 }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.DrawCards, EffectParameters = JsonConvert.SerializeObject(new DrawCardsEffectParameters { CardsCount = 2 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 4, Attack = 2, BaseHealth = 1, IsLegendary = true, Title = sinner, Character = yerag, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.Destroy, EffectParameters = JsonConvert.SerializeObject(new DestroyEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "3" }) } } }, new Card { Id = Guid.NewGuid(), Cost = 3, Attack = 1, BaseHealth = 3, IsLegendary = true, Title = undead, Character = yerag, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "5", EffectStrength = -1 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 3, Attack = 3, BaseHealth = 2, IsLegendary = true, Title = monk, Character = drahlget, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.CharacterName, TargetParameter = uni.Name, EffectStrength = 1 }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.CharacterName, TargetParameter = aiba.Name, EffectStrength = 1 }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.CharacterName, TargetParameter = yuu.Name, EffectStrength = 1 }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.DrawCards, EffectParameters = JsonConvert.SerializeObject(new DrawCardsEffectParameters { CardsCount = 1 }) } } }, new Card { Id = Guid.NewGuid(), Cost = 4, Attack = 2, BaseHealth = 3, IsLegendary = true, Title = fist, Character = drahlget, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.Destroy, EffectParameters = JsonConvert.SerializeObject(new DestroyEffectParameters { TargetingType = TargetingType.Title, TargetParameter = recruit.Name }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.Destroy, EffectParameters = JsonConvert.SerializeObject(new DestroyEffectParameters { TargetingType = TargetingType.Title, TargetParameter = soldier.Name }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.Destroy, EffectParameters = JsonConvert.SerializeObject(new DestroyEffectParameters { TargetingType = TargetingType.Title, TargetParameter = pawn.Name }) } }, }, new Card { Id = Guid.NewGuid(), Cost = 3, Attack = 1, BaseHealth = 4, IsLegendary = true, Title = leader, Character = drahlget, Effects = new List <CardEffect> { new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.NumberOfTargets, TargetParameter = "1", EffectStrength = 2 }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.Title, TargetParameter = pawn.Name, EffectStrength = -1 }) }, new CardEffect { Id = Guid.NewGuid(), EffectType = EffectType.ChangeStats, EffectParameters = JsonConvert.SerializeObject(new ChangeStatsEffectParameters { TargetingType = TargetingType.Title, TargetParameter = recruit.Name, EffectStrength = -1 }) }, } }, new Card { Id = Guid.NewGuid(), Cost = 0, Attack = 1, BaseHealth = 1, IsLegendary = false, Character = stormling }); await this.dbContext.SaveChangesAsync(); return(VoidAppResult.Success()); }