1
0
forked from 0ad/0ad

Fixes the tutorial AI and updates the tutorial with the blacksmith.

This was SVN commit r15016.
This commit is contained in:
scythetwirler 2014-04-27 03:22:02 +00:00
parent 98905af6eb
commit bc9b7f9af3
2 changed files with 18 additions and 8 deletions

View File

@ -71,7 +71,7 @@ var introductoryTutorial = [
"time": 34 //TODO: This is a hack, should be when town phase is researched
},
{
"instructions": markForTranslation("Build a barracks nearby. Whenever your population limit is reached, build an extra house using any available builder units."),
"instructions": markForTranslation("Build a Barracks nearby. Whenever your population limit is reached, build an extra house using any available builder units."),
"trigger": "entity_count",
"template": "units/spart_support_female_citizen",
"count": 8
@ -83,12 +83,18 @@ var introductoryTutorial = [
"count": 1
},
{
"instructions": markForTranslation("Select the Barracks and research the Infantry Training technology (sword icon) to improve infantry hack attack."),
"action": introductory_tutorial_attack,
"instructions": markForTranslation("Build a Blacksmith and research the Infantry Training technology (sword icon) to improve infantry hack attack."),
"trigger": "entity_count",
"template": "structures/spart_defense_tower",
"count": 1
},
{
"instructions": markForTranslation("The enemy is coming. Build more soldiers to fight off the enemies."),
"action": introductory_tutorial_attack,
"trigger": "entity_count",
"template": "structures/spart_blacksmith",
"count": 1
},
{
"instructions": markForTranslation("The enemy's attack has been defeated. Now build a market and temple while assigning new units to gather any required resources."),
"trigger": "dead_enemy_units",
@ -123,7 +129,7 @@ var introductoryTutorial = [
}
];
var introductory_tutorial_attack = function(gameState) {
function introductory_tutorial_attack (gameState) {
var units = gameState.updatingCollection(
"intro_tutorial_attackers",
API3.Filters.or(
@ -141,7 +147,7 @@ var introductory_tutorial_attack = function(gameState) {
units.move(towerPos[0]+5, towerPos[1]+15);
}
var introductory_tutorial_remove_champions = function(gameState) {
function introductory_tutorial_remove_champions (gameState) {
var units = gameState.updatingCollection(
"intro_tutorial_champions",
API3.Filters.or(
@ -160,4 +166,4 @@ var introductory_tutorial_remove_champions = function(gameState) {
);
units.destroy();
}
}

View File

@ -135,7 +135,12 @@ m.TutorialAI.prototype.OnUpdate = function() {
}
break;
case "dead_enemy_units":
var ents = gameState.updatingCollection(nextState.collectionId);
var ents = gameState.updatingCollection(nextState.collectionId,
API3.Filters.or(
API3.Filters.byType("units/athen_infantry_spearman_b"),
API3.Filters.byType("units/athen_infantry_javelinist_b")
),
gameState.getOwnEntities());
if (ents.length === 0) {
doNext = true;
}
@ -159,7 +164,6 @@ m.TutorialAI.prototype.OnUpdate = function() {
this.currentState = this.tutorial[this.currentPos];
this.chat(this.currentState.instructions);
this.lastChat = gameState.getTimeElapsed();
if (this.currentState.action) {
this.currentState.action(gameState);
}