settings: add coefficient to hint and wchoices
This commit is contained in:
parent
2623d9dd61
commit
c5f8288f39
10 changed files with 43 additions and 13 deletions
|
|
@ -2,12 +2,16 @@ package fic
|
|||
|
||||
import (
|
||||
"log"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
// UnlockedChallenges disables dependancy requirement between challenges.
|
||||
var UnlockedChallenges bool
|
||||
|
||||
// WchoiceCoefficient is the current coefficient applied on the cost of changing flag into choices
|
||||
var WChoiceCoefficient = 1.0
|
||||
|
||||
// Team represents a group of players, come to solve our challenges.
|
||||
type Team struct {
|
||||
Id int64 `json:"id"`
|
||||
|
|
@ -174,7 +178,7 @@ func (t Team) HasHint(h EHint) (bool) {
|
|||
|
||||
// OpenHint registers to the database that the Team has now revealed.
|
||||
func (t Team) OpenHint(h EHint) (error) {
|
||||
_, err := DBExec("INSERT INTO team_hints (id_team, id_hint, time) VALUES (?, ?, ?)", t.Id, h.Id, time.Now())
|
||||
_, err := DBExec("INSERT INTO team_hints (id_team, id_hint, time, coefficient) VALUES (?, ?, ?, ?)", t.Id, h.Id, time.Now(), math.Max(HintCoefficient, 0.0))
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +191,7 @@ func (t Team) SeeChoices(k FlagKey) (bool) {
|
|||
|
||||
// DisplayChoices registers to the database that the Team has now revealed.
|
||||
func (t Team) DisplayChoices(k FlagKey) (error) {
|
||||
_, err := DBExec("INSERT INTO team_wchoices (id_team, id_flag, time) VALUES (?, ?, ?)", t.Id, k.Id, time.Now())
|
||||
_, err := DBExec("INSERT INTO team_wchoices (id_team, id_flag, time, coefficient) VALUES (?, ?, ?, ?)", t.Id, k.Id, time.Now(), math.Max(WChoiceCoefficient, 0.0))
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue