Skip to content
Snippets Groups Projects
Commit 7f33c82b authored by deuce's avatar deuce
Browse files

Add a separate menu for enntering a guarded sector, and fix calculations of

captured holds when destroying an enemy.
parent 518e012e
Branches
Tags
No related merge requests found
ɹForward Viewͻ͹TradeWars2/JavaScript Sector Invasionͻ
 . .. 
 .  . .  Attack
 . ... Info on you
. .   Quit the Game 
 .  ..  ReDisplay Sector
 .  Retreat
ͼͼ
......@@ -195,8 +195,8 @@ function AttackPlayer()
var j;
console.writeln("You destroyed the ship and salvaged these cargo holds:");
var holds=new Array(Commodities.length+1);
for(i=0; i<holds.length+1; i++)
var holds=new Array(Commodities.length);
for(i=0; i<holds.length; i++)
holds[i]=0;
for(i=0; i<otherplayer.Holds; i++) {
var limit=0;
......@@ -549,9 +549,9 @@ function DoBattle(opp, otherteam)
console.writeln("You lost "+lost+" fighter(s), "+player.Fighters+" remain.");
if(opp.Fighters > 0)
console.write("You destroyed "+killed+" enemy fighters, "+opp.Fighters+" remain.");
console.writeln("You destroyed "+killed+" enemy fighters, "+opp.Fighters+" remain.");
else
console.write("You destroyed all of the enemy fighters.");
console.writeln("You destroyed all of the enemy fighters.");
return(killed);
}
}
......
......@@ -79,13 +79,13 @@ function EnterSector() /* 20000 */
console.attributes="Y";
sector=db.read(Settings.DB,'sectors.'+player.Sector,LOCK_READ);
DisplaySector(sector,player.Sector,false);
if(sector.FighterOwner > 0) {
otherplayer=players.Get(sector.FighterOwner);
if(otherplayer.TeamNumber > 0)
fighterteam=otherplayer.TeamNumber;
}
while(sector.FighterOwner != player.Record && sector.Fighters > 0 && fighterteam != player.TeamNumber) {
DisplaySector(sector,player.Sector,false,'enter.ans');
console.writeln("You have to destroy the fighters before you can enter this sector.");
console.writeln("Fighters: "+player.Fighters+" / "+sector.Fighters);
console.write("Option? (A,D,I,Q,R,?):? ");
......@@ -111,7 +111,7 @@ function EnterSector() /* 20000 */
case 'D':
console.writeln("<Display>");
sector=db.read(Settings.DB,'sectors.'+player.Sector,LOCK_READ);
DisplaySector(sector,player.Sector,false);
DisplaySector(sector,player.Sector,false,'enter.ans');
break;
case 'I':
console.writeln("<Info>");
......@@ -198,10 +198,11 @@ function EnterSector() /* 20000 */
console.writeln("Invalid command. ? = Help");
}
}
DisplaySector(sector,player.Sector,false,'main.ans');
return(true);
}
function DisplaySector(sector, secnum, helponly)
function DisplaySector(sector, secnum, helponly, mainfname)
{
var i;
var count=0;
......@@ -215,7 +216,7 @@ function DisplaySector(sector, secnum, helponly)
}
if(user.settings&USER_ANSI) {
console.printfile(fname("main.ans"));
console.printfile(fname(mainfname));
if(sector.Port > 0)
console.printfile(fname("port.ans"));
if(sector.Planet > 0)
......
......@@ -85,7 +85,7 @@ function Menu(sector)
case 'D':
console.writeln("<Display>");
sector=db.read(Settings.DB,'sectors.'+player.Sector,LOCK_READ);
DisplaySector(sector,player.Sector,false);
DisplaySector(sector,player.Sector,false,'main.ans');
continue;
case 'E':
if(user.level < 90)
......@@ -138,7 +138,7 @@ function Menu(sector)
console.crlf();
if(user.settings&USER_ANSI) {
sector=db.read(Settings.DB,'sectors.'+player.Sector,LOCK_READ);
DisplaySector(sector,player.Sector,true);
DisplaySector(sector,player.Sector,true,'main.ans');
}
else
console.printfile(fname("main.asc"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment