Has anyone tried to make code like this?
Basicly it chages some strategies depending of some conditions & randomness.
P.S.
I put this in General Forum several days ago, but nobody replied.
PHP Code:
HandleEvent(NextStrategicState) 'StrategiesSpecial' pre {
int_t my_cities;
int_t strat_rnd;
player[0] = g.player;
my_cities = player[0].cities;
strat_rnd = random(100);
if (strat_rnd <= 50) {
if (HasAdvance(player[0], ID_ADVANCE_AERODYNAMICS)
|| HasAdvance(player[0], ID_ADVANCE_SUPERSONIC_FLIGHT)
|| HasAdvance(player[0], ID_ADVANCE_ADVANCED_COMPOSITES)) {
ConsiderStrategicState(player[0], 9800, StrategyDB(STRATEGY_AIR_SPECIAL));
}
}
strat_rnd = random(100);
if (strat_rnd <= 33) {
if (HasAdvance(player[0], ID_ADVANCE_GUIDED_WEAPON_SYSTEMS)) {
ConsiderStrategicState(player[0], 9900, StrategyDB(STRATEGY_MISSILE_SPECIAL));
}
}
strat_rnd = random(100);
if (strat_rnd <= 50) {
if (HasAdvance(player[0], ID_ADVANCE_NATIONALISM)
|| HasAdvance(player[0], ID_ADVANCE_NEURAL_INTERFACE)) {
ConsiderStrategicState(player[0], 9800, StrategyDB(STRATEGY_SPECIAL_SPY));
}
}
strat_rnd = random(100);
if (strat_rnd <= 33) {
if (HasAdvance(player[0], ID_ADVANCE_NUCLEAR_POWER)
&& WonderOwner(WonderDB(WONDER_NANITE_DEFUSER)) < 0) {
if (my_cities > 35) {
ConsiderStrategicState(player[0], 9900, StrategyDB(STRATEGY_THE_MAXIMUM_NUKES));
}
if (my_cities <= 35 && my_cities > 20) {
ConsiderStrategicState(player[0], 9900, StrategyDB(STRATEGY_THE_AVERAGE_NUKES));
}
if (my_cities <= 20 && my_cities > 6) {
ConsiderStrategicState(player[0], 9900, StrategyDB(STRATEGY_THE_MINIMAL_NUKES));
}
if (my_cities <= 6) {
ConsiderStrategicState(player[0], 9900, StrategyDB(STRATEGY_A_PAIR_OF_NUKES));
}
}
}
if (my_cities < 4 && g.year > 75 && player[0] != 0) {
ConsiderStrategicState(player[0], 9999, StrategyDB(STRATEGY_SMALL_EMPIRE));
}
}
P.S.
I put this in General Forum several days ago, but nobody replied.
Comment