GolangGame

command module
v0.0.0-...-0d3fd51 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2020 License: MIT Imports: 2 Imported by: 0

README

Game of chance

worktime 2h
Golang Coding Demo.

Hero stats:

  • Health: 70 - 100
  • Strength: 70 - 80
  • Defence: 45 – 55
  • Speed: 40 – 50
  • Luck: 10% - 30% (0% means no luck, 100% lucky all the time)

Hero skills:

  • Critical Strike: Strike twice while it’s his turn to attack; there’s a 10% chance he’ll use this skill every time he attacks. If he uses this skill then there is also a 1% chance that he’ll strike three times instead of two.
  • Resilience: Takes only half of the usual damage when an enemy attacks; there’s a 20% chance he’ll use this skill when he defends but this skill cannot be used two turns in a row.

Bad-Guy stats:

  • Health: 60 - 90
  • Strength: 60 - 90
  • Defence: 40 – 60
  • Speed: 40 – 60
  • Luck: 25% - 40%

Game rules: You’ll have to simulate a battle between the hero and a nefarious villain, either at command line or using a web browser. On every battle, the hero and the villain must be initialized with random properties, within their ranges.

The first attack is done by the player with the higher speed. If both players have the same speed, then the attack is carried on by the player with the highest luck. After an attack, the players switch roles: the attacker now defends and the defender now attacks.

The damage done by the attacker is calculated with the following formula: Damage = Attacker strength – Defender defence

The damage is subtracted from the defender’s health. An attacker can miss their hit and do no damage if the defender gets lucky that turn.

The hero’s skills occur randomly, based on their chances, so take them into account on each turn.

Game over The game ends when one of the players remain without health or the number of turns reaches 20. The application must output the results each turn: what happened, which skills were used (if any), the damage done, defender’s health left. If we have a winner before the maximum number of rounds is reached, he must be declared.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL