Git Product home page Git Product logo

mtg's Introduction

Magic: The Gathering: The Ruby Project

This is an attempt to build a somewhat functional simulation of Magic: The Gathering in Ruby.

It is incredibly rudimentary. I have little-to-no prior game programming experience. You have been warned.

Parts of this have been inspired by Grove -- a C# implementation of MTG. Unlike Grove, this implementation does not have any UI. Use your imagination!

Getting Started

To get started with this project:

bundle install
bundle exec rspec

All the tests should pass.

Implementing a card

Let's say we want to implement a simple card, such as Story Seeker. We can do this by creating a new card at lib/magic/cards/story_seeker.rb, and then we can use the CardBuilder DSL to build this card. Given that this card does not have any activated abilities or other effects, the code is quite simple:

module Magic
  module Cards
    StorySeeker = Creature("Story Seeker") do
      cost generic: 1, white: 1
      creature_type("Dwarf Cleric")
      keywords :lifelink
      power 2
      toughness 2
    end
  end
end

You might end up implementing cards that are more complex, like Annul, which has a resolution effect that counters a target artifact or enchantment spell. You can see how this is handled at Magic::Cards::Annul.

If you're unsure how to implement a card, read through the current cards that exist -- you might find something there that matches what you need.

You might find some cards that do not use the CardBuilder DSL. These are cards that were implemented before the CardBuilder DSL was added. Can you switch these over to using the CardBuilder DSL?

Contributing in other ways

Other than cards, you could contribute by adding additional test cases around things like combat, or existing card abilities. Be sure to check the Issues for this project to see if anything is open and listed there.

Copyright

Magic: The Gathering is copyright of Wizards of the Coast.

mtg's People

Contributors

radar avatar jxc136 avatar afogel avatar d2ndjim avatar deyemiobaa avatar diogochaves 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.