public void TestEquipToHand_EquippingTwoHandedWeaponWhereBothHandsAreEmpty() { Dictionary <Dungeons_and_Dragons.Attribute, int> dict = new Dictionary <Dungeons_and_Dragons.Attribute, int>(); dict.Add(Dungeons_and_Dragons.Attribute.Strength, 12); dict.Add(Dungeons_and_Dragons.Attribute.Dexterity, 15); dict.Add(Dungeons_and_Dragons.Attribute.Intelligence, 3); dict.Add(Dungeons_and_Dragons.Attribute.Wisdom, 18); dict.Add(Dungeons_and_Dragons.Attribute.Constitution, 17); dict.Add(Dungeons_and_Dragons.Attribute.Charisma, 9); int xp = 0; int hp = 3; Fighter fighter = new Fighter("Richard", Race.Human, dict, hp, xp); TwoHandedSword sword = new TwoHandedSword(); Assert.IsNull(fighter.equippedInRightHand, "TEST1: It was expected that nothing should be equipped to the fighter's right hand"); Assert.IsNull(fighter.equippedInLeftHand, "TEST2: It was expected that nothing should be equipped to the fighter's left hand"); bool val = fighter.EquipToHand(sword, Hand.Right); Assert.IsTrue(val, "TEST3: It was expected equipping the sword to the right hand should return true"); Assert.AreEqual(sword, fighter.equippedInRightHand, "TEST4: It was expected that the sword should be equipped to the right hand"); Assert.AreEqual(sword, fighter.equippedInLeftHand, "TEST5: It was expected that the sword should be equipped to the left hand"); }
public void TestEquipToHand_EquippingTwoHandWeaponWhenBothHandsAreHoldingWeapons() { int expectedItemCountInInventory = 0; int expectedItemCountInInventoryAfterTheSwap = 2; Dictionary <Dungeons_and_Dragons.Attribute, int> dict = new Dictionary <Dungeons_and_Dragons.Attribute, int>(); dict.Add(Dungeons_and_Dragons.Attribute.Strength, 12); dict.Add(Dungeons_and_Dragons.Attribute.Dexterity, 15); dict.Add(Dungeons_and_Dragons.Attribute.Intelligence, 3); dict.Add(Dungeons_and_Dragons.Attribute.Wisdom, 18); dict.Add(Dungeons_and_Dragons.Attribute.Constitution, 17); dict.Add(Dungeons_and_Dragons.Attribute.Charisma, 9); int xp = 0; int hp = 3; Fighter fighter = new Fighter("Richard", Race.Human, dict, hp, xp); Mace mace = new Mace(); Spear spear = new Spear(); TwoHandedSword twoHandedSword = new TwoHandedSword(); bool valMaceEquip = fighter.EquipToHand(mace, Hand.Right); bool valSpearEquip = fighter.EquipToHand(spear, Hand.Left); Assert.IsTrue(valMaceEquip, "TEST1: It was expected equipping the mace to the right hand should return true"); Assert.AreEqual(mace, fighter.equippedInRightHand, "TEST2: It was expected that the mace should be equipped to the right hand"); Assert.IsTrue(valSpearEquip, "TEST3: It was expected equipping the spear to the left hand should return true"); Assert.AreEqual(spear, fighter.equippedInLeftHand, "TEST4: It was expected that the spear should be equipped to the left hand"); Assert.AreEqual(expectedItemCountInInventory, fighter.inventory.Count, "TEST5: It was expected that the fighter's inventory was empty"); bool valSwordEquip = fighter.EquipToHand(twoHandedSword, Hand.Left); Assert.IsTrue(valSwordEquip, "TEST5: It was expected equipping the two hand sword should return true"); Assert.AreEqual(twoHandedSword, fighter.equippedInRightHand, "TEST6: It was expected that the two handed sword should be equipped in the right hand"); Assert.AreEqual(twoHandedSword, fighter.equippedInLeftHand, "TEST7: It was expected that the two handed sword should be equipped in the left hand"); Assert.AreEqual(expectedItemCountInInventoryAfterTheSwap, fighter.inventory.Count, "TEST8: It was expected that the fighter's inventory should contain 2 items"); Assert.AreEqual(mace, fighter.inventory[0], "TEST9: It was expected that the mace should be in the inventory"); Assert.AreEqual(spear, fighter.inventory[1], "TEST10: It was expected that the spear should be in the inventory"); }
// Use this for initialization void Start() { //Initialize Abilities - TODO Should this be done statically? dStrike = new Decisive_Strike(); dStrike.setScript(this); courage = new Courage(); courage.setScript(this); judgement = new Judgement(); judgement.setScript(this); dJustice = new Demacian_Justice(); dJustice.setScript(this); valor = new Valor(); valor.setScript(this); level = 1; IconWidth = judgementTexture.width; IconHeight = judgementTexture.height; //Initially not running running = false; idling = true; a = gameObject.GetComponent(typeof(Animation)) as Animation; originalRotation = transform.localRotation; spinning = false; alive = true; inventory = new Item[inventorySize]; TwoHandedSword startingSword = new TwoHandedSword(); startingSword.randomizeWeapon(1, 1); awardItem(startingSword); Helm startingHelm = new Helm(); startingHelm.randomizeArmor(1, 1); awardItem(startingHelm); Chest startingChest = new Chest(); startingChest.randomizeArmor(1, 1); awardItem(startingChest); Gloves startingGloves = new Gloves(); startingGloves.randomizeArmor(1, 1); awardItem(startingGloves); Boots startingBoots = new Boots(); startingBoots.randomizeArmor(1, 1); awardItem(startingBoots); checkpointTexture = Resources.Load("CheckpointTexture/CheckpointMaybe") as Texture2D; playerPortrait = Resources.Load("CheckpointTexture/garen_circle") as Texture2D; playerManaTexture = Resources.Load("PlayerTextures/mana") as Texture2D; leftClickOverlay = Resources.Load("InstructionPage/leftclick") as Texture2D; rightClickOverlay = Resources.Load("InstructionPage/rightclick") as Texture2D; winTexture = Resources.Load("GUITextures/victoryFull") as Texture2D; lossTexture = Resources.Load("GUITextures/defeatFull") as Texture2D; continueButton = Resources.Load("InstructionPage/Continue") as Texture2D; continueButtonHighlighted = Resources.Load("InstructionPage/Continue2") as Texture2D; equipment = new Item[5]; //TODO decide on size equipmentRect = new Rect(50, 50, 300, 300); inventoryRect = new Rect(Screen.width - 350, 50, 300, Mathf.Ceil(inventorySize / 6) * 50 + 20); confirmRect = new Rect((Screen.width / 2) - 150, Screen.height / 4, 300, 300); continueRect = new Rect((Screen.width / 2) - (continueButton.width / 2), Screen.height * (3.0f/4.0f), continueButton.width, continueButton.height); movementSpeed = 1; recalculateStats(); if(PlayerPrefs.GetString("IsSaveGame") == "true"){ name = PlayerPrefs.GetString("SaveFileName"); Load(); } currentHealth = maxHealth; Save(); }
public void TestThatTwoHandedSwordCanBeEquippedInMainHandWithNothingPresent() { EquipmentClass testCandidate = new TwoHandedSword(); EquipInMainHandAndTestThatItIsOccupied(testCandidate); }
public void TestThatBoltQuiverCannotBeEquippedWhenNonCrossBowIsInMainHand() { PlayerEquipmentSlots playerEquipment = new PlayerEquipmentSlots(); EquipmentClass mainHandEquipment = new OneHandedSword(); EquipmentClass offHand = new BoltQuiver(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(offHand); EquipmentClass offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new OneHandedMace(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(offHand); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new Wand(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(offHand); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new TwoHandedSword(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(offHand); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new TwoHandedMace(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(offHand); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new MagicStaff(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(offHand); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new Bow(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(offHand); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new CrossBow(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(offHand); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.EqualTo(offHand)); }
public void TestThatTwoHandedSwordsCannotBeEquippedWithOffHands() { EquipmentClass testCandidate = new TwoHandedSword(); TestThatTwoHandedWeaponsCannotBeEquippedWithOffHands(testCandidate); }
private void TestThatOffHanderCanOnlyBeEquippedWithOneHander(EquipmentClass firstOffHanderInstance, EquipmentClass secondOffHanderInstance) { PlayerEquipmentSlots playerEquipment = new PlayerEquipmentSlots(); EquipmentClass mainHandEquipment = new TwoHandedSword(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(firstOffHanderInstance); EquipmentClass offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new TwoHandedMace(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(firstOffHanderInstance); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new MagicStaff(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(firstOffHanderInstance); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new Bow(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(firstOffHanderInstance); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new CrossBow(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(firstOffHanderInstance); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.Null); mainHandEquipment = new OneHandedSword(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(firstOffHanderInstance); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.EqualTo(firstOffHanderInstance)); mainHandEquipment = new OneHandedMace(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(secondOffHanderInstance); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.EqualTo(secondOffHanderInstance)); mainHandEquipment = new Wand(); playerEquipment.EquipInMainHand(mainHandEquipment); playerEquipment.EquipInOffHand(firstOffHanderInstance); offHandEquipment = playerEquipment.GetOffHandEquipment(); Assert.That(offHandEquipment, Is.EqualTo(firstOffHanderInstance)); }
public static void Weapon() { string prefixName; int prefixValue; string prefixStat; (prefixName, prefixStat, prefixValue) = Prefix.Generate("Weapon"); string suffixName; string suffixStat; int suffixValue; (suffixName, suffixStat, suffixValue) = Suffix.Generate("Weapon"); int _weaponType = random.Next(1, 27); //26 weapons switch (_weaponType) { case 1: Axe axe = new Axe(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); // Console.WriteLine("prefixName: " + prefixName + ", prefixStat: " + prefixStat + ", prefixValue: " + prefixValue + ", suffixName: " + suffixName + ", suffixStat: " + suffixStat + ", suffixVallue: " + suffixValue); axe.WeaponAddToInventory(); break; case 2: BastardSword bastardSword = new BastardSword(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); bastardSword.WeaponAddToInventory(); break; case 3: BattleAxe battleAxe = new BattleAxe(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); battleAxe.WeaponAddToInventory(); break; case 4: Blade blade = new Blade(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); blade.WeaponAddToInventory(); break; case 5: BroadAxe broadAxe = new BroadAxe(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); broadAxe.WeaponAddToInventory(); break; case 6: BroadSword broadSword = new BroadSword(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); broadSword.WeaponAddToInventory(); break; case 7: Claymore claymore = new Claymore(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); claymore.WeaponAddToInventory(); break; case 8: Club club = new Club(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); club.WeaponAddToInventory(); break; case 9: Dagger dagger = new Dagger(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); dagger.WeaponAddToInventory(); break; case 10: Falchion falchion = new Falchion(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); falchion.WeaponAddToInventory(); break; case 11: Flail flail = new Flail(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); flail.WeaponAddToInventory(); break; case 12: GreatAxe greatAxe = new GreatAxe(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); greatAxe.WeaponAddToInventory(); break; case 13: GreatSword greatSword = new GreatSword(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); greatSword.WeaponAddToInventory(); break; case 14: LargeAxe largeAxe = new LargeAxe(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); largeAxe.WeaponAddToInventory(); break; case 15: LongSword longSword = new LongSword(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); longSword.WeaponAddToInventory(); break; case 16: Mace mace = new Mace(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); mace.WeaponAddToInventory(); break; case 17: Maul maul = new Maul(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); maul.WeaponAddToInventory(); break; case 19: MorningStar morningStar = new MorningStar(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); morningStar.WeaponAddToInventory(); break; case 20: Sabre sabre = new Sabre(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); sabre.WeaponAddToInventory(); break; case 21: Scimitar scimitar = new Scimitar(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); scimitar.WeaponAddToInventory(); break; case 22: ShortSword shortSword = new ShortSword(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); shortSword.WeaponAddToInventory(); break; case 23: SmallAxe smallAxe = new SmallAxe(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); smallAxe.WeaponAddToInventory(); break; case 24: SpikedClub spikedClub = new SpikedClub(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); spikedClub.WeaponAddToInventory(); break; case 25: TwoHandedSword twoHandedSword = new TwoHandedSword(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); twoHandedSword.WeaponAddToInventory(); break; case 26: WarHammer warHammer = new WarHammer(prefixName, prefixStat, prefixValue, suffixName, suffixStat, suffixValue); warHammer.WeaponAddToInventory(); break; } }