Correct bugs in point counter and css changes
This commit is contained in:
parent
c1d5a792d0
commit
fbd656cb52
@ -242,7 +242,7 @@ def edituser(user):
|
|||||||
else:
|
else:
|
||||||
user.name = name
|
user.name = name
|
||||||
if len(password)>=2:
|
if len(password)>=2:
|
||||||
user.password = password
|
user.set_password(password)
|
||||||
user.level = level
|
user.level = level
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return flask.redirect('/admin/users')
|
return flask.redirect('/admin/users')
|
||||||
|
80
db.py
80
db.py
@ -243,18 +243,47 @@ class Game(db.Model):
|
|||||||
self.cards_to_distribute += self.played
|
self.cards_to_distribute += self.played
|
||||||
self.played = None
|
self.played = None
|
||||||
self.first_player = (self.first_player + winnr)%4
|
self.first_player = (self.first_player + winnr)%4
|
||||||
|
|
||||||
if self.turn == N_TURN*N_PLAYERS: # Dix de der, chute, belote et capote !
|
if self.turn == N_TURN*N_PLAYERS: # Dix de der, chute, belote et capote !
|
||||||
if (self.first_player + winnr)%2 == 0:
|
# Dix de der
|
||||||
|
if self.first_player%2 == 0:
|
||||||
self.points_0 += 10
|
self.points_0 += 10
|
||||||
else:
|
else:
|
||||||
self.points_1 += 10
|
self.points_1 += 10
|
||||||
if self.get_player(self.preneur).nr %2 ==0 and self.points_0 < self.points_1:
|
|
||||||
self.points_0 = 0
|
# Belote possible
|
||||||
self.points_1 = 162
|
winnr = self.distributeur
|
||||||
if self.get_player(self.preneur).nr %2 ==1 and self.points_1 < self.points_0:
|
belote =-1
|
||||||
self.points_0 = 162
|
belote_0 = 0
|
||||||
self.points_1 = 0
|
belote_1 = 0
|
||||||
if self.points_0 == 162 or self.points_1 == 162:
|
ccc = self.cards_to_distribute.split(',')
|
||||||
|
for i in range(N_TURN):
|
||||||
|
cccc = ccc[i*N_PLAYERS:(i+1)*N_PLAYERS]
|
||||||
|
if 'R'+self.atout in cccc:
|
||||||
|
if belote>=0:
|
||||||
|
if (cccc.index('R'+self.atout) + winnr)%4 == belote %4:
|
||||||
|
if belote %2 ==0:
|
||||||
|
self.points_0 += 20
|
||||||
|
belote_0 = 20
|
||||||
|
else:
|
||||||
|
self.points_1 += 20
|
||||||
|
belote_1 = 20
|
||||||
|
else:
|
||||||
|
belote = winnr + cccc.index('R'+self.atout)
|
||||||
|
if 'D'+self.atout in cccc:
|
||||||
|
if belote>=0:
|
||||||
|
if (cccc.index('D'+self.atout) + winnr)%4 == belote %4:
|
||||||
|
if belote %2 ==0:
|
||||||
|
self.points_0 += 20
|
||||||
|
else:
|
||||||
|
self.points_1 += 20
|
||||||
|
else:
|
||||||
|
belote = winnr + cccc.index('D'+self.atout)
|
||||||
|
win, xxx = winner(cccc, self.atout)
|
||||||
|
winnr = win+winnr
|
||||||
|
|
||||||
|
# Capote
|
||||||
|
if self.points_0 >= 162 or self.points_1 >= 162:
|
||||||
winequipe = 0 if self.points_0 == 162 else 1
|
winequipe = 0 if self.points_0 == 162 else 1
|
||||||
# Capote possible.
|
# Capote possible.
|
||||||
winnr = self.distributeur
|
winnr = self.distributeur
|
||||||
@ -269,32 +298,15 @@ class Game(db.Model):
|
|||||||
self.points_0 += 90
|
self.points_0 += 90
|
||||||
else:
|
else:
|
||||||
self.points_1 += 90
|
self.points_1 += 90
|
||||||
# belote possible
|
|
||||||
winnr = self.distributeur
|
# Chute
|
||||||
belote =-1
|
if self.get_player(self.preneur).nr %2 ==0 and self.points_0 < self.points_1:
|
||||||
ccc = self.cards_to_distribute.split(',')
|
self.points_0 = belote_0
|
||||||
for i in range(N_TURN):
|
self.points_1 = 162
|
||||||
cccc = ccc[i*N_PLAYERS:(i+1)*N_PLAYERS]
|
if self.get_player(self.preneur).nr %2 ==1 and self.points_1 < self.points_0:
|
||||||
if 'R'+self.atout in cccc:
|
self.points_0 = 162
|
||||||
if belote>=0:
|
self.points_1 = belote_1
|
||||||
if (cccc.index('R'+self.atout) + winnr)%4 == belote %4:
|
|
||||||
if belote %2 ==0:
|
|
||||||
self.points_0 += 20
|
|
||||||
else:
|
|
||||||
self.points_1 += 20
|
|
||||||
else:
|
|
||||||
belote = winnr + cccc.index('R'+self.atout)
|
|
||||||
if 'D'+self.atout in cccc:
|
|
||||||
if belote>=0:
|
|
||||||
if (cccc.index('D'+self.atout) + winnr)%4 == belote %4:
|
|
||||||
if belote %2 ==0:
|
|
||||||
self.points_0 += 20
|
|
||||||
else:
|
|
||||||
self.points_1 += 20
|
|
||||||
else:
|
|
||||||
belote = winnr + cccc.index('D'+self.atout)
|
|
||||||
win, xxx = winner(cccc, self.atout)
|
|
||||||
winnr = win+winnr
|
|
||||||
# Retirer la carte du jeu !
|
# Retirer la carte du jeu !
|
||||||
p = self.get_player(user)
|
p = self.get_player(user)
|
||||||
ccc = p.cards
|
ccc = p.cards
|
||||||
|
@ -195,10 +195,10 @@ div, p, li, a, th, td {
|
|||||||
#suivant {
|
#suivant {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 15px;
|
bottom: 15px;
|
||||||
right: 90px;
|
right: 40px;
|
||||||
}
|
}
|
||||||
#suivant input {
|
#suivant input {
|
||||||
width: 80px;
|
width: 130px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ov {
|
#ov {
|
||||||
@ -224,10 +224,9 @@ position: absolute;
|
|||||||
margin: 0px auto 0px auto;
|
margin: 0px auto 0px auto;
|
||||||
}
|
}
|
||||||
#choix {
|
#choix {
|
||||||
height: 160px;
|
height: 150px;
|
||||||
margin-top: 25px;
|
margin-top: 20px;
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
border: 1px solid #092E1E;
|
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
@ -304,20 +303,19 @@ position: absolute;
|
|||||||
}
|
}
|
||||||
.joueur {
|
.joueur {
|
||||||
width: 90px;
|
width: 90px;
|
||||||
height: 18px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-decoration: underscore;
|
text-decoration: underscore;
|
||||||
}
|
}
|
||||||
.carte {
|
.carte {
|
||||||
height: 77px;
|
height: 77px;
|
||||||
width: 50px;
|
width: 53px;
|
||||||
/* carte : hauteur = 1,54 * largueur; */
|
/* carte : hauteur = 1,54 * largueur; */
|
||||||
border: 1px solid #092E1E;
|
border: 1px solid #092E1E;
|
||||||
background-color: #117F4A;
|
background-color: #117F4A;
|
||||||
}
|
}
|
||||||
.carte-en-main, .carte-dernier-pli {
|
.carte-en-main, .carte-dernier-pli {
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 12px;
|
margin-right: 9px;
|
||||||
}
|
}
|
||||||
.item-choix {
|
.item-choix {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
@ -335,9 +333,6 @@ position: absolute;
|
|||||||
#zone-de-conversation {
|
#zone-de-conversation {
|
||||||
height: 84px;
|
height: 84px;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
/*
|
|
||||||
border: 1px solid #092E1E;
|
|
||||||
*/
|
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
#chat {
|
#chat {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<div id="jeu-2" class="carte"></div><!-- jeu-2 -->
|
<div id="jeu-2" class="carte"></div><!-- jeu-2 -->
|
||||||
<div id="jeu-3" class="carte"></div><!-- jeu-3 -->
|
<div id="jeu-3" class="carte"></div><!-- jeu-3 -->
|
||||||
<div id="suivant">
|
<div id="suivant">
|
||||||
<input type="submit" name="suivant" value="Recommencer" onclick="javascript:restart_jeu()">
|
<input type="submit" name="suivant" value="Redistribuer" onclick="javascript:restart_jeu()">
|
||||||
</div><!-- suivant -->
|
</div><!-- suivant -->
|
||||||
</div><!-- plateau -->
|
</div><!-- plateau -->
|
||||||
<div id="ov">
|
<div id="ov">
|
||||||
@ -35,7 +35,9 @@
|
|||||||
</div><!-- dernier-pli -->
|
</div><!-- dernier-pli -->
|
||||||
<div id="options">
|
<div id="options">
|
||||||
<p class="item-choix">Options <img id="options-fleche" src="/static/fleche-bas.gif" /></p>
|
<p class="item-choix">Options <img id="options-fleche" src="/static/fleche-bas.gif" /></p>
|
||||||
<!--<div id="options-valeur" class="item-choix-valeur">Texte</div>-->
|
<div id="options-valeur" class="item-choix-valeur">
|
||||||
|
<!--<div id="item-choix-1" class="menu-item">Do sth</div>-->
|
||||||
|
</div>
|
||||||
</div><!-- options -->
|
</div><!-- options -->
|
||||||
</div><!-- choix -->
|
</div><!-- choix -->
|
||||||
</div><!-- ov -->
|
</div><!-- ov -->
|
||||||
|
Loading…
Reference in New Issue
Block a user