public override void TakeTurn(IBoardGame gameBoard) { if (!this.CanTakeTurn) { return; } // hard code in specific abilities depending on the monster var cleanupTurn = new CleanupTurn(this); cleanupTurn.Cleanup(); // simply attack right now var humanPlayers = gameBoard.GetHumanPlayers().ToList(); var humanToAttack = new RandomPlayer().TargetPlayer(humanPlayers); if (humanToAttack < 0) { return; } var humanPlayer = humanPlayers[humanToAttack]; var attackAmount = new StaticAmount().AttackAmount(); var attackParameters = new AttackParameters { AdjustedAmount = attackAmount, OriginalAmount = attackAmount, PlayerAttacking = this, PlayerBeingAttacked = humanPlayer }; humanPlayer.TakeDamage(gameBoard, attackParameters); GameLogger.LogFormat("{0} gave {1} damage to {2}", this.Name, attackAmount, attackParameters.ReportPlayersBeingAttacked()); }
public void WarriorTakesDamageWhenOtherHumanPlayerIsHitFromMonster() { // arrange var builder = new CharacterBuilder(); var cleric = (Cleric)builder.BuildCharacter("cleric", "TestUser1"); var warrior = (Warrior)builder.BuildCharacter("warrior", "TestUser"); var monster = builder.BuildCharacter("monster", "TestMonster"); var gameBoard = new BoardGame(new List<Player> { warrior, monster, cleric }, false); warrior.Initialize(gameBoard); cleric.Initialize(gameBoard); var shareTheLoadCard = warrior.CardsToDrawFrom.First(card => card.GetType() == typeof(ShareTheLoad)); warrior.CurrentCards.Add(shareTheLoadCard); warrior.CardsToDrawFrom.Remove(shareTheLoadCard); var healthBefore = cleric.Hp; var attackParameters = new AttackParameters { AdjustedAmount = 4, OriginalAmount = 4, PlayerAttacking = monster, PlayerBeingAttacked = cleric }; // act cleric.TakeDamage(gameBoard, attackParameters); // assert Assert.AreEqual(healthBefore - 2, cleric.Hp); }
public void ShareTheLoadIsNotRemovedWhenDefensiveInstantCardNotUsedOnSelf() { // arrange var builder = new CharacterBuilder(); var cleric = (Cleric)builder.BuildCharacter("cleric", "TestUser1"); var warrior = (Warrior)builder.BuildCharacter("warrior", "TestUser"); var monster = builder.BuildCharacter("monster", "TestMonster"); var gameBoard = new BoardGame(new List<Player> { warrior, monster, cleric }, false); warrior.Initialize(gameBoard); cleric.Initialize(gameBoard); var shareTheLoadCard = warrior.CardsToDrawFrom.First(card => card.GetType() == typeof(ShareTheLoad)); warrior.CurrentCards.Add(shareTheLoadCard); warrior.CardsToDrawFrom.Remove(shareTheLoadCard); Assert.IsFalse(warrior.UsedInstantCard); Assert.AreEqual(1, warrior.CurrentCards.Count); var warriorHp = warrior.Hp; var attackParameters = new AttackParameters { AdjustedAmount = 4, OriginalAmount = 4, PlayerAttacking = monster, PlayerBeingAttacked = cleric }; // act warrior.TakeDamage(gameBoard, attackParameters); // assert Assert.IsFalse(warrior.UsedInstantCard); Assert.AreEqual(warriorHp - 4, warrior.Hp); Assert.AreEqual(1, warrior.CurrentCards.Count); }
public override bool CanUse(AttackParameters attackParameters = null) { if (attackParameters != null && attackParameters.PlayerBeingAttacked.Name != this.warriorPlayer.Name) { return true; } return false; }
/// <summary> /// melee /// When an enemy hits you, that enemy takes DMG equal to your ATK /// TODO: Implement range vs melee /// TODO: Implement movement system /// TODO: Implement energy system /// TODO: Make this card do what it's actually supposed to. /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } }
/// <summary> /// Range: 6 /// Instant /// Target player takes 1/2 DMG and no status effects from a monster hit /// TODO: Implement ranged vs. melee /// TODO: implement status effects over turns /// TODO: Make this do what its supposed to do. /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Target player takes 1/2 DMG and no status effects from a monster hit }
/// <summary> /// Instant /// You Take no Damage or status effects from a monster hit. /// TODO: Implement ranged vs. melee /// TODO: Make this do what its supposed to do. /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // You Take no Damage or status effects from a monster hit. }
/// <summary> /// Range: 6 /// Instant /// Target player gets +2 DEF for 2 turns /// TODO: Implement ranged vs. melee /// TODO: implement status effects over turns /// TODO: Make this do what its supposed to do. /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Target player gets +2 DEF for 2 turns }
/// <summary> /// Instant /// Draw 1 normal attack from your discard pile and play it immediately. /// TODO: Implement ranged vs. melee /// TODO: Make this do what its supposed to do. /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Draw 1 normal attack from your discard pile and play it immediately. }
/// <summary> /// melee /// Draw any normal attack from your discard pile and play it immediately /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // TODO: Make this do what its supposed to do. }
/// <summary> /// Gain +2 ATK until end of your next turn /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Gain +2 ATK until end of your next turn // TODO: Make it so this does what it's supposed to. }
/// <summary> /// Play when you are hit by an enemy monster. You take no DMG or status effects from that hit /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Play when you are hit by an enemy monster. You take no DMG or status effects from that hit // TODO: Make it so this does what it's supposed to. }
/// <summary> /// Draw a normal attack card from your discard pile and play it immediately. /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Draw a normal attack card from your discard pile and play it immediately. // TODO: Make it so this does what it's supposed to. }
/// <summary> /// Take 1/2 DMG and no status effects from a monster hit or remove all status effects from yourself /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Take 1/2 DMG and no status effects from a monster hit or remove all status effects from yourself // TODO: Make it so this does what it's supposed to. }
/// <summary> /// Play when any player is hit by an enemy. That enemy takes DMG equal to your ATK. /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Play when any player is hit by an enemy. That enemy takes DMG equal to your ATK. // TODO: Make it so this does what it's supposed to. }
public override void TakeDamage(IBoardGame gameBoard, AttackParameters attackParameters) { var humanPlayers = gameBoard.GetHumanPlayers(); // all of them will play defensive cards foreach (var humanPlayer in humanPlayers) { var defensiveInstant = humanPlayer.CurrentCards.FirstOrDefault(card => card.IsDefensiveInstant); if (defensiveInstant != null && !humanPlayer.UsedInstantCard && defensiveInstant.CanUse(attackParameters)) { defensiveInstant.Use(attackParameters); humanPlayer.CurrentCards.Remove(defensiveInstant); } } // we'll take damage here base.TakeDamage(gameBoard, attackParameters); }
/// <summary> /// Melee /// Deal 1d6 DMG to all adjacent enemies /// TODO: Implement range vs melee /// TODO: Implement movement system to do AOE DMG /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Deal 1d6 DMG to all adjacent enemies var damageTaken = Utilities.Randomizer.GetRandomValue(1, 6); monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.warriorPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// Range: 6 /// Deal 2d6 + MGK DMG to a single enemy /// TODO: Implement ranged vs. melee /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Deal 2d6 + MGK DMG to a single enemy var damageTaken = Utilities.Randomizer.GetRandomValue(1, 6) + Utilities.Randomizer.GetRandomValue(1, 6) + this.clericPlayer.MagicPower; monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.clericPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// Range: 6 /// -1 Mana: Deal 1d6+MGK DMG to a single enemy. /// TODO: implement Mana System /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // -1 Mana: Deal 1d6+MGK DMG to a single enemy. var damageTaken = this.wizardPlayer.MagicPower; monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.wizardPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// Melee /// Deal your DEF in DMG to a Single enemy /// and gain DEF until the end of your next turn /// TODO: Implement range vs melee /// TODO: Implement concept of DEF until the end of your turn /// TODO: Implement until end of next turn for the + DEF /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Deal DEF in DMG to a single enemy var damageTaken = this.warriorPlayer.DefensePower; monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.warriorPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// melee /// Deal 1d4 DMG to a single enemy and get +2 DEF until the end of your next turn. /// TODO: Implement range vs melee /// TODO: Implement movement system /// TODO: Implement energy system /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Deal 1d4 DMG to a single enemy and get +2 DEF until the end of your next turn. var damageTaken = Utilities.Randomizer.GetRandomValue(1, 4); monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.thiefPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// Range: 6 /// +1 Spirit: Deal 1d6 DMG to a single Enemy. /// TODO: implement Spirit System /// TODO: Implement ranged vs. melee /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // +1 Spirit: Deal 1d6 DMG to a single Enemy. // TODO Implement Spirit System var damageTaken = Utilities.Randomizer.GetRandomValue(1, 6); monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.clericPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// Range: 8 /// Deal ATK DMG to all enemies in a 2x2 area /// TODO: Implement range vs melee /// TODO: Implement movement system /// TODO: Implement energy system /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Deal ATK DMG to all enemies in a 2x2 area // TODO: implement movement system for AOE var damageTaken = this.archerPlayer.AttackPower; monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.archerPlayer.Name, this.Name, damageTaken, monster.Name); }
public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // You gain +2 MGK for 2 turns. // TODO: Change this to actually do what it says. var damageTaken = Utilities.Randomizer.GetRandomValue(1, 6) + this.wizardPlayer.MagicPower; monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.wizardPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// Melee /// 1 Rage: deal 1d6+ATK DMG to a single enemy /// 2 Rage: deal 2d6+ATK DMG to a single enemy /// 3 Rage: deal 3d6+ATK DMG to a single enemy /// TODO: Implement range vs melee /// TODO: Make this attack work how it's supposed to. /// TODO: Implement Rage system /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; var firstRoll = Utilities.Randomizer.GetRandomValue(1, 6); var secondRoll = Utilities.Randomizer.GetRandomValue(1, 6); var damageTaken = firstRoll + secondRoll + this.warriorPlayer.AttackPower; monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.warriorPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// Range: 8 /// Deal 1d8 dmg to 2 Different enemies /// TODO: Implement range vs melee /// TODO: Implement movement system /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Deal 1d8 dmg to 2 Different enemies // TODO: Select another target to do DMG to. var damageTaken = Utilities.Randomizer.GetRandomValue(1, 8); monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.archerPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// Range: 8 /// Deal 1d8 + MGK DMG to X enemies, where X equals the amount of energy spent. /// TODO: Implement range vs melee /// TODO: Implement movement system /// TODO: Implement energy system /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Deal 1d8 + MGK DMG to X enemies, where X equals the amount of energy spent. // TODO: figure out how to make this do what it's supposed to and target multiple enemies. var damageTaken = Utilities.Randomizer.GetRandomValue(1, 8) + this.archerPlayer.AttackPower; monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.archerPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// Instant /// Play when any other player takes DMG. You each take 1/2 that damage. You take the higher number for odd numbers. /// </summary> public void Use(AttackParameters attackParameters = null) { if (attackParameters == null) { throw new ArgumentNullException("attackParameters"); } var amountToTake = (int)(attackParameters.OriginalAmount / 2); this.warriorPlayer.TakeDamage(amountToTake); attackParameters.AdjustedAmount = attackParameters.OriginalAmount - amountToTake; this.warriorPlayer.UsedInstantCard = true; attackParameters.AddPlayerBeingAttacked(this.warriorPlayer); GameLogger.LogFormat("{0} used the instant defensive card {1} taking {2} hp from {3} for {4}", this.warriorPlayer.Name, this.Name, amountToTake, attackParameters.PlayerAttacking.Name, attackParameters.PlayerBeingAttacked.Name); }
public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Any single player takes 1/2 DMG from a hit (ignoring status effects) OR remove all status effectts from a single player. // TODO: Change this to actually do what it says. var damageTaken = Utilities.Randomizer.GetRandomValue(1, 6) + this.wizardPlayer.MagicPower; monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.wizardPlayer.Name, this.Name, damageTaken, monster.Name); }
/// <summary> /// Charge in a straight line your move distance. /// Deal 1d6 DMG to X different enemies you pass adjacent to, /// where X=Rage spent. /// Also, gain 2 DEF for every 2 Rage spent in this way /// TODO: Implement move system. For now just attacking one monster /// TODO: Make this so it does what it's supposed to. /// TODO: Implement Rage system /// </summary> public void Use(AttackParameters attackParameters = null) { var monsters = this.gameBoard.GetMonsters().ToList(); var monsterIdx = this.targetPlayer.TargetPlayer(monsters); if (monsterIdx < 0) { return; } var monster = monsters[monsterIdx]; // Deal 1d6+ATK DMG to a single Enemy // TODO: Make this do what it's supposed to do. var firstRoll = Utilities.Randomizer.GetRandomValue(1, 6); var damageTaken = firstRoll; monster.TakeDamage(damageTaken); GameLogger.LogFormat("{0} used the {1} and gave {2} damage to {3}", this.warriorPlayer.Name, this.Name, damageTaken, monster.Name); }