fix a crash, add a normal bot (harder)

This commit is contained in:
Chris Forbes
2010-12-21 18:33:11 +13:00
parent e94e21fd32
commit 92e6570f50
2 changed files with 32 additions and 10 deletions

View File

@@ -38,6 +38,9 @@ namespace OpenRA.Mods.RA
[FieldLoader.Load] [FieldLoader.Load]
public readonly string Name; public readonly string Name;
[FieldLoader.Load]
public readonly int SquadSize = 8;
string IBotInfo.Name { get { return this.Name; } } string IBotInfo.Name { get { return this.Name; } }
[FieldLoader.LoadUsing("LoadUnits")] [FieldLoader.LoadUsing("LoadUnits")]
@@ -256,17 +259,13 @@ namespace OpenRA.Mods.RA
//This is purely to identify production buildings that don't have a rally point set. //This is purely to identify production buildings that don't have a rally point set.
List<Actor> activeProductionBuildings = new List<Actor>(); List<Actor> activeProductionBuildings = new List<Actor>();
bool IsHumanPlayer(Player p) bool IsHumanPlayer(Player p) { return !p.IsBot && !p.NonCombatant; }
{
/* hack hack: this actually detects 'is not HackyAI' -- possibly actually a good thing. */
var hackyAI = p.PlayerActor.Trait<HackyAI>();
return !hackyAI.enabled;
}
bool HasHumanPlayers() bool HasHumanPlayers()
{ {
return p.World.players.Any(a => !a.Value.IsBot && !a.Value.NonCombatant); return p.World.players.Any(a => !a.Value.IsBot && !a.Value.NonCombatant);
} }
int2? ChooseEnemyTarget() int2? ChooseEnemyTarget()
{ {
// Criteria for picking an enemy: // Criteria for picking an enemy:
@@ -305,7 +304,7 @@ namespace OpenRA.Mods.RA
/* Create an attack force when we have enough units around our base. */ /* Create an attack force when we have enough units around our base. */
// (don't bother leaving any behind for defense.) // (don't bother leaving any behind for defense.)
if (unitsHangingAroundTheBase.Count > 8) if (unitsHangingAroundTheBase.Count >= Info.SquadSize)
{ {
BotDebug("Launch an attack."); BotDebug("Launch an attack.");

View File

@@ -32,7 +32,7 @@ Player:
InitialCash: 5000 InitialCash: 5000
ActorGroupProxy: ActorGroupProxy:
DeveloperMode: DeveloperMode:
HackyAI@Default: HackyAI@EasyAI:
Name:Easy AI Name:Easy AI
BuildingFractions: BuildingFractions:
proc: 20% proc: 20%
@@ -40,7 +40,6 @@ Player:
tent: 5% tent: 5%
weap: 5% weap: 5%
pbox: 5% pbox: 5%
hbox: 5%
gun: 5% gun: 5%
tsla: 5% tsla: 5%
ftur: 5% ftur: 5%
@@ -48,9 +47,9 @@ Player:
sam: 1% sam: 1%
atek: 1% atek: 1%
stek: 1% stek: 1%
silo: 5%
fix: 1% fix: 1%
dome: 1% dome: 1%
hbox: 5%
UnitsToBuild: UnitsToBuild:
e1: 0% e1: 0%
e2: 0% e2: 0%
@@ -58,6 +57,30 @@ Player:
1tnk: 0% 1tnk: 0%
2tnk: 0% 2tnk: 0%
3tnk: 0% 3tnk: 0%
HackyAI@NormalAI:
Name:Normal AI
BuildingFractions:
proc: 30%
tent: 1%
weap: 1%
pbox: 5%
gun: 15%
ftur: 10%
tsla: 15%
dome: 1%
agun: 5%
sam: 1%
atek: 1%
stek: 1%
fix: 0.1%
UnitsToBuild:
1tnk: 0%
2tnk: 0%
3tnk: 0%
4tnk: 0%
arty: 0%
v2rl: 0%
SquadSize: 15
PlayerColorPalette: PlayerColorPalette:
BasePalette: terrain BasePalette: terrain
SurrenderOnDisconnect: SurrenderOnDisconnect: