Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #875704 ยป 0004-Government-action-immunity-score-by-action-result.patch

Sveinung Kvilhaugsvik, 2020-05-30 11:46 PM

View differences:

server/advisors/advdata.c
/* TODO: Individual and well balanced value. */
action_iterate(act) {
struct action *paction = action_by_number(act);
if (!action_immune_government(gov, act)) {
/* This government doesn't provide immunity againt this
* action. */
continue;
}
switch ((enum gen_action)act) {
case ACTION_ATTACK:
case ACTION_SUICIDE_ATTACK:
case ACTION_SPY_INCITE_CITY:
case ACTION_SPY_INCITE_CITY_ESC:
case ACTION_CONQUER_CITY:
case ACTION_CONQUER_CITY2:
switch (paction->result) {
case ACTRES_ATTACK:
case ACTRES_SPY_INCITE_CITY:
case ACTRES_CONQUER_CITY:
bonus += 4;
break;
case ACTION_SPY_BRIBE_UNIT:
case ACTRES_SPY_BRIBE_UNIT:
bonus += 2;
break;
case ACTION_TRANSFORM_TERRAIN:
case ACTRES_TRANSFORM_TERRAIN:
bonus += 1.5;
break;
case ACTION_CULTIVATE:
case ACTION_PLANT:
case ACTRES_CULTIVATE:
case ACTRES_PLANT:
bonus += 0.3;
break;
case ACTION_PILLAGE:
case ACTRES_PILLAGE:
bonus += 0.2;
break;
case ACTION_SPY_INVESTIGATE_CITY:
case ACTION_INV_CITY_SPEND:
case ACTION_SPY_POISON:
case ACTION_SPY_POISON_ESC:
case ACTION_SPY_SPREAD_PLAGUE:
case ACTION_SPY_STEAL_GOLD:
case ACTION_SPY_STEAL_GOLD_ESC:
case ACTION_SPY_SABOTAGE_CITY:
case ACTION_SPY_SABOTAGE_CITY_ESC:
case ACTION_SPY_TARGETED_SABOTAGE_CITY:
case ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC:
case ACTION_SPY_SABOTAGE_CITY_PRODUCTION:
case ACTION_SPY_SABOTAGE_CITY_PRODUCTION_ESC:
case ACTION_SPY_STEAL_TECH:
case ACTION_SPY_STEAL_TECH_ESC:
case ACTION_SPY_TARGETED_STEAL_TECH:
case ACTION_SPY_TARGETED_STEAL_TECH_ESC:
case ACTION_SPY_SABOTAGE_UNIT:
case ACTION_SPY_SABOTAGE_UNIT_ESC:
case ACTION_CAPTURE_UNITS:
case ACTION_STEAL_MAPS:
case ACTION_STEAL_MAPS_ESC:
case ACTION_BOMBARD:
case ACTION_BOMBARD2:
case ACTION_BOMBARD3:
case ACTION_SPY_NUKE:
case ACTION_SPY_NUKE_ESC:
case ACTION_NUKE:
case ACTION_NUKE_CITY:
case ACTION_NUKE_UNITS:
case ACTION_DESTROY_CITY:
case ACTION_EXPEL_UNIT:
case ACTION_STRIKE_BUILDING:
case ACTION_STRIKE_PRODUCTION:
case ACTION_SPY_ATTACK:
case ACTRES_SPY_INVESTIGATE_CITY:
case ACTRES_SPY_POISON:
case ACTRES_SPY_SPREAD_PLAGUE:
case ACTRES_SPY_STEAL_GOLD:
case ACTRES_SPY_SABOTAGE_CITY:
case ACTRES_SPY_TARGETED_SABOTAGE_CITY:
case ACTRES_SPY_SABOTAGE_CITY_PRODUCTION:
case ACTRES_SPY_STEAL_TECH:
case ACTRES_SPY_TARGETED_STEAL_TECH:
case ACTRES_SPY_SABOTAGE_UNIT:
case ACTRES_CAPTURE_UNITS:
case ACTRES_STEAL_MAPS:
case ACTRES_BOMBARD:
case ACTRES_SPY_NUKE:
case ACTRES_NUKE:
case ACTRES_NUKE_CITY:
case ACTRES_NUKE_UNITS:
case ACTRES_DESTROY_CITY:
case ACTRES_EXPEL_UNIT:
case ACTRES_STRIKE_BUILDING:
case ACTRES_STRIKE_PRODUCTION:
case ACTRES_SPY_ATTACK:
/* Being a target of this is usually undesireable */
/* TODO: Individual and well balanced values. */
bonus += 0.1;
break;
case ACTION_MARKETPLACE:
case ACTION_FOUND_CITY:
case ACTION_DISBAND_UNIT:
case ACTION_PARADROP:
case ACTION_FORTIFY:
case ACTRES_MARKETPLACE:
case ACTRES_FOUND_CITY:
case ACTRES_DISBAND_UNIT:
case ACTRES_PARADROP:
case ACTRES_FORTIFY:
/* Wants the ability to do this to it self. Don't want others
* to target it. Do nothing since action_immune_government()
* doesn't separate based on who the actor is. */
break;
case ACTION_USER_ACTION1:
case ACTION_USER_ACTION2:
case ACTION_USER_ACTION3:
case ACTRES_NONE:
/* Ruleset defined */
break;
case ACTION_ESTABLISH_EMBASSY:
case ACTION_ESTABLISH_EMBASSY_STAY:
case ACTION_TRADE_ROUTE:
case ACTION_JOIN_CITY:
case ACTION_HELP_WONDER:
case ACTION_RECYCLE_UNIT:
case ACTION_HOME_CITY:
case ACTION_UPGRADE_UNIT:
case ACTION_AIRLIFT:
case ACTION_HEAL_UNIT:
case ACTION_ROAD:
case ACTION_CONVERT:
case ACTION_BASE:
case ACTION_MINE:
case ACTION_IRRIGATE:
case ACTION_CLEAN_POLLUTION:
case ACTION_CLEAN_FALLOUT:
case ACTION_TRANSPORT_ALIGHT:
case ACTION_TRANSPORT_UNLOAD:
case ACTION_TRANSPORT_DISEMBARK1:
case ACTION_TRANSPORT_DISEMBARK2:
case ACTION_TRANSPORT_BOARD:
case ACTION_TRANSPORT_EMBARK:
case ACTRES_ESTABLISH_EMBASSY:
case ACTRES_TRADE_ROUTE:
case ACTRES_JOIN_CITY:
case ACTRES_HELP_WONDER:
case ACTRES_RECYCLE_UNIT:
case ACTRES_HOME_CITY:
case ACTRES_UPGRADE_UNIT:
case ACTRES_AIRLIFT:
case ACTRES_HEAL_UNIT:
case ACTRES_ROAD:
case ACTRES_CONVERT:
case ACTRES_BASE:
case ACTRES_MINE:
case ACTRES_IRRIGATE:
case ACTRES_CLEAN_POLLUTION:
case ACTRES_CLEAN_FALLOUT:
case ACTRES_TRANSPORT_ALIGHT:
case ACTRES_TRANSPORT_UNLOAD:
case ACTRES_TRANSPORT_DISEMBARK:
case ACTRES_TRANSPORT_BOARD:
case ACTRES_TRANSPORT_EMBARK:
/* Could be good. An embassy gives permanent contact. A trade
* route gives gold per turn. Join city gives population. Help
* wonder gives shields. */
/* TODO: Individual and well balanced values. */
break;
case ACTION_COUNT:
/* Invalid */
fc_assert(act != ACTION_COUNT);
break;
}
} action_iterate_end;
    (1-1/1)