Swiftpack.co - MarcosAtMorais/TypeEffectivenessKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by MarcosAtMorais.
MarcosAtMorais/TypeEffectivenessKit v1.0.1
Want to know what to use when battling a Pokémon? TypeEffectivenessKit is here to help you with all types.
⭐️ 2
🕓 1 year ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/MarcosAtMorais/TypeEffectivenessKit.git", from: "v1.0.1")

Swift Version Dependency frameworks Twitter Platforms

TypeEffectivenessKit is a Type Effectiveness Checker for all kinds of Pokémon Types and Pokémon Move Types. With TypeEffectivenessKit, you'll be able to have a simple yet flexible framework to work with.

✨ Features

  • Type Weaknesses: No Effect, Barely Effective (1/4), Not Very Effective (1/2), Effective, Super Effective (2x) and Ultra Effective (4x).
  • The relationships are all ready. Both for Single and Dual Types. A PokemonType has its weaknesses, as well as some identifiers.
  • Easily check a type. Just bring the method for Checking Effectiveness and you'll be able to check everything.
  • Built Swifty and with lightweight in mind.
  • 100% Swift.
  • Three examples are included in the package. All using SwiftUI, following architectural patterns and leveraging SwiftUI's power.
  • Fully documented and tested.
  • Updated from the latest games released.
  • This will be very useful especially for Terastal Pokémon and Tera Raid Battles on the brand-new games.

🚀 Get Started

Using TypeEffectivenessKit in Production Code

Just import TypeEffectivenessKit:

import TypeEffectivenessKit

Then, you can use it as you please. Like this quick example using single types:

let pokemonType: PokemonType = .fire
let moveType: PokemonType = .water

let effectiveness = pokemonType.checkSingleTypeEffectiveness(offensiveType: moveType)

print(effectiveness.localized) // Super Effective

An example using a Pokémon that has two types. This is one option:

let pokemonFirstType: PokemonType = .fire
let pokemonSecondType: PokemonType = .ghost
let moveType: PokemonType = .grass

let effectiveness = pokemonFirstType.checkDualTypeEffectiveness(otherType: pokemonSecondType, offensiveType: moveType)

print(effectiveness.localized) // Not Very Effective

Another example using Dual Type Pokémon, now using a struct named DualType that includes it with a convenience method:

let pokemonFirstType: PokemonType = .fairy
let pokemonSecondType: PokemonType = .psychic
let dualType = DualType(firstType: pokemonFirstType, secondType: pokemonSecondType)

let moveType: PokemonType = .dragon

let effectiveness = dualType.fetchTypeEffectivenessAccordingTo(moveType)

print(effectiveness.localized) // No Effect

This package also includes several SwiftUI views that display the types, color and symbols in a stylish way. As well as grids and stacks. You can use these views as you please. Explore 'em all!

📱 Example App for educational purposes

TypeEffectivenessKit also comes with several scenes that you can learn from for how to use types. Such as this one and many others:

All examples are located on the View folder, but the elements should be able to be used just with the package import.

🔨 Swift Package Manager

You can also add this library using Swift Package Manager.

  1. Go to File > Add Packages.
  2. The Add Package dialog will appear, by default with Apple packages.
  3. In the upper right hand corner, paste https://github.com/MarcosAtMorais/TypeEffectivenessKit into the search bar.
  4. Hit Return to kick off the search.
  5. Click Add Package.
  6. You're all set! Just import TypeEffectivenessKit whenever and wherever you want to use it.

🌟 Requirements

iOS 15+

macOS 12+

watchOS 7+

tvOS 14+

💭 Related

This package is just for hobby and educational purposes. It may not be used for commercial releases. Pokémon is a trademark of Nintendo, Game Freak, The Pokémon Company and Creatures Inc. No copyright or trademark infringement is intended.

GitHub

link
Stars: 2
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.0.1
1 year ago

This version includes all functionality for the Kit, while also including some example projects located on the View folder. Have fun!

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics