/** * @test */ public function I_can_get_every_weapon_by_weapon_codes_library() { $staffsAndSpearsTable = new StaffsAndSpearsTable(); foreach (MeleeWeaponCode::getStaffAndSpearCodes() as $staffAndSpearCode) { $row = $staffsAndSpearsTable->getRow([$staffAndSpearCode]); self::assertNotEmpty($row); } }
/** * @test */ public function I_can_ask_code_if_is_specific_weapon_type() { $questions = ['isAxe', 'isKnifeOrDagger', 'isMaceOrClub', 'isMorningstarOrMorgenstern', 'isSaberOrBowieKnife', 'isStaffOrSpear', 'isSword', 'isVoulgeOrTrident', 'isUnarmed']; foreach (MeleeWeaponCode::getAxeCodes() as $codeValue) { $code = MeleeWeaponCode::getIt($codeValue); self::assertTrue($code->isMelee()); self::assertFalse($code->isRanged()); self::assertTrue($code->isAxe()); foreach ($questions as $question) { if ($question !== 'isAxe') { self::assertFalse($code->{$question}()); } } } foreach (MeleeWeaponCode::getKnifeAndDaggerCodes() as $codeValue) { $code = MeleeWeaponCode::getIt($codeValue); self::assertTrue($code->isMelee()); self::assertFalse($code->isRanged()); self::assertTrue($code->isKnifeOrDagger()); foreach ($questions as $question) { if ($question !== 'isKnifeOrDagger') { self::assertFalse($code->{$question}()); } } } foreach (MeleeWeaponCode::getMaceAndClubCodes() as $codeValue) { $code = MeleeWeaponCode::getIt($codeValue); self::assertTrue($code->isMelee()); self::assertFalse($code->isRanged()); self::assertTrue($code->isMaceOrClub()); foreach ($questions as $question) { if ($question !== 'isMaceOrClub') { self::assertFalse($code->{$question}()); } } } foreach (MeleeWeaponCode::getMorningstarAndMorgensternCodes() as $codeValue) { $code = MeleeWeaponCode::getIt($codeValue); self::assertTrue($code->isMelee()); self::assertFalse($code->isRanged()); self::assertTrue($code->isMorningstarOrMorgenstern()); foreach ($questions as $question) { if ($question !== 'isMorningstarOrMorgenstern') { self::assertFalse($code->{$question}()); } } } foreach (MeleeWeaponCode::getSaberAndBowieKnifeCodes() as $codeValue) { $code = MeleeWeaponCode::getIt($codeValue); self::assertTrue($code->isMelee()); self::assertFalse($code->isRanged()); self::assertTrue($code->isSaberOrBowieKnife()); foreach ($questions as $question) { if ($question !== 'isSaberOrBowieKnife') { self::assertFalse($code->{$question}()); } } } foreach (MeleeWeaponCode::getStaffAndSpearCodes() as $codeValue) { $code = MeleeWeaponCode::getIt($codeValue); self::assertTrue($code->isMelee()); if ($codeValue !== MeleeWeaponCode::SPEAR) { self::assertFalse($code->isRanged()); } else { self::assertTrue($code->isRanged()); } self::assertTrue($code->isStaffOrSpear()); foreach ($questions as $question) { if ($question !== 'isStaffOrSpear') { if ($question !== 'isThrowingWeapon' || $codeValue !== MeleeWeaponCode::SPEAR) { self::assertFalse($code->{$question}()); } else { self::assertTrue($code->{$question}()); } } } } foreach (MeleeWeaponCode::getSwordCodes() as $codeValue) { $code = MeleeWeaponCode::getIt($codeValue); self::assertTrue($code->isMelee()); self::assertFalse($code->isRanged()); self::assertTrue($code->isSword()); foreach ($questions as $question) { if ($question !== 'isSword') { self::assertFalse($code->{$question}()); } } } foreach (MeleeWeaponCode::getVoulgeAndTridentCodes() as $codeValue) { $code = MeleeWeaponCode::getIt($codeValue); self::assertTrue($code->isMelee()); self::assertFalse($code->isRanged()); self::assertTrue($code->isVoulgeOrTrident()); foreach ($questions as $question) { if ($question !== 'isVoulgeOrTrident') { self::assertFalse($code->{$question}()); } } } foreach (MeleeWeaponCode::getUnarmedCodes() as $codeValue) { $code = MeleeWeaponCode::getIt($codeValue); self::assertTrue($code->isMelee()); self::assertFalse($code->isRanged()); self::assertTrue($code->isUnarmed()); foreach ($questions as $question) { if ($question !== 'isUnarmed') { self::assertFalse($code->{$question}()); } } } }