Live game development.

This commit is contained in:
gyboth 2005-03-13 15:46:15 +00:00
parent 855112a384
commit 4dd1f7b08b
21 changed files with 874 additions and 489 deletions

View File

@ -29,7 +29,10 @@ callback_show_next_live_game(void)
if(g_array_index(lig(i).fixtures, Fixture, j).week_number == week &&
g_array_index(lig(i).fixtures, Fixture, j).week_round_number == week_round &&
fixture_user_team_involved(&g_array_index(lig(i).fixtures, Fixture, j)) != -1 &&
g_array_index(lig(i).fixtures, Fixture, j).attendance == -1)
g_array_index(lig(i).fixtures, Fixture, j).attendance == -1 &&
option_int("int_opt_user_show_live_game",
usr(fixture_user_team_involved(&g_array_index(lig(i).fixtures, Fixture, j))).
options))
{
live_game_calculate_fixture(&g_array_index(lig(i).fixtures, Fixture, j));
return;
@ -54,6 +57,9 @@ callback_show_next_live_game(void)
/* no more user games to show: end round. */
end_week_round();
stat0 = STATUS_MAIN;
/*d*/
game_gui_show_main();
}
/** Handle a click on the player list.
@ -76,9 +82,11 @@ callback_player_clicked(gint idx, GdkEventButton *event)
player_swap(usr(current_user).tm, selected_row[0],
usr(current_user).tm, idx);
if(opt_user_int("int_opt_user_swap_adapts") == 1)
if(opt_user_int("int_opt_user_swap_adapts") == 1 &&
usr(current_user).tm->structure !=
team_find_appropriate_structure(usr(current_user).tm))
{
team_change_structure(usr(current_user).tm,
team_change_structure(usr(current_user).tm,
team_find_appropriate_structure(usr(current_user).tm));
team_rearrange(usr(current_user).tm);
}

View File

@ -168,7 +168,7 @@ on_player_list1_button_press_event (GtkWidget *widget,
treeview_select_row(GTK_TREE_VIEW(widget), event);
idx = treeview_get_index(GTK_TREE_VIEW(widget), 0);
if(idx < 0)
if(idx < 0 || idx - 1 == selected_row[0])
{
selected_row[0] = -1;
return FALSE;
@ -649,10 +649,10 @@ on_eventbox_style_button_press_event (GtkWidget *widget,
if(event->type != GDK_BUTTON_PRESS)
return FALSE;
if(event->button == 1)
if(event->button == 3)
new_style = (usr(current_user).tm->style != 2) ?
usr(current_user).tm->style + 1 : -2;
else if(event->button == 3)
else if(event->button == 1)
new_style = (usr(current_user).tm->style != -2) ?
usr(current_user).tm->style - 1 : 2;
else
@ -677,10 +677,10 @@ on_eventbox_boost_button_press_event (GtkWidget *widget,
if(event->type != GDK_BUTTON_PRESS)
return FALSE;
if(event->button == 1)
if(event->button == 3)
new_boost = (usr(current_user).tm->boost != 1) ?
usr(current_user).tm->boost + 1 : -1;
else if(event->button == 3)
else if(event->button == 1)
new_boost = (usr(current_user).tm->boost != -1) ?
usr(current_user).tm->boost - 1 : 1;
else

View File

@ -6,6 +6,7 @@
#include "misc.h"
#include "option.h"
#include "player.h"
#include "table.h"
#include "team.h"
#include "treeview.h"
#include "user.h"
@ -55,12 +56,16 @@ game_get_values(const Fixture *fix, gfloat team_values[][GAME_TEAM_VALUE_END],
((1 + style_factor) * (1 + home_advantage * (i == 0)) *
(1 + const_float("float_player_boost_skill_effect") * tm[i]->boost));
/* printf("%s attack %.1f midf %.1f defend %.1f style %d struct %d\n", */
/* tm[i]->name->str, */
/* team_values[i][GAME_TEAM_VALUE_ATTACK], */
/* team_values[i][GAME_TEAM_VALUE_MIDFIELD], */
/* team_values[i][GAME_TEAM_VALUE_DEFEND], */
/* tm[i]->style, tm[i]->structure); */
if(fixture_user_team_involved(fix) != -1)
{
printf("week %d %d\n", week, week_round);
printf("%s attack %.1f midf %.1f defend %.1f style %d struct %d\n",
tm[i]->name->str,
team_values[i][GAME_TEAM_VALUE_ATTACK],
team_values[i][GAME_TEAM_VALUE_MIDFIELD],
team_values[i][GAME_TEAM_VALUE_DEFEND],
tm[i]->style, tm[i]->structure);
}
}
}
@ -170,17 +175,13 @@ game_get_player_probs(GArray *players, gfloat *probs, gfloat *weights, gboolean
{
gint i;
probs[0] = (skills) ? (gfloat)g_array_index(players, Player, 1).cskill *
powf((gfloat)g_array_index(players, Player, 1).fitness,
const_float("float_player_fitness_exponent")) *
probs[0] = (skills) ? player_get_game_skill(&g_array_index(players, Player, 1), FALSE) *
weights[g_array_index(players, Player, 1).pos - 1] :
weights[g_array_index(players, Player, 1).pos - 1] *
(g_array_index(players, Player, 1).cskill != 0);
for(i=1;i<10;i++)
probs[i] = probs[i - 1] +
((skills) ? (gfloat)g_array_index(players, Player, i + 1).cskill *
powf((gfloat)g_array_index(players, Player, i + 1).fitness,
const_float("float_player_fitness_exponent")) *
((skills) ? player_get_game_skill(&g_array_index(players, Player, i + 1), FALSE) *
weights[g_array_index(players, Player, i + 1).pos - 1] :
weights[g_array_index(players, Player, i + 1).pos - 1] *
(g_array_index(players, Player, i + 1).cskill != 0));
@ -232,14 +233,20 @@ game_initialize(Fixture *fix)
fix->attendance = 1000;
for(i=0;i<2;i++)
for(j=0;j<11;j++)
for(j=0;j<fix->teams[i]->players->len;j++)
{
if(player_of(fix->teams[i], j)->cskill > 0)
game_player_increase(fix->clid, player_of(fix->teams[i], j),
GAME_PLAYER_INCREASE_GAMES);
if(player_card_get(player_of(fix->teams[i], j), fix->clid, PLAYER_CARD_RED) > 0)
player_card_set(player_of(fix->teams[i], j), fix->clid, PLAYER_CARD_RED, -1, TRUE);
if(j < 11)
{
if(player_of(fix->teams[i], j)->cskill > 0)
player_games_goals_set(player_of(fix->teams[i], j), fix->clid,
PLAYER_VALUE_GAMES, 1, TRUE);
if(player_card_get(player_of(fix->teams[i], j), fix->clid, PLAYER_VALUE_CARD_RED) > 0)
player_card_set(player_of(fix->teams[i], j), fix->clid, PLAYER_VALUE_CARD_RED, -1, TRUE);
}
player_of(fix->teams[i], j)->participation =
(j < 11 && player_of(fix->teams[i], j)->cskill > 0);
}
}
@ -327,38 +334,6 @@ game_get_subs(gint team_number, gint *subs_in, gint *subs_out)
}
}
/** Increase the number of shots in the player struct.
@param fix The game being played.
@param team The team index.
@param player_id The player id. */
void
game_player_increase(gint clid, Player *pl, gint type)
{
gint i;
PlayerGamesGoals new;
for(i=0;i<pl->games_goals->len;i++)
if(g_array_index(pl->games_goals, PlayerGamesGoals, i).clid == clid)
{
if(type == GAME_PLAYER_INCREASE_SHOTS)
g_array_index(pl->games_goals, PlayerGamesGoals, i).shots++;
else if(type == GAME_PLAYER_INCREASE_GOALS)
g_array_index(pl->games_goals, PlayerGamesGoals, i).goals++;
else if(type == GAME_PLAYER_INCREASE_GAMES)
g_array_index(pl->games_goals, PlayerGamesGoals, i).games++;
return;
}
/* Entry not found, we create a new one. */
new.clid = clid;
new.shots = new.goals = new.games = 0;
g_array_append_val(pl->games_goals, new);
game_player_increase(clid, pl, type);
}
/** Choose an injury for a player and adjust health values.
@param pl The player that gets injured. */
void
@ -486,6 +461,7 @@ game_substitute_player(Team *tm, gint player_number)
((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));
@ -640,10 +616,9 @@ game_decrease_fitness(const Fixture *fix)
for(i=0;i<2;i++)
{
if(team_is_user(fix->teams[i]) != -1)
for(j=0;j<11;j++)
if(player_of(fix->teams[i], j)->cskill > 0)
player_decrease_fitness(player_of(fix->teams[i], j));
for(j=0;j<11;j++)
if(player_of(fix->teams[i], j)->cskill > 0)
player_decrease_fitness(player_of(fix->teams[i], j));
}
}
@ -984,3 +959,22 @@ game_update_stats_player(gpointer live_game, gconstpointer live_game_unit)
}
}
}
/** Make some team updates after a match.
@param fix The match we examine. */
void
game_post_match(Fixture *fix)
{
gint i;
if(query_fixture_has_tables(fix))
table_update(fix);
for(i=0;i<2;i++)
{
if(team_is_user(fix->teams[i]) == -1)
team_update_cpu_team(fix->teams[i]);
else
team_update_post_match(fix->teams[i]);
}
}

View File

@ -26,16 +26,6 @@ enum GamePlayerType
GAME_PLAYER_TYPE_END
};
/** @see game_player_increase() */
enum GamePlayerIncreaseType
{
GAME_PLAYER_INCREASE_SHOTS = 0,
GAME_PLAYER_INCREASE_GOALS,
GAME_PLAYER_INCREASE_GAMES,
GAME_PLAYER_INCREASE_YELLOW,
GAME_PLAYER_INCREASE_END
};
void
game_get_values(const Fixture *fix, gfloat team_values[][GAME_TEAM_VALUE_END],
gfloat home_advantage);
@ -69,9 +59,6 @@ game_get_subs(gint team_number, gint *subs_in, gint *subs_out);
gint
game_substitute_player(Team *tm, gint player_number);
void
game_player_increase(gint clid, Player *pl, gint type);
void
game_player_injury(Player *pl);
@ -102,4 +89,7 @@ game_update_stats(gpointer live_game, gconstpointer live_game_unit);
void
game_update_stats_player(gpointer live_game, gconstpointer live_game_unit);
void
game_post_match(Fixture *fix);
#endif

View File

@ -64,9 +64,13 @@ game_gui_live_game_show_unit(const LiveGameUnit *unit)
{
gtk_widget_set_sensitive(lookup_widget(window.live, "button_live_close"), TRUE);
gtk_widget_hide(lookup_widget(window.live, "button_pause"));
gtk_widget_hide(lookup_widget(window.live, "button_resume"));
}
else if(unit->event.type == LIVE_GAME_EVENT_PENALTIES)
{
gtk_widget_hide(lookup_widget(window.live, "button_pause"));
gtk_widget_hide(lookup_widget(window.live, "button_resume"));
}
}
/** Set the area scale position and color in the live game window.

View File

@ -9,7 +9,6 @@
#include "option.h"
#include "player.h"
#include "support.h"
#include "table.h"
#include "team.h"
#include "treeview.h"
#include "user.h"
@ -57,13 +56,7 @@ live_game_calculate_fixture(Fixture *fix)
stat0 != STATUS_LIVE_GAME_PAUSE);
if(stat0 != STATUS_LIVE_GAME_PAUSE)
{
/* if(fixture_user_team_involved(fix) != -1) */
/* game_create_stats(match); */
if(query_fixture_has_tables(fix))
table_update(fix);
}
game_post_match(fix);
}
/** Create a game unit for the live game.
@ -309,7 +302,7 @@ live_game_event_foul(void)
}
else if(type == LIVE_GAME_EVENT_FOUL_YELLOW)
player_card_set(player_of_id(tm[foul_team], foul_player),
match->fix->clid, PLAYER_CARD_YELLOW, 1, TRUE);
match->fix->clid, PLAYER_VALUE_CARD_YELLOW, 1, TRUE);
if(last_unit.area == LIVE_GAME_UNIT_AREA_ATTACK && foul_team ==
last_unit.possession)
@ -389,8 +382,8 @@ live_game_event_injury(gint team, gint player, gboolean create_new)
last_unit.event.values[LIVE_GAME_EVENT_VALUE_PLAYER])->fitness =
MAX(0, player_of_id(tm[last_unit.event.values[LIVE_GAME_EVENT_VALUE_TEAM]],
last_unit.event.values[LIVE_GAME_EVENT_VALUE_PLAYER])->fitness -
math_rndi(const_int("int_live_game_temp_injury_fitness_decrease_lower"),
const_int("int_live_game_temp_injury_fitness_decrease_upper")));
math_rnd(const_float("float_live_game_temp_injury_fitness_decrease_lower"),
const_float("float_live_game_temp_injury_fitness_decrease_upper")));
}
live_game_finish_unit();
@ -756,9 +749,9 @@ live_game_event_send_off(gint team, gint player, gboolean second_yellow)
player_of_id(tm[team], player)->cskill = 0;
if(second_yellow)
player_card_set(player_of_id(tm[team], player), match->fix->clid, PLAYER_CARD_RED, 1, FALSE);
player_card_set(player_of_id(tm[team], player), match->fix->clid, PLAYER_VALUE_CARD_RED, 1, FALSE);
else
player_card_set(player_of_id(tm[team], player), match->fix->clid, PLAYER_CARD_RED,
player_card_set(player_of_id(tm[team], player), match->fix->clid, PLAYER_VALUE_CARD_RED,
game_player_get_ban_duration(), FALSE);
if(match->subs_left[team] > 0)
@ -818,8 +811,11 @@ live_game_event_substitution(gint team_number, gint sub_in, gint sub_out)
if(player_of_id(tm[team_number], sub_in)->cskill > 0)
game_player_increase(match->fix->clid, player_of_id(tm[team_number], sub_in),
GAME_PLAYER_INCREASE_GAMES);
{
player_games_goals_set(player_of_id(tm[team_number], sub_in),
match->fix->clid, PLAYER_VALUE_GAMES, 1, TRUE);
player_of_id(tm[team_number], sub_in)->participation = TRUE;
}
g_array_append_val(unis, new);
@ -871,10 +867,9 @@ live_game_event_duel(void)
attacker = player_of_id(tm[new.possession],
new.event.values[LIVE_GAME_EVENT_VALUE_PLAYER]);
goalie = player_of(tm[!new.possession], 0);
duel_factor = (((gfloat)attacker->cskill * powf((gfloat)attacker->fitness / 10000,
const_float("float_player_fitness_exponent"))) /
((gfloat)goalie->cskill * powf((gfloat)goalie->fitness / 10000,
const_float("float_player_fitness_exponent"))));
duel_factor = player_get_game_skill(attacker, FALSE) /
player_get_game_skill(goalie, FALSE);
res_idx1 = new.possession;
if(new.time == LIVE_GAME_UNIT_TIME_PENALTIES)
res_idx2 = 2;
@ -896,8 +891,8 @@ live_game_event_duel(void)
if(new.time != LIVE_GAME_UNIT_TIME_PENALTIES)
{
game_player_increase(match->fix->clid, attacker, GAME_PLAYER_INCREASE_SHOTS);
game_player_increase(match->fix->clid, goalie, GAME_PLAYER_INCREASE_SHOTS);
player_games_goals_set(attacker, match->fix->clid, PLAYER_VALUE_SHOTS, 1, TRUE);
player_games_goals_set(goalie, match->fix->clid, PLAYER_VALUE_SHOTS, 1, TRUE);
}
if(rndom < scoring_prob)
@ -908,8 +903,8 @@ live_game_event_duel(void)
if(new.time != LIVE_GAME_UNIT_TIME_PENALTIES)
{
game_player_increase(match->fix->clid, attacker, GAME_PLAYER_INCREASE_GOALS);
game_player_increase(match->fix->clid, goalie, GAME_PLAYER_INCREASE_GOALS);
player_games_goals_set(attacker, match->fix->clid, PLAYER_VALUE_GOALS, 1, TRUE);
player_games_goals_set(goalie, match->fix->clid, PLAYER_VALUE_GOALS, 1, TRUE);
}
}
else
@ -1429,6 +1424,8 @@ live_game_finish_unit(void)
fixture_user_team_involved(match->fix) != -1)
{
game_decrease_fitness(match->fix);
game_get_values(match->fix, match->team_values,
match->home_advantage);
if(stat2 == current_user && show &&
unit->minute % const_int("int_live_game_player_list_refresh") == 0)
treeview_show_user_player_list(&usr(current_user), 1);
@ -1439,8 +1436,9 @@ live_game_finish_unit(void)
if(unit->time != LIVE_GAME_UNIT_TIME_PENALTIES)
{
game_update_stats(match, unit);
treeview_show_game_stats(GTK_TREE_VIEW(lookup_widget(window.live, "treeview_stats")),
match);
if(show)
treeview_show_game_stats(GTK_TREE_VIEW(lookup_widget(window.live, "treeview_stats")),
match);
}
live_game_generate_commentary(unit);
@ -1466,7 +1464,7 @@ live_game_injury_get_player(void)
for(j=0;j<2;j++)
{
fitness_factor = (player_of(tm[j], 0)->fitness < 0.025) ?
40 : 1 / ((gfloat)player_of(tm[j], 0)->fitness / 10000);
40 : 1 / player_of(tm[j], 0)->fitness;
probs[j * 11] = goalie_factor * fitness_factor *
(player_of(tm[j], 0)->cskill != 0) * (1 + tm[j]->boost * boost_factor);
if(j == 1)
@ -1518,7 +1516,7 @@ live_game_resume(void)
{
usr(stat2).live_game.subs_left[i]--;
live_game_event_substitution(i, subs_in[j], subs_out[j]);
}
}
}
if(tm[i]->structure != usr(stat2).live_game.team_state[i].structure)

View File

@ -51,7 +51,7 @@ option_float(gchar *name, GArray *option_array)
for(i=0;i<option_array->len;i++)
if(strcmp(g_array_index(option_array, Option, i).name->str, name) == 0)
return (gfloat)g_array_index(option_array, Option, i).value / 1000;
return (gfloat)g_array_index(option_array, Option, i).value / 10000;
g_warning("option_float: option named %s not found\n", name);

View File

@ -15,45 +15,56 @@
The player's skill can deviate from this value by #CONSTANT_PLAYER_AVERAGE_SKILL_VARIANCE %
@return A newly created player. */
Player
player_new(Team *tm, gint average_skill)
player_new(Team *tm, gfloat average_skill)
{
gfloat skill_factor =
math_rnd(1 - const_float("float_player_average_skill_variance"),
1 + const_float("float_player_average_skill_variance"));
Player new;
Player new;
new.name =
g_string_new(((GString*)g_ptr_array_index(player_names, math_rndi(0, player_names->len - 1)))->str);
new.id = player_new_id(tm->players);
new.pos = player_get_position_from_structure(tm->structure, tm->players->len);
new.cpos = new.pos;
new.skill = CLAMP((gint)rint((gfloat)average_skill * skill_factor), 0,
const_int("int_player_max_skill"));
new.cskill = new.skill;
new.age = math_gauss_disti(const_int("int_player_age_lower"),
const_int("int_player_age_upper"));
new.age = math_gauss_dist(const_float("float_player_age_lower"),
const_float("float_player_age_upper"));
new.peak_age =
math_rndi(const_int("int_player_peak_age_lower") +
(new.pos == PLAYER_POS_GOALIE) *
const_int("int_player_peak_age_goalie_addition"),
const_int("int_player_peak_age_upper") +
(new.pos == PLAYER_POS_GOALIE) *
const_int("int_player_peak_age_goalie_addition"));
math_rnd(const_float("float_player_peak_age_lower") +
(new.pos == PLAYER_POS_GOALIE) *
const_float("float_player_peak_age_goalie_addition"),
const_float("float_player_peak_age_upper") +
(new.pos == PLAYER_POS_GOALIE) *
const_float("float_player_peak_age_goalie_addition"));
new.skill = CLAMP(average_skill * skill_factor, 0,
const_float("float_player_max_skill"));
new.talent = player_new_talent(new.skill);
player_estimate_talent(&new);
new.fitness = math_rndi(const_int("int_player_fitness_lower"),
const_int("int_player_fitness_upper"));
if(new.peak_age - new.age > const_float("float_player_peak_age_diff_younger1") ||
new.peak_age - new.age < const_float("float_player_peak_age_diff_older1"))
new.skill = new.skill * const_float("float_player_skill_reduction1");
else if(new.peak_age - new.age > const_float("float_player_peak_age_diff_younger2") ||
new.peak_age - new.age < const_float("float_player_peak_age_diff_peak_older"))
new.skill = new.skill * const_float("float_player_skill_reduction2");
new.cskill = new.skill;
new.fitness = math_rnd(const_float("float_player_fitness_lower"),
const_float("float_player_fitness_upper"));
new.health = new.recovery = 0;
new.games_goals = g_array_new(FALSE, FALSE, sizeof(PlayerGamesGoals));
new.value = player_assign_value(&new);
new.wage = player_assign_wage(&new);
new.contract = math_rndi(const_int("int_player_contract_lower"),
const_int("int_player_contract_upper"));
new.lsu = math_rndi(const_int("int_player_lsu_lower"),
const_int("int_player_lsu_upper"));
new.contract = math_rnd(const_float("float_player_contract_lower"),
const_float("float_player_contract_upper"));
new.lsu = math_rnd(const_float("float_player_lsu_lower"),
const_float("float_player_lsu_upper"));
new.cards = g_array_new(FALSE, FALSE, sizeof(PlayerCard));
new.team = tm;
new.participation = FALSE;
return new;
}
@ -113,11 +124,11 @@ player_get_position_from_structure(gint structure, gint player_number)
/** Calculate the talent value of the player based on his skill.
@param skill The player's skill.
@return The new talent value. */
gint
player_new_talent(gint skill)
gfloat
player_new_talent(gfloat skill)
{
gint talent = math_gauss_disti(2 * skill - const_int("int_player_max_skill"),
const_int("int_player_max_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;
@ -130,22 +141,22 @@ void
player_estimate_talent(Player *pl)
{
gint i, j;
gint scout_deviance[QUALITY_END];
gfloat scout_deviance[QUALITY_END];
/* the maximal deviance in both directions */
gint deviance_bound[2] =
{pl->talent - pl->skill, const_int("int_player_max_skill") - pl->talent};
gfloat deviance_bound[2] =
{pl->talent - pl->skill, const_float("float_player_max_skill") - pl->talent};
for(i=0;i<QUALITY_END;i++)
{
scout_deviance[i] = (i + 1) * const_int("int_player_etal_scout_factor");
scout_deviance[i] = (i + 1) * const_float("float_player_etal_scout_factor");
/* adjust deviance_bounds with regard to the scout's
deviance */
for(j=0;j<2;j++)
deviance_bound[j] = MIN(deviance_bound[j], scout_deviance[i]);
pl->etal[i] = math_rndi(pl->talent - deviance_bound[0],
pl->talent + deviance_bound[1]);
pl->etal[i] = math_rnd(pl->talent - deviance_bound[0],
pl->talent + deviance_bound[1]);
}
}
@ -157,21 +168,21 @@ gint
player_assign_value(const Player *pl)
{
gint value;
gfloat diff = pl->peak_age - pl->age;
value = (gint)powf((const_float("float_player_value_skill_weight") *
(gfloat)pl->skill +
(1 - const_float("float_player_value_skill_weight")) *
(gfloat)pl->talent * 0.7),
value = (gint)powf((const_float("float_player_value_skill_weight") * pl->skill +
(1 - const_float("float_player_value_skill_weight")) * pl->talent * 0.7),
const_float("float_player_value_power"));
if(pl->age <= const_int("int_player_age_lower") + 2 * 52)
value = (gint)((gfloat)value * 1.05);
else if(pl->age <= const_int("int_player_age_lower") + 4 * 52)
value = (gint)((gfloat)value * 1.1);
else if(pl->age >= const_int("int_player_age_upper") - 4 * 52)
value = (gint)((gfloat)value * 0.95);
else if(pl->age >= const_int("int_player_age_upper") - 2 * 52)
value = (gint)((gfloat)value * 0.9);
/*todooooo*/
if(diff > const_float("float_player_peak_age_diff_older1"))
value = (gint)rint((gfloat)value * (1 - const_float("float_player_value_scale1")));
else if(diff > const_float("float_player_peak_age_diff_peak_older"))
value = (gint)rint((gfloat)value * (1 - const_float("float_player_value_scale2")));
else if(diff < const_float("float_player_peak_age_diff_younger1"))
value = (gint)rint((gfloat)value * (1 + const_float("float_player_value_scale1")));
else if(diff < const_float("float_player_peak_age_diff_younger2"))
value = (gint)rint((gfloat)value * (1 + const_float("float_player_value_scale2")));
value = math_round_integer(value, 2);
@ -228,7 +239,7 @@ player_copy(const Player *source, Player *dest)
void
player_append_to_array(const Player *pl, Team *tm)
{
Player new_player = player_new(tm, const_int("int_player_max_skill"));
Player new_player = player_new(tm, const_float("float_player_max_skill"));
player_copy(pl, &new_player);
@ -339,11 +350,11 @@ player_all_games_goals(const Player *pl, gint type)
gint i, sum = 0;
for(i=0;i<pl->games_goals->len;i++)
if(type == PLAYER_LIST_ATTRIBUTE_GOALS)
if(type == PLAYER_VALUE_GOALS)
sum += g_array_index(pl->games_goals, PlayerGamesGoals, i).goals;
else if(type == PLAYER_LIST_ATTRIBUTE_GAMES)
else if(type == PLAYER_VALUE_GAMES)
sum += g_array_index(pl->games_goals, PlayerGamesGoals, i).games;
else if(type == PLAYER_LIST_ATTRIBUTE_SHOTS)
else if(type == PLAYER_VALUE_SHOTS)
sum += g_array_index(pl->games_goals, PlayerGamesGoals, i).shots;
return sum;
@ -397,9 +408,10 @@ player_compare_func(gconstpointer a, gconstpointer b, gpointer data)
else if(pl2->pos != pl1->pos)
return_value = misc_int_compare(pl2->pos, pl1->pos);
else
return_value =
misc_float_compare(player_get_game_skill(pl1, TRUE),
player_get_game_skill(pl2, TRUE));
return_value = 0;
/* return_value = */
/* misc_float_compare(player_get_game_skill(pl1, TRUE), */
/* player_get_game_skill(pl2, TRUE)); */
}
return return_value;
@ -418,14 +430,12 @@ player_compare_substitute_func(gconstpointer a, gconstpointer b, gpointer data)
const Player *pl1 = *(const Player**)a;
const Player *pl2 = *(const Player**)b;
gint position = GPOINTER_TO_INT(data);
gint skill_for_pos1 = (gint)rint((gfloat)player_get_cskill(pl1, position) *
powf((gfloat)pl1->fitness / 10000,
const_float("float_player_fitness_impact_on_skill"))),
skill_for_pos2 = (gint)rint((gfloat)player_get_cskill(pl2, position) *
powf((gfloat)pl2->fitness / 10000,
const_float("float_player_fitness_impact_on_skill")));
gint game_skill1 = (gint)rint(player_get_game_skill(pl1, FALSE)),
game_skill2 = (gint)rint(player_get_game_skill(pl2, FALSE));
gfloat skill_for_pos1 = player_get_cskill(pl1, position) *
powf(pl1->fitness, const_float("float_player_fitness_exponent")),
skill_for_pos2 = player_get_cskill(pl2, position) *
powf(pl2->fitness, const_float("float_player_fitness_exponent"));
gfloat game_skill1 = player_get_game_skill(pl1, FALSE),
game_skill2 = player_get_game_skill(pl2, FALSE);
gboolean good_structure1 =
player_substitution_good_structure(pl1->team->structure, position, pl1->pos),
good_structure2 =
@ -434,7 +444,7 @@ player_compare_substitute_func(gconstpointer a, gconstpointer b, gpointer data)
if(pl1->pos == position && pl2->pos == position)
return_value =
misc_int_compare(game_skill1, game_skill2);
misc_float_compare(game_skill1, game_skill2);
else if(pl1->pos == position)
return_value = -1;
else if(pl2->pos == position)
@ -443,20 +453,20 @@ player_compare_substitute_func(gconstpointer a, gconstpointer b, gpointer data)
{
if(good_structure1 && good_structure2)
return_value =
misc_int_compare(game_skill1, game_skill2);
misc_float_compare(game_skill1, game_skill2);
else if(good_structure1)
return_value =
misc_int_compare(game_skill1, skill_for_pos2);
misc_float_compare(game_skill1, skill_for_pos2);
else if(good_structure2)
return_value =
misc_int_compare(skill_for_pos1, game_skill2);
misc_float_compare(skill_for_pos1, game_skill2);
else
return_value =
misc_int_compare(skill_for_pos1, skill_for_pos2);
misc_float_compare(skill_for_pos1, skill_for_pos2);
}
else
return_value =
misc_int_compare(skill_for_pos1, skill_for_pos2);
misc_float_compare(skill_for_pos1, skill_for_pos2);
/* printf("%s %d %s %d %d\n", pl1->name->str, pl1->pos, pl2->name->str, */
/* pl2->pos, return_value); */
@ -547,7 +557,7 @@ player_swap(Team *tm1, gint player_number1, Team *tm2, gint player_number2)
@param pl The player we examine.
@param position The position we's like to put the player.
@return A new cskill. */
gint
gfloat
player_get_cskill(const Player *pl, gint position)
{
gfloat cskill_factor;
@ -566,7 +576,7 @@ player_get_cskill(const Player *pl, gint position)
else
cskill_factor = 0.75;
return MIN((gint)rint((gfloat)pl->talent * cskill_factor), pl->skill);
return MIN(pl->talent * cskill_factor, pl->skill);
}
else
return pl->skill;
@ -581,9 +591,8 @@ player_get_cskill(const Player *pl, gint position)
gint
player_is_banned(const Player *pl)
{
gint i;
Fixture *fix = team_get_next_fixture(pl->team);
gint yellow_red, yellow, red;
gint yellow_red = -1, yellow, red;
if(fix == NULL)
return 0;
@ -593,8 +602,8 @@ player_is_banned(const Player *pl)
else
yellow_red = cup_from_clid(fix->clid)->yellow_red;
yellow = player_card_get(pl, fix->clid, PLAYER_CARD_YELLOW);
red = player_card_get(pl, fix->clid, PLAYER_CARD_RED);
yellow = player_card_get(pl, fix->clid, PLAYER_VALUE_CARD_YELLOW);
red = player_card_get(pl, fix->clid, PLAYER_VALUE_CARD_RED);
if(red > 0)
return red;
@ -613,11 +622,9 @@ gfloat
player_get_game_skill(const Player *pl, gboolean skill)
{
if(skill)
return (gfloat)pl->skill * powf((gfloat)pl->fitness / 10000,
const_float("float_player_fitness_impact_on_skill"));
return pl->skill * powf(pl->fitness, const_float("float_player_fitness_exponent"));
return (gfloat)pl->cskill * powf((gfloat)pl->fitness / 10000,
const_float("float_player_fitness_impact_on_skill"));
return pl->cskill * powf(pl->fitness, const_float("float_player_fitness_exponent"));
}
/** Decrease a player's fitness during a match.
@ -625,37 +632,80 @@ player_get_game_skill(const Player *pl, gboolean skill)
void
player_decrease_fitness(Player *pl)
{
gint i, reduction;
gint age_limits[7] =
{const_int("int_player_fitness_decrease_peak_age_diff1"),
const_int("int_player_fitness_decrease_peak_age_diff2"),
const_int("int_player_fitness_decrease_peak_age_diff3"),
const_int("int_player_fitness_decrease_peak_age_diff4"),
const_int("int_player_fitness_decrease_peak_age_diff5"),
const_int("int_player_fitness_decrease_peak_age_diff6"),
const_int("int_player_fitness_decrease_peak_age_diff7")};
gint reduce[8] =
{const_int("int_player_fitness_decrease_minus1"),
const_int("int_player_fitness_decrease_minus2"),
const_int("int_player_fitness_decrease_minus3"),
const_int("int_player_fitness_decrease_minus4"),
const_int("int_player_fitness_decrease_minus5"),
const_int("int_player_fitness_decrease_minus6"),
const_int("int_player_fitness_decrease_minus7"),
const_int("int_player_fitness_decrease_minus_else")};
gint i;
gint age_limits[7] = {const_float("float_player_peak_age_diff_younger1"),
const_float("float_player_peak_age_diff_younger2"),
const_float("float_player_peak_age_diff_younger3"),
const_float("float_player_peak_age_diff_peak_younger"),
const_float("float_player_peak_age_diff_peak_older"),
const_float("float_player_peak_age_diff_older1"),
const_float("float_player_peak_age_diff_older2")};
gfloat reduce[8] =
{const_float("float_player_fitness_decrease_younger1"),
const_float("float_player_fitness_decrease_younger2"),
const_float("float_player_fitness_decrease_younger3"),
const_float("float_player_fitness_decrease_peak_younger"),
const_float("float_player_fitness_decrease_peak_older"),
const_float("float_player_fitness_decrease_older1"),
const_float("float_player_fitness_decrease_older2"),
const_float("float_player_fitness_decrease_else")};
gint diff = pl->peak_age - pl->age;
gfloat diff = pl->peak_age - pl->age;
gfloat reduction;
for(i=0;i<7;i++)
if(diff > age_limits[i])
break;
reduction = (gint)rint((gfloat)reduce[i] *
(1 + pl->team->boost * const_float("float_player_boost_fitness_effect")));
reduction = reduce[i] * (1 + (gfloat)pl->team->boost * const_float("float_player_boost_fitness_effect")) *
(1 - (pl->cpos == 0) * const_float("float_player_fitness_decrease_factor_goalie"));
pl->fitness = MAX(0, pl->fitness - reduction);
}
/** Increase of player fitness after a match.
Depends on the decrease values and the
percentage values that determine how much of the
decrease a player gains.
@param pl The player we edit. */
void
player_update_fitness(Player *pl)
{
gint i;
gint age_limits[7] = {const_float("float_player_peak_age_diff_younger1"),
const_float("float_player_peak_age_diff_younger2"),
const_float("float_player_peak_age_diff_younger3"),
const_float("float_player_peak_age_diff_peak_younger"),
const_float("float_player_peak_age_diff_peak_older"),
const_float("float_player_peak_age_diff_older1"),
const_float("float_player_peak_age_diff_older2")};
gfloat increase_base[8] =
{const_float("float_player_fitness_increase_younger1"),
const_float("float_player_fitness_increase_younger2"),
const_float("float_player_fitness_increase_younger3"),
const_float("float_player_fitness_increase_peak_younger"),
const_float("float_player_fitness_increase_peak_older"),
const_float("float_player_fitness_increase_older1"),
const_float("float_player_fitness_increase_older2"),
const_float("float_player_fitness_increase_else")};
gfloat diff = pl->peak_age - pl->age;
gfloat increase = -1;
if(pl->participation)
return;
for(i=0;i<7;i++)
if(diff > age_limits[i])
break;
increase = math_rnd(increase_base[i] - const_float("float_player_fitness_increase_variance"),
increase_base[i] + const_float("float_player_fitness_increase_variance"));
pl->fitness = MIN(pl->fitness + increase, 1);
}
/** Return the number of yellow cards of a player
or the number of weeks banned.
@param pl The player.
@ -665,12 +715,12 @@ gint
player_card_get(const Player *pl, gint clid, gint card_type)
{
gint i;
gint return_value = -1;
gint return_value = 0;
for(i=0;i<pl->cards->len;i++)
if(g_array_index(pl->cards, PlayerCard, i).clid == clid)
{
if(card_type == PLAYER_CARD_YELLOW)
if(card_type == PLAYER_VALUE_CARD_YELLOW)
return_value = g_array_index(pl->cards, PlayerCard, i).yellow;
else
return_value = g_array_index(pl->cards, PlayerCard, i).red;
@ -691,15 +741,15 @@ player_card_get(const Player *pl, gint clid, gint card_type)
void
player_card_set(Player *pl, gint clid, gint card_type, gint value, gboolean diff)
{
gint i, *card_value;
gint i, *card_value = NULL;
PlayerCard new;
for(i=0;i<pl->cards->len;i++)
if(g_array_index(pl->cards, PlayerCard, i).clid == clid)
{
if(card_type == PLAYER_CARD_YELLOW)
if(card_type == PLAYER_VALUE_CARD_YELLOW)
card_value = &g_array_index(pl->cards, PlayerCard, i).yellow;
else
else if(card_type == PLAYER_VALUE_CARD_RED)
card_value = &g_array_index(pl->cards, PlayerCard, i).red;
if(diff)
@ -723,3 +773,176 @@ player_card_set(Player *pl, gint clid, gint card_type, gint value, gboolean diff
player_card_set(pl, clid, card_type, value, diff);
}
/** Return the number of games or goals.
@param pl The player.
@param clid The cup or league id.
@param card_type Whether games or goals cards. */
gint
player_games_goals_get(const Player *pl, gint clid, gint type)
{
gint i, return_value = 0;
for(i=0;i<pl->games_goals->len;i++)
if(g_array_index(pl->games_goals, PlayerGamesGoals, i).clid == clid)
{
if(type == PLAYER_VALUE_GAMES)
return_value = g_array_index(pl->games_goals, PlayerGamesGoals, i).games;
else if(type == PLAYER_VALUE_GOALS)
return_value = g_array_index(pl->games_goals, PlayerGamesGoals, i).goals;
else if(type == PLAYER_VALUE_SHOTS)
return_value = g_array_index(pl->games_goals, PlayerGamesGoals, i).shots;
}
return return_value;
}
/** Change a card value for the player.
@param pl The player.
@param clid The cup or league id.
@param type Whether games or goals or shots.
@param value The new value.
@param diff Whether we add the value to the old one or
replace the old value by the new one. */
void
player_games_goals_set(Player *pl, gint clid, gint type, gint value, gboolean diff)
{
gint i, *games_goals_value = NULL;
PlayerGamesGoals new;
for(i=0;i<pl->games_goals->len;i++)
if(g_array_index(pl->games_goals, PlayerGamesGoals, i).clid == clid)
{
if(type == PLAYER_VALUE_GAMES)
games_goals_value = &g_array_index(pl->games_goals, PlayerGamesGoals, i).games;
else if(type == PLAYER_VALUE_GOALS)
games_goals_value = &g_array_index(pl->games_goals, PlayerGamesGoals, i).goals;
else if(type == PLAYER_VALUE_SHOTS)
games_goals_value = &g_array_index(pl->games_goals, PlayerGamesGoals, i).shots;
if(diff)
*games_goals_value += value;
else
*games_goals_value = value;
if(*games_goals_value < 0)
{
g_warning("player_games_goals_set: negative value; setting to 0\n");
*games_goals_value = 0;
}
return;
}
new.clid = clid;
new.games = new.goals = new.shots = 0;
g_array_append_val(pl->games_goals, new);
player_games_goals_set(pl, clid, type, value, diff);
}
/** Update skill and lsu of a user player.
@param pl The player we update. */
void
player_update_skill(Player *pl)
{
gint i;
gint age_limits[7] =
{const_float("float_player_peak_age_diff_younger1"),
const_float("float_player_peak_age_diff_younger2"),
const_float("float_player_peak_age_diff_younger3"),
const_float("float_player_peak_age_diff_peak_younger"),
const_float("float_player_peak_age_diff_peak_older"),
const_float("float_player_peak_age_diff_older1"),
const_float("float_player_peak_age_diff_older2")};
gfloat factor_limits[3][2] =
{{const_float("float_player_skill_devel_younger1_lower"),
const_float("float_player_skill_devel_younger1_upper")},
{const_float("float_player_skill_devel_younger2_lower"),
const_float("float_player_skill_devel_younger2_upper")},
{const_float("float_player_skill_devel_younger3_lower"),
const_float("float_player_skill_devel_younger3_upper")}};
gint increase_decrease[4][2] =
{{const_float("float_player_skill_devel_peak_lower"),
const_float("float_player_skill_devel_peak_upper")},
{const_float("float_player_skill_devel_older1_lower"),
const_float("float_player_skill_devel_older1_upper")},
{const_float("float_player_skill_devel_older2_lower"),
const_float("float_player_skill_devel_older2_upper")},
{const_float("float_player_skill_devel_else_lower"),
const_float("float_player_skill_devel_else_upper")}};
gfloat diff;
if(pl->age > pl->peak_age)
pl->lsu += (pl->health == 0) ? 1 : const_float("float_player_lsu_injured_old");
else if(pl->health == 0 &&
((gfloat)player_games_goals_get(pl, pl->team->clid, PLAYER_VALUE_GAMES) / (gfloat)week >=
const_float("float_player_lsu_games_percentage") ||
math_rnd(0, 1) <= const_float("float_player_lsu_increase_prob")))
pl->lsu++;
if(pl->lsu < const_float("float_player_lsu_update_limit") ||
math_rnd(0, 1) < powf(const_float("float_player_lsu_update_base_prob"),
pl->lsu - const_float("float_player_lsu_update_limit")))
return;
pl->lsu = 0;
diff = pl->peak_age - pl->age;
for(i=0;i<7;i++)
if(diff > age_limits[i])
break;
if(i < 3)
pl->skill += (pl->talent - pl->skill) * math_rnd(factor_limits[i][0], factor_limits[i][1]);
else if(i < 5)
pl->skill += math_rnd(increase_decrease[0][0], increase_decrease[0][1]);
else if(i < 7)
pl->skill += math_rnd(increase_decrease[i - 4][0], increase_decrease[i - 4][1]);
else
pl->skill += math_rnd(increase_decrease[3][0], increase_decrease[3][1]);
pl->skill = CLAMP(pl->skill, 0, pl->talent);
pl->cskill = player_get_cskill(pl, pl->cpos);
}
/** Update players in user teams (age, skill, fitness etc.)
@param tm The team of the player.
@param idx The index in the players array. */
void
player_update_weekly(Team *tm, gint idx)
{
Player *pl = player_of(tm, idx);
pl->age += 0.0192;
pl->contract -= 0.0192;
if(pl->contract <= 0)
player_remove_contract(tm, idx);
player_update_skill(pl);
}
/** Remove a player from a user team after the contract expired.
@param tm The user team.
@param idx The player index. */
void
player_remove_contract(Team *tm, gint idx)
{
/*todo: add event*/
free_player(player_of(tm, idx));
g_array_remove_index(tm->players, idx);
}
/** Make some player updates after a match
for user players.
@param pl The player we update. */
void
player_update_post_match(Player *pl)
{
if(pl->health == 0)
player_update_fitness(pl);
}

View File

@ -12,15 +12,18 @@ enum PlayerCompareAttrib
PLAYER_COMPARE_ATTRIBUTE_END
};
enum PlayerCardType
enum PlayerValue
{
PLAYER_CARD_YELLOW = 0,
PLAYER_CARD_RED,
PLAYER_CARD_END
PLAYER_VALUE_CARD_YELLOW = 0,
PLAYER_VALUE_CARD_RED,
PLAYER_VALUE_GAMES,
PLAYER_VALUE_GOALS,
PLAYER_VALUE_SHOTS,
PLAYER_VALUE_END
};
Player
player_new(Team *tm, gint average_skill);
player_new(Team *tm, gfloat average_skill);
gint
player_new_id(const GArray *players);
@ -28,8 +31,8 @@ player_new_id(const GArray *players);
gint
player_get_position_from_structure(gint structure, gint player_number);
gint
player_new_talent(gint skill);
gfloat
player_new_talent(gfloat skill);
void
player_estimate_talent(Player *pl);
@ -76,7 +79,7 @@ player_move(Team *tm1, gint player_number, Team *tm2, gint insert_at);
void
player_swap(Team *tm1, gint player_number1, Team *tm2, gint player_number2);
gint
gfloat
player_get_cskill(const Player *pl, gint position);
gint
@ -100,4 +103,25 @@ player_card_get(const Player *pl, gint clid, gint card_type);
void
player_card_set(Player *pl, gint clid, gint card_type, gint value, gboolean diff);
void
player_games_goals_set(Player *pl, gint clid, gint type, gint value, gboolean diff);
gint
player_games_goals_get(const Player *pl, gint clid, gint type);
void
player_update_weekly(Team *tm, gint idx);
void
player_remove_contract(Team *tm, gint idx);
void
player_update_skill(Player *pl);
void
player_update_fitness(Player *pl);
void
player_update_post_match(Player *pl);
#endif

View File

@ -74,21 +74,25 @@ typedef struct
gint pos, /**< Position. @see #PlayerPos */
cpos, /**< Current position. @see #PlayerPos */
skill, /**< Skill. Between 0 and a constant (specified in the constants file). */
cskill, /**< Current Skill. */
age, /**< Age in weeks */
peak_age, /**< Age at which the player reaches his peak ability. */
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 9900. */
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. */
contract, /**< The number of weeks until the player's contract expires. */
lsu; /**< Last skill update. Number of weeks since the player skill was last updated. */
wage; /**< Wage of the player. */
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. */
age, /**< Age in years. */
peak_age, /**< Age at which the player reaches his peak ability. */
contract; /**< The years until the player's contract expires. */
/** Whether the player participated in the team's last match. */
gboolean participation;
/** Array of games and goals; one item per league and cup.
@see PlayerGamesGoals */

View File

@ -32,7 +32,9 @@ WeekFunc start_week_round_funcs[] =
/** Array of functions called when a week
is started. */
WeekFunc start_week_funcs[] = {NULL};
WeekFunc start_week_funcs[] = {start_week_update_user_teams, NULL};
WeekFunc end_week_funcs[] = {NULL};
/** Generate the teams etc. */
void
@ -259,6 +261,9 @@ start_week_round(void)
(*start_func)();
start_func++;
}
if(!user_games_this_week_round())
end_week_round();
}
/** Start a new week. */
@ -273,3 +278,15 @@ start_week(void)
start_func++;
}
}
/** Fitness increase etc. of players.
CPU teams get updated at the end of their matches
(to avoid cup teams getting updated too often). */
void
start_week_update_user_teams(void)
{
gint i;
for(i=0;i<users->len;i++)
team_update_user_team_weekly(usr(i).tm);
}

View File

@ -36,4 +36,7 @@ start_week_round(void);
void
start_week(void);
void
start_week_update_user_teams(void);
#endif

View File

@ -108,21 +108,18 @@ team_generate_players(Team *tm)
gfloat skill_factor = math_rnd(1 - const_float("float_team_skill_variance"),
1 + const_float("float_team_skill_variance"));
Player new;
gint average_skill;
gfloat average_skill;
if(tm->clid < ID_CUP_START)
average_skill =
(gint)rint((gfloat)const_int("int_player_max_skill") *
((gfloat)team_return_league_cup_value_int(tm, LEAGUE_CUP_VALUE_AVERAGE_SKILL) / 100) *
skill_factor);
const_float("float_player_max_skill") * skill_factor *
((gfloat)team_return_league_cup_value_int(tm, LEAGUE_CUP_VALUE_AVERAGE_SKILL) / 100);
else
average_skill =
(gint)rint((gfloat)const_int("int_player_max_skill") *
(((gfloat)lig(0).average_skill +
(gfloat)team_return_league_cup_value_int(tm, LEAGUE_CUP_VALUE_SKILL_DIFF)) / 100) *
skill_factor);
skill_factor * lig(0).average_skill *
((gfloat)team_return_league_cup_value_int(tm, LEAGUE_CUP_VALUE_SKILL_DIFF) / 1000);
average_skill = CLAMP(average_skill, 0, const_int("int_player_max_skill"));
average_skill = CLAMP(average_skill, 0, const_float("float_player_max_skill"));
for(i=0;i<const_int("int_team_max_players");i++)
{
@ -252,7 +249,7 @@ team_copy(const Team *source, Team *dest)
for(i=0;i<source->players->len;i++)
{
new_player = player_new(dest, const_int("int_player_max_skill"));
new_player = player_new(dest, const_float("float_player_max_skill"));
free_player(&new_player);
player_copy(&g_array_index(source->players, Player, i),
&new_player);
@ -509,9 +506,7 @@ team_get_average_skill(const Team *tm, gboolean cskill)
else
for(i=0;i<11;i++)
{
sum += player_of(tm, i)->cskill *
powf((gfloat)player_of(tm, i)->fitness / 10000,
const_float("float_player_fitness_exponent"));
sum += player_get_game_skill(player_of(tm, i), FALSE);
counter++;
}
@ -673,3 +668,34 @@ team_change_attribute_with_message(Team *tm, gint attribute, gint new_value)
game_gui_print_message(buf);
}
/** Heal players, re-set fitnesses, make some random subs
and replace some players with new ones.
@param tm The team we examine. */
void
team_update_cpu_team(Team *tm)
{
}
/** Increase player ages etc.
@param tm The user team we examine. */
void
team_update_user_team_weekly(Team *tm)
{
gint i;
for(i=0;i<tm->players->len;i++)
player_update_weekly(tm, i);
}
/** Regenerate player fitness etc. after a match.
@param tm The user team we examine. */
void
team_update_post_match(Team *tm)
{
gint i;
for(i=0;i<tm->players->len;i++)
player_update_post_match(player_of(tm, i));
}

View File

@ -84,4 +84,13 @@ team_attribute_to_char(gint attribute, gint value);
void
team_change_attribute_with_message(Team * tm, gint attribute, gint new_value);
void
team_update_user_team_weekly(Team *tm);
void
team_update_cpu_team(Team *tm);
void
team_update_post_match(Team *tm);
#endif

View File

@ -34,12 +34,13 @@ enum TeamAttribute
typedef struct
{
gint capacity, /**< How many people fit in. Default: -1 (depends on league). */
safety, /**< Safety percentage between 0 and 100. Default: randomized. */
average_attendance, /**< How many people watched on average. Default: 0. */
possible_attendance, /**< How many people would've watched if every game had been
sold out. We need this only to compute the average attendance in percentage
of the capacity. Default: 0. */
games; /**< Number of games. Default: 0. */
gfloat safety; /**< Safety percentage between 0 and 100. Default: randomized. */
} Stadium;
/** Structure representing a team.

View File

@ -95,13 +95,12 @@ treeview_cell_player_to_cell(GtkTreeViewColumn *col,
treeview_cell_player_cskill_to_cell(renderer, buf, pl);
break;
case PLAYER_LIST_ATTRIBUTE_SKILL:
sprintf(buf, "%d", pl->skill);
sprintf(buf, "%.*f", opt_int("int_opt_player_precision"), pl->skill);
break;
case PLAYER_LIST_ATTRIBUTE_FITNESS:
treeview_cell_player_fitness_to_cell(renderer, buf, pl->fitness);
break;
case PLAYER_LIST_ATTRIBUTE_GAMES:
/*todo*/
treeview_cell_player_games_goals_to_cell(buf, pl, PLAYER_LIST_ATTRIBUTE_GAMES);
break;
case PLAYER_LIST_ATTRIBUTE_GOALS:
@ -117,10 +116,11 @@ treeview_cell_player_to_cell(GtkTreeViewColumn *col,
treeview_cell_player_cards_to_cell(buf, pl);
break;
case PLAYER_LIST_ATTRIBUTE_AGE:
sprintf(buf, "%d", (gint)rint((gfloat)pl->age / 52));
sprintf(buf, "%.*f", opt_int("int_opt_player_precision"), pl->age);
break;
case PLAYER_LIST_ATTRIBUTE_ETAL:
sprintf(buf, "%d", pl->etal[usr(current_user).scout % 10]);
sprintf(buf, "%.*f", opt_int("int_opt_player_precision"),
pl->etal[usr(current_user).scout % 10]);
break;
case PLAYER_LIST_ATTRIBUTE_VALUE:
misc_print_grouped_int(pl->value, buf, FALSE);
@ -147,17 +147,18 @@ treeview_cell_player_to_cell(GtkTreeViewColumn *col,
@param buf The string the cell will contain.
@param contract_time The contract time in weeks. */
void
treeview_cell_player_contract_to_cell(GtkCellRenderer *renderer, gchar *buf, gint contract_time)
treeview_cell_player_contract_to_cell(GtkCellRenderer *renderer, gchar *buf, gfloat contract_time)
{
sprintf(buf, "%.1f", (gfloat)contract_time / 52);
sprintf(buf, "%.*f", opt_int("int_opt_player_precision"),
contract_time);
if(contract_time < const_int("int_treeview_cell_limit_player_contract_below3"))
if(contract_time < const_float("float_treeview_cell_limit_player_contract_below3"))
g_object_set(renderer, "foreground",
const_str("string_treeview_cell_color_player_contract_below3"), NULL);
else if(contract_time < const_int("int_treeview_cell_limit_player_contract_below2"))
else if(contract_time < const_float("float_treeview_cell_limit_player_contract_below2"))
g_object_set(renderer, "foreground",
const_str("string_treeview_cell_color_player_contract_below2"), NULL);
else if(contract_time < const_int("int_treeview_cell_limit_player_contract_below1"))
else if(contract_time < const_float("float_treeview_cell_limit_player_contract_below1"))
g_object_set(renderer, "foreground",
const_str("string_treeview_cell_color_player_contract_below1"), NULL);
else
@ -191,7 +192,7 @@ treeview_cell_player_cards_to_cell(gchar *buf, const Player *pl)
return;
}
yellow = player_card_get(pl, fix->clid, PLAYER_CARD_YELLOW);
yellow = player_card_get(pl, fix->clid, PLAYER_VALUE_CARD_YELLOW);
if(yellow != -1)
{
@ -244,8 +245,8 @@ treeview_cell_player_status_to_cell(GtkCellRenderer *renderer, gchar *buf, const
void
treeview_cell_player_games_goals_to_cell(gchar *buf, const Player *pl, gint type)
{
gint i, idx = -1;
Fixture *fix = team_get_next_fixture(pl->team);
gint clid = pl->team->clid;
if(pl->games_goals->len == 0)
{
@ -253,42 +254,14 @@ treeview_cell_player_games_goals_to_cell(gchar *buf, const Player *pl, gint type
return;
}
if(fix == NULL)
idx = 0;
else
{
for(i=0;i<pl->games_goals->len;i++)
if(g_array_index(pl->games_goals, PlayerGamesGoals, i).clid == fix->clid)
{
idx = i;
break;
}
}
if(fix != NULL)
clid = fix->clid;
if(type == PLAYER_LIST_ATTRIBUTE_GOALS)
{
if(opt_user_int("int_opt_user_show_overall"))
sprintf(buf, "%d(%d)", g_array_index(pl->games_goals, PlayerGamesGoals, idx).goals,
player_all_games_goals(pl, PLAYER_LIST_ATTRIBUTE_GOALS));
else
sprintf(buf, "%d", g_array_index(pl->games_goals, PlayerGamesGoals, idx).goals);
}
else if(type == PLAYER_LIST_ATTRIBUTE_GAMES)
{
if(opt_user_int("int_opt_user_show_overall"))
sprintf(buf, "%d(%d)", g_array_index(pl->games_goals, PlayerGamesGoals, idx).games,
player_all_games_goals(pl, PLAYER_LIST_ATTRIBUTE_GAMES));
else
sprintf(buf, "%d", g_array_index(pl->games_goals, PlayerGamesGoals, idx).games);
}
else if(type == PLAYER_LIST_ATTRIBUTE_SHOTS)
{
if(opt_user_int("int_opt_user_show_overall"))
sprintf(buf, "%d(%d)", g_array_index(pl->games_goals, PlayerGamesGoals, idx).shots,
player_all_games_goals(pl, PLAYER_LIST_ATTRIBUTE_SHOTS));
else
sprintf(buf, "%d", g_array_index(pl->games_goals, PlayerGamesGoals, idx).shots);
}
if(opt_user_int("int_opt_user_show_overall"))
sprintf(buf, "%d(%d)", player_games_goals_get(pl, clid, type),
player_all_games_goals(pl, PLAYER_VALUE_GOALS));
else
sprintf(buf, "%d", player_games_goals_get(pl, clid, type));
}
/** Render a cell of player fitness.
@ -296,17 +269,17 @@ treeview_cell_player_games_goals_to_cell(gchar *buf, const Player *pl, gint type
@param buf The string the cell will contain.
@param fitness The fitness of the player. */
void
treeview_cell_player_fitness_to_cell(GtkCellRenderer *renderer, gchar *buf, gint fitness)
treeview_cell_player_fitness_to_cell(GtkCellRenderer *renderer, gchar *buf, gfloat fitness)
{
sprintf(buf, "%d%%", (gint)rint((gfloat)fitness / 100));
sprintf(buf, "%d%%", (gint)rint(fitness * 100));
if(fitness < const_int("int_treeview_cell_limit_player_fitness_below3"))
if(fitness < const_float("float_treeview_cell_limit_player_fitness_below3"))
g_object_set(renderer, "foreground",
const_str("string_treeview_cell_color_player_fitness_below3"), NULL);
else if(fitness < const_int("int_treeview_cell_limit_player_fitness_below2"))
else if(fitness < const_float("float_treeview_cell_limit_player_fitness_below2"))
g_object_set(renderer, "foreground",
const_str("string_treeview_cell_color_player_fitness_below2"), NULL);
else if(fitness < const_int("int_treeview_cell_limit_player_fitness_below2"))
else if(fitness < const_float("float_treeview_cell_limit_player_fitness_below2"))
g_object_set(renderer, "foreground",
const_str("string_treeview_cell_color_player_fitness_below2"), NULL);
else
@ -361,7 +334,8 @@ treeview_cell_player_pos_to_cell(GtkCellRenderer *renderer, gchar *buf, gint pos
void
treeview_cell_player_cskill_to_cell(GtkCellRenderer *renderer, gchar *buf, const Player *pl)
{
sprintf(buf, "%d", (gint)rint(player_get_game_skill(pl, FALSE)));
sprintf(buf, "%.*f", opt_int("int_opt_player_precision"),
player_get_game_skill(pl, FALSE));
if(pl->cskill < pl->skill)
g_object_set(renderer, "background",

View File

@ -26,7 +26,7 @@ treeview_cell_player_to_cell(GtkTreeViewColumn *col,
gpointer user_data);
void
treeview_cell_player_contract_to_cell(GtkCellRenderer *renderer, gchar *buf, gint contract_time);
treeview_cell_player_contract_to_cell(GtkCellRenderer *renderer, gchar *buf, gfloat contract_time);
void
treeview_cell_player_cards_to_cell(gchar *buf, const Player *pl);
@ -38,7 +38,7 @@ void
treeview_cell_player_games_goals_to_cell(gchar *buf, const Player *pl, gint type);
void
treeview_cell_player_fitness_to_cell(GtkCellRenderer *renderer, gchar *buf, gint fitness);
treeview_cell_player_fitness_to_cell(GtkCellRenderer *renderer, gchar *buf, gfloat fitness);
void
treeview_cell_player_pos_to_cell(GtkCellRenderer *renderer, gchar *buf, gint pos);

View File

@ -1,3 +1,4 @@
#include "fixture.h"
#include "free.h"
#include "league.h"
#include "maths.h"
@ -124,3 +125,31 @@ user_set_player_list_attributes(const User *user, PlayerListAttribute *attribute
cnt++;
}
}
/** Find out whether there are user games at the specified date. */
gboolean
user_games_in_week_round(gint week_number, gint week_round_number)
{
gint i, j;
if(week_round_number == 1)
{
for(i=0;i<ligs->len;i++)
for(j=0;j<lig(i).fixtures->len;j++)
if(fixture_user_team_involved(&g_array_index(lig(i).fixtures, Fixture, j)) != -1 &&
g_array_index(lig(i).fixtures, Fixture, j).week_number == week_number &&
g_array_index(lig(i).fixtures, Fixture, j).week_round_number == week_round_number)
return TRUE;
}
else
{
for(i=0;i<cps->len;i++)
for(j=0;j<cp(i).fixtures->len;j++)
if(fixture_user_team_involved(&g_array_index(cp(i).fixtures, Fixture, j)) != -1 &&
g_array_index(lig(i).fixtures, Fixture, j).week_number == week_number &&
g_array_index(lig(i).fixtures, Fixture, j).week_round_number == week_round_number)
return TRUE;
}
return FALSE;
}

View File

@ -7,6 +7,7 @@
/** Convenience abbrevs. */
#define usr(i) g_array_index(users, User, i)
#define user_games_this_week_round() user_games_in_week_round(week, week_round)
void
user_set_up_team_new_game(User *user);
@ -26,4 +27,7 @@ user_remove(gint idx, gboolean regenerate_team);
void
user_set_player_list_attributes(const User *user, PlayerListAttribute *attribute, gint list_number);
gboolean
user_games_in_week_round(gint week_number, gint week_round_number);
#endif

View File

@ -1,23 +1,35 @@
#### int constants
#### float constants get divided by 10000 and loaded as floats
#### so we write 5000 if we'd like to have 0.5
# number of seconds until messages disappear
int_game_gui_message_duration 5
# lower limit for player ages.
int_player_age_lower 936
float_player_age_lower 180000
# upper limit for player ages.
int_player_age_upper 1872
float_player_age_upper 360000
# lower limit for player peak ages.
int_player_peak_age_lower 1560
float_player_peak_age_lower 300000
# upper limit for player peak ages.
int_player_peak_age_upper 1716
# by how many weeks the peak age of goalies is
float_player_peak_age_upper 330000
# by how many years the peak age of goalies is
# greater.
int_player_peak_age_goalie_addition 104
float_player_peak_age_goalie_addition 20000
# limits for initial fitness (read it as 85%)
int_player_fitness_lower 8500
float_player_fitness_lower 8500
# limits for initial fitness.
int_player_fitness_upper 10000
float_player_fitness_upper 10000
# skill reduction factor for very young and very old players
# at generation
float_player_skill_reduction1 7500
float_player_skill_reduction2 9000
# value scale factor (we take 1 + factor or 1 - factor
# in the game) for values of young/old players
float_player_value_scale1 1000
float_player_value_scale2 500
# the bounds determining the player positions in a newly created
# team for players 13 to constant_team_max_players.
@ -26,28 +38,46 @@ int_player_pos_bound1 15
int_player_pos_bound2 18
# bounds for the contract time at player generation.
int_player_contract_lower 52
int_player_contract_upper 208
float_player_contract_lower 10000
float_player_contract_upper 40000
# bounds for the last skill update at player generation.
int_player_lsu_lower 2
int_player_lsu_upper 10
float_player_lsu_lower 20000
float_player_lsu_upper 100000
# lsu addition for injured players who are older
# than their peak age
float_player_lsu_injured_old 15000
# percentage of league games a player has to participate
# in to have his lsu increased
float_player_lsu_games_percentage 3000
# probability that the lsu gets increased even
# if the player didn't participate in that many games
float_player_lsu_increase_prob 4000
# the lsu above which a skill update is considered
float_player_lsu_update_limit 120000
# 1 - probability that the update occurs right away
float_player_lsu_update_base_prob 8000
# this determines the accuracy of the scout's
# talent estimate. the smaller the better.
int_player_etal_scout_factor 7
float_player_etal_scout_factor 70000
# fitness limits below which fitness is shown
# in orange and red etc.
int_treeview_cell_limit_player_fitness_below1 8500
int_treeview_cell_limit_player_fitness_below2 7000
int_treeview_cell_limit_player_fitness_below3 6000
float_treeview_cell_limit_player_fitness_below1 8500
float_treeview_cell_limit_player_fitness_below2 7000
float_treeview_cell_limit_player_fitness_below3 6000
# contract limits below which contract time is shown
# in orange and red etc.
int_treeview_cell_limit_player_contract_below1 52
int_treeview_cell_limit_player_contract_below2 40
int_treeview_cell_limit_player_contract_below3 20
float_treeview_cell_limit_player_contract_below1 10000
float_treeview_cell_limit_player_contract_below2 7000
float_treeview_cell_limit_player_contract_below3 4000
# the integer that the cell data functions will interpret as an empty string.
int_treeview_cell_int_empty -5
@ -60,312 +90,359 @@ int_transfer_deadline 35
int_team_max_players 20
# highest skill and talent a player can have.
int_player_max_skill 99
float_player_max_skill 990000
# determines initial money of the users
int_initial_money_lower 80
int_initial_money_upper 110
#### float constants
#### these get divided by 1000 and loaded as floats
#### so we write 500 if we'd like to have 0.5
# live game scale configuration
float_game_gui_live_game_scale_attack 300
float_game_gui_live_game_scale_chance 450
float_game_gui_live_game_scale_range 10000
float_game_gui_live_game_scale_attack 3000
float_game_gui_live_game_scale_chance 4500
float_game_gui_live_game_scale_range 100000
# How much a player's skill can deviate from
# the average skill in his team.
float_player_average_skill_variance 100
float_player_average_skill_variance 1000
# these determine the value calculation of players.
# value is a function of skill and talent involving
# a power.
float_player_value_skill_weight 650
float_player_value_power 3500
float_player_value_skill_weight 6500
float_player_value_power 35000
# these determine the wage calculation of players.
# wage depends on the value and a random factor near 1.
float_player_wage_value_factor 10
float_player_wage_random_dev 150
float_player_wage_value_factor 100
float_player_wage_random_dev 1500
# constants determining the probabilities for
# the playing styles of cpu teams.
float_team_playing_style_prob1 100
float_team_playing_style_prob2 250
float_team_playing_style_prob3 750
float_team_playing_style_prob4 900
float_team_playing_style_prob1 1000
float_team_playing_style_prob2 2500
float_team_playing_style_prob3 7500
float_team_playing_style_prob4 9000
# constants determining the probabilities for
# the playing structures of cpu teams.
float_team_playing_structure_prob1 150
float_team_playing_structure_prob2 500
float_team_playing_structure_prob3 700
float_team_playing_structure_prob4 850
float_team_playing_structure_prob1 1500
float_team_playing_structure_prob2 5000
float_team_playing_structure_prob3 7000
float_team_playing_structure_prob4 8500
# kinda hard to explain.
# @see team_generate_players()
# @see player_generate()
float_team_skill_variance 75
float_team_skill_variance 750
# base probability that the ball gets from defending area
# to midfield area.
float_live_game_area_def_mid 500
float_live_game_area_def_mid 5000
# influence of attack/defend values on the base probability; the lower
# the smaller the influence.
float_live_game_area_def_mid_team_exponent 1000
float_live_game_area_def_mid_team_exponent 10000
# base probability that the ball gets from midfield area
# to attack area or back to defend area.
float_live_game_area_mid_att 500
float_live_game_area_mid_def 300
float_live_game_area_mid_att 5000
float_live_game_area_mid_def 3000
# influence of attack/defend values on the base probability; the lower
# the smaller the influence.
float_live_game_area_mid_team_exponent 1250
float_live_game_area_mid_team_exponent 12500
# base probability that the ball gets from attacking area
# to midfield area.
float_live_game_area_att_mid 300
float_live_game_area_att_mid 3000
# influence of attack/defend values on the base probability; the lower
# the smaller the influence.
float_live_game_area_att_mid_team_exponent 1000
float_live_game_area_att_mid_team_exponent 10000
# base probability of a general event (no foul, no injury, no goal etc.)
float_live_game_event_general 500
float_live_game_event_general 5000
# base probability for possession change.
float_live_game_possession_changes 200
float_live_game_possession_changes 2000
# influence of the team values on the possession change.
float_live_game_possession_team_exponent 4000
float_live_game_possession_team_exponent 40000
# base prob for a scoring chance if a team is attacking.
float_live_game_scoring_chance 300
float_live_game_scoring_chance 3000
# team values influence on the scoring chance.
float_live_game_scoring_chance_team_exponent 1250
float_live_game_scoring_chance_team_exponent 12500
# probability that it's the player in possession who
# has the scoring chance.
float_live_game_player_in_poss_shoots 500
float_live_game_player_in_poss_shoots 5000
# base probability to score with a scoring chance.
float_live_game_score_base_prob 300
float_live_game_score_base_prob 3000
# base probability to score with a free kick.
float_live_game_score_free_kick 50
float_live_game_score_free_kick 500
# base probability to score with a penalty.
float_live_game_score_penalty 800
float_live_game_score_penalty 8000
# influence of the attacker/goalie skills on the probability to score.
float_live_game_score_duel_exponent 300
float_live_game_score_duel_exponent 3000
# influence of the team attacking/defending values on the probability to score.
float_live_game_score_team_exponent 700
float_live_game_score_team_exponent 7000
# the smaller this number, the smaller the probability of
# many stopping minutes after 90 or 45 minutes.
float_live_game_break_base 600
float_live_game_break_base 6000
# the bigger this number, the faster the probability of
# yet another additional minute after the 45th minute decays.
float_live_game_45_break_exponent_factor 1300
float_live_game_45_break_exponent_factor 13000
# the bigger this number, the faster the probability of
# yet another additional minute after the 90th minute decays.
float_live_game_90_break_exponent_factor 700
float_live_game_90_break_exponent_factor 7000
# the probability that the team that shot on the goal stays
# in possession after a post or cross-bar hit.
float_live_game_possession_after_post 300
float_live_game_possession_after_post 3000
# probability that there is a passing event after a special event.
float_live_game_general_event_second_player 500
float_live_game_general_event_second_player 5000
# constants for stadium events.
float_live_game_stadium_event_exponent 50
float_live_game_stadium_event_fire 200
float_live_game_stadium_event_riots 500
float_live_game_stadium_event_breakdown 1000
float_live_game_stadium_event_exponent 500
float_live_game_stadium_event_fire 2000
float_live_game_stadium_event_riots 5000
float_live_game_stadium_event_breakdown 10000
# foul probabilities.
float_live_game_foul 110
float_live_game_foul_red_injury 50
float_live_game_foul_red 80
float_live_game_foul_yellow 230
float_live_game_foul 0 #1100
float_live_game_foul_red_injury 500
float_live_game_foul_red 800
float_live_game_foul_yellow 2300
# ban duration probabilities
# should add up to 1000
float_live_game_ban_1 700
float_live_game_ban_2 150
float_live_game_ban_3 100
float_live_game_ban_4 30
float_live_game_ban_5 20
float_live_game_ban_1 7000
float_live_game_ban_2 1500
float_live_game_ban_3 1000
float_live_game_ban_4 300
float_live_game_ban_5 200
# probability that the foul player is from the
# team that has the ball
float_live_game_foul_by_possession 200
float_live_game_foul_by_possession 2000
# injury probabilities.
float_live_game_injury 17
float_live_game_injury_goalie_factor 200
float_live_game_injury_is_temp 700
float_live_game_injury 0 #170
float_live_game_injury_goalie_factor 2000
float_live_game_injury_is_temp 7000
# probabilities for different injuries
# these should add up to 1000
float_player_injury_concussion 200
float_player_injury_pulled_muscle 200
float_player_injury_hamstring 150
float_player_injury_groin 150
float_player_injury_frac_ankle 100
float_player_injury_rib 75
float_player_injury_leg 40
float_player_injury_brok_ankle 40
float_player_injury_arm 20
float_player_injury_shoulder 15
float_player_injury_ligament 7
float_player_injury_career_stop 3
float_player_injury_concussion 2000
float_player_injury_pulled_muscle 2000
float_player_injury_hamstring 1500
float_player_injury_groin 1500
float_player_injury_frac_ankle 1000
float_player_injury_rib 750
float_player_injury_leg 400
float_player_injury_brok_ankle 400
float_player_injury_arm 200
float_player_injury_shoulder 150
float_player_injury_ligament 70
float_player_injury_career_stop 30
# duration of the injuries (mean and deviance)
int_player_injury_duration_concussion 2
int_player_injury_duration_dev_concussion 1
int_player_injury_duration_pulled_muscle 3
int_player_injury_duration_dev_pulled_muscle 1
int_player_injury_duration_hamstring 5
int_player_injury_duration_dev_hamstring 2
int_player_injury_duration_groin 5
int_player_injury_duration_dev_groin 2
int_player_injury_duration_frac_ankle 6
int_player_injury_duration_dev_frac_ankle 2
int_player_injury_duration_rib 8
int_player_injury_duration_dev_rib 4
int_player_injury_duration_leg 9
int_player_injury_duration_dev_leg 4
int_player_injury_duration_brok_ankle 11
int_player_injury_duration_dev_brok_ankle 5
int_player_injury_duration_arm 6
int_player_injury_duration_dev_arm 2
int_player_injury_duration_shoulder 10
int_player_injury_duration_dev_shoulder 5
int_player_injury_duration_ligament 22
int_player_injury_duration_dev_ligament 8
int_player_injury_duration_concussion 2
int_player_injury_duration_dev_concussion 1
int_player_injury_duration_pulled_muscle 3
int_player_injury_duration_dev_pulled_muscle 1
int_player_injury_duration_hamstring 5
int_player_injury_duration_dev_hamstring 2
int_player_injury_duration_groin 5
int_player_injury_duration_dev_groin 2
int_player_injury_duration_frac_ankle 6
int_player_injury_duration_dev_frac_ankle 2
int_player_injury_duration_rib 8
int_player_injury_duration_dev_rib 4
int_player_injury_duration_leg 9
int_player_injury_duration_dev_leg 4
int_player_injury_duration_brok_ankle 11
int_player_injury_duration_dev_brok_ankle 5
int_player_injury_duration_arm 6
int_player_injury_duration_dev_arm 2
int_player_injury_duration_shoulder 10
int_player_injury_duration_dev_shoulder 5
int_player_injury_duration_ligament 22
int_player_injury_duration_dev_ligament 8
# fitness decrease when injury is temporary
int_live_game_temp_injury_fitness_decrease_lower 200
int_live_game_temp_injury_fitness_decrease_upper 800
float_live_game_temp_injury_fitness_decrease_lower 200
float_live_game_temp_injury_fitness_decrease_upper 800
# refresh rate of the player list during a live game
# the smaller the more often the list gets refreshed
int_live_game_player_list_refresh 5
# probability that a scoring chance is an own goal.
float_live_game_scoring_chance_is_own_goal 10
float_live_game_scoring_chance_is_own_goal 100
# probability of a free kick after a foul.
float_live_game_free_kick_prob 150
float_live_game_free_kick_prob 1500
# probability of a penalty after a foul.
float_live_game_penalty_prob 50
float_live_game_penalty_prob 500
# probability that a scoring chance is a header.
float_live_game_scoring_chance_is_header 350
float_live_game_scoring_chance_is_header 3500
# influence in % of the game style towards more attack.
float_game_style_factor 75
float_game_style_factor 750
# influence of boost on player's skill.
# these should be between 0 and 1
float_player_boost_skill_effect 150
float_player_boost_skill_effect 1500
# influence of boost on player's fitness decay.
float_player_boost_fitness_effect 500
float_player_boost_fitness_effect 5000
# influence of boost on injury probability.
float_player_boost_injury_effect 500
float_player_boost_injury_effect 5000
# influence of boost on cards probability.
float_player_boost_card_effect 500
float_player_boost_card_effect 5000
# influence of team boost on probability that the team in possession
# of the ball fouls
float_team_boost_foul_by_possession_factor1 500
float_team_boost_foul_by_possession_factor2 900
float_team_boost_foul_by_possession_factor1 5000
float_team_boost_foul_by_possession_factor2 9000
# influence of boost on foul probability
float_team_boost_foul_factor 400
float_team_boost_foul_factor 4000
# the influence of the fitness on the current skill.
# this determines the player's contribution to the team
# during a game. the higher the value the bigger the influence.
float_player_fitness_impact_on_skill 250
float_player_fitness_exponent 2500
# difference limits between age and peak age
float_player_peak_age_diff_younger1 100000 # 10 years younger
float_player_peak_age_diff_younger2 50000 # 5 years younger
float_player_peak_age_diff_younger3 30000 # 3 years younger
float_player_peak_age_diff_peak_younger 20000 # 2 years younger
float_player_peak_age_diff_peak_older -20000 # 2 years older
float_player_peak_age_diff_older1 -40000 # 4 years older
float_player_peak_age_diff_older2 -80000 # 8 years older
# values determining player skill development
# depending on peak-age - age
# factors; the higher the faster players develop
float_player_skill_devel_younger1_lower 500
float_player_skill_devel_younger1_upper 1000
float_player_skill_devel_younger2_lower 1000
float_player_skill_devel_younger2_upper 1500
float_player_skill_devel_younger3_lower 1000
float_player_skill_devel_younger3_upper 2000
# increase and decrease around peak age
float_player_skill_devel_peak_lower -20000
float_player_skill_devel_peak_upper 20000
# decrease in skill units
float_player_skill_devel_older1_lower -20000
float_player_skill_devel_older1_upper -50000
float_player_skill_devel_older2_lower -30000
float_player_skill_devel_older2_upper -70000
float_player_skill_devel_else_lower -50000
float_player_skill_devel_else_upper -120000
# influence of the fitness on the player contribution.
# the higher the worse. @see game_get_player_contribution()
float_player_fitness_exponent 250
# these determine the players' fitness decrease during
# a match
int_player_fitness_decrease_peak_age_diff1 500
int_player_fitness_decrease_minus1 8
int_player_fitness_decrease_peak_age_diff2 250
int_player_fitness_decrease_minus2 7
int_player_fitness_decrease_peak_age_diff3 150
int_player_fitness_decrease_minus3 6
int_player_fitness_decrease_peak_age_diff4 100
int_player_fitness_decrease_minus4 5
int_player_fitness_decrease_peak_age_diff5 -100
int_player_fitness_decrease_minus5 5
int_player_fitness_decrease_peak_age_diff6 -200
int_player_fitness_decrease_minus6 7
int_player_fitness_decrease_peak_age_diff7 -400
int_player_fitness_decrease_minus7 10
int_player_fitness_decrease_minus_else 15
# a match (depending on the peak age diff
float_player_fitness_decrease_younger1 6
float_player_fitness_decrease_younger2 5
float_player_fitness_decrease_younger3 4
float_player_fitness_decrease_peak_younger 3
float_player_fitness_decrease_peak_older 3
float_player_fitness_decrease_older1 5
float_player_fitness_decrease_older2 8
float_player_fitness_decrease_else 12
# goalies get affected less by the decrease
float_player_fitness_decrease_factor_goalie 5000
# float_player_fitness_decrease_younger1 12
# float_player_fitness_decrease_younger2 11
# float_player_fitness_decrease_younger3 10
# float_player_fitness_decrease_peak_younger 9
# float_player_fitness_decrease_peak_older 9
# float_player_fitness_decrease_older1 11
# float_player_fitness_decrease_older2 14
# float_player_fitness_decrease_else 19
# fitness increase (after games) in percentage of
# the decrease values above
float_player_fitness_increase_younger1 1000
float_player_fitness_increase_younger2 1200
float_player_fitness_increase_younger3 1400
float_player_fitness_increase_peak_younger 1500
float_player_fitness_increase_peak_older 1500
float_player_fitness_increase_older1 1000
float_player_fitness_increase_older2 800
float_player_fitness_increase_else 500
# random variance for fitness increase
float_player_fitness_increase_variance 300
# bounds for the home advantage factor
float_game_home_advantage_lower 40
float_game_home_advantage_upper 80
float_game_home_advantage_lower 400
float_game_home_advantage_upper 800
# How the cskill of field players get weighted for the team values in
# a match
float_player_team_weight_defender_defense 1000
float_player_team_weight_defender_midfield 400
float_player_team_weight_defender_attack 250
float_player_team_weight_midfielder_defense 625
float_player_team_weight_midfielder_midfield 1000
float_player_team_weight_midfielder_attack 625
float_player_team_weight_forward_defense 200
float_player_team_weight_forward_midfield 600
float_player_team_weight_forward_attack 1300
float_player_team_weight_defender_defense 10000
float_player_team_weight_defender_midfield 4000
float_player_team_weight_defender_attack 2500
float_player_team_weight_midfielder_defense 6250
float_player_team_weight_midfielder_midfield 10000
float_player_team_weight_midfielder_attack 6250
float_player_team_weight_forward_defense 2000
float_player_team_weight_forward_midfield 6000
float_player_team_weight_forward_attack 13000
#### string constants
# live game scale configuration
string_game_gui_live_game_scale_color_defend lightblue
string_game_gui_live_game_scale_color_midfield khaki
string_game_gui_live_game_scale_color_attack gold
string_game_gui_live_game_scale_color_chance orange
string_game_gui_live_game_scale_color_goal red
string_game_gui_live_game_scale_color_miss lightgreen
string_game_gui_live_game_scale_color_defend lightblue
string_game_gui_live_game_scale_color_midfield khaki
string_game_gui_live_game_scale_color_attack gold
string_game_gui_live_game_scale_color_chance orange
string_game_gui_live_game_scale_color_goal red
string_game_gui_live_game_scale_color_miss lightgreen
# meter icons (style, boost) in the main window
string_game_gui_style_all_out_attack_icon style_all_atk.png
string_game_gui_style_attack_icon style_atk.png
string_game_gui_style_balanced_icon style_bal.png
string_game_gui_style_defend_icon style_def.png
string_game_gui_style_all_out_defend_icon style_all_def.png
string_game_gui_style_all_out_attack_icon style_all_atk.png
string_game_gui_style_attack_icon style_atk.png
string_game_gui_style_balanced_icon style_bal.png
string_game_gui_style_defend_icon style_def.png
string_game_gui_style_all_out_defend_icon style_all_def.png
string_game_gui_boost_on_icon boost_on.png
string_game_gui_boost_off_icon boost_off.png
string_game_gui_boost_anti_icon boost_anti.png
string_game_gui_boost_on_icon boost_on.png
string_game_gui_boost_off_icon boost_off.png
string_game_gui_boost_anti_icon boost_anti.png
# default background and foreground in treeviews
string_treeview_cell_color_default_background white
string_treeview_cell_color_default_foreground black
# player list colours
string_treeview_cell_color_player_pos_goalie_bg black
string_treeview_cell_color_player_pos_goalie_fg white
string_treeview_cell_color_player_pos_defender_bg darkgreen
string_treeview_cell_color_player_pos_defender_fg white
string_treeview_cell_color_player_pos_midfielder_bg darkblue
string_treeview_cell_color_player_pos_midfielder_fg white
string_treeview_cell_color_player_pos_forward_bg darkred
string_treeview_cell_color_player_pos_forward_fg white
string_treeview_cell_color_player_pos_goalie_bg black
string_treeview_cell_color_player_pos_goalie_fg white
string_treeview_cell_color_player_pos_defender_bg darkgreen
string_treeview_cell_color_player_pos_defender_fg white
string_treeview_cell_color_player_pos_midfielder_bg darkblue
string_treeview_cell_color_player_pos_midfielder_fg white
string_treeview_cell_color_player_pos_forward_bg darkred
string_treeview_cell_color_player_pos_forward_fg white
string_treeview_cell_color_player_injury lightgreen
string_treeview_cell_color_player_banned red
string_treeview_cell_color_player_banned red
string_treeview_cell_color_player_yellow_danger yellow
string_treeview_cell_color_player_fitness_normal darkgreen
@ -390,22 +467,22 @@ string_treeview_cell_live_game_result_attributes weight='bold' size='large'
string_live_game_possession_color darkblue
# icons used in live games
string_live_game_event_start_match_icon whistle.png
string_live_game_event_start_match_icon whistle.png
string_live_game_event_lost_possession_icon
string_live_game_event_penalty_icon scoring_chance.png
string_live_game_event_scoring_chance_icon scoring_chance.png
string_live_game_event_goal_icon goal.png
string_live_game_event_own_goal_icon own_goal.png
string_live_game_event_penalty_icon scoring_chance.png
string_live_game_event_scoring_chance_icon scoring_chance.png
string_live_game_event_goal_icon goal.png
string_live_game_event_own_goal_icon own_goal.png
string_live_game_event_post_icon
string_live_game_event_save_icon save.png
string_live_game_event_missed_icon miss.png
string_live_game_event_save_icon save.png
string_live_game_event_missed_icon miss.png
string_live_game_event_foul_icon
string_live_game_event_foul_yellow_icon yellow.png
string_live_game_event_send_off_icon red.png
string_live_game_event_injury_icon injury.png
string_live_game_event_temp_injury_icon injury_temp.png
string_live_game_event_foul_yellow_icon yellow.png
string_live_game_event_send_off_icon red.png
string_live_game_event_injury_icon injury.png
string_live_game_event_temp_injury_icon injury_temp.png
string_live_game_event_stadium_breakdown_icon
string_live_game_event_stadium_fire_icon
string_live_game_event_stadium_riots_icon
string_live_game_event_substitution_icon sub.png
string_live_game_event_structure_change_icon structure_change.png
string_live_game_event_substitution_icon sub.png
string_live_game_event_structure_change_icon structure_change.png

View File

@ -5,7 +5,7 @@
# is rather clear if you take a look at the options window in the game.
int_opt_user_confirm_unfit 1
int_opt_user_show_live_game 1
int_opt_user_show_live_game 0
int_opt_user_live_game_speed -10
int_opt_user_show_tendency_bar 1
int_opt_user_notify_transfer 0