state sync; the basic early game works
This commit is contained in:
19
app/pylocal/actions.py
Normal file
19
app/pylocal/actions.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import json
|
||||
import random
|
||||
|
||||
import flask
|
||||
|
||||
from . import core
|
||||
|
||||
def dice_roll(min=0, max=100, modifiers=[]):
|
||||
result = random.randint(min, max)
|
||||
for _, mod in modifiers:
|
||||
result += mod
|
||||
|
||||
return result
|
||||
|
||||
@core.app.route("/act/steal/<resource>", methods=["POST"])
|
||||
def steal_resource(resource):
|
||||
return flask.Response(json.dumps({
|
||||
"success": (dice_roll() >= 50)
|
||||
}), status=200, content_type="application/json")
|
Reference in New Issue
Block a user