public void Sharer_loses_an_item_and_shared_gains_one() { //Characters: Caronte caronte = new Caronte(10, 10, 10); Wizard wizard = new Wizard(10, 10, 10); //Items: var curingPotion = new CuringPotion(103); var shield = new Shield(1456); var sword = new Sword(993); var trident = new Trident(12081, 120); //Adding items: caronte.AddItem(shield); wizard.AddItem(curingPotion); wizard.AddItem(sword); wizard.AddItem(trident); //Encounter ExchangeEncounter encounter = new ExchangeEncounter(wizard, caronte, curingPotion); //Saving previous item counts int previousCaronteItems = caronte.Items.Count; int previousWizardItems = wizard.Items.Count; //Running the encounter (assuming the encounter success) encounter.RunEncounter(); Assert.IsTrue(caronte.Items.Count == previousCaronteItems + 1 && wizard.Items.Count == previousWizardItems - 1 && caronte.Items.Contains(curingPotion) && !wizard.Items.Contains(curingPotion)); }
public virtual void Setup() { Character MagicGladiador = new Gladiador("MagicGladiador"); Character KingTroll = new Troll("KingTroll"); Character QueenElf = new Elf("QueenElf"); Character MagicWizard = new Wizard("MagicWizard"); IItem PinkyBow = new BowAndArrow(); IItem IcedCup = new Ice(); QueenElf.AddItem(IcedCup); QueenElf.AddItem(PinkyBow); IItem Blade = new LightSaber(); IItem Axe = new FireAx(); KingTroll.AddItem(Blade); KingTroll.AddItem(Axe); IItem Saber = new LightSaber(); IItem BlueRobe = new Robes(); MagicWizard.AddItem(Saber); MagicWizard.AddItem(Blade); IItem ChainArmor = new CompleteArmor(); InfiniteGauntlet Gauntlet = new InfiniteGauntlet(); Gauntlet.AddStone(); MagicGladiador.AddItem(ChainArmor); MagicGladiador.AddItem(Gauntlet); characters.Add(MagicGladiador); characters.Add(KingTroll); characters.Add(QueenElf); characters.Add(MagicWizard); }
static void Main(string[] args) { SpellsBook book = new SpellsBook(); WhirlWind spell1 = new WhirlWind(); FireBall spell2 = new FireBall(); book.AddSpell(spell1); book.AddSpell(spell2); Wizard gandalf = new Wizard("Gandalf"); gandalf.AddItem(new Staff()); gandalf.AddItem(book); Dwarf gimli = new Dwarf("Gimli"); gimli.AddItem(new Axe()); gimli.AddItem(new Helmet()); gimli.AddItem(new Shield()); Console.WriteLine($"Gimli has {gimli.Health} HP points"); Console.WriteLine($"Gandalf attacks Gimli with {gandalf.AttackValue} points."); gimli.ReceiveAttack(gandalf.AttackValue); Console.WriteLine($"Gimli has {gimli.Health} HP"); gimli.Cure(); Console.WriteLine($"Gimli has {gimli.Health} HP"); }
public void GetWizardStats() { testingWizard3.AddItem(testingItem); testingWizard3.AddItem(testingItem2); testingWizard3.RemoveItem(testingItem); int expectedWizardAttack = 30; int expectedWizardDefense = 25; Assert.AreEqual(expectedWizardAttack, testingWizard3.GetCharacterAttack()); Assert.AreEqual(expectedWizardDefense, testingWizard3.GetCharacterDefense()); }
static void Main(string[] args) { SpellsBook book = new SpellsBook(); book.Spells = new Spell[] { new Spell() }; Wizard gandalf = new Wizard("Gandalf"); Staff staff = new Staff(); SpellsBook spellsBook = book; gandalf.AddItem(spellsBook); gandalf.AddItem(staff); Dwarf gimli = new Dwarf("Gimli"); Axe axe = new Axe(); Helmet helmet = new Helmet(); Shield shield = new Shield(); gimli.AddItem(axe); gimli.AddItem(helmet); gimli.AddItem(shield); Archer legolas = new Archer("Legolas"); Bow bow = new Bow(); Shield legolasShield = new Shield(); Helmet legolasHelmet = new Helmet(); legolas.AddItem(bow); legolas.AddItem(legolasShield); legolas.AddItem(legolasHelmet); Console.WriteLine($"Gimli has ❤️ {gimli.Health}"); Console.WriteLine($"Gandalf attacks Gimli with ⚔️ {gandalf.AttackValue}"); gimli.ReceiveAttack(gandalf); Console.WriteLine($"Gimli has ❤️ {gimli.Health}"); gimli.Cure(); Console.WriteLine($"Gimli has ❤️ {gimli.Health}"); legolas.RemoveItem(legolasHelmet); gandalf.ReceiveAttack(legolas); Console.WriteLine($"Legolas attacks Gandalf with ⚔️ {legolas.AttackValue}"); Console.WriteLine($"Gandalf has ❤️ {gandalf.Health}"); legolas.ReceiveAttack(gimli); Console.WriteLine($"Gimli attacks Legolas with ⚔️ {gimli.AttackValue}"); Console.WriteLine($"Legolas has ❤️ {legolas.Health}"); }
public void Setup() { this.gandalf = new Wizard("Gandalf"); this.staff = new Staff(); this.spellsBook = new SpellsBook(); spellsBook.Spells = new Spell[] { new Spell() }; gandalf.AddItem(staff); gandalf.AddItem(spellsBook); this.saruman = new Wizard("Saruman"); this.sarumanStaff = new Staff(); this.sarumanSpellsBook = new SpellsBook(); sarumanSpellsBook.Spells = new Spell[] { new Spell() }; }
public void AddItem() { testingWizard.AddItem(testingItem); string expectedItemName = "testingItem"; Assert.AreEqual(expectedItemName, testingWizard.ItemsList[0].Name); }
static void Main(string[] args) { SpellsBook book = new SpellsBook(); book.AddSpell("Bola de fuego", 10, 0); book.AddSpell("Escudo de maná", 0, 20); Wizard gandalf = new Wizard("Gandalf"); gandalf.SpellsBook = book; gandalf.AddItem("Staff", 30, 20); Dwarf gimli = new Dwarf("Gimli"); gimli.AddItem("Helmet", 0, 20); gimli.AddItem("Axe", 40, 0); Console.WriteLine($"Gimli has ❤️ {gimli.Health}"); Console.WriteLine($"Gandalf attacks Gimli with ⚔️ {gandalf.AttackValue}"); gimli.ReceiveAttack(gandalf.AttackValue); Console.WriteLine($"Gimli has ❤️ {gimli.Health}"); gimli.Cure(); Console.WriteLine($"Gimli has ❤️ {gimli.Health}"); }
public void Can_add_magic_item_to_wizard() { ForbiddenStaff staff = new ForbiddenStaff(70, 90); Wizard wizard = new Wizard(1, 1, 1); Assert.Catch <CannotAddItemException>(() => wizard.AddItem(staff)); }
public void BookOfWisdomWorksForWizards() { Scenario scenario = new Scenario(); Wizard gandalf = new Wizard(); Orc orc = new Orc(); Excalibur sword = new Excalibur(); gandalf.AddItem(sword); List <CharacterClass> heroes = new List <CharacterClass>() { gandalf }; List <CharacterClass> villains = new List <CharacterClass>() { orc }; BattleEncounter battle = new BattleEncounter(heroes, villains); List <List <CharacterClass> > everything = battle.PlayEncounter(); Assert.AreEqual($"-{everything[1][0].Name} has been slain by {everything[0][0].Name}", everything[0][0].Registres.ShowRegistres()); }
static void Main(string[] args) { SpellsBook book = new SpellsBook(); book.AddSpell(new SpellOne()); book.AddSpell(new SpellOne()); Wizard gandalf = new Wizard("Gandalf"); gandalf.AddItem(book); Dwarf gimli = new Dwarf("Gimli"); Console.WriteLine($"Gimli has ❤️ {gimli.Health}"); Console.WriteLine($"Gandalf attacks Gimli with ⚔️ {gandalf.AttackValue}"); gimli.ReceiveAttack(gandalf.AttackValue); Console.WriteLine($"Gimli has ❤️ {gimli.Health}"); gimli.Cure(); Console.WriteLine($"Someone cured Gimli. Gimli now has ❤️ {gimli.Health}"); DarkArcher darkArcher = new DarkArcher("Orc Commander"); darkArcher.Pv = 5; DarkBow darkBow = new DarkBow(); darkArcher.AddItem(darkBow); darkArcher.ReceiveAttack(gimli.AttackValue); gimli.MorePv(darkArcher.ChechHealth()); }
public void Test1() //Ejercicio 7 { wizard.AddItem(magic); int actual = wizard.AttackPower; int expected = magic.AttackPower; Assert.AreEqual(expected, actual); }
public void TestAttackPowerSum() { //Desafio 11 Wizard wizard = new Wizard("Wizard"); int baseAtackPower = wizard.AttackPower; MagicStick magicStick = new MagicStick(); Gauntlet gauntlet = new Gauntlet(); wizard.AddItem(new MagicStick()); wizard.AddItem(new Gauntlet()); int atackPowerFromItems = magicStick.AttackPower + gauntlet.AttackPower; int expectedAtackPower = baseAtackPower + atackPowerFromItems; int actualAtackPower = wizard.AttackPower; Assert.AreEqual(expectedAtackPower, actualAtackPower); }
public void TestDefensePowerSum() { //Desafio 12 Wizard wizard = new Wizard("Wizard"); int baseDefensePower = wizard.DefensePower; MagicStick magicStick = new MagicStick(); Armor armor = new Armor(); wizard.AddItem(new MagicStick()); wizard.AddItem(new Armor()); int defensePowerFromItems = magicStick.DefensePower + armor.DefensePower; int expectedDefensePower = baseDefensePower + defensePowerFromItems; int actualDefensePower = wizard.DefensePower; Assert.AreEqual(expectedDefensePower, actualDefensePower); }
public void Setup() { this.legolas = new Archer("Legolas"); this.bow = new Bow(); this.helmet = new Helmet(); this.shield = new Shield(); legolas.AddItem(bow); legolas.AddItem(helmet); legolas.AddItem(shield); this.nurgargan = new Wizard("Nurgargan"); Staff staff = new Staff(); SpellsBook book = new SpellsBook(); book.Spells = new Spell[] { new Spell() }; nurgargan.AddItem(staff); nurgargan.AddItem(book); }
public void AddItemShouldModifyWizardStats() { int expectedWizardAttack = 30; int expectedWizardDefense = 25; testingWizard2.AddItem(testingItem2); Assert.AreEqual(expectedWizardAttack, testingWizard2.GetCharacterAttack()); Assert.AreEqual(expectedWizardDefense, testingWizard2.GetCharacterDefense()); }
public void WizardsCanUseMagicalItemsTest() { Wizard gandalf = new Wizard(); Excalibur excalibur = new Excalibur(); gandalf.AddItem(excalibur); Assert.AreEqual(1, gandalf.ItemList.Count); }
public void MagicCreationHealth() { Character wizard = new Wizard("wizardName"); Magic magiaPotagia = new Magic(); int before = wizard.AttackPower; int expected = magiaPotagia.AttackPower; wizard.AddItem(magiaPotagia); int after = wizard.AttackPower; Assert.AreEqual(expected, after - before); }
public void RecieveAttackShouldDamageIfEnemyDefenseIsNotGreater() { Wizard attacker1 = new Wizard(100, "attacker1"); Wizard attacker2 = new Wizard(100, "attacker2"); attacker1.AddItem(testingItem2); attacker2.AddItem(testingItem); attacker2.RecieveAttack(attacker1.GetCharacterAttack()); int expected = 80; Assert.AreEqual(expected, attacker2.Health); }
public void RemoveMagic() { Character wizard = new Wizard("wizardName"); Magic magiaPotagia = new Magic(); int before = wizard.AttackPower; wizard.AddItem(magiaPotagia); int expected = wizard.AttackPower - magiaPotagia.AttackPower; wizard.RemoveItem(magiaPotagia); int after = wizard.AttackPower; Assert.AreEqual(expected, after); }
public void EnoughAttackShouldKill() { Wizard attacker1 = new Wizard(100, "attacker1"); Wizard attacker2 = new Wizard(100, "attacker2"); Item theAdminsSword = new Item("The admin sword", 1000, 1000); attacker1.AddItem(theAdminsSword); attacker2.AddItem(testingItem); attacker2.RecieveAttack(attacker1.GetCharacterAttack()); int expected = 0; Assert.AreEqual(expected, attacker2.Health); Assert.True(attacker2.IsDead); }
public void Successfully_recognize_spell_and_spell_book_and_combine_them_after_creation() { SpellBook spellBook = new SpellBook(new List <Spell>()); Wizard wizard = new Wizard(10, 10, 10, new List <AbstractItem>() { spellBook }); Spell spell = new Spell(10, 10, 10); wizard.AddItem(spell); Assert.IsTrue(wizard.Damage.Equals(10 + spell.DamageValue) && wizard.Defense.Equals(10 + spell.DefenseValue) && wizard.Hp.Equals(10 + spell.HealthValue)); }
static void Main(string[] args) { // IScenario scenario = new ConsoleScenario(); // scenario.Setup(); // scenario.Run(); Elf elfo = new Elf("El Elfo"); Wizard wizard = new Wizard("El Mago"); Troll troll = new Troll("El Troll"); Coraza coraza = new Coraza(); Cuchillo cuchillo = new Cuchillo(); Magic magic = new Magic(); Martillo martillo = new Martillo(); Palo palo = new Palo(); Rifle rifle = new Rifle(); RifleConCuchillo rifleConCuchillo = new RifleConCuchillo(); Robes robes = new Robes(); List<IGema> Gemas = new List<IGema>(); Gemas.Add(new GemaAmarilla()); Gemas.Add(new GemaCeleste()); Gemas.Add(new GemaRoja()); GuanteDePoder guanteDePoder = new GuanteDePoder(Gemas); elfo.AddItem(magic); elfo.AddItem(robes); wizard.AddItem(guanteDePoder); troll.AddItem(rifleConCuchillo); AttackEncounter attackEncounter = new AttackEncounter(elfo,wizard); ConsoleReporter consoleReporter = new ConsoleReporter(); attackEncounter.Reporter = consoleReporter; attackEncounter.DoEncounter(); AttackEncounter attackEncounter1 = new AttackEncounter(wizard, troll); attackEncounter1.Reporter = consoleReporter; attackEncounter1.DoEncounter(); }
public void TestAgregarItem() { Gandalf.AddItem(armor); Assert.IsNotEmpty(Gandalf.Items); }
public void Health_Is_Modified_By_Attack() //Prueba que el metodo ReceiveAttack modifica la vida { saruman.AddItem(sarumanSpellsBook); saruman.AddItem(sarumanStaff); saruman.AddItem(sarumanStaff); int initialLife = gandalf.Health; gandalf.ReceiveAttack(saruman); Assert.AreNotEqual(initialLife, gandalf.Health); }