19 lines
438 B
Python
19 lines
438 B
Python
|
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")
|