"Player streaks first draft implemented."

This commit is contained in:
gyboth 2005-09-18 10:02:10 +00:00
parent dfe16dbe33
commit 6b4a11c8f1
43 changed files with 790 additions and 239 deletions

View File

@ -1,6 +1,7 @@
10/10/2005: v1.9.2
- fixed some minor bugs
- updated the Bulgarian translation
- updated the French translation
- switched to Gnu zip in the Windows port
09/10/2005: v1.9.1

File diff suppressed because one or more lines are too long

View File

@ -845,7 +845,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">0 -10 20 1 10 10</property>
<property name="adjustment">0 0 40 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -24,6 +24,15 @@ callback_show_next_live_game(void)
{
gint i, j;
/*d*/
if(debug > 0)
for(i=0;i<current_user.tm->players->len;i++)
printf("wee %-25s st %d cnt %f pro %.3f\n",
g_array_index(current_user.tm->players, Player, i).name->str,
g_array_index(current_user.tm->players, Player, i).streak,
g_array_index(current_user.tm->players, Player, i).streak_count,
g_array_index(current_user.tm->players, Player, i).streak_prob);
for(i=0;i<users->len;i++)
usr(i).counters[COUNT_USER_TOOK_TURN] = 0;

View File

@ -65,9 +65,6 @@ file_compress_files(const gchar *destfile, const gchar *prefix);
void
file_decompress(const gchar *filename);
GPtrArray*
file_get_name_files(void);
void
file_remove_files(const gchar *files);

View File

@ -203,15 +203,26 @@ fixture_get_round_robin_advance(const Cup *cup, gint round)
/** Return the pointer of the team that won the encounter.
@param fix The fixture we examine.
@param team_name Whether to return a team pointer or the
team name of the winner.
team id of the winner.
@return A team pointer or a coded integer. */
gpointer
fixture_winner_of(const Fixture *fix, gboolean team_id)
{
gint winner_idx = -1;
const Fixture *first_leg;
const CupRound *cupround =
&g_array_index(cup_from_clid(fix->clid)->rounds, CupRound, fix->round);
const Fixture *first_leg = NULL;
const CupRound *cupround = NULL;
if(fix->clid < ID_CUP_START)
{
winner_idx = (fix->result[0][0] < fix->result[1][0]);
if(team_id)
return GINT_TO_POINTER(fix->team_ids[winner_idx]);
else
return (gpointer)fix->teams[winner_idx];
}
cupround = &g_array_index(cup_from_clid(fix->clid)->rounds,
CupRound, fix->round);
if(cupround->replay != 0 || !cupround->home_away)
winner_idx = (math_sum_int_array(&(fix->result[0][0]), 3) <

View File

@ -86,7 +86,8 @@ game_get_player_contribution(const Player *pl, gint type)
const_float("float_player_team_weight_forward_attack")}};
return player_get_game_skill(pl, FALSE) *
player_weights[pl->cpos - 1][type - GAME_TEAM_VALUE_DEFEND];
player_weights[pl->cpos - 1][type - GAME_TEAM_VALUE_DEFEND] *
(1 + (gfloat)pl->streak * const_float("float_player_streak_influence_skill"));
}
/** Return a random attacking or defending player
@ -108,7 +109,6 @@ game_get_player(const Team *tm, gint player_type,
gfloat probs[10];
gfloat rndom;
/*todo move to constants file?*/
if(player_type == GAME_PLAYER_TYPE_ATTACK)
{
weights[0] = const_float("float_game_player_weight_attack_def");
@ -182,16 +182,27 @@ game_get_player_probs(GArray *players, gfloat *probs, gfloat *weights, gboolean
{
gint i;
probs[0] = (skills) ? player_get_game_skill(&g_array_index(players, Player, 1), FALSE) *
probs[0] = (skills) ?
player_get_game_skill(&g_array_index(players, Player, 1), FALSE) *
weights[g_array_index(players, Player, 1).cpos - 1] :
weights[g_array_index(players, Player, 1).cpos - 1] *
(g_array_index(players, Player, 1).cskill != 0);
probs[0] *= (1 + (gfloat)g_array_index(players, Player, 1).streak *
const_float("float_player_streak_influence_skill"));
for(i=1;i<10;i++)
{
probs[i] = probs[i - 1] +
((skills) ? player_get_game_skill(&g_array_index(players, Player, i + 1), FALSE) *
((skills) ?
player_get_game_skill(&g_array_index(players, Player, i + 1), FALSE) *
weights[g_array_index(players, Player, i + 1).cpos - 1] :
weights[g_array_index(players, Player, i + 1).cpos - 1] *
(g_array_index(players, Player, i + 1).cskill != 0));
probs[i] *= (1 + (gfloat)g_array_index(players, Player, i + 1).streak *
const_float("float_player_streak_influence_skill"));
}
}
/** Return the player who's shooting the following penalty
@ -281,17 +292,29 @@ game_initialize(Fixture *fix)
{
if(g_array_index(fix->teams[i]->players, Player, j).cskill > 0)
{
player_games_goals_set(&g_array_index(fix->teams[i]->players, Player, j), fix->clid,
player_games_goals_set(&g_array_index(fix->teams[i]->players,
Player, j), fix->clid,
PLAYER_VALUE_GAMES, 1);
g_array_index(fix->teams[i]->players, Player, j).career[PLAYER_VALUE_GAMES]++;
g_array_index(fix->teams[i]->players, Player, j).
career[PLAYER_VALUE_GAMES]++;
g_array_index(fix->teams[i]->players, Player, j).participation = TRUE;
g_array_index(fix->teams[i]->players, Player, j).
participation = TRUE;
if(query_player_is_youth((&g_array_index(fix->teams[i]->players, Player, j))))
if(query_player_is_youth((&g_array_index(fix->teams[i]->players,
Player, j))))
g_array_index(fix->teams[i]->players, Player, j).lsu +=
const_float("float_youth_lsu_addition_match");
player_streak_add_to_prob(
&g_array_index(fix->teams[i]->players, Player, j),
const_float("float_player_streak_add_startup"));
}
}
else
player_streak_add_to_prob(
&g_array_index(fix->teams[i]->players, Player, j),
const_float("float_player_streak_add_no_startup"));
}
if(user_idx[i] != -1)
@ -573,8 +596,17 @@ game_player_injury(Player *pl)
}
if(pl->health == PLAYER_INJURY_CAREER_STOP && team_is_user(pl->team) != -1)
user_event_add(&usr(team_is_user(pl->team)), EVENT_TYPE_PLAYER_CAREER_STOP, pl->id, -1,
user_event_add(&usr(team_is_user(pl->team)),
EVENT_TYPE_PLAYER_CAREER_STOP, pl->id, -1,
NULL, NULL);
player_streak_add_to_prob(
pl, const_float("float_player_streak_add_injury"));
if(pl->streak == PLAYER_STREAK_HOT)
{
pl->streak = PLAYER_STREAK_NONE;
player_streak_reset_count(pl);
}
}
/** Return a factor influencing who's fouled whom
@ -603,30 +635,38 @@ game_get_foul_possession_factor(gint boost1, gint boost2)
gint
game_substitute_player(Team *tm, gint player_number)
{
gint i;
gint i, substitute = -1;
GPtrArray *substitutes = g_ptr_array_new();
gboolean adapt_structure;
gint substitute = -1;
for(i=11;i<tm->players->len;i++)
if(g_array_index(tm->players, Player, i).cskill > 0)
g_ptr_array_add(substitutes, &g_array_index(tm->players, Player, i));
g_ptr_array_sort_with_data(substitutes, (GCompareDataFunc)player_compare_substitute_func,
GINT_TO_POINTER(player_of_idx_team(tm, player_number)->cpos));
g_ptr_array_sort_with_data(substitutes,
(GCompareDataFunc)player_compare_substitute_func,
GINT_TO_POINTER(player_of_idx_team(tm,
player_number)->cpos));
adapt_structure =
(math_get_place(team_find_appropriate_structure(tm), 1) +
math_get_place(team_find_appropriate_structure(tm), 2) +
math_get_place(team_find_appropriate_structure(tm), 3) != 10 ||
(player_of_idx_team(tm, player_number)->cpos != ((Player*)g_ptr_array_index(substitutes, 0))->pos &&
(player_of_idx_team(tm, player_number)->cpos !=
((Player*)g_ptr_array_index(substitutes, 0))->pos &&
player_substitution_good_structure(tm->structure,
player_of_idx_team(tm, player_number)->cpos,
((Player*)g_ptr_array_index(substitutes, 0))->pos)));
substitute = ((Player*)g_ptr_array_index(substitutes, 0))->id;
player_swap(tm, player_number,
tm, player_id_index(tm, ((Player*)g_ptr_array_index(substitutes, 0))->id));
player_streak_add_to_prob(
&g_array_index(tm->players, Player, player_number),
const_float("float_player_streak_add_sub_out"));
player_streak_add_to_prob((Player*)g_ptr_array_index(substitutes, 0),
const_float("float_player_streak_add_sub_in"));
player_swap(tm, player_number, tm, player_id_index(tm, substitute));
g_ptr_array_free(substitutes, TRUE);
@ -942,6 +982,12 @@ game_post_match(Fixture *fix)
GPtrArray *teams = NULL;
Cup *cup = NULL;
if((debug > 100 && fixture_user_team_involved(fix) != -1) ||
debug > 130)
printf("game_post_match: %s - %s\n",
fix->teams[0]->name->str,
fix->teams[1]->name->str);
if(query_fixture_has_tables(fix))
table_update(fix);
@ -951,7 +997,7 @@ game_post_match(Fixture *fix)
team_update_cpu_team(fix->teams[i],
(fixture_user_team_involved(fix) != -1));
else
team_update_post_match(fix->teams[i], fix->clid);
team_update_post_match(fix->teams[i], fix);
}
if(fix->clid < ID_CUP_START)

View File

@ -49,7 +49,8 @@ live_game_calculate_fixture(Fixture *fix)
game_get_values(match->fix, match->team_values,
match->home_advantage);
if(debug > 80 && fixture_user_team_involved(match->fix) != -1)
if((debug > 80 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\n\nlive_game_calculate_fixture\n%04d %s %s %04d\n\n",
tm0->id, tm0->name->str, tm1->name->str, tm1->id);
@ -92,8 +93,8 @@ live_game_initialize(Fixture *fix)
window.live = window_create(WINDOW_LIVE);
else
gtk_window_set_title(GTK_WINDOW(window.live),
league_cup_get_name_string(((LiveGame*)statp)->fix->clid));
window_live_set_spinbuttons();
league_cup_get_name_string(((LiveGame*)statp)->fix->clid));
window_live_set_spinbuttons();
}
game_initialize(fix);
@ -109,7 +110,8 @@ live_game_create_unit(void)
{
LiveGameUnit new;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_create_unit\n");
if(unis->len == 0)
@ -168,7 +170,8 @@ live_game_fill_new_unit(LiveGameUnit *new)
gfloat possession_change, scoring_chance = 0,
injury_event_prob, foul_event_prob;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_fill_new_unit\n");
possession_change = const_float("float_live_game_event_general") *
@ -227,7 +230,8 @@ live_game_create_start_unit(void)
{
LiveGameUnit new;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_create_start_unit\n");
new.event.player =
new.event.player2 = -1;
@ -255,7 +259,8 @@ live_game_evaluate_unit(LiveGameUnit *unit)
{
gint type = unit->event.type;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_evaluate_unit\n");
if(type == LIVE_GAME_EVENT_FOUL)
live_game_event_foul();
@ -295,7 +300,8 @@ live_game_event_foul(void)
gfloat rndom = math_rnd(0, 1);
gint type, fouled_player, foul_player, foul_team;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_foul\n");
if(math_rnd(0, 1) > const_float("float_live_game_foul_by_possession") *
game_get_foul_possession_factor(
@ -322,7 +328,7 @@ live_game_event_foul(void)
last_unit.area, 0, -1, FALSE);
foul_player = last_unit.event.player2 =
game_get_player(tm[last_unit.possession],
last_unit.area, 0, -1, FALSE);
last_unit.area, 0, -1, FALSE);
}
if(rndom < const_float("float_live_game_foul_red_injury"))
@ -373,7 +379,8 @@ live_game_event_foul(void)
void
live_game_event_lost_possession(void)
{
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_lost_possession\n");
last_unit.event.player =
game_get_player(tm[last_unit.possession],
@ -404,7 +411,8 @@ live_game_event_injury(gint team, gint player, gboolean create_new)
LiveGameUnit new;
gint old_structure = -1;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_injury\n");
if(create_new)
{
@ -445,7 +453,7 @@ live_game_event_injury(gint team, gint player, gboolean create_new)
if(last_unit.event.type == LIVE_GAME_EVENT_INJURY)
{
game_player_injury(player_of_id_team(tm[last_unit.event.team],
last_unit.event.player));
last_unit.event.player));
if(match->subs_left[last_unit.event.team] > 0)
{
@ -495,7 +503,8 @@ live_game_event_stadium(void)
for(i=1;i<3;i++)
probs[i] += probs[i - 1];
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_stadium\n");
if(rndom <= probs[0])
last_unit.event.type = LIVE_GAME_EVENT_STADIUM_BREAKDOWN;
@ -525,7 +534,8 @@ live_game_event_scoring_chance(void)
else
res_idx = 0;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_scoring_chance\n");
if(math_rnd(0, 1) < const_float("float_live_game_scoring_chance_is_own_goal"))
@ -536,6 +546,10 @@ live_game_event_scoring_chance(void)
last_unit.event.team = !last_unit.possession;
match->fix->result[last_unit.possession][res_idx]++;
last_unit.result[last_unit.possession]++;
player_streak_add_to_prob(player_of_id_team(tm[last_unit.event.team],
last_unit.event.player),
const_float("float_player_streak_add_own_goal"));
}
else
{
@ -544,14 +558,14 @@ live_game_event_scoring_chance(void)
if(uni(unis->len - 2).event.player != -1 &&
math_rnd(0, 1) < const_float("float_live_game_player_in_poss_shoots") &&
query_player_id_in_team(uni(unis->len - 2).event.player,
tm[last_unit.possession]))
tm[last_unit.possession]))
last_unit.event.player =
uni(unis->len - 2).event.player;
else
{
if(uni(unis->len - 2).event.player != -1 &&
query_player_id_in_team(uni(unis->len - 2).event.player,
tm[last_unit.possession]))
tm[last_unit.possession]))
{
last_unit.event.player =
game_get_player(tm[last_unit.possession], last_unit.area, 0,
@ -590,7 +604,8 @@ live_game_event_penalty(void)
{
LiveGameUnit new;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_penalty\n");
if(last_unit.time != LIVE_GAME_UNIT_TIME_PENALTIES)
@ -655,7 +670,8 @@ live_game_event_general(gboolean create_new)
{
LiveGameUnit new;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_general\n");
if(create_new)
{
@ -738,7 +754,8 @@ live_game_event_general_get_players(void)
uni(unis->len - 2).event.player;
gint type = uni(unis->len - 2).event.type;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_general_get_players\n");
*pl1 = *pl2 = -1;
@ -771,7 +788,8 @@ live_game_event_free_kick(void)
{
LiveGameUnit new = last_unit;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_free_kick\n");
new.event.player =
new.event.player2 = -1;
@ -804,7 +822,8 @@ live_game_event_send_off(gint team, gint player, gboolean second_yellow)
LiveGameUnit new = last_unit;
gint substitute = -1, to_substitute = -1;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_send_off\n");
new.event.player =
new.event.player2 = -1;
@ -823,6 +842,15 @@ live_game_event_send_off(gint team, gint player, gboolean second_yellow)
if(debug >= 50 && team_is_user(tm[team]) != -1)
return;
player_streak_add_to_prob(
player_of_id_team(tm[team], player),
const_float("float_player_streak_add_sendoff"));
if(player_of_id_team(tm[team], player)->streak == PLAYER_STREAK_HOT)
{
player_of_id_team(tm[team], player)->streak = PLAYER_STREAK_NONE;
player_streak_reset_count(player_of_id_team(tm[team], player));
}
player_of_id_team(tm[team], player)->cskill = 0;
if(second_yellow)
player_card_set(player_of_id_team(tm[team], player), match->fix->clid, PLAYER_VALUE_CARD_RED, 2, FALSE);
@ -939,10 +967,11 @@ live_game_event_duel(void)
gfloat scoring_prob;
gfloat duel_factor;
LiveGameUnit new = last_unit;
Player *attacker, *goalie;
Player *attacker, *goalie, *assistant;
gint res_idx1, res_idx2;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_event_duel\n");
new.minute = -1;
@ -950,8 +979,12 @@ live_game_event_duel(void)
new.event.commentary = NULL;
attacker = player_of_id_team(tm[new.possession],
new.event.player);
new.event.player);
goalie = player_of_idx_team(tm[!new.possession], 0);
assistant = (new.event.player2 != -1) ?
player_of_id_team(tm[new.possession], new.event.player2) : NULL;
new.event.player2 = goalie->id;
duel_factor = player_get_game_skill(attacker, FALSE) /
@ -994,6 +1027,14 @@ live_game_event_duel(void)
player_games_goals_set(goalie, match->fix->clid, PLAYER_VALUE_GOALS, 1);
attacker->career[PLAYER_VALUE_GOALS]++;
goalie->career[PLAYER_VALUE_GOALS]++;
player_streak_add_to_prob(attacker,
const_float("float_player_streak_add_goal"));
player_streak_add_to_prob(goalie,
const_float("float_player_streak_add_goalie_goal"));
if(assistant != NULL)
player_streak_add_to_prob(
assistant, const_float("float_player_streak_add_assist"));
}
}
else
@ -1005,6 +1046,10 @@ live_game_event_duel(void)
{
player_games_goals_set(goalie, match->fix->clid, PLAYER_VALUE_SHOTS, 1);
goalie->career[PLAYER_VALUE_SHOTS]++;
if(new.event.type == LIVE_GAME_EVENT_SAVE)
player_streak_add_to_prob(goalie,
const_float("float_player_streak_add_goalie_save"));
}
g_array_append_val(unis, new);
@ -1289,10 +1334,12 @@ live_game_finish_unit(void)
{
LiveGameUnit *unit = &last_unit;
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("\t\tlive_game_finish_unit\n");
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("OOOO1 idx %d type %d poss %d team %d pl %d %d\n", unis->len - 1,
unit->event.type, unit->possession, unit->event.team,
unit->event.player,
@ -1345,7 +1392,8 @@ live_game_finish_unit(void)
if(show)
game_gui_live_game_show_unit(unit);
if(debug > 100 && fixture_user_team_involved(match->fix) != -1)
if((debug > 100 && fixture_user_team_involved(match->fix) != -1) ||
debug > 130)
printf("OOOO idx %d type %d poss %d team %d pl %d %d\n", unis->len - 1,
unit->event.type, unit->possession, unit->event.team,
unit->event.player,

View File

@ -10,9 +10,6 @@ live_game_calculate_fixture(Fixture *fix);
void
live_game_initialize(Fixture *fix);
void
live_game_post_match(void);
gboolean
query_live_game_event_is_break(gint minute, gint time);
@ -106,9 +103,6 @@ live_game_finish_unit(void);
LiveGameUnit*
live_game_unit_before(const LiveGameUnit* unit, gint gap);
void
live_game_set_match(LiveGame *live_game);
gint
live_game_event_get_verbosity(gint event_type);

View File

@ -161,7 +161,10 @@ void
main_exit_program(gint exit_code, gchar *exit_message)
{
if(gtk_main_level() > 0)
{
window_main_save_geometry();
gtk_main_quit();
}
free_memory();

View File

@ -32,9 +32,6 @@ misc_int_compare(gint first, gint second);
gint
misc_float_compare(gfloat first, gfloat second);
void
misc_truncate_string(const gchar *src, gchar *dest, gint number_of_chars);
gboolean
query_misc_string_contains(const gchar *string, const gchar *text);

View File

@ -309,6 +309,8 @@ enum SpinOptions
void
option_gui_write_spin_widgets(gint **spin_options, GtkSpinButton **spin_widgets)
{
gint speed_val = 0;
spin_widgets[SPIN_OPT_AUTOSAVE] =
GTK_SPIN_BUTTON(lookup_widget(window.options, "spinbutton_autosave"));
spin_options[SPIN_OPT_AUTOSAVE] = opt_intp("int_opt_autosave_interval");
@ -329,9 +331,15 @@ option_gui_write_spin_widgets(gint **spin_options, GtkSpinButton **spin_widgets)
GTK_SPIN_BUTTON(lookup_widget(window.options, "spinbutton_live_speed"));
spin_options[SPIN_OPT_LIVE_SPEED] = opt_user_intp("int_opt_user_live_game_speed");
gtk_spin_button_set_range(GTK_SPIN_BUTTON(spin_widgets[SPIN_OPT_LIVE_SPEED]), 0,
-rint((gfloat)(const_int("int_game_gui_live_game_speed_max") - 10) /
(gfloat)(const_int("int_game_gui_live_game_speed_grad"))));
/** Note the spinbutton value so that it doesn't get lost
when setting the range. */
speed_val = gtk_spin_button_get_value_as_int(spin_widgets[SPIN_OPT_LIVE_SPEED]);
gtk_spin_button_set_range(
spin_widgets[SPIN_OPT_LIVE_SPEED], 0,
-rint((gfloat)(const_int("int_game_gui_live_game_speed_max") - 10) /
(gfloat)(const_int("int_game_gui_live_game_speed_grad"))));
gtk_spin_button_set_value(spin_widgets[SPIN_OPT_LIVE_SPEED],
(gfloat)speed_val);
spin_widgets[SPIN_OPT_LIVE_VERBOSITY] =
GTK_SPIN_BUTTON(lookup_widget(window.options, "spinbutton_live_verbosity"));
@ -409,12 +417,13 @@ option_gui_write_options(void)
gint *spin_options[SPIN_OPT_END];
GtkEntry *entry_widgets[ENTRY_OPT_END];
GString *entry_options[ENTRY_OPT_END];
language_set(language_index);
option_gui_write_bool_widgets(bool_options, bool_widgets);
option_gui_write_spin_widgets(spin_options, spin_widgets);
option_gui_write_entry_widgets(entry_options, entry_widgets);
for(i=0;i<BOOL_OPT_END;i++)
*(bool_options[i]) = gtk_toggle_button_get_active(bool_widgets[i]);

View File

@ -439,7 +439,7 @@ create_window_options (void)
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label39), 1, 0.5);
spinbutton_live_speed_adj = gtk_adjustment_new (0, -10, 20, 1, 10, 10);
spinbutton_live_speed_adj = gtk_adjustment_new (0, 0, 40, 1, 10, 10);
spinbutton_live_speed = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_live_speed_adj), 1, 0);
gtk_widget_show (spinbutton_live_speed);
gtk_table_attach (GTK_TABLE (table3), spinbutton_live_speed, 1, 2, 0, 1,

View File

@ -72,6 +72,9 @@ player_new(Team *tm, gfloat average_talent, gboolean new_id)
new.participation = FALSE;
new.offers = 0;
new.streak = PLAYER_STREAK_NONE;
new.streak_count = new.streak_prob = 0;
return new;
}
@ -207,21 +210,6 @@ player_skill_from_talent(const Player *pl)
return skill;
}
/** Calculate the talent value of the player based on his skill.
@param skill The player's skill.
@return The new talent value. */
gfloat
player_new_talent(gfloat skill)
{
gfloat talent = math_gauss_dist(2 * skill - const_float("float_player_max_skill"),
const_float("float_player_max_skill"));
if(talent < skill)
talent = 2 * skill - talent;
return talent;
}
/** Estimate a player's talent.
@param pl The player of which we'd like to estimate the talent. */
void
@ -705,20 +693,22 @@ player_decrease_fitness(Player *pl)
gfloat boost_factor =
1 + (gfloat)pl->team->boost *
const_float("float_player_boost_fitness_effect");
gfloat streak_factor = 1 + (gfloat)pl->streak *
const_float("float_player_streak_influence_fitness_decrease");
if(pl->age < pl->peak_age - pl->peak_region)
pl->fitness -= (((pl->peak_age - pl->peak_region - pl->age) *
const_float("float_player_fitness_decrease_younger_factor") +
const_float("float_player_fitness_decrease_add")) *
goalie_factor * boost_factor);
goalie_factor * boost_factor * streak_factor);
else if(pl->age > pl->peak_age + pl->peak_region)
pl->fitness -= (((pl->age - pl->peak_age - pl->peak_region) *
const_float("float_player_fitness_decrease_older_factor") +
const_float("float_player_fitness_decrease_add")) *
goalie_factor * boost_factor);
goalie_factor * boost_factor * streak_factor);
else
pl->fitness -= (const_float("float_player_fitness_decrease_add") *
goalie_factor * boost_factor);
goalie_factor * boost_factor * streak_factor);
pl->fitness = MAX(0, pl->fitness);
}
@ -735,6 +725,8 @@ player_update_fitness(Player *pl)
gfloat variance =
math_rnd(1 - const_float("float_player_fitness_increase_variance"),
1 + const_float("float_player_fitness_increase_variance"));
gfloat streak_factor =
1 + (pl->streak * const_float("float_player_streak_influence_fitness_increase"));
if(pl->participation)
{
@ -746,14 +738,15 @@ player_update_fitness(Player *pl)
pl->fitness += (((pl->peak_age - pl->peak_region - pl->age) *
const_float("float_player_fitness_increase_younger_factor") +
const_float("float_player_fitness_increase_add")) *
variance);
variance * streak_factor);
else if(pl->age > pl->peak_age + pl->peak_region)
pl->fitness += (((pl->age - pl->peak_age - pl->peak_region) *
const_float("float_player_fitness_increase_older_factor") +
const_float("float_player_fitness_increase_add")) *
variance);
variance * streak_factor);
else
pl->fitness += (const_float("float_player_fitness_increase_add") * variance);
pl->fitness += (const_float("float_player_fitness_increase_add") *
variance * streak_factor);
pl->fitness = MIN(pl->fitness, 1);
}
@ -993,6 +986,96 @@ player_update_injury(Player *pl)
}
}
/** Weekly test whether a player goes on a hot/cold
streak; if he's on a streak, decrease the streak counter. */
void
player_update_streak(Player *pl)
{
gfloat streak_type, streak_prob,
streak_length, decrease_factor = 0;
gfloat streak_prob_factor =
const_float("float_player_streak_prob_max") -
const_float("float_player_streak_prob_zero"),
streak_prob_add = const_float("float_player_streak_prob_zero");
/*d*/
if(debug > 0)
printf("upd %-25s streak %d count %.1f prob %.3f\n",
pl->name->str, pl->streak, pl->streak_count, pl->streak_prob);
/** Player streak is locked. */
if(pl->streak_count < 0)
{
pl->streak_count++;
if(pl->streak_count >= 0)
pl->streak_count = 0;
return;
}
else if(pl->streak_count > 0)
{
if(pl->streak == PLAYER_STREAK_HOT)
decrease_factor = -1;
else if(pl->streak == PLAYER_STREAK_COLD)
decrease_factor = 1;
else
g_warning("player_update_streak: streak count is positive (%.1f) but player %s is not on a streak!\n", pl->streak_count, pl->name->str);
pl->streak_count -=
(pl->streak_prob * decrease_factor *
const_float("float_player_streak_count_decrease_factor") +
const_float("float_player_streak_count_decrease_add"));
/** Streak is over. */
if(pl->streak_count <= 0)
{
pl->streak = PLAYER_STREAK_NONE;
player_streak_reset_count(pl);
}
return;
}
if(query_player_is_in_ya(pl))
return;
/** Now let's find out whether there's a new streak. */
streak_type = math_rnd(-1, 1);
streak_prob = math_rnd(0, 1);
streak_length = math_rnd(const_float("float_player_streak_length_lower"),
const_float("float_player_streak_length_upper"));
if(streak_type < pl->streak_prob &&
((pl->streak_prob > 0 &&
streak_prob < streak_prob_factor * pl->streak_prob + streak_prob_add) ||
(pl->streak_prob <= 0 &&
streak_prob < streak_prob_add * pl->streak_prob + streak_prob_add)))
{
pl->streak = PLAYER_STREAK_HOT;
pl->streak_count = streak_length;
/*d*/
if(debug > 0)
printf("**** %s HOT length %.1f prob %.2f\n",
pl->name->str, pl->streak_count, pl->streak_prob);
}
else if(streak_type > pl->streak_prob &&
((pl->streak_prob > 0 &&
streak_prob < -streak_prob_add * pl->streak_prob + streak_prob_add) ||
(pl->streak_prob <= 0 &&
streak_prob < -streak_prob_factor * pl->streak_prob + streak_prob_add)))
{
pl->streak = PLAYER_STREAK_COLD;
pl->streak_count = streak_length;
/*d*/
if(debug > 0)
printf("**** %s COLD length %.1f prob %.2f\n",
pl->name->str, pl->streak_count, pl->streak_prob);
}
}
/** Update a player in a user team (age, skill etc.). */
void
player_update_weekly(Player *pl)
@ -1015,8 +1098,11 @@ player_update_weekly(Player *pl)
player_remove_contract(pl);
player_update_skill(pl);
if(pl->health > 0)
player_update_injury(pl);
else
player_update_streak(pl);
}
/** Remove a player from a user team after the contract expired.
@ -1045,20 +1131,40 @@ player_remove_from_team(Team *tm, gint idx)
@param pl The player we update.
@param clid The fixture clid. */
void
player_update_post_match(Player *pl, gint clid)
player_update_post_match(Player *pl, const Fixture *fix)
{
gint yellow_red = league_cup_get_yellow_red(clid);
gint yellow_red = league_cup_get_yellow_red(fix->clid);
gint winner = -1;
if(player_card_get(pl, clid, PLAYER_VALUE_CARD_RED) > 0)
player_card_set(pl, clid, PLAYER_VALUE_CARD_RED, -1, TRUE);
if(player_card_get(pl, fix->clid, PLAYER_VALUE_CARD_RED) > 0)
player_card_set(pl, fix->clid, PLAYER_VALUE_CARD_RED, -1, TRUE);
if(player_card_get(pl, clid, PLAYER_VALUE_CARD_YELLOW) >= yellow_red)
if(player_card_get(pl, fix->clid, PLAYER_VALUE_CARD_YELLOW) >= yellow_red)
{
player_card_set(pl, clid, PLAYER_VALUE_CARD_YELLOW, 0, FALSE);
player_card_set(pl, fix->clid, PLAYER_VALUE_CARD_YELLOW, 0, FALSE);
if(player_card_get(pl, clid, PLAYER_VALUE_CARD_RED) == 0 && debug < 50)
player_card_set(pl, clid, PLAYER_VALUE_CARD_RED, 1, FALSE);
}
if(player_card_get(pl, fix->clid, PLAYER_VALUE_CARD_RED) == 0 && debug < 50)
player_card_set(pl, fix->clid, PLAYER_VALUE_CARD_RED, 1, FALSE);
}
if(pl->cpos == PLAYER_POS_GOALIE &&
((fix->result[0][0] == 0 && fix->teams[1] == pl->team) ||
(fix->result[1][0] == 0 && fix->teams[0] == pl->team)))
player_streak_add_to_prob(
pl, const_float("float_player_streak_add_goalie_clean"));
/** No streak change if we had a draw. */
if(!fix->decisive && fix->result[0][0] == fix->result[1][0])
return;
winner = GPOINTER_TO_INT(fixture_winner_of(fix, TRUE));
if(winner == pl->team->id)
player_streak_add_to_prob(
pl, const_float("float_player_streak_add_win"));
else
player_streak_add_to_prob(
pl, const_float("float_player_streak_add_loss"));
}
/** Replace a player by a new one in a cpu team.
@ -1264,3 +1370,34 @@ player_move_from_ya(gint idx)
g_array_remove_index(current_user.youth_academy.players, idx);
g_array_append_val(current_user.tm->players, player);
}
/** Wrapper for the streak probability addition operation
so that it always stays between -1 and 1. */
void
player_streak_add_to_prob(Player *pl, gfloat add)
{
/** No streaks for CPU players (yet). */
if(team_is_user(pl->team) == -1)
return;
pl->streak_prob += add;
pl->streak_prob = CLAMP(pl->streak_prob, -1, 1);
/*d*/
if(debug > 0)
printf("addto %-25s st %d cnt %.1f pro %.3f\n",
pl->name->str, pl->streak, pl->streak_count,
pl->streak_prob);
}
/** Find out whether a player is in the youth academy. */
gboolean
query_player_is_in_ya(const Player *pl)
{
gint i;
for(i=0;i<pl->team->players->len;i++)
if(pl == &g_array_index(pl->team->players, Player, i))
return FALSE;
return TRUE;
}

View File

@ -2,6 +2,8 @@
#define PLAYER_H
#include "bygfoot.h"
#include "fixture_struct.h"
#include "maths.h"
#include "player_struct.h"
#include "team_struct.h"
@ -15,6 +17,9 @@ enum PlayerCompareAttrib
#define query_player_is_youth(pl) (pl->age <= const_float("float_player_age_lower"))
/** Reset the streak counter. */
#define player_streak_reset_count(pl) pl->streak_count = -math_rnd((gfloat)const_int("int_player_streak_lock_length_lower"), (gfloat)const_int("int_player_streak_lock_length_upper"))
Player
player_new(Team *tm, gfloat average_skill, gboolean new_id);
@ -24,9 +29,6 @@ player_get_position_from_structure(gint structure, gint player_number);
gfloat
player_skill_from_talent(const Player *pl);
gfloat
player_new_talent(gfloat skill);
void
player_estimate_talent(Player *pl);
@ -103,7 +105,7 @@ void
player_update_fitness(Player *pl);
void
player_update_post_match(Player *pl, gint clid);
player_update_post_match(Player *pl, const Fixture *fix);
void
player_replace_by_new(Player *pl, gboolean free_player);
@ -144,4 +146,13 @@ player_move_to_ya(gint idx);
void
player_move_from_ya(gint idx);
void
player_streak_add_to_prob(Player *pl, gfloat add);
void
player_update_streak(Player *pl);
gboolean
query_player_is_in_ya(const Player *pl);
#endif

View File

@ -18,6 +18,14 @@ enum PlayerPos
PLAYER_POS_END
};
/** Streaks a player can go on. */
enum PlayerStreak
{
PLAYER_STREAK_COLD = -1,
PLAYER_STREAK_NONE,
PLAYER_STREAK_HOT
};
/**
Cards in different cups are counted separately for players;
for each league or cup the cards are stored in such a struct.
@ -87,25 +95,34 @@ typedef struct
gint pos, /**< Position. @see #PlayerPos */
cpos, /**< Current position. @see #PlayerPos */
health, /**< Health. An integer signifying an injury or good health. @see #PlayerInjury */
health, /**< Health. An integer signifying an injury or
good health. @see #PlayerInjury */
recovery, /**< Weeks until the player gets healthy. */
id, /**< Id of the player within the team. */
value, /**< Value of the player. */
wage, /**< Wage of the player. */
offers; /**< Number of times the player received a contract offer. */
gfloat skill, /**< Skill. Between 0 and a constant (specified in the constants file). */
offers, /**< Number of times the player received a contract offer. */
streak; /**< The streak the player is on. */
gfloat skill, /**< Skill. Between 0 and a constant
(specified in the constants file). */
cskill, /**< Current Skill. */
talent, /**< Talent. The peak ability (which isn't always reached). */
etal[QUALITY_END], /**< Estimated talent (the user never sees the actual talent).
Depends on scout quality. */
fitness, /**< Fitness. Between 0 and 1. */
lsu, /**< Last skill update. Number of weeks since the player skill was last updated. */
lsu, /**< Last skill update. Number of weeks since the player
skill was last updated. */
age, /**< Age in years. */
peak_age, /**< Age at which the player reaches his peak ability. */
peak_region, /**< Region around the peak age during which the player's
ability is at the peak (in years). */
contract; /**< The years until the player's contract expires. */
contract, /**< The years until the player's contract expires. */
streak_prob, /**< This number determines how probable it is that a player
goes on a hot/cold streak. Between -1 and 1. */
streak_count; /**< How many weeks the streak goes (or how
long a new streak may not begin if the value
is negative). */
/** Whether the player participated in the team's last match. */
gboolean participation;
@ -166,6 +183,7 @@ enum PlayerInfoAttributeValue
PLAYER_INFO_ATTRIBUTE_GAMES_GOALS,
PLAYER_INFO_ATTRIBUTE_YELLOW_CARDS,
PLAYER_INFO_ATTRIBUTE_BANNED,
PLAYER_INFO_ATTRIBUTE_STREAK,
PLAYER_INFO_ATTRIBUTE_CAREER,
PLAYER_INFO_ATTRIBUTE_OFFERS,
PLAYER_INFO_ATTRIBUTE_END

View File

@ -366,6 +366,21 @@ team_get_average_skill(const Team *tm, gboolean cskill)
return (counter > 0) ? sum / (gfloat)counter : 0;
}
/** Return the overall average talent of the team's players.
@param tm The team we examine. */
gfloat
team_get_average_talent(const Team *tm)
{
gint i;
gfloat sum = 0;
for(i=0;i<tm->players->len;i++)
sum += player_of_idx_team(tm, i)->talent;
return (tm->players->len > 0) ? sum / (gfloat)tm->players->len : 0;
}
/** Return the rank of the team in the league tables. */
gint
team_get_league_rank(const Team *tm)
@ -679,12 +694,12 @@ team_update_user_team_weekly(Team *tm)
@param tm The user team we examine.
@param clid The fixture clid. */
void
team_update_post_match(Team *tm, gint clid)
team_update_post_match(Team *tm, const Fixture *fix)
{
gint i;
for(i=0;i<tm->players->len;i++)
player_update_post_match(player_of_idx_team(tm, i), clid);
player_update_post_match(player_of_idx_team(tm, i), fix);
}
/** Some updates each round.

View File

@ -51,6 +51,9 @@ team_get_fixture(const Team *tm, gboolean last_fixture);
gfloat
team_get_average_skill(const Team *tm, gboolean cskill);
gfloat
team_get_average_talent(const Team *tm);
gint
team_is_user(const Team *tm);
@ -82,7 +85,7 @@ void
team_update_cpu_team(Team *tm, gboolean reset_fitness);
void
team_update_post_match(Team *tm, gint clid);
team_update_post_match(Team *tm, const Fixture *fix);
void
team_update_cpu_corrections(Team *tm, gboolean reset_fitness);

View File

@ -402,22 +402,6 @@ transfer_add_offer(gint idx, Team *tm, gint fee, gint wage)
return FALSE;
}
/** Return the index of the transfer containing the player going with
the team and the id. */
gint
transfer_get_index(const Team *tm, gint id)
{
gint i;
for(i=0;i<transfer_list->len;i++)
if(trans(i).tm == tm && trans(i).id == id)
return i;
main_exit_program(EXIT_INT_NOT_FOUND,
"transfer_get_index: didn't find transfer.");
return -1;
}
/** Remove any offers from the team for the given transfer player. */
gboolean
transfer_remove_offer(gint idx, const Team *tm)

View File

@ -53,9 +53,6 @@ transfer_remove_player_ptr(const Player *pl);
Team*
transfer_team_get_new(void);
gint
transfer_get_index(const Team *tm, gint id);
void
transfer_add_remove_user_player(Player *pl);

View File

@ -180,29 +180,32 @@ treeview_show_team_list(GtkTreeView *treeview, gboolean show_cup_teams,
@param players The array containing the players.
@param attributes An array containing the attributes we show.
@param max The size of the attribute array.
@param separator Whether we draw a blank line after the 11th player. */
@param separator Whether we draw a blank line after the 11th player.
@param status Whether player status is shown (takes two columns). */
GtkTreeModel*
treeview_create_player_list(GPtrArray *players, gint *attributes, gint max,
gboolean show_separator, gboolean sortable)
gboolean show_separator, gboolean sortable, gboolean status)
{
gint i, j;
GtkListStore *ls;
GtkTreeIter iter;
GType types[max + 1];
GType types[max + 1 + status];
types[0] = G_TYPE_INT;
for(i=0;i<max;i++)
for(i=0;i<max + status;i++)
types[i + 1] = G_TYPE_POINTER;
ls = gtk_list_store_newv(max + 1, types);
ls = gtk_list_store_newv(max + 1 + status, types);
for(i=0;i<players->len;i++)
{
gtk_list_store_append(ls, &iter);
if(show_separator && i == 11)
{
gtk_list_store_set(ls, &iter, 0, const_int("int_treeview_helper_int_empty"), -1);
for(j=0;j<max;j++)
gtk_list_store_set(ls, &iter, 0,
const_int("int_treeview_helper_int_empty"), -1);
for(j=0;j<max + status;j++)
gtk_list_store_set(ls, &iter, j + 1, NULL, -1);
gtk_list_store_append(ls, &iter);
@ -211,7 +214,7 @@ treeview_create_player_list(GPtrArray *players, gint *attributes, gint max,
else
gtk_list_store_set(ls, &iter, 0, i + 1, -1);
for(j=0;j<max;j++)
for(j=0;j<max + status;j++)
gtk_list_store_set(ls, &iter, j + 1, g_ptr_array_index(players, i), -1);
}
@ -227,8 +230,10 @@ treeview_create_player_list(GPtrArray *players, gint *attributes, gint max,
attributes[i] == PLAYER_LIST_ATTRIBUTE_ETAL ||
attributes[i] == PLAYER_LIST_ATTRIBUTE_VALUE ||
attributes[i] == PLAYER_LIST_ATTRIBUTE_WAGE)
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(ls), i + 1,
treeview_helper_player_compare, GINT_TO_POINTER(attributes[i]), NULL);
gtk_tree_sortable_set_sort_func(
GTK_TREE_SORTABLE(ls),
i + 1 + (status && attributes[i] > PLAYER_LIST_ATTRIBUTE_STATUS),
treeview_helper_player_compare, GINT_TO_POINTER(attributes[i]), NULL);
}
return (GtkTreeModel*)ls;
@ -239,7 +244,7 @@ void
treeview_set_up_player_list(GtkTreeView *treeview, gint *attributes, gint max,
gboolean show_separator, gboolean sortable)
{
gint i;
gint i, cnt = 1;
GtkTreeViewColumn *col;
GtkCellRenderer *renderer;
gchar *titles[PLAYER_LIST_ATTRIBUTE_END] =
@ -318,7 +323,26 @@ treeview_set_up_player_list(GtkTreeView *treeview, gint *attributes, gint max,
attributes[i] == PLAYER_LIST_ATTRIBUTE_ETAL ||
attributes[i] == PLAYER_LIST_ATTRIBUTE_VALUE ||
attributes[i] == PLAYER_LIST_ATTRIBUTE_WAGE))
gtk_tree_view_column_set_sort_column_id(col, i + 1);
gtk_tree_view_column_set_sort_column_id(col, cnt);
cnt++;
if(attributes[i] == PLAYER_LIST_ATTRIBUTE_STATUS)
{
col = gtk_tree_view_column_new();
gtk_tree_view_append_column(treeview, col);
renderer = gtk_cell_renderer_pixbuf_new();
gtk_tree_view_column_pack_start(col, renderer, TRUE);
gtk_tree_view_column_set_cell_data_func(
col, renderer, treeview_helper_player_status_to_cell,
NULL, NULL);
gtk_tree_view_column_set_alignment(col, 0.5);
g_object_set(renderer, "xalign", 0.5,
NULL);
cnt++;
}
}
}
@ -330,24 +354,31 @@ treeview_set_up_player_list(GtkTreeView *treeview, gint *attributes, gint max,
@param attrib The #PlayerListAttribute that determines which attributes to show.
@param show_separator Whether we draw a blank line after the 11th player. */
void
treeview_show_player_list(GtkTreeView *treeview, GPtrArray *players, PlayerListAttribute attribute,
treeview_show_player_list(GtkTreeView *treeview, GPtrArray *players,
PlayerListAttribute attribute,
gboolean show_separator)
{
gint i, cnt = 0;
gint columns = math_sum_int_array(attribute.on_off, PLAYER_LIST_ATTRIBUTE_END);
gint attributes[columns];
GtkTreeModel *model = NULL;
gboolean sortable = (treeview != GTK_TREE_VIEW(lookup_widget(window.main, "player_list1")));
gboolean sortable =
(treeview != GTK_TREE_VIEW(lookup_widget(window.main, "player_list1")));
treeview_helper_clear(treeview);
for(i=0;i<PLAYER_LIST_ATTRIBUTE_END;i++)
{
if(attribute.on_off[i])
attributes[cnt++] = i;
}
treeview_set_up_player_list(treeview, attributes, columns, show_separator, sortable);
model = treeview_create_player_list(players, attributes, columns, show_separator, sortable);
model = treeview_create_player_list(players, attributes,
columns, show_separator,
sortable,
attribute.on_off[PLAYER_LIST_ATTRIBUTE_STATUS]);
gtk_tree_view_set_model(treeview, model);
g_object_unref(model);
@ -1824,6 +1855,8 @@ treeview_create_player_info(const Player *pl)
banned automatically for a match. */
_("Yellow cards (limit)\n"),
_("Banned\n"),
/* Hot streak or cold streak of a player. */
_("Streak"),
_("Career values"),
_("New contract\noffers")};

View File

@ -21,7 +21,7 @@ treeview_show_team_list(GtkTreeView *treeview, gboolean show_cup_teams,
GtkTreeModel*
treeview_create_player_list(GPtrArray *players, gint *attributes, gint max,
gboolean show_separator, gboolean sortable);
gboolean show_separator, gboolean sortable, gboolean status);
void
treeview_set_up_player_list (GtkTreeView *treeview, gint *attributes, gint max,

View File

@ -708,6 +708,9 @@ treeview_helper_player_ext_info_to_cell(GtkTreeViewColumn *col,
case PLAYER_INFO_ATTRIBUTE_BANNED:
treeview_helper_player_info_banned_to_cell(renderer, pl->cards);
break;
case PLAYER_INFO_ATTRIBUTE_STREAK:
treeview_helper_player_info_streak_to_cell(renderer, pl->streak);
break;
case PLAYER_INFO_ATTRIBUTE_CAREER:
treeview_helper_player_info_career_to_cell(renderer, pl);
break;
@ -777,7 +780,8 @@ treeview_helper_player_info_banned_to_cell(GtkCellRenderer *renderer, const GArr
for(i=0;i<cards->len;i++)
if(g_array_index(cards, PlayerCard, i).red > 0)
{
/* Ban info of a player in the format: 'Cup/league name: Number of weeks banned' */
/* Ban info of a player in the format:
'Cup/league name: Number of weeks banned' */
sprintf(buf2, _("%s: %d weeks\n"),
league_cup_get_name_string(g_array_index(cards, PlayerCard, i).clid),
g_array_index(cards, PlayerCard, i).red);
@ -846,6 +850,15 @@ treeview_helper_player_info_games_goals_to_cell(GtkCellRenderer *renderer, const
g_object_set(renderer, "text", buf, NULL);
}
void
treeview_helper_player_info_streak_to_cell(GtkCellRenderer *renderer, gint streak)
{
if(streak == PLAYER_STREAK_HOT)
g_object_set(renderer, "text", _("The player is on a hot streak"), NULL);
else if(streak == PLAYER_STREAK_COLD)
g_object_set(renderer, "text", _("The player is on a cold streak"), NULL);
}
void
treeview_helper_player_info_health_to_cell(GtkCellRenderer *renderer, const Player *pl)
{
@ -867,10 +880,10 @@ treeview_helper_player_info_health_to_cell(GtkCellRenderer *renderer, const Play
/** Render a player list cell. */
void
treeview_helper_player_to_cell(GtkTreeViewColumn *col,
GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data)
GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data)
{
gint column = treeview_helper_get_col_number_column(col);
gint attribute = GPOINTER_TO_INT(user_data);
@ -921,7 +934,8 @@ treeview_helper_player_to_cell(GtkTreeViewColumn *col,
treeview_helper_player_games_goals_to_cell(buf, pl, PLAYER_VALUE_SHOTS);
break;
case PLAYER_LIST_ATTRIBUTE_STATUS:
treeview_helper_player_status_to_cell(renderer, buf, pl);
treeview_helper_player_status_to_cell(NULL, renderer,
NULL, NULL, (gpointer)pl);
break;
case PLAYER_LIST_ATTRIBUTE_CARDS:
treeview_helper_player_cards_to_cell(buf, pl);
@ -950,7 +964,8 @@ treeview_helper_player_to_cell(GtkTreeViewColumn *col,
break;
}
g_object_set(renderer, "text", buf, NULL);
if(attribute != PLAYER_LIST_ATTRIBUTE_STATUS)
g_object_set(renderer, "text", buf, NULL);
}
/** Render a cell of a player name. */
@ -1064,34 +1079,95 @@ treeview_helper_player_cards_to_cell(gchar *buf, const Player *pl)
@param buf The string the cell will contain.
@param pl The pointer to the player. */
void
treeview_helper_player_status_to_cell(GtkCellRenderer *renderer, gchar *buf, const Player *pl)
treeview_helper_player_status_to_cell(GtkTreeViewColumn *col,
GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data)
{
gint ban = player_is_banned(pl);
const Player *pl = NULL;
gchar buf[SMALL];
gint ban = 0, column = -1;
GdkPixbuf *symbol = NULL;
gboolean render_icon = (user_data == NULL);
if(pl->health != PLAYER_INJURY_NONE)
if(render_icon)
{
/* Injury info. */
sprintf(buf, _("INJ(%d)"), pl->recovery);
g_object_set(renderer, "background",
const_app("string_treeview_helper_color_player_injury"), NULL);
column = treeview_helper_get_col_number_column(col);
gtk_tree_model_get(model, iter, column, &pl, -1);
}
else
pl = (const Player*)user_data;
if(pl == NULL)
{
if(render_icon)
g_object_set(renderer, "pixbuf", NULL, NULL);
return;
}
if(ban > 0)
ban = player_is_banned(pl);
if(pl->health != PLAYER_INJURY_NONE)
{
/* Injury info. */
if(!render_icon)
{
sprintf(buf, _("INJ(%d)"), pl->recovery);
g_object_set(renderer, "background",
const_app("string_treeview_helper_color_player_injury"), NULL);
}
else
symbol =
treeview_helper_pixbuf_from_filename(
const_app("string_treeview_helper_player_status_injury"));
}
else if(ban > 0)
{
/* Red card info (how long the player is banned). */
sprintf(buf, _("BAN(%d)"), ban);
g_object_set(renderer, "background",
const_app("string_treeview_helper_color_player_banned"), NULL);
if(!render_icon)
{
sprintf(buf, _("BAN(%d)"), ban);
g_object_set(renderer, "background",
const_app("string_treeview_helper_color_player_banned"), NULL);
}
else
symbol =
treeview_helper_pixbuf_from_filename(
const_app("string_treeview_helper_player_status_ban"));
}
else
/* Player status: ok. */
strcpy(buf, _("OK"));
{
if(!render_icon)
strcpy(buf, "OK");
else
{
if(ban == -1)
symbol =
treeview_helper_pixbuf_from_filename(
const_app("string_treeview_helper_player_status_yellow_danger"));
else if(pl->streak == PLAYER_STREAK_HOT)
symbol =
treeview_helper_pixbuf_from_filename(
const_app("string_treeview_helper_player_status_hot_streak"));
else if(pl->streak == PLAYER_STREAK_COLD)
symbol =
treeview_helper_pixbuf_from_filename(
const_app("string_treeview_helper_player_status_cold_streak"));
else
symbol =
treeview_helper_pixbuf_from_filename(
const_app("string_treeview_helper_player_status_ok"));
}
}
if(ban == -1)
g_object_set(renderer, "background",
const_app("string_treeview_helper_color_player_yellow_danger"), NULL);
if(render_icon)
{
g_object_set(renderer, "pixbuf", symbol, NULL);
treeview_helper_unref(G_OBJECT(symbol));
}
else
g_object_set(renderer, "text", buf, NULL);
}
/** Render a cell of player games or goals.

View File

@ -107,7 +107,11 @@ void
treeview_helper_player_cards_to_cell(gchar *buf, const Player *pl);
void
treeview_helper_player_status_to_cell(GtkCellRenderer *renderer, gchar *buf, const Player *pl);
treeview_helper_player_status_to_cell(GtkTreeViewColumn *col,
GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data);
void
treeview_helper_player_games_goals_to_cell(gchar *buf, const Player *pl, gint type);
@ -143,6 +147,10 @@ treeview_helper_player_info_banned_to_cell(GtkCellRenderer *renderer, const GArr
void
treeview_helper_player_info_career_to_cell(GtkCellRenderer *renderer, const Player *pl);
void
treeview_helper_player_info_streak_to_cell(GtkCellRenderer *renderer, gint streak);
gchar*
treeview_helper_get_user_history_icon(gint history_type);

View File

@ -24,21 +24,21 @@
#include "window.h"
/** Show the window with the news. */
void
window_show_news(void)
{
GtkNotebook *nb = NULL;
/* void */
/* window_show_news(void) */
/* { */
/* GtkNotebook *nb = NULL; */
window_create(WINDOW_HELP);
/* window_create(WINDOW_HELP); */
nb = GTK_NOTEBOOK(lookup_widget(window.help, "notebook1"));
/* nb = GTK_NOTEBOOK(lookup_widget(window.help, "notebook1")); */
gtk_notebook_remove_page(nb, 0);
gtk_notebook_remove_page(nb, -1);
/* gtk_notebook_remove_page(nb, 0); */
/* gtk_notebook_remove_page(nb, -1); */
gtk_label_set_text(GTK_LABEL(lookup_widget(window.help, "label_contributors")),
_("News"));
}
/* gtk_label_set_text(GTK_LABEL(lookup_widget(window.help, "label_contributors")), */
/* _("News")); */
/* } */
/** Show the help/about window.
@param page Which notebook page to display. */
@ -166,16 +166,17 @@ window_show_file_sel(void)
else
{
if(os_is_unix)
sprintf(buf, "%s%s%s%ssaves%s", home, G_DIR_SEPARATOR_S,
HOMEDIRNAME, G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S);
sprintf(buf, "%s%s%s%ssaves", home, G_DIR_SEPARATOR_S,
HOMEDIRNAME, G_DIR_SEPARATOR_S);
else
{
gchar *pwd = g_get_current_dir();
sprintf(buf, "%s%ssaves%s", pwd, G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S);
sprintf(buf, "%s%ssaves", pwd, G_DIR_SEPARATOR_S);
g_free(pwd);
}
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(window.file_chooser), buf);
gtk_file_chooser_set_current_folder(
GTK_FILE_CHOOSER(window.file_chooser), buf);
}
if(gtk_dialog_run(GTK_DIALOG(window.file_chooser)) == GTK_RESPONSE_OK)
@ -414,19 +415,94 @@ window_live_set_spinbuttons(void)
{
GtkSpinButton *sb_speed =
GTK_SPIN_BUTTON(lookup_widget(window.live, "spinbutton_speed"));
gtk_spin_button_set_range(sb_speed, 0,
-rint((gfloat)(const_int("int_game_gui_live_game_speed_max") - 10) /
(gfloat)(const_int("int_game_gui_live_game_speed_grad"))));
gfloat user_option = (gfloat)option_int("int_opt_user_live_game_speed",
&usr(stat2).options);
gtk_spin_button_set_range(
sb_speed, 0, -rint((gfloat)(const_int("int_game_gui_live_game_speed_max") - 10) /
(gfloat)(const_int("int_game_gui_live_game_speed_grad"))));
gtk_spin_button_set_value(sb_speed, user_option);
gtk_spin_button_set_value(sb_speed,
(gfloat)option_int("int_opt_user_live_game_speed",
&usr(stat2).options));
gtk_spin_button_set_value(
GTK_SPIN_BUTTON(lookup_widget(window.live, "spinbutton_verbosity")),
(gfloat)option_int("int_opt_user_live_game_verbosity", &usr(stat2).options));
}
/** Save main window size and position into a file.*/
void
window_main_save_geometry(void)
{
gchar filename[SMALL];
const gchar *home = g_get_home_dir();
gchar *pwd = g_get_current_dir();
FILE *fil = NULL;
gint width, height, pos_x, pos_y, paned_pos;
if(os_is_unix)
sprintf(filename, "%s%s%s%swindow_settings",
home, G_DIR_SEPARATOR_S, HOMEDIRNAME, G_DIR_SEPARATOR_S);
else
sprintf(filename, "%s%swindow_settings",
pwd, G_DIR_SEPARATOR_S);
g_free(pwd);
if(window.main != NULL && file_my_fopen(filename, "w", &fil, FALSE))
{
gtk_window_get_size(GTK_WINDOW(window.main), &width, &height);
gtk_window_get_position(GTK_WINDOW(window.main), &pos_x, &pos_y);
paned_pos = gtk_paned_get_position(
GTK_PANED(lookup_widget(window.main, "hpaned2")));
fprintf(fil, "int_window_settings_width\t%d\n", width);
fprintf(fil, "int_window_settings_height\t%d\n", height);
fprintf(fil, "int_window_settings_pos_x\t%d\n", pos_x);
fprintf(fil, "int_window_settings_pos_y\t%d\n", pos_y);
fprintf(fil, "int_window_settings_paned_pos\t%d\n", paned_pos);
fclose(fil);
}
}
/** Set the main window geometry according to the file
settings. */
void
window_main_load_geometry(void)
{
gchar filename[SMALL];
const gchar *home = g_get_home_dir();
gchar *pwd = g_get_current_dir();
OptionList optionlist;
if(os_is_unix)
sprintf(filename, "%s%s%s%swindow_settings",
home, G_DIR_SEPARATOR_S, HOMEDIRNAME, G_DIR_SEPARATOR_S);
else
sprintf(filename, "%s%swindow_settings",
pwd, G_DIR_SEPARATOR_S);
g_free(pwd);
if(g_file_test(filename, G_FILE_TEST_EXISTS))
{
optionlist.list = NULL;
optionlist.datalist = NULL;
file_load_opt_file(filename, &optionlist);
gtk_window_resize(GTK_WINDOW(window.main),
option_int("int_window_settings_width", &optionlist),
option_int("int_window_settings_height", &optionlist));
gtk_window_move(GTK_WINDOW(window.main),
option_int("int_window_settings_pos_x", &optionlist),
option_int("int_window_settings_pos_y", &optionlist));
gtk_paned_set_position(GTK_PANED(lookup_widget(window.main, "hpaned2")),
option_int("int_window_settings_paned_pos", &optionlist));
free_option_list(&optionlist, FALSE);
}
}
/** Create and show a window. Which one depends on the argument.
@param window_type An integer telling us which window to
create.
@ -454,6 +530,7 @@ window_create(gint window_type)
{
window.main = create_main_window();
wind = window.main;
window_main_load_geometry();
game_gui_print_message(_("Welcome to Bygfoot %s"), VERS);
sprintf(buf, "Bygfoot Football Manager %s", VERS);
}

View File

@ -75,4 +75,10 @@ window_show_news(void);
void
window_show_mmatches(void);
void
window_main_save_geometry(void);
void
window_main_load_geometry(void);
#endif

View File

@ -37,6 +37,9 @@ enum
TAG_PLAYER_CARD_YELLOW,
TAG_PLAYER_CARD_RED,
TAG_PLAYER_CAREER,
TAG_PLAYER_STREAK,
TAG_PLAYER_STREAK_COUNT,
TAG_PLAYER_STREAK_PROB,
TAG_END
};
@ -96,7 +99,10 @@ xml_loadsave_players_end_element(gint tag, GArray *players)
tag == TAG_PLAYER_PARTICIPATION ||
tag == TAG_PLAYER_GAMES_GOAL ||
tag == TAG_PLAYER_CAREER ||
tag == TAG_PLAYER_CARD)
tag == TAG_PLAYER_CARD ||
tag == TAG_PLAYER_STREAK ||
tag == TAG_PLAYER_STREAK_COUNT ||
tag == TAG_PLAYER_STREAK_PROB)
{
state = TAG_PLAYER;
if(tag == TAG_PLAYER_ETAL)
@ -187,6 +193,12 @@ xml_loadsave_players_text(gchar *text)
new_card.red = int_value;
else if(state == TAG_PLAYER_CAREER)
new_player.career[careeridx] = int_value;
else if(state == TAG_PLAYER_STREAK)
new_player.streak = int_value;
else if(state == TAG_PLAYER_STREAK_COUNT)
new_player.streak_count = float_value;
else if(state == TAG_PLAYER_STREAK_PROB)
new_player.streak_prob = float_value;
}
void
@ -236,6 +248,10 @@ xml_loadsave_players_write_player(FILE *fil, const Player *pl)
for(i=0;i<PLAYER_VALUE_END;i++)
xml_write_int(fil, pl->career[i], TAG_PLAYER_CAREER, I2);
xml_write_int(fil, pl->streak, TAG_PLAYER_STREAK, I2);
xml_write_float(fil, pl->streak_count, TAG_PLAYER_STREAK_COUNT, I2);
xml_write_float(fil, pl->streak_prob, TAG_PLAYER_STREAK_PROB, I2);
for(i=0;i<pl->games_goals->len;i++)
{
fprintf(fil, "%s<_%d>\n", I2, TAG_PLAYER_GAMES_GOAL);

View File

@ -35,7 +35,4 @@ xml_loadsave_teams_write(const gchar *filename, const GArray *teams);
void
xml_loadsave_teams_write_team(FILE *fil, const Team* team);
void
xml_loadsave_teams_write_player(FILE *fil, const Player *pl);
#endif

View File

@ -15,7 +15,7 @@
#define TAG_TEAM_NAME "team_name"
#define TAG_STADIUM_NAME "stadium_name"
#define TAG_SYMBOL "symbol"
#define TAG_AVERAGE_SKILL "average_skill"
#define TAG_AVERAGE_TALENT "average_talent"
#define TAG_FORMATION "formation"
#define TAG_NAMES_FILE "names_file"
#define TAG_PLAYER "player"
@ -32,7 +32,7 @@ enum XmlTeamStates
STATE_TEAM_NAME,
STATE_STADIUM_NAME,
STATE_SYMBOL,
STATE_AVERAGE_SKILL,
STATE_AVERAGE_TALENT,
STATE_FORMATION,
STATE_NAMES_FILE,
STATE_PLAYER,
@ -47,7 +47,7 @@ enum XmlTeamStates
gint state, birth_year;
Player new_player;
gfloat average_skill;
gfloat average_talent;
Team *team;
const gchar *d_file;
@ -67,8 +67,8 @@ xml_team_read_start_element (GMarkupParseContext *context,
state = STATE_STADIUM_NAME;
else if(strcmp(element_name, TAG_SYMBOL) == 0)
state = STATE_SYMBOL;
else if(strcmp(element_name, TAG_AVERAGE_SKILL) == 0)
state = STATE_AVERAGE_SKILL;
else if(strcmp(element_name, TAG_AVERAGE_TALENT) == 0)
state = STATE_AVERAGE_TALENT;
else if(strcmp(element_name, TAG_FORMATION) == 0)
state = STATE_FORMATION;
else if(strcmp(element_name, TAG_NAMES_FILE) == 0)
@ -76,7 +76,7 @@ xml_team_read_start_element (GMarkupParseContext *context,
else if(strcmp(element_name, TAG_PLAYER) == 0)
{
state = STATE_PLAYER;
new_player = player_new(team, average_skill, TRUE);
new_player = player_new(team, average_talent, TRUE);
}
else if(strcmp(element_name, TAG_PLAYER_NAME) == 0)
state = STATE_PLAYER_NAME;
@ -111,7 +111,7 @@ xml_team_read_end_element (GMarkupParseContext *context,
if(strcmp(element_name, TAG_TEAM_NAME) == 0 ||
strcmp(element_name, TAG_STADIUM_NAME) == 0 ||
strcmp(element_name, TAG_SYMBOL) == 0 ||
strcmp(element_name, TAG_AVERAGE_SKILL) == 0 ||
strcmp(element_name, TAG_AVERAGE_TALENT) == 0 ||
strcmp(element_name, TAG_FORMATION) == 0 ||
strcmp(element_name, TAG_NAMES_FILE) == 0 ||
strcmp(element_name, TAG_PLAYER) == 0)
@ -172,8 +172,8 @@ xml_team_read_text (GMarkupParseContext *context,
}
else if(state == STATE_SYMBOL)
g_string_printf(team->symbol, "%s", buf);
else if(state == STATE_AVERAGE_SKILL && opt_int("int_opt_load_defs") == 1)
average_skill = int_value;
else if(state == STATE_AVERAGE_TALENT && opt_int("int_opt_load_defs") == 1)
average_talent = int_value;
else if(state == STATE_FORMATION)
team->structure = int_value;
else if(state == STATE_PLAYER_NAME)
@ -229,6 +229,6 @@ xml_team_read(Team *tm, const gchar *def_file)
misc_print_error(&error, TRUE);
}
team_complete_def(tm, ((gfloat)average_skill / 10000) *
team_complete_def(tm, ((gfloat)average_talent / 10000) *
const_float("float_player_max_skill"));
}

View File

@ -48,8 +48,8 @@ youth_academy_add_new_player(YouthAcademy *youth_academy)
const_float("float_youth_academy_pos_midfielder"),
const_float("float_youth_academy_pos_forward")};
gfloat rndom;
gfloat av_skill = team_get_average_skill(youth_academy->tm, FALSE);
gfloat percentage_coach_skill_factor;
gfloat av_talent = team_get_average_talent(youth_academy->tm);
gfloat percentage_coach_talent_factor;
Player new;
new.name = name_get(youth_academy->tm->names_file->str);
@ -84,35 +84,33 @@ youth_academy_add_new_player(YouthAcademy *youth_academy)
(new.pos == PLAYER_POS_GOALIE) *
const_float("float_player_peak_age_goalie_addition"));
/* Argument for the skill factor function, depending on average coach and
/* Argument for the talent factor function, depending on average coach and
percentage values (weighted). */
percentage_coach_skill_factor = (4 - youth_academy->av_coach) *
percentage_coach_talent_factor = (4 - youth_academy->av_coach) *
(gfloat)const_int("int_youth_academy_max_percentage") *
const_float("float_youth_academy_coach_weight") * 0.25 + youth_academy->av_percentage;
const_float("float_youth_academy_coach_weight") * 0.25 +
youth_academy->av_percentage;
/* Applying the skill factor funtion leading to a factor between
float_youth_academy_skill_factor_lower and _upper */
percentage_coach_skill_factor =
((const_float("float_youth_academy_skill_factor_upper") -
const_float("float_youth_academy_skill_factor_lower")) /
/* Applying the talent factor funtion leading to a factor between
float_youth_academy_talent_factor_lower and _upper */
percentage_coach_talent_factor =
((const_float("float_youth_academy_talent_factor_upper") -
const_float("float_youth_academy_talent_factor_lower")) /
((gfloat)const_int("int_youth_academy_max_percentage") *
(1 + const_float("float_youth_academy_coach_weight")))) *
percentage_coach_skill_factor + const_float("float_youth_academy_skill_factor_lower");
percentage_coach_talent_factor +
const_float("float_youth_academy_talent_factor_lower");
new.skill = math_gauss_dist(
percentage_coach_skill_factor * av_skill * (1 - const_float("float_youth_academy_skill_variance")),
percentage_coach_skill_factor * av_skill * (1 + const_float("float_youth_academy_skill_variance")));
new.talent = math_gauss_dist(
percentage_coach_talent_factor * av_talent *
(1 - const_float("float_youth_academy_talent_variance")),
percentage_coach_talent_factor * av_talent *
(1 + const_float("float_youth_academy_talent_variance")));
new.skill = CLAMP(new.skill, 0, const_float("float_player_max_skill"));
new.talent = player_new_talent(new.skill);
player_estimate_talent(&new);
/* Reduce skill depending on age. */
new.skill *= powf(const_float("float_youth_academy_skill_reduce_factor"),
new.peak_age - new.age);
new.skill = CLAMP(new.skill, 0, const_float("float_player_max_skill"));
new.talent = CLAMP(new.talent, 0, const_float("float_player_max_skill"));
new.skill = player_skill_from_talent(&new);
new.cskill = new.skill;
player_estimate_talent(&new);
new.fitness = math_rnd(const_float("float_player_fitness_lower"),
const_float("float_player_fitness_upper"));
@ -132,6 +130,9 @@ youth_academy_add_new_player(YouthAcademy *youth_academy)
new.team = youth_academy->tm;
new.participation = FALSE;
new.offers = 0;
new.streak = PLAYER_STREAK_NONE;
new.streak_count = new.streak_prob = 0;
g_array_append_val(youth_academy->players, new);
}

View File

@ -213,3 +213,11 @@ string_treeview_helper_user_history_symbol_champion_icon champion.png
string_treeview_table_up_icon table_up.png
string_treeview_table_down_icon table_down.png
string_treeview_table_stay_icon table_stay.png
# player status icons
string_treeview_helper_player_status_hot_streak player_status_hot.png
string_treeview_helper_player_status_cold_streak player_status_cold.png
string_treeview_helper_player_status_injury player_status_injury.png
string_treeview_helper_player_status_ban player_status_ban.png
string_treeview_helper_player_status_ok
string_treeview_helper_player_status_yellow_danger player_status_yellow.png

View File

@ -767,22 +767,18 @@ float_youth_academy_youth_counter_upper 2500000
float_youth_academy_age_lower 1550000
float_youth_academy_age_upper 1750000
# skill reduce factor (exponent is
# peak_age - age)
float_youth_academy_skill_reduce_factor 98800
# weight of the coach for the average skill
# weight of the coach for the average talent
# between 0 and 1
float_youth_academy_coach_weight 25000
# upper and lower factor values for average skill
# upper and lower factor values for average talent
# (actual value depends on coach and percentage)
float_youth_academy_skill_factor_lower 67000
float_youth_academy_skill_factor_upper 105000
float_youth_academy_talent_factor_lower 67000
float_youth_academy_talent_factor_upper 105000
# youth skill variance (to have random
# skills, not always the same)
float_youth_academy_skill_variance 15000
# youth talent variance (to have random
# talents, not always the same)
float_youth_academy_talent_variance 15000
# probabilities for the different positions
# cumulative listing, adding up to 1
@ -822,3 +818,56 @@ float_youth_lsu_addition_match 150000
# how many youths there may be at most in the YA
int_youth_academy_max_youths 10
# influence of various events on the streak
# probabililty
float_player_streak_add_startup 5000
float_player_streak_add_no_startup -3000
float_player_streak_add_sub_in 3000
float_player_streak_add_sub_out -2000
float_player_streak_add_goal 12000
float_player_streak_add_own_goal -15000
float_player_streak_add_assist 5000
float_player_streak_add_win 4000
float_player_streak_add_loss -4000
float_player_streak_add_goalie_save 2000
float_player_streak_add_goalie_goal -3000
float_player_streak_add_goalie_clean 6000
float_player_streak_add_injury -18000
float_player_streak_add_sendoff -12000
# influence of the streak on player values
# in percent
float_player_streak_influence_skill 7000
float_player_streak_influence_fitness_decrease -20000
float_player_streak_influence_fitness_increase 20000
# how many weeks there mustn't be an new streak
int_player_streak_count_lower 3
int_player_streak_count_upper 6
# parameters (linear function) that determine how
# fast the streak count decreases depending on the
# current streak prob
float_player_streak_count_decrease_factor 75000
float_player_streak_count_decrease_add 100000
# upper and lower bounds for streak lock length
# (ie. how many weeks a player may not go on a new
# streak)
int_player_streak_lock_length_lower 3
int_player_streak_lock_length_upper 6
# upper and lower bounds for streak length
float_player_streak_length_lower 150000
float_player_streak_length_upper 400000
# the two values determining the probability
# that a player goes on a streak
# maximum probabililty (when the player's streak_prob
# is 1 or -1)
float_player_streak_prob_max 40000
# probability at streak_prob=0 (this is >0 because
# the streak_prob is between -1 and 1, not 0 and 1)
float_player_streak_prob_zero 5000

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B