Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combat #5

Open
Mizar999 opened this issue Feb 12, 2020 · 0 comments
Open

Combat #5

Mizar999 opened this issue Feb 12, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Mizar999
Copy link
Owner

  • Add a game log
  • Add an attack action
  • Implement basic combat mechanics
func attack(source, target) -> void:
    if attackHits(source, target):
        applyHits(source, target)

func attackHits(source, target) -> bool:
    var result = roll(source.dex)
    if result < 0.25:
        return false
    return (source.dex - (target.dex * 0.5) + result) > 4

func roll(sides: int) -> float:
    var result = (rand() * rand()) * sides * 0.5
    if result > (sides - 0.5):
        result += roll(sides)
    return result
@Mizar999 Mizar999 self-assigned this Feb 12, 2020
@Mizar999 Mizar999 added the enhancement New feature or request label Feb 12, 2020
@Mizar999 Mizar999 added this to To do in Basic game elements via automation Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant