Compare commits

...

9 Commits

Author SHA1 Message Date
Dennis
2da9e96537 Lightning 2024-03-27 22:30:19 +01:00
Dennis
e848494967 l 2024-02-29 23:58:49 +01:00
Dennis
2331bab303 sdf 2024-02-22 20:35:18 +01:00
Dennis
346273f737 sdf 2024-02-22 20:26:27 +01:00
Dennis
d2f490a9cf s 2024-02-22 10:02:52 +01:00
Dennis
eff508033c s 2024-02-22 10:02:07 +01:00
Dennis
31c08a3864 asdf 2024-02-21 15:51:11 +01:00
Dennis
8fff8fdcaa asdf 2024-02-21 14:13:27 +01:00
Dennis
bea46a4ecd Opdatering af specielt crit og skade håndtering. 2024-02-21 14:12:51 +01:00
4 changed files with 102 additions and 525 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
input.txt

476
input.txt
View File

@@ -1,476 +0,0 @@
View all chat entries for this game »
Dennis:
24 + 4 19 + 4
20/60
Gauntlets of Midnight (+14)
30
Divine
21 + 4 31 + 4
20/60
Gauntlets of Midnight (+14)
20
Divine
32 + 2 26 + 2
20/60
Gauntlets of Midnight (+14)
29
Divine
Almighty GM (GM):Revered Ancient Vampire Spellcaster Claws at Zarkull against AC 27
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 44 | 29
Damage: 91bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Revered Ancient Vampire Spellcaster Bites at Healem All The Empowered against AC 28
Bite (Bat or Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 37 | 37
Damage: 51piercing + 51necrotic
The target's hit point maximum is reduced by an amount equal to the necrotic damage taken, and the vampire regains hit points equal to that amount. The reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0. A humanoid slain in this way and then buried in the ground rises the following night as a vampire spawn under the vampire's control
Almighty GM (GM):Revered Ancient Vampire Spellcaster Claws at Zarkull against AC 27
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 28 | 35
Revered Ancient Vampire Spellcaster Claws at Zarkull against AC 27
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 41 | 39
Damage: 111bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Revered Ancient Vampire Spellcaster Claws at Mehtahl Whint against AC 35
Almighty GM (GM):
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 38 | 38
Damage: 67bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Revered Ancient Vampire Spellcaster Claws at Healem All The Empowered against AC 28
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 44 | 33
Damage: 94bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Healem All:
29 + 4 30 + 4
CONSTITUTION SAVE (12)
15 + 2 17 + 2
CONSTITUTION SAVE (12)
Almighty GM (GM) The night seems to go on forever
Almighty GM (GM):Web of Lilith
Almighty GM (GM) A huge spider web covers the area, all movement for the party is considered difficult terrain. This last one turn. Additionally, a random party member becomes entangled in the web and is incapcitated (until web is removed)
Almighty GM (GM):rolling 1d4
(
1
)
=1
Gynther halftooth:
16 + -2 21 + -2
arm of dawn, dormant (+14)
10
Great Weapon Master
23
Slashing
27 + -1 33 + -1
arm of dawn, dormant (+14)
10
Great Weapon Master
16 + 16
Slashing
16 + -1 19 + -1
arm of dawn, dormant (+14)
10
Great Weapon Master
18
Slashing
18 + -4 25 + -4
arm of dawn, dormant (+14)
10
Great Weapon Master
14
Slashing
32 + -3 19 + -3
arm of dawn, dormant (+14)
10
Great Weapon Master
16 + 8
Slashing
Almighty GM (GM):Revered Ancient Vampire Spellcaster Bites at Zarkull against AC 27
Bite (Bat or Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 41 | 33
Damage: 35piercing + 35necrotic
The target's hit point maximum is reduced by an amount equal to the necrotic damage taken, and the vampire regains hit points equal to that amount. The reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0. A humanoid slain in this way and then buried in the ground rises the following night as a vampire spawn under the vampire's control
Revered Ancient Vampire Spellcaster Claws at Zarkull against AC 27
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 40 | 36
Damage: 91bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Almighty GM (GM):Revered Ancient Vampire Spellcaster Claws at Gynther halftooth against AC 28
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 44 | 38
Damage: 92bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Revered Ancient Vampire Spellcaster Claws at Gynther halftooth against AC 28
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 35 | 33
Damage: 76bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Almighty GM (GM):Revered Ancient Vampire Spellcaster Claws at Mehtahl Whint against AC 35
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 29 | 39
Gynther halftooth:
17 + -2 19 + -2
arm of dawn, dormant (+14)
10
Great Weapon Master
14
Slashing
24 + -3 21 + -3
arm of dawn, dormant (+14)
10
Great Weapon Master
21
Slashing
17 + -3 26 + -3
arm of dawn, dormant (+14)
10
Great Weapon Master
19
Slashing
28 + -3 20 + -3
arm of dawn, dormant (+14)
10
Great Weapon Master
11
Slashing
28 + -3 30 + -3
arm of dawn, dormant (+14)
10
Great Weapon Master
17
Slashing
Jonas:
37 + 2 35 + 2
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
47
Slashing
39
Radiant
23 + 4 30 + 4
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
45
Slashing
37
Radiant
24 + 4 23 + 4
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
50
Slashing
45
Radiant
25 + 2 27 + 2
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
37
Slashing
31
Radiant
23 + 4 23 + 4
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
57
Slashing
35
Radiant
36 + 2 33 + 2
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
43
Slashing
37
Radiant
Jonas:
35 + 2 28 + 2
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
59
Slashing
43
Radiant
38 + 1 32 + 1
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
50 + 20
Slashing
41 + 68
Radiant
32 + 2 31 + 2
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
55
Slashing
54
Radiant
26 + 4 23 + 4
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
38
Slashing
45
Radiant
29 + 2 38 + 2
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
49 + 24
Slashing
47 + 63
Radiant
Almighty GM (GM):Revered Ancient Vampire Spellcaster Claws at Mehtahl Whint against AC 35
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 30 | 32
Revered Ancient Vampire Spellcaster Claws at Mehtahl Whint against AC 35
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 27 | 40
Revered Ancient Vampire Spellcaster Claws at Mehtahl Whint against AC 35
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 44 | 29
Almighty GM (GM):Revered Ancient Vampire Spellcaster Claws at Mehtahl Whint against AC 35
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 32 | 37
Revered Ancient Vampire Spellcaster Claws at Mehtahl Whint against AC 35
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 40 | 40
Revered Ancient Vampire Spellcaster Claws at Mehtahl Whint against AC 35
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 41 | 44
Almighty GM (GM):
Damage: 92bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Damage: 83bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Gynther halftooth:
30 + -2 24 + -2
arm of dawn, dormant (+14)
10
Great Weapon Master
14
Slashing
Almighty GM (GM):Revered Ancient Vampire Spellcaster Claws at Mehtahl Whint against AC 35
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 44 | 40
Damage: 105bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Gynther halftooth:
25 + -4 31 + -4
arm of dawn, dormant (+14)
10
Great Weapon Master
20
Slashing
27 + -3 34 + -3
arm of dawn, dormant (+14)
10
Great Weapon Master
12 + 10
Slashing
31 + -1 28 + -1
arm of dawn, dormant (+14)
10
Great Weapon Master
11
Slashing
18 + -2 22 + -2
arm of dawn, dormant (+14)
10
Great Weapon Master
18
Slashing
34 + -3 20 + -3
arm of dawn, dormant (+14)
10
Great Weapon Master
21 + 5
Slashing
15 + -1 31 + -1
arm of dawn, dormant (+14)
10
Great Weapon Master
16
Slashing
Almighty GM (GM):Revered Ancient Vampire Spellcaster Claws at Gynther halftooth against AC 28
Unarmed Strike (Vampire Form Only)
Revered Ancient Vampire Spellcaster
Attack: 39 | 43
Damage: 77bludgeoning
Instead of dealing damage, the vampire can grapple the target, escape DC 28
Jonas:
24 + 4 41 + 4
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
50 + 25
Slashing
35 + 59
Radiant
42 + 2 31 + 2
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
46 + 26
Slashing
43 + 74
Radiant
40 + 2 26 + 2
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
53 + 38
Slashing
39 + 63
Radiant
31 + 3 26 + 3
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
42
Slashing
32
Radiant
25 + 4 27 + 4
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
48
Slashing
46
Radiant
28 + 1 38 + 1
Sword of Eternal Sunshine (+22)
On a hit:
Heals wielder for 25 hp
On a crit:
Heals a nearby ally for 25 hp
On kill:
Embrace of Darkness on wielder
46 + 34
Slashing
38 + 71
Radiant
Almighty GM (GM) The night seems to go on forever
Almighty GM (GM):Swarm of Bats
Almighty GM (GM) Bats! Bats! Bat's everywhere. Everyone in the party are attacked by bats, each taking damage
Almighty GM (GM):rolling 3d6
(
1
+
2
+
3
)
=6
What's New?
jan. 2024
The redesigned toolbar has leveled up and is ready for the final battle: serving all Roll20 users! Opt in to the Beta Features toggle if you'd like to keep testing features like Page Folders and the New Compendium Search.
Learn More
Chat Tips
Type these chat commands into the text box below then press the Enter key.
Dice Rolls
/roll 1d20 or /r 1d20
/gmroll 2d6>5 or /gr 2d6>5
Whisper a Player or Character
/w name message
/w gm message

View File

@@ -14,60 +14,87 @@ class MyForm(FlaskForm):
chatTekst = TextAreaField('Chat tekst', validators=[InputRequired()]) chatTekst = TextAreaField('Chat tekst', validators=[InputRequired()])
ac = IntegerField(label='Ac', validators=[InputRequired()]) ac = IntegerField(label='Ac', validators=[InputRequired()])
advantage = BooleanField(label='Har advantage') advantage = BooleanField(label='Har advantage')
critRange = IntegerField(label='Crit over :' , validators=[InputRequired()])
class Action: class Action:
def __init__(self) -> None: def __init__(self) -> None:
self.Dam=[] self.Dam=[]
self.curActionValue=0
self.actionCounter=0
self.hit=[] self.hit=[]
self.targetAc=0 self.targetAc=0
self.advantage=0 self.advantage=0
self.failedHitValue=0
self.critAbove=20
self.crits=False
self.atkMod=0
def addActionValue(self,actionValue):
self.curActionValue=actionValue
def setActionTypeToDam(self,DamType): def setActionTypeToDam(self,value,value2,DamType):
self.Dam.append([self.actionCounter,self.curActionValue,DamType]) self.Dam.append([value,value2,DamType])
def setActionTypeToDam(self,value,DamType): def setAtkMod(self, mod):
self.Dam.append([self.actionCounter,value,DamType]) if(mod>0):
self.atkMod=mod
def setActionTypeToHit(self,rul): def setActionTypeToHit(self,hitArray):
if(rul==1): if(len(hitArray)>1):
self.actionCounter=self.actionCounter+1 self.hit=[hitArray[0][0],hitArray[0][1],hitArray[1][0],hitArray[1][1]]
self.hit.append([self.actionCounter,rul,self.curActionValue]) else:
self.hit=[hitArray[0][0],hitArray[0][1],0,0]
def setActionTypeToHit(self,value,rul):
self.hit.append([self.actionCounter,rul,value])
def setTargetAc(self,ac): def setTargetAc(self,ac):
self.targetAc=ac self.targetAc=ac
def setWithAdvantage(self,advantage): def setWithAdvantage(self):
self.advantage=advantage self.advantage=self.advantage+1
def setWithDisAdvantage(self):
self.advantage=self.advantage-1
def setCritRange(self,crit):
self.critAbove=crit
def getDamForHit(self): def getDamForHit(self):
dam=dict() dam=dict()
hits=False hits=False
if(self.advantage==False): crit=False
if(self.hit[0][2]>self.targetAc): #actioncounter styre hvilket rul er tale om if(self.advantage==0):
if(((self.hit[0]+self.hit[1]) >=self.targetAc and (self.hit[0]-self.atkMod)>1) or self.critAbove<=(self.hit[0]-self.atkMod)): # 0 (rul 1 value), 1 (rul 1 bonus), 2 (rul 2 value), 3(rul 2 bonus)
hits=1 hits=1
if(self.advantage==True): if(self.critAbove<=(self.hit[0]-self.atkMod)):
if(self.hit[0][2]>self.targetAc or self.hit[1][2]>self.targetAc): #actioncounter styre hvilket rul er tale om self.crits=1
if(self.advantage==1):
if(((self.hit[2]+self.hit[3]) >=self.targetAc and (self.hit[2]-self.atkMod)>1 or (self.hit[0]+self.hit[1]) >=self.targetAc and (self.hit[0]-self.atkMod)>1) or (self.critAbove<=self.hit[2]-self.atkMod) or (self.critAbove<=self.hit[0]-self.atkMod)):
hits=1 hits=1
if((self.critAbove<=self.hit[2]-self.atkMod) or (self.critAbove<=self.hit[0]-self.atkMod)):
self.crits=1
if(self.advantage==-1):
if((((self.hit[2]+self.hit[3]) >=self.targetAc and (self.hit[2]-self.atkMod)>1) or ((self.critAbove<=self.hit[2]-self.atkMod))) and (((self.hit[0]+self.hit[1]) >=self.targetAc and (self.hit[0]-self.atkMod)>1) or (self.critAbove<=self.hit[0]-self.atkMod))):
hits=1
if((self.critAbove<=self.hit[2]-self.atkMod) and (self.critAbove<=self.hit[0]-self.atkMod)):
self.crits=1
if(hits==1): if(hits==1):
for d in self.Dam: for d in self.Dam: # Dam def: value,value2,DamType
if(dam.get(d[2])==None): if(self.crits):
dam[d[2]]=d[1] dam[d[2]]=d[0]+d[1]
else: else:
dam[d[2]]=dam[d[2]]+d[1] dam[d[2]]=d[0]
return dam return dam
def getFumble(self):
fumbles=True
if(self.advantage==0):
if((self.hit[0]-self.atkMod)>1): # 0 (rul 1 value), 1 (rul 1 bonus), 2 (rul 2 value), 3(rul 2 bonus)
fumbles=False
if(self.advantage==1):
if((self.hit[0]-self.atkMod)>1 or (self.hit[2]-self.atkMod)>1):
fumbles=False
if(self.advantage==-1):
if((self.hit[0]-self.atkMod)>1 and (self.hit[2]-self.atkMod)>1):
fumbles=False
return fumbles
damTypes=["Slashing","Radiant","Great Weapon Master","Divine","Holy Weapon","Great Weapon Master/Radiant", "Bludgeoning","arm of dawn, Awakend","Lightning"]
damTypes=["Slashing","Radiant","Great Weapon Master","Divine","Holy Weapon","Great Weapon Master/Radiant"]
con=0 con=0
def incContext(): def incContext():
res=0 res=0
@@ -83,13 +110,17 @@ def getContext():
return con return con
def isItTheRightContext(c,line): def isItTheRightContext(c,line):
res=0 res=0
return res return res
def checkIfCounts(line): def checkIfCounts(line):
estCon=0 estCon=0
if(re.match("(^_?[0-9]+){1}( \+ [0-9]+)?( [0-9]+( \+ [0-9])*)?", line)): if(re.match("(^_?[0-9]+){1}( \+ [0-9]+)?( [0-9]+( \+ [0-9])*)?", line)):
print("match : " + line) print("match : " + line)
estCon=1 # attackroll eller dam estCon=1 # attackroll eller
s=re.search('\([-|\+][0-9]+\)+', line)
if(s!=None):
print("match modifier: " + line)
estCon=3
return estCon return estCon
def getAllDamage(runder): def getAllDamage(runder):
@@ -111,8 +142,9 @@ def getAllDamage(runder):
def parseText(runder,lines,ac,advantage): def parseText(runder,lines,ac,advantage,critRange):
line=None line=None
attMod=0
for nextLine in lines: for nextLine in lines:
nextLine=nextLine.strip() nextLine=nextLine.strip()
if(line==None): if(line==None):
@@ -122,50 +154,69 @@ def parseText(runder,lines,ac,advantage):
print(line) print(line)
c=checkIfCounts(line) c=checkIfCounts(line)
if(c==3): # attack modifier
s=re.search('\([-|\+][0-9]+\)+', line)
v=re.search('[0-9]+', s.group(0))
if(s.group(0)[1]=='+'):
curAction.setAtkMod(int(v.group(0)))
else:
curAction.setAtkMod(0-int(v.group(0)))
if(c==1): if(c==1):
if(nextLine in damTypes): if(nextLine in damTypes):
c=2 # damage c=2 # damage
else: else:
c=1 # to hit c=1 # to hit
if(c==1): if(c==1): # Hit
lastActionFumble=False
if(len(runder)>0):
lastActionFumble=curAction.getFumble()
curAction=Action() curAction=Action()
curAction.setTargetAc(ac) curAction.setTargetAc(ac)
curAction.setWithAdvantage(advantage) if(critRange!=20 and critRange!=None): curAction.setCritRange(critRange)
if(advantage): curAction.setWithAdvantage()
if(lastActionFumble): curAction.setWithDisAdvantage()
h=line.split(" ") h=line.split(" ")
HitArray=[]
if(h[0].rfind("+")>-1 or h[0].rfind("-")>-1): if(h[0].rfind("+")>-1 or h[0].rfind("-")>-1):
if(h[0].rfind("+")>-1): if(h[0].rfind("+")>-1):
curAction.setActionTypeToHit(int(h[0].split("+")[0])+int(h[0].split("+")[1]),1) HitArray.append([int(h[0].split("+")[0]),int(h[0].split("+")[1].strip())])
else: else:
curAction.setActionTypeToHit(int(h[0].split("-")[0])-int(h[0].split("-")[1]),1) HitArray.append([int(h[0].split("+")[0]),0-int(h[0].split("+")[1].strip())])
else: else:
curAction.setActionTypeToHit(h[0]) HitArray.append([int(h[0].strip()),0])
if(h[1].rfind("+")>-1 or h[1].rfind("-")>-1): if(len(h)>1):
if(h[1].rfind("+")>-1): if((h[1].rfind("+")>-1 or h[1].rfind("-")>-1)):
curAction.setActionTypeToHit(int(h[1].split("+")[0])+int(h[1].split("+")[1]),2) if(h[1].rfind("+")>-1):
HitArray.append([int(h[1].split("+")[0]),int(h[1].split("+")[1].strip())])
else:
HitArray.append([int(h[1].split("-")[0]),0-int(h[1].split("-")[1].strip())])
else: else:
curAction.setActionTypeToHit(int(h[1].split("-")[0])-int(h[1].split("-")[1]),2) HitArray.append([int(h[1].strip()),0])
else: curAction.setActionTypeToHit(HitArray)
curAction.setActionTypeToHit(h[1],2)
runder.append(curAction) runder.append(curAction)
if(c==2): if(c==2): # Skade
if(len(runder)==0): if(len(runder)==0):
continue continue
curAction=runder[len(runder)-1] curAction=runder[len(runder)-1]
if(line.rfind("+")>-1 or line.rfind("-")>-1): if(line.rfind("+")>-1 or line.rfind("-")>-1):
if(line.rfind("+")>-1): if(line.rfind("+")>-1):
curAction.setActionTypeToDam(int(line.split("+")[0])+int(line.split("+")[1]),nextLine) curAction.setActionTypeToDam(int(line.split("+")[0]),int(line.split("+")[1].strip()),nextLine)
else: else:
curAction.setActionTypeToDam(int(line.split("-")[0])+int(line.split("-")[1]),nextLine) curAction.setActionTypeToDam(int(line.split("-")[0]),0-int(line.split("-")[1].strip()),nextLine)
else: else:
curAction.setActionTypeToDam(int(line),nextLine) curAction.setActionTypeToDam(int(line.strip()),0,nextLine)
line=nextLine line=nextLine
file1 = open("input.txt", "w")
@app.route('/', methods=['GET', 'POST']) @app.route('/', methods=['GET', 'POST'])
def main(): def main():
form = MyForm() form = MyForm()
runder: List[Action] = list() runder: List[Action] = list()
if form.validate_on_submit(): if form.validate_on_submit():
parseText(runder,form.chatTekst.data.splitlines(),form.ac.data, form.advantage.data) for a in form.chatTekst.data.splitlines():
file1.writelines(form.chatTekst.data.splitlines())
parseText(runder,form.chatTekst.data.splitlines(),form.ac.data, form.advantage.data, form.critRange.data)
dam=getAllDamage(runder) dam=getAllDamage(runder)
return render_template('index.html', dam=dam, form=form) return render_template('index.html', dam=dam, form=form)
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -1,12 +1,13 @@
<html> <html>
<head> <head>
<title>Templating in Flask</title> <title>Roll20 dam calculator</title>
</head> </head>
<body> <body>
<h1>Dam {{ dam }} !</h1> <h1>Dam {{ dam }} !</h1>
<form method="post" action="/" enctype="multipart/form-data"> <form method="post" action="/" enctype="multipart/form-data">
{{ form.csrf_token }} {{ form.csrf_token }}
<p>{{ form.ac.label }} {{ form.ac() }}</p> <p>{{ form.ac.label }} {{ form.ac() }}</p>
<p>{{ form.critRange.label }} {{ form.critRange() }}</p>
<p>{{ form.advantage.label }} {{ form.advantage }}</p> <p>{{ form.advantage.label }} {{ form.advantage }}</p>
<p>{{ form.chatTekst.label }} {{ form.chatTekst(rows='40',cols='60') }}</p> <p>{{ form.chatTekst.label }} {{ form.chatTekst(rows='40',cols='60') }}</p>
<p><input type="submit" value="Submit"></p> <p><input type="submit" value="Submit"></p>