1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2024-12-16 02:11:23 +01:00

Transfers, star player balking. Ticket price constant adjusted.

This commit is contained in:
gyboth 2008-11-01 11:21:28 +00:00
parent e03374deaa
commit 7b670240ab
4 changed files with 58 additions and 24 deletions

View File

@ -1,26 +1,26 @@
/*
game.c
game.c
Bygfoot Football Manager -- a small and simple GTK2-based
football management game.
Bygfoot Football Manager -- a small and simple GTK2-based
football management game.
http://bygfoot.sourceforge.net
http://bygfoot.sourceforge.net
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "cup.h"
@ -186,7 +186,7 @@ game_get_player(const Team *tm, gint player_type,
if(i < 10)
g_print("prob %.3f ", probs[i]);
g_print("%d %20s health %d cskill %.2f\n", i, player_of_idx_team(tm, i)->name,
player_of_idx_team(tm, i)->health, player_of_idx_team(tm, i)->cskill);
player_of_idx_team(tm, i)->health, player_of_idx_team(tm, i)->cskill);
}
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
@ -977,8 +977,8 @@ game_post_match(Fixture *fix)
if((debug > 100 && fixture_user_team_involved(fix) != -1) ||
debug > 130)
g_print("game_post_match: %s - %s\n",
fix->teams[0]->name,
fix->teams[1]->name);
fix->teams[0]->name,
fix->teams[1]->name);
if(query_fixture_has_tables(fix))
table_update(fix);

View File

@ -248,8 +248,7 @@ transfer_evaluate_offers(void)
player_of_id_team(trans(i).tm, trans(i).id)->name);
transoff(i, j).status = TRANSFER_OFFER_REJECTED;
}
else if(query_player_star_balks(
player_of_id_team(trans(i).tm, trans(i).id), transoff(i, j).tm, TRUE))
else if(transfer_new_star_balks(&trans(i), &transoff(i, j)))
{
user_event_add(
user_from_team(transoff(i, j).tm),
@ -548,3 +547,35 @@ transfer_get_previous_offer(const Transfer *tr, const Team *tm, gint *fee, gint
*wage = g_array_index(tr->offers, TransferOffer, i).wage;
}
}
/** Find out if a potential new star balks because there are already
enough stars on the user team. */
gboolean
transfer_new_star_balks(const Transfer *tr, const TransferOffer *troff)
{
gint i;
gint number_of_stars;
/* Weak players never balk. */
if(player_of_id_team(tr->tm, tr->id)->skill <
const_float("float_transfer_star_skill_limit"))
return FALSE;
/* There is some chance that the new star doesn't balk at all. */
if(math_rnd(0, 1) < const_float("float_transfer_star_no_balk"))
return FALSE;
/* Find out if there are any stars at all on the team. */
number_of_stars = 0;
for(i = 0; i < troff->tm->players->len; i++)
{
if(g_array_index(troff->tm->players, Player, i).skill >
const_float("float_transfer_star_skill_limit"))
number_of_stars++;
}
if(number_of_stars == 0)
return FALSE;
return (math_rnd(0, 1) > 1 - number_of_stars * const_float("float_transfer_star_prob_decrease"));
}

View File

@ -96,4 +96,7 @@ transfer_offers_pending(void);
void
transfer_get_previous_offer(const Transfer *tr, const Team *tm, gint *fee, gint *wage);
gboolean
transfer_new_star_balks(const Transfer *tr, const TransferOffer *troff);
#endif

View File

@ -96,13 +96,13 @@ float_team_stadium_safety_upper 100000
# ticket price; this determines together with
# the player wages the size of the stadium at
# generation. It's also used inattendance
# generation. Also used in attendance
# calculation
int_team_stadium_ticket_price 25
# price vs attendace. This determines together
# with the prices gow high the attedace will be
float_team_stadium_price_attendance_factor 5000
# with the prices how high the attedace will be
float_team_stadium_price_attendance_factor 4000
# factor for stadium size; this determines the income
# of the user teams