From 0b9ac811ee84b56d94165e97c9340aade6818213 Mon Sep 17 00:00:00 2001 From: tcaxle Date: Sat, 11 Apr 2020 14:55:45 +0100 Subject: [PATCH] rollConfiguration. Migrations. --- app/__pycache__/admin.cpython-38.pyc | Bin 645 -> 678 bytes app/__pycache__/models.cpython-38.pyc | Bin 10399 -> 12919 bytes app/admin.py | 2 + app/migrations/0011_rollconfiguration.py | 30 ++++++ .../0011_rollconfiguration.cpython-38.pyc | Bin 0 -> 1384 bytes app/models.py | 100 ++++++++++++++++++ 6 files changed, 132 insertions(+) create mode 100644 app/migrations/0011_rollconfiguration.py create mode 100644 app/migrations/__pycache__/0011_rollconfiguration.cpython-38.pyc diff --git a/app/__pycache__/admin.cpython-38.pyc b/app/__pycache__/admin.cpython-38.pyc index 9c1e40b9d400e36ff45c2b7f7a76ac21b8bd5680..6ae4697fe6d6727c572ce404e6d9cf7de3ff9194 100644 GIT binary patch delta 91 zcmZo=UB=2A%FD~e00ak5O^nN*$SccuW1{wHj#S1h<^?RNA`?HUFp5qVXVe!g%FoGh s&d*EBOfM};EXmBzo9x2)fK39Zvq)mH7Lz%r5|GKm$ic)jIfF?S0J7H@F8}}l delta 63 zcmZ3++RDls%FD~e00i6gC&sx?C6SU%InLo6o9yP2x3ZfkyPK!YQ}UL5%RVJ}$>b$fn};x!hvXqgxhhrp{+H}dFg58KQ3vHeSm8D$69^Xwp~F?NVeu)_$&*%9^vJIY>U$Jk3ts+pJyvEwZH zAjFckbYtXx*c=7r1bZ2jmqFPE$`~lGuvbBO6_o9ujDvELodV@lP-+J#r`Z`$&e-ye zoyhYXD6g@zpqvd#?E>X>_68_#1f_O^@+Nx=l(z!P9#GD)^PrpuWiRU42g+C2+n~H1 zQ1*jzfxQFDJNAC$IDq&?_AcV@ium)0Ut$L0hKL_Te3GRQPX#p`0wv8dpk(Yrs9^%} z%WMkqDG@)6_%zERp0y7n{RrY$*n5b-C*m(4o?|nJ&xrg-5zn&%;)S4v7eOhq_d$6- zpd16G#LA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4JWK(+J>n!Y}$>%{?_#>w2ioChYM=T=e^-dYqYFep5pWt7F>Fj zANujFT>bbE5W(t$cf}5rLwPywWJ|O6QSd$G@RMykPtUB4JC-JWV>!J-4wxnG7b;@l zcdL3rTU$Eu<&TP)^f2&FqEZGwLm5K_Lkq+1F~&-UDuz~uI)-|NHh}7z)+n9Ok|9Ee zwKIK$p@X4;A;3_>(8zEcpn77Pap)u->eR$!GXvj6$p?rAyZ7I0-BqSS44hzIqmAsX z_1sY`zhDosGAuvojVTYa#gx}izLPw(&%RVp%V^MP*<4o5^au{W$ol&m)bFE5c@5Bh z@XLP;MVaULah_V0{J5{?VAZ#w`n8;@liq$!b)vtfZwV_bcl;Afyq~Aaa`1%wN`K2P z-C!k^;SPg&FeZ4k$?yPRc!pOr8cXO&VZIK-Gtc)rQ|6s#l<)>!)-y}^^dUZE)$(cF zvlB5rsmC+R`LH!FHe~LxqUl}!3&*_5nAZ^E%LMUfpYAef3~>hjmJojph|gZ)6O#BK zBR*@0H@CSfiFX%qKM=no;(8NTjyUJf76%PzxG&;Z+fM42Q6XFE8K6XQ%Rir*Eb~+r On?H9Y|9o<0pzHq&i7l=G diff --git a/app/admin.py b/app/admin.py index 394fbea..3262720 100644 --- a/app/admin.py +++ b/app/admin.py @@ -1,6 +1,8 @@ from django.contrib import admin from .models import * +admin.site.register(rollConfiguration) + admin.site.register(modifierAttribute) admin.site.register(modifierAbility) admin.site.register(modifierStatic) diff --git a/app/migrations/0011_rollconfiguration.py b/app/migrations/0011_rollconfiguration.py new file mode 100644 index 0000000..dcdd186 --- /dev/null +++ b/app/migrations/0011_rollconfiguration.py @@ -0,0 +1,30 @@ +# Generated by Django 3.0.5 on 2020-04-11 13:55 + +import app.models +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0010_auto_20200411_1302'), + ] + + operations = [ + migrations.CreateModel( + name='rollConfiguration', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('r01', app.models.DieField(choices=[('NONE', 'None'), ('SUCCESS', 'Success'), ('DOUBLE', 'Double'), ('EXPLODING', 'Exploding'), ('DISAPPEARING', 'Disappearing'), ('SUBTRACTING', 'Subtracting')], default='NONE', max_length=100, number=1, verbose_name='1s')), + ('r02', app.models.DieField(choices=[('NONE', 'None'), ('SUCCESS', 'Success'), ('DOUBLE', 'Double'), ('EXPLODING', 'Exploding'), ('DISAPPEARING', 'Disappearing'), ('SUBTRACTING', 'Subtracting')], default='NONE', max_length=100, number=2, verbose_name='2s')), + ('r03', app.models.DieField(choices=[('NONE', 'None'), ('SUCCESS', 'Success'), ('DOUBLE', 'Double'), ('EXPLODING', 'Exploding'), ('DISAPPEARING', 'Disappearing'), ('SUBTRACTING', 'Subtracting')], default='NONE', max_length=100, number=3, verbose_name='3s')), + ('r04', app.models.DieField(choices=[('NONE', 'None'), ('SUCCESS', 'Success'), ('DOUBLE', 'Double'), ('EXPLODING', 'Exploding'), ('DISAPPEARING', 'Disappearing'), ('SUBTRACTING', 'Subtracting')], default='NONE', max_length=100, number=4, verbose_name='4s')), + ('r05', app.models.DieField(choices=[('NONE', 'None'), ('SUCCESS', 'Success'), ('DOUBLE', 'Double'), ('EXPLODING', 'Exploding'), ('DISAPPEARING', 'Disappearing'), ('SUBTRACTING', 'Subtracting')], default='NONE', max_length=100, number=5, verbose_name='5s')), + ('r06', app.models.DieField(choices=[('NONE', 'None'), ('SUCCESS', 'Success'), ('DOUBLE', 'Double'), ('EXPLODING', 'Exploding'), ('DISAPPEARING', 'Disappearing'), ('SUBTRACTING', 'Subtracting')], default='NONE', max_length=100, number=6, verbose_name='6s')), + ('r07', app.models.DieField(choices=[('NONE', 'None'), ('SUCCESS', 'Success'), ('DOUBLE', 'Double'), ('EXPLODING', 'Exploding'), ('DISAPPEARING', 'Disappearing'), ('SUBTRACTING', 'Subtracting')], default='SUCCESS', max_length=100, number=7, verbose_name='7s')), + ('r08', app.models.DieField(choices=[('NONE', 'None'), ('SUCCESS', 'Success'), ('DOUBLE', 'Double'), ('EXPLODING', 'Exploding'), ('DISAPPEARING', 'Disappearing'), ('SUBTRACTING', 'Subtracting')], default='SUCCESS', max_length=100, number=8, verbose_name='8s')), + ('r09', app.models.DieField(choices=[('NONE', 'None'), ('SUCCESS', 'Success'), ('DOUBLE', 'Double'), ('EXPLODING', 'Exploding'), ('DISAPPEARING', 'Disappearing'), ('SUBTRACTING', 'Subtracting')], default='SUCCESS', max_length=100, number=9, verbose_name='9s')), + ('r10', app.models.DieField(choices=[('NONE', 'None'), ('SUCCESS', 'Success'), ('DOUBLE', 'Double'), ('EXPLODING', 'Exploding'), ('DISAPPEARING', 'Disappearing'), ('SUBTRACTING', 'Subtracting')], default='DOUBLE', max_length=100, number=10, verbose_name='10s')), + ], + ), + ] diff --git a/app/migrations/__pycache__/0011_rollconfiguration.cpython-38.pyc b/app/migrations/__pycache__/0011_rollconfiguration.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..10a2c7a611b61762fcd643b3d26ce9ecc535cbdf GIT binary patch literal 1384 zcmZ{k$!^m?7{|S5El?=?4rK{TVy9)35Kxj(DnVM2Rzf*oIr*lpgO@P2QOgysJ@5kD z;aPZsxpMLYaNz)aGclqPWGs*8Kl2;Ue9O$n%uHFrvhwxgt1nea`o_iHqM>+%Z(PR; zB#?cnFXLD7l|b#Qf!5b#X;}glv=0(!L>=kx)xHjLPpat|&XKw`g_Q%(rB32SVa$vm z0^-L*KDM{ap?HLE{7IH1B39`uAiHv3CE7>_1yo{;3ZUVmg8_wIZBv0FDUOU$2})3g z3RGbR_PGY^hXXJR2jS4Jj?COt<}e(|nWIygV{klYPE2J^!l|4&J(W2FXLIJ@7u1saFLM>;mO=YgbjhwmpU#5<0HNc!OZUwAe1!GZ$CPsFFm7f2J zD27*c#$$HWG%eG1(j>B*X45nmEz7nR%qE+qk?*&naMN?sNfI!{gY_p&S!vfaRuxl* zlsE|iRvA+-aOjTxn(VMrOsMDh-aEpoZwVblF|k7@AWWsEh3jhF)oustC?u!~y^U6@ z)9Ya)9S%txW1rDp-FW=0gWo6}_?#+rUamb`ZLf5fvAI3=Bk)2O`>XAh-qPAyXXynW zsI@Scqx&&sGvF1bt;7^7uIa2W+=@Kh0xJO7 zbW%UT6X0yyJ_+4qiy2`W3<#w&d;*%%%oH)T8FRIesX{FXwV3e}$dpB)Ze_Yqw}iT# z8A9C_>JFVnl@&zS9np0+D++a2sC!vSsC!&lCOyP)e)^eencP{L@U5}w5g+1it-^}7 zaJOxY~f=1o-k_Op!e9Vsq2Bq=$GHGDWSvJqF;okhJ zk9R0{8}~&#k5y4serdWUE6SWa|L^l%`KkR9GipY^j7!ufchqFFB^WuO8`WVT%o7#~ a`0sWnt*5vWE8d?t>H#-A=DR4$2h`sp5OtRT literal 0 HcmV?d00001 diff --git a/app/models.py b/app/models.py index 656f4eb..32933f2 100644 --- a/app/models.py +++ b/app/models.py @@ -1,5 +1,6 @@ from django.db import models import multiselectfield +from random import randint #==============================================================================# #-------------------------------- OPTION LISTS --------------------------------# @@ -150,6 +151,15 @@ INTENSITIES = [ ("DEFINING", "Defining"), ] +DIE_TYPES = [ + ("NONE", "None"), + ("SUCCESS", "Success"), + ("DOUBLE", "Double"), + ("EXPLODING", "Exploding"), + ("DISAPPEARING", "Disappearing"), + ("SUBTRACTING", "Subtracting") +] + #==============================================================================# #------------------------------- CUSTOM MODELS --------------------------------# #==============================================================================# @@ -205,6 +215,96 @@ class NamedCharField(models.CharField): kwargs['max_length'] = 100 super().__init__(*args, **kwargs) +class DieField(models.CharField): + def __init__(self, verbose_name, number, default, *args, **kwargs): + self.number = number + kwargs['verbose_name'] = verbose_name + kwargs['default'] = default + kwargs['choices'] = DIE_TYPES + kwargs['blank'] = False + kwargs['max_length'] = 100 + super().__init__(*args, **kwargs) + + def deconstruct(self): + name, path, args, kwargs = super().deconstruct() + kwargs['number'] = self.number + return name, path, args, kwargs + +#==============================================================================# +#-------------------------------- DICE ROLLING --------------------------------# +#==============================================================================# +class rollConfiguration(models.Model): + r01 = DieField("1s", 1, "NONE") + r02 = DieField("2s", 2, "NONE") + r03 = DieField("3s", 3, "NONE") + r04 = DieField("4s", 4, "NONE") + r05 = DieField("5s", 5, "NONE") + r06 = DieField("6s", 6, "NONE") + r07 = DieField("7s", 7, "SUCCESS") + r08 = DieField("8s", 8, "SUCCESS") + r09 = DieField("9s", 9, "SUCCESS") + r10 = DieField("10s", 10, "DOUBLE") + + def listDice(self): + listDice = [ + self.r01, + self.r02, + self.r03, + self.r04, + self.r05, + self.r06, + self.r07, + self.r08, + self.r09, + self.r10, + ] + listSuccess = [] + listDouble = [] + listExploding = [] + listDisappearing = [] + listSubtracting = [] + for die in listDice: + if die == "SUCCESS": + listSuccess.append(die.number) + elif die == "DOUBLE": + listDouble.append(die.number) + elif die == "EXPLODING": + listExploding.append(die.number) + elif die == "DISAPPEARING": + listDisappearing.append(die.number) + elif die == "SUBTRACTING": + listSubtracting.append(die.number) + return listSuccess, listDouble, listExploding, listDisappearing, listSubtracting + + def roll(self, pool=1): + listSuccess, listDouble, listExploding, listDisappearing, listSubtracting = self.listDice() + successes = 0 + listExploded, listDisappeared = [], [] + listRoll = [0 for die in range(pool)] + while 0 in listRoll: + for die in listRoll: + if die == 0: + die = randint(1, 10) + if die in listExploding: + listExploded.append(die) + die = 0 + if die in listDisappearing: + listDisappeared.append(die) + die = 0 + for die in listRoll + listExploded: + if die in listSuccess: + successes += 1 + elif die in listDouble: + successes += 2 + elif die in listSubtracting: + successes -= 1 + if successes < 0: + successes = 0 + botch = (successes == 0) and (1 in listRoll) + return successes, botch, listRoll, listExploded, listDisappeared + + + #==============================================================================# #--------------------------------- MODIFIERS ----------------------------------#