Mini jogo de RPG em Ruby
✓ Published0🌍 Public
SSeralto
Last edited May 9, 2016
Created on May 9, 2016
This example shows a text-based combat simulation between a hero and a series of monsters, tracking the hero's energy and kill count until the hero dies. It implements a turn-based loop where the hero (an instance of the `Heroi` class) and a `Monstro` instance alternately call the `bater` method, reducing each other's `energia` attribute with random attack values. The code uses Ruby's `Random.rand` to determine damage and relies on class attributes such as `energia`, `ataque`, and `numero_de_mortos` to manage state, with the process repeating via nested `while` loops until one character’s energy drops to zero.
AI-generated description