Revert simplification of upkeep,

...as per ml discussion so scottk doesn't work himself to death.
This commit is contained in:
Rusty Russell 2006-05-19 08:15:18 +00:00
parent a177dbc3a8
commit 307c813c16
13 changed files with 31 additions and 32 deletions

View file

@ -96,8 +96,6 @@ SVN trunk (1.1.2+svn):
* fix alt key under MacosX
* help contents available from title screen
* preferences available from multiplayer lobby
* simplified upkeep: Each controlled village gives 2 GP per turn, and
each unit costs 1*(# of Levels) GP per turn, unless loyal.
* new /help command in mp lobby to get info on available commands
* :mute command to silent observers
* new --turns= commandline parameter

View file

@ -46,7 +46,7 @@ default=yes
[game_config]
base_income=2
village_income=2
village_income=1
poison_amount=8
rest_heal_amount=2
recall_cost=20

View file

@ -233,11 +233,11 @@ id=income_and_upkeep
title= _ "Income and Upkeep"
text= _ "In Wesnoth, it is not enough simply to recruit units and fight. You must watch your gold as well, especially in campaigns, where you can carry extra gold over from one scenario to the next. There are two aspects to this; Income and Upkeep." + _"
Income is simple. You have a base income of 2 gold per turn. For every village you control, you gain two additional gold each turn. Thus, if you have five villages, you would normally gain 12 gold each turn. Your Upkeep costs are subtracted from this income, as detailed below." + _"
Income is simple. You have a base income of 2 gold per turn. For every village you control, you gain one additional gold each turn. Thus, if you have ten villages, you would normally gain 12 gold each turn. Your Upkeep costs are subtracted from this income, as detailed below." + _"
Upkeep is also fairly simple. Each unit requires an amount of Upkeep equal to its level. For example, if you have five level one units and one level two unit, all your upkeep would cost 7 gold each turn." + _"
Upkeep is also fairly simple. Each unit requires an amount of Upkeep equal to its level. You can support as many levels <italic>text=worth</italic> of units as you have villages, without paying any upkeep. However, for each level of unit beyond the number of villages you have, you must pay one gold per turn. For example, if you have twelve level one units and ten villages, you would have to pay two gold each turn in upkeep." + _"
Upkeep costs are subtracted from your Income, so in the case of seven levels of units and five villages, your resultant Income would be 3 gold per turn." + _"
Upkeep costs are subtracted from your Income, so in the case of twelve levels of units and ten villages, your resultant Income would be 10 gold per turn." + _"
There is one important exception to Upkeep: units with the Loyal trait never incur upkeep. Units you begin the scenario with (such as Konrad or Delfador), or units who join you during a scenario (such as the Horseman in the second scenario of Heir to the Throne) will usually have the Loyal trait."
[/topic]

View file

@ -468,7 +468,7 @@ Now, this quintain gets five chances to hit you, and if it hits every time, you'
{NODEST}
[message]
speaker=narrator
message=_ "You now 'own' this village: you can see it flies your flag, and soon a '1' will appear next to the house icon at the top of screen. Villages give gold: every turn you gain two gold, plus two for every village you own.
message=_ "You now 'own' this village: you can see it flies your flag, and soon a '1' will appear next to the house icon at the top of screen. Villages give gold: every turn you gain two gold, plus one for every village you own.
*Left click or any key to continue..."
[/message]
{PRINT (_"Click on the End Turn button")}
@ -804,6 +804,15 @@ These dummies only attack if you are a single tile away. With care, you should
[message]
speaker=narrator
message=_ "Note:
Each village you own can support a single unit for free. After that, each unit costs you one gold per turn."
[/message]
[/event]
[event]
name="turn 10"
[message]
speaker=narrator
message=_ "Note:
When a unit gets enough experience (the experience bar is the smaller bar on the right), it will go up a level. Elvish Fighters have two options, and you will get to choose which one you want."
[/message]
[/event]

View file

@ -841,7 +841,7 @@ One Elvish Shaman")}
{NUMEQ villages_around_keep 1}
[then]
# FIXME: Level 2 units change costs.
{TEACHER (_"You've learned well, $student|! The village pays two gold per turn: you're only losing 1 gold per turn now.")}
{TEACHER (_"You've learned well, $student|! The village supports one unit, and pays one gold per turn: you're only losing 1 gold per turn now.")}
{PRINT (_"End your turn")}
[/then]
[/if]

View file

@ -325,10 +325,10 @@ void play_controller::init_side(const unsigned int team_index){
//if the expense is less than the number of villages owned,
//then we don't have to pay anything at all
const int expense = team_upkeep(units_,player_number_);
const int expense = team_upkeep(units_,player_number_) -
current_team.villages().size();
if(expense > 0) {
current_team.spend_gold(expense);
current_team.max_upkeep(expense);
}
calculate_healing((*gui_),map_,units_,player_number_,teams_, !recorder.is_skipping());

View file

@ -263,15 +263,15 @@ LEVEL_RESULT playsingle_controller::play_scenario(const std::vector<config*>& st
player_info *player=gamestate_.get_player(i->save_id());
const int remaining_gold = i->gold();
const int finishing_bonus_per_turn =(
const int finishing_bonus_per_turn =
map_.villages().size() * game_config::village_income +
game_config::base_income) - i->get_max_upkeep();
game_config::base_income;
const int turns_left = maximum<int>(0,status_.number_of_turns() - status_.turn());
const int finishing_bonus = end_level.gold_bonus ?
(finishing_bonus_per_turn * turns_left) : 0;
if(player) {
player->gold = ((remaining_gold + finishing_bonus * 115 / 100) * 80) / 100;
player->gold = ((remaining_gold + finishing_bonus) * 80) / 100;
if(gamestate_.players.size()>1) {
if(i!=teams_.begin()) {

View file

@ -34,7 +34,7 @@ namespace {
"unit_alignment","unit_abilities","unit_hp","unit_xp",
"unit_advancement_options","unit_moves","unit_weapons",
"unit_image","unit_profile","time_of_day",
"turn","gold","villages","num_units","upkeep",
"turn","gold","villages","num_units","upkeep", "expenses",
"income", "terrain", "position", "side_playing", "observers",
"report_countdown", "report_clock",
"selected_terrain","edit_left_button_function"
@ -348,7 +348,12 @@ Units cannot be killed by poison alone. The poison will not reduce it below 1 HP
}
case UPKEEP: {
const team_data data = calculate_team_data(current_team,current_side,units);
str << data.upkeep;
str << data.expenses << " (" << data.upkeep << ")";
break;
}
case EXPENSES: {
const team_data data = calculate_team_data(current_team,current_side,units);
str << data.expenses;
break;
}
case INCOME: {

View file

@ -33,7 +33,7 @@ namespace reports {
UNIT_ALIGNMENT, UNIT_ABILITIES, UNIT_HP, UNIT_XP,
UNIT_ADVANCEMENT_OPTIONS, UNIT_MOVES, UNIT_WEAPONS,
UNIT_IMAGE, UNIT_PROFILE, TIME_OF_DAY,
TURN, GOLD, VILLAGES, NUM_UNITS, UPKEEP,
TURN, GOLD, VILLAGES, NUM_UNITS, UPKEEP, EXPENSES,
INCOME, TERRAIN, POSITION, SIDE_PLAYING, OBSERVERS,
REPORT_COUNTDOWN, REPORT_CLOCK, SELECTED_TERRAIN,
EDIT_LEFT_BUTTON_FUNCTION, NUM_REPORTS};

View file

@ -94,7 +94,6 @@ team::team_info::team_info(const config& cfg)
income = cfg["income"];
name = cfg["name"];
team_name = cfg["team_name"];
max_upkeep = lexical_cast_default<int>(cfg["max_upkeep"]);
if(team_name.empty()) {
team_name = cfg["side"];
}
@ -242,15 +241,6 @@ team::team_info::team_info(const config& cfg)
music = cfg["music"];
}
void team::max_upkeep(int amount) const
{
info_.max_upkeep = maximum<int>(info_.max_upkeep,amount);
}
int team::get_max_upkeep() const
{
return info_.max_upkeep;
}
void team::team_info::write(config& cfg) const
{
for(std::vector<config>::const_iterator ai = ai_params.begin(); ai != ai_params.end(); ++ai) {
@ -261,7 +251,6 @@ void team::team_info::write(config& cfg) const
cfg["gold"] = gold;
cfg["income"] = income;
cfg["max_upkeep"] = lexical_cast_default<std::string>(max_upkeep);
cfg["name"] = name;
cfg["team_name"] = team_name;
cfg["save_id"] = save_id;

View file

@ -75,7 +75,6 @@ public:
std::string save_id;
std::string countdown_time;
int action_bonus_count;
mutable int max_upkeep;
std::string flag;
@ -121,8 +120,6 @@ public:
int gold() const;
int income() const;
void max_upkeep(int amount) const;
int get_max_upkeep() const;
void new_turn();
void set_time_of_day(int turn, const struct time_of_day& tod);
void get_shared_maps();

View file

@ -2775,7 +2775,8 @@ team_data calculate_team_data(const team& tm, int side, const unit_map& units)
res.units = team_units(units,side);
res.upkeep = team_upkeep(units,side);
res.villages = tm.villages().size();
res.net_income = tm.income() - res.upkeep;
res.expenses = maximum<int>(0,res.upkeep - res.villages);
res.net_income = tm.income() - res.expenses;
res.gold = tm.gold();
return res;
}

View file

@ -404,7 +404,7 @@ unit_map::const_iterator find_visible_unit(const unit_map& units,
struct team_data
{
int units, upkeep, villages, net_income, gold;
int units, upkeep, villages, expenses, net_income, gold;
};
team_data calculate_team_data(const class team& tm, int side, const unit_map& units);