public void GetDamage_2_Flip_0_Heads() { var attack = new FlipCoinPlusAttack() { CoinsToFlip = 2, HeadsForBonus = 2, ExtraforHeads = 40, Damage = 20 }; var game = new GameField().WithFlips(CoinFlipper.TAILS, CoinFlipper.TAILS); Assert.Equal(20, attack.GetDamage(null, null, game).NormalDamage); }
public void GetDamage_2_Flip_2_Heads_Only_1_Required() { var attack = new FlipCoinPlusAttack() { CoinsToFlip = 2, HeadsForBonus = 1, ExtraforHeads = 40, Damage = 20 }; var game = new GameField().WithFlips(CoinFlipper.HEADS, CoinFlipper.HEADS); Assert.Equal(60, attack.GetDamage(null, null, game).NormalDamage); }
public void GetDamage_1_Flip_Tails_Bonus() { var attack = new FlipCoinPlusAttack() { CoinsToFlip = 1, HeadsForBonus = 1, ExtraforHeads = 20, ExtraforTails = 10, Damage = 20 }; var game = new GameField().WithFlips(CoinFlipper.TAILS); Assert.Equal(30, attack.GetDamage(null, null, game).NormalDamage); }
public static bool TryAddEffects(ref Attack baseAttack, PokemonTcgSdk.Models.Attack sdkAttack) { if (sdkAttack.Text.ToLower().StartsWith(firstPartApplyEffect.ToLower())) { StatusEffect?effect = stringToStatusEffect(baseAttack.Description.Substring(firstPartApplyEffect.Length)); if (effect == null) { return(false); } else { baseAttack.Effects.Add(new ApplyStatusEffect() { CoinflipConditional = new CoinFlipConditional { FlipCoin = true }, TargetingMode = TargetingMode.OpponentActive, StatusEffect = effect.Value }); return(true); } } else if (sdkAttack.Text.ToLower().StartsWith(firstPartForceEffect.ToLower())) { StatusEffect?effect = stringToStatusEffect(baseAttack.Description.Substring(firstPartForceEffect.Length)); if (effect == null) { return(false); } else { baseAttack.Effects.Add(new ApplyStatusEffect() { TargetingMode = TargetingMode.OpponentActive, StatusEffect = effect.Value }); return(true); } } else if (Regex.IsMatch(sdkAttack.Text, @".*does \d+ damage to itself[.]")) { int damage = int.Parse(Regex.Matches(sdkAttack.Text, @"\d+")[0].Value); baseAttack.Effects.Add(new DamageEffect { Amount = damage, TargetingMode = TargetingMode.YourActive }); return(true); } else if (sdkAttack.Text.Trim() == "Flip a coin. If tails, this attack does nothing.") { var cost = baseAttack.Cost.ToList(); var damage = baseAttack.Damage; baseAttack = new AttackFailsOnTails { Name = sdkAttack.Name, Description = sdkAttack.Text, Cost = new ObservableCollection <Energy>(cost), Damage = damage }; return(true); } else if (Regex.IsMatch(sdkAttack.Text, @"Flip \d+ coins[.] This attack does \d+ damage times the number of heads[.]")) { var cost = baseAttack.Cost.ToList(); int coins = int.Parse(Regex.Matches(sdkAttack.Text, @"\d+")[0].Value); int damage = int.Parse(Regex.Matches(sdkAttack.Text, @"\d+")[1].Value); baseAttack = new FlipCoinAttack { Name = sdkAttack.Name, Description = sdkAttack.Text, Coins = coins, Damage = damage, Cost = new ObservableCollection <Energy>(cost) }; return(true); } else if (Regex.IsMatch(sdkAttack.Text, @"Flip a coin[.] If heads[,] this attack does \d+ damage plus \d+ more damage; if tails, this attack does \d+ damage[.]")) { var cost = baseAttack.Cost.ToList(); int damage = baseAttack.Damage; int extraForHeads = int.Parse(Regex.Matches(sdkAttack.Text, @"\d+")[0].Value) + int.Parse(Regex.Matches(sdkAttack.Text, @"\d+")[1].Value); int extraForTails = int.Parse(Regex.Matches(sdkAttack.Text, @"\d+")[2].Value); baseAttack = new FlipCoinPlusAttack { Name = sdkAttack.Name, Description = sdkAttack.Text, Damage = damage, ExtraforHeads = extraForHeads, ExtraforTails = extraForTails, Cost = new ObservableCollection <Energy>(cost) }; return(true); } else if (sdkAttack.Text == "If the Defending Pokémon tries to attack during your opponent's next turn, your opponent flips a coin. If tails, that attack does nothing.") { var cost = baseAttack.Cost.ToList(); var damage = baseAttack.Damage; baseAttack = new ApplyAttackFailOnTails { Name = sdkAttack.Name, Description = sdkAttack.Text, Cost = new ObservableCollection <Energy>(cost), Damage = damage }; return(true); } else if (sdkAttack.Text.Trim() == "The Defending Pokémon can't retreat during your opponent's next turn.") { baseAttack.Effects.Add(new ApplyRetreatStopper() { TargetingMode = TargetingMode.OpponentActive, Turns = 2 }); return(true); } return(false); }