Giter Site home page Giter Site logo

marcosatmorais / typeeffectivenesskit Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 214 KB

Want to know what to use when battling a Pokémon? TypeEffectivenessKit is here to help you with all types.

Swift 100.00%
battles best-practices effective effectiveness move pokedex pokemon pokemon-types swift swiftui

typeeffectivenesskit's Introduction

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.

typeeffectivenesskit's People

Contributors

marcosatmorais avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.