📄 smugglersingh.java
字号:
a = 6;
fire = 0;
} else
if(fire == 1 && a == 6 && no == 6)
{
a = 2;
fire = 0;
} else
if(fire == 1 && a == 2 && no == 7)
a = 7;
repaint();
}
public void keyPressed(int i)
{
switch(getGameAction(i))
{
case 1: // '\001'
if(a == 3 || a == 4)
{
sumx -= 15;
if(sumx < 0)
sumx = 0;
}
if(a != 2)
break;
if(selno > 1)
{
selno--;
sely -= 15;
}
if(selno <= 1)
selno = 1;
no--;
if(no < 1)
{
fire = 0;
sely = 160;
selno = 7;
no = 7;
}
break;
case 6: // '\006'
if(a == 3)
{
sumx += 15;
if(sumx > 180)
sumx = 180;
}
if(a == 4)
{
sumx += 15;
if(sumx > 180)
sumx = 168;
}
if(a != 2)
break;
if(selno <= 6)
{
selno++;
sely += 15;
}
no++;
if(no > 7)
{
fire = 0;
sely = 70;
selno = 1;
no = 1;
}
break;
case 8: // '\b'
if(fire == 0)
fire = 1;
break;
default:
if(i == -6 && fire == 0)
fire = 1;
break;
}
}
public Intro()
{
intros.setGain(40);
}
}
Display display;
Intro intro;
GameCanvas obj;
Gameover gameover;
buysell bs;
FieldMover mover;
Timer timer;
String store;
public int gamePaint;
public int py;
public int iy;
public int scene;
public int oy;
public int rn;
public int uamt;
public int loan;
public int inp1;
public int titem;
public int pcc;
public boolean checkPause;
public boolean vis;
Random rnd;
Random rnd1;
Random rnd2;
Random rnd3;
Random rnd4;
Font fnt;
Font fnt1;
String places[] = {
"Kabul", "Peshawar", "Delhi", "Hyderabad", "Calcutta", "Pondicherry"
};
String items[] = {
"Rifle", "Gold", "Opium", "Silk", "Dynamite", "Diamonds"
};
String options[] = {
"Buy", "Sell", "Inventory", "Move", "Back", "Exit"
};
String none[] = {
"none", "none", "none", "none", "none", "none"
};
String sum[] = {
"It's the year 1897.", "The Silk Route still runs", "through an undivided India.", "Smuggler Singh travels from", "town to town trading his ", "black market goods. He has ", "a loan to pay off. Singh has", "to keep track of prices and", "rely on the blessings of ", "Laxmi, the Goddess of Wealth.",
"An old beggar may give him a", "tip and a camel seller may ", "provide him with more camels.", "It's the police who he hates.", "If he doesn't bribe them, he", "must out run them or they'll", "shoot him dead. Help Smuggler", "Singh make his living!"
};
String sum1[] = {
"1. Buy more camels as you get", "wealthier. You can carry more", "load this way.", "2. Check your Inventory in ", "the Buy / Sell Menu as often ", "as you can. It helps you keep", "a track of your finances.", "3. Repay your loan as soon as", "possible. The interest builds", "up with time.",
"4. At the beginning, it's ", "often a good idea to have at", "least 500 coins with you at", "all times. You never know ", "when the cops will raid your ", "camp. You need to have ", "enough coins to bribe them."
};
int price[];
int chk[];
int in[];
int buy[];
public int inpno;
public int count;
public int xx;
public int inp;
public int cup;
public int capa;
public int sumx;
public int flg;
public int tip;
public int poli;
public int cam;
public int turn;
public int tipa;
public int tipit;
public int tipci;
public int tiph;
public int loant;
public int mfr;
byte abyte0[];
Sound intros;
public Image bul;
public Image menu;
public Image load;
public Image m2w;
public Image gover;
public Image gintro;
public Image bg;
public Image joy;
public Image camel;
public Image police;
public Image begger;
int a;
int cnt;
int j;
int selx;
int sely;
int selno;
int up;
int down;
int right;
int left;
int fire;
int sound;
int w;
int h;
int intcnt;
int game;
int no;
int xy;
int gend;
int scr;
int bpc;
String comment;
static final String DBNAME = "Test";
public boolean highscorecheck;
public boolean highscoretext;
public SmugglerSingh()
{
mover = new FieldMover();
timer = new Timer();
fnt = Font.getFont(0, 1, 8);
fnt1 = Font.getFont(0, 0, 8);
price = new int[6];
chk = new int[6];
in = new int[6];
buy = new int[6];
mfr = 0;
abyte0 = new byte[200];
intros = a(this, "/intro.ott", abyte0);
sound = 0;
comment = "";
highscorecheck = true;
highscoretext = false;
intro = new Intro();
obj = new GameCanvas();
bs = new buysell();
display = Display.getDisplay(this);
}
public void PlayAgain()
{
Init();
}
public void anim(Graphics g)
{
g.setColor(0, 0, 0);
for(int i = 0; i < 20; i++)
g.fillRect(0, 0 + i * 10, 176, 10 - mfr);
mfr += 2;
}
public void End()
{
gameover = new Gameover();
display.setCurrent(gameover);
}
void restartGame(String s)
{
try
{
scr = (int)Long.parseLong(s.substring(0, s.indexOf(64)));
}
catch(Exception exception) { }
}
public void Init()
{
PriceRandom();
scene = 1;
uamt = 500;
loan = 2000;
xx = 85;
bpc = 0;
pcc = 0;
poli = 0;
cam = 0;
py = 1;
cup = 1;
capa = 30;
tipci = 0;
tipit = 0;
loant = 3;
sumx = 0;
tiph = 0;
highscorecheck = true;
highscoretext = false;
for(int i = 0; i < 6; i++)
buy[i] = 0;
flg = 0;
turn = 30;
tip = 2;
py = cup - 1;
if(py < 0)
py = places.length - 1;
titem = 0;
}
public void PriceRandom()
{
if(turn % 2 == 0)
loant = 3;
if(turn % 2 == 0)
{
rnd = new Random();
bpc = Math.abs(rnd.nextInt() % 100);
if(bpc < 0)
bpc = -bpc;
}
System.out.println("bpc" + bpc);
if(turn < 29)
if(bpc >= 20 && bpc < 50 && uamt >= 200 && tip == 2)
{
scene = 7;
tip = 3;
} else
if(bpc >= 70 && bpc < 100 && uamt >= 400 && capa < 80)
scene = 9;
else
if(bpc >= 55 && bpc < 70)
scene = 8;
bpc = 0;
price[0] = Math.abs(rnd.nextInt() % 900);
price[1] = Math.abs(rnd.nextInt() % 5000);
price[2] = Math.abs(rnd.nextInt() % 1100);
price[3] = Math.abs(rnd.nextInt() % 800);
price[4] = Math.abs(rnd.nextInt() % 200);
price[5] = Math.abs(rnd.nextInt() % 20000);
rnd4 = new Random();
if(tip == 1)
{
if(tipci == cup && tiph == 1)
{
price[tipit] = price[tipit] * 10;
if(price[tipit] < 1000)
price[tipit] = price[tipit] + 1000;
}
if(tipci == cup && tiph == 0)
price[tipit] = price[tipit] / 50 + 5;
tip = 2;
} else
if(tip == 1)
tip = 2;
if(price[0] < 100 && tipit != 0)
chk[0] = 1;
else
chk[0] = 0;
if(price[1] < 900 && tipit != 1)
chk[1] = 1;
else
chk[1] = 0;
if(price[2] < 300 && tipit != 2)
chk[2] = 1;
else
chk[2] = 0;
if(price[3] < 100 && tipit != 3)
chk[3] = 1;
else
chk[3] = 0;
if(price[4] < 20 && tipit != 4)
chk[4] = 1;
else
chk[4] = 0;
if(price[5] < 2500 && tipit != 5)
chk[5] = 1;
else
chk[5] = 0;
tipit = 10;
}
public void InputText(Graphics g, int i)
{
g.drawRect(w / 2 - 15, 80, 30, 15);
if(count == 2)
i = in[1] * 10 + in[2];
else
if(count == 1)
i = in[1];
if(count <= 1)
if(vis)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -