📄 fight1.cpp
字号:
louttextxy(fe_x[en[st[i].obj].seat]+rand()%3,30-y,hp);
lOutToScr(&ls,0,0,0,0,319,239);
Noop(fight_delay);
}
}
if (en[st[i].obj].hp<=0) {
en[st[i].obj].hp=0;
Dead(st[i].obj,0);
}
}
if (st[i].atf==4) {
for (j=0;j<fenemy_num;j++){
if (en[j].attrib==2) {
lputImage(fa_x[st[i].source],189,menu_p.LpcImage[27]);
louttextxy(fa_x[st[i].source]+5,177,"逃跑失败");
Noop(fight_delay*60);
}
else { if (st[i].sm-en[st[i].obj].sm>en[st[i].obj].sm/2) {
lputImage(fa_x[st[i].source],189,menu_p.LpcImage[27]);
louttextxy(fa_x[st[i].source]+5,177,"逃跑成功");
Noop(fight_delay*60);
newflag=1;
Victory_Fight(0);
return 1;
}
else { lputImage(fa_x[st[i].source],189,menu_p.LpcImage[27]);
louttextxy(fa_x[st[i].source]+5,177,"逃跑失败");
}
}
}
}
break;
case 1: //if (en[st[i].source].flag) { // PATCH
if (en[st[i].source].flag==99||en[st[i].source].flag==0) break;
if (en[st[i].source].flag!=99&&en[st[i].source].flag!=0) {
if (st[i].atf==1&&ac[st[i].obj].flag!=99&&ac[st[i].obj].flag) {
ac[st[i].obj].hp=ac[st[i].obj].hp-(en[st[i].source].at*3)/ac[st[i].obj].df;
if (ac[st[i].obj].hp<=0) ac[st[i].obj].hp=0;
lBlitFast(&ls,0,0,0,240,319,479,&ls,0);
Fighter_View();
lputSpirit(fe_x[en[st[i].source].seat],40,menu_p.LpcImage[1]);
lOutToScr(&ls,0,0,0,0,319,239);
Noop(fight_delay*25);
Fighter_View();
}
if (st[i].atf==2) {
lBlitFast(&ls,0,0,0,240,319,479,&ls,0);
Fighter_View();
lputSpirit(fe_x[en[st[i].source].seat],40,menu_p.LpcImage[7]);
lOutToScr(&ls,0,0,0,0,319,239);
Noop(fight_delay*30);
}
if (ac[st[i].obj].hp<=0) {
ac[st[i].obj].hp=0;
Dead(st[i].obj,1);
}
}
break;
case 2: //if (ac[st[i].source].flag&&ac[st[i].obj].flag){
lBlitFast(&ls,0,0,0,240,319,479,&ls,0);
lOutToScr(&ls,0,0,0,0,319,239);
// }
break;
case 3: lBlitFast(&ls,0,0,0,240,319,479,&ls,0);
lOutToScr(&ls,0,0,0,0,319,239);
break;
}
}
mode_mf=2,menu=0;
for(i=0;i<9;i++) {
st[i].mode=-1;
st[i].sm=0;
st[i].source=0;
st[i].obj=-1;
st[i].atf=0;
}
return 0;
}
////////////////////////////////////////////////////////////////////////////
void Fight_Control()
{
short k;
int f_l;
f_l=0;
f_f=0;
for (f_i=0;f_i<4&&f_f!=1;f_i++) {
press_count=0;
if (ac[f_i].hp<=0&&ac[f_i].flag) ac[f_i].flag=99;
if (ac[f_i].flag&&ac[f_i].flag!=99) {
while (press_count!=-1){
Fight_Scr_View();
if(mode_mf!=110&&mode_mf!=4) lkgetch(&k);
switch (mode_mf) {
case 2:switch (k) {
case KEY_UP: mode_mf=2,menu=0; break;
case KEY_DOWN: mode_mf=2,menu=2; break;
case KEY_LEFT: mode_mf=2,menu=3; break;
case KEY_RIGHT: mode_mf=2,menu=1; break;
case KEY_SPACE:
case KEY_CTRL:
case KEY_ENTER: if (menu==0) mode_mf=3,menu=0;
if (menu==1) mode_mf=4,menu=0;
if (menu==2) mode_mf=5,menu=0;
if (menu==3) mode_mf=6,menu=0;
break;
case KEY_ALT: // PATCH
case KEY_ESC: //mode_mf=0,menu=0,press_count=-1,f_f=1;
break;
}break;
case 3:switch (k) {
case KEY_LEFT: mode_mf=3,menu=0;break;
case KEY_RIGHT: mode_mf=3,menu=1;break;
case KEY_ALT:
case KEY_ESC: mode_mf=2,menu=0;break;
case KEY_SPACE:
case KEY_ENTER:
case KEY_CTRL: if (menu==0) {
mode_mf=10,menu=0;//mode_mf=110 Fight Enemy
Fighter_count();
if (Choice_Enemy()==1) f_l++;
if (f_l>=factor_num) {
mode_mf=110,menu=0;
}
else mode_mf=2,menu=0;
// debug=f_l;
}
if (menu==1) {
mode_mf=11,menu=0;
Choice_Enemy();
mode_mf=110;
menu=0;
press_count=-1;
}
break;
}break;
case 4: Choice_goods();
mode_mf=2,menu=0;
break;
case 5:switch (k) {
case KEY_LEFT: mode_mf=5,menu=0;break;
case KEY_RIGHT: mode_mf=5,menu=1;break;
case KEY_ALT:
case KEY_ESC: mode_mf=2,menu=0;break;
case KEY_ENTER:
case KEY_CTRL:
case KEY_SPACE: if (menu==0) mode_mf=2,menu=0,st[f_i].atf=3,f_l++;//mode_mf=100 DF mode_mf=101 TAOPAO
if (menu==1) mode_mf=2,menu=0,st[f_i].atf=4,f_l++;
if (f_l>=factor_num) mode_mf=110,press_count=-1,f_f=1;
else mode_mf=2,menu=0,press_count=-1;
break;
}break;
case 6: Choice_magic(f_i);
mode_mf=2,menu=0;
break;
case 110: Fight();
Fighter_count();
if (!fenemy_num) {
Victory_Fight(1);
mode_mf=0;
press_count=-1;
f_f=1;
}
if (!factor_num) {
Failed_Fight();
mode_mf=0;
press_count=-1;
f_f=1;
}
if (factor_num&&fenemy_num) {
mode_mf=2;
menu=0;
press_count=-1;
f_l=0;
f_f=1;
}
break;
}
}
}
}
}
//X,Y is Left top point len>3 wid >3
void Windows_draw(int x,int y,int len,int wid,int no)
{
int i,j,k;
lActiveSurface(&ls);
lBlitFast(&ls,0,0,0,240,319,479,&ls,0);
Fighter_View();
for (i=18;i<21;i++) { if (i==19) for (k=0;k<wid-2;k++) lputImage(x+(34*(i-18)+(34*k)),y,menu_p.LpcImage[i]);
if (i==18) lputImage(x,y,menu_p.LpcImage[i]);
if (i==20) lputImage(x+(34*(wid-1)),y,menu_p.LpcImage[i]);
}
for (j=0;j<len;j++) for (i=21;i<24;i++) { if (i==22) for (k=0;k<wid-2;k++) lputImage(x+(34*(i-21)+(34*k)),y+34+(34*j),menu_p.LpcImage[i]);
if (i==21) lputImage(x,y+34+(34*j),menu_p.LpcImage[i]);
if (i==23) lputImage(x+(34*(wid-1)),y+34+(34*j),menu_p.LpcImage[i]);
}
for (i=24;i<27;i++) { if (i==25) for (k=0;k<wid-2;k++) lputImage(x+(34*(i-24)+(34*k)),y+(len*34),menu_p.LpcImage[i]);
if (i==24) lputImage(x,y+(len*34),menu_p.LpcImage[i]);
if (i==26) lputImage(x+(34*(wid-1)),y+(len*34),menu_p.LpcImage[i]);
}
lOutToScr(&ls,0,0,0,0,319,239);
}
void Choice_box(int x,int y,int wid)
{int i,j;
lActiveSurface(&ls);
for (i=15;i<18;i++){ if (i==17) lputImage(x+(20*(wid-1)),y,menu_p.LpcImage[i]);
if (i==15) lputImage(x,y,menu_p.LpcImage[i]);
if (i==16) for (j=0;j<wid-2;j++) lputImage(x+20+(j*20),y,menu_p.LpcImage[i]);
}
}
void Magic_list(int Magic_id,int ac_no)
{int l,k;
}
int Choice_magic(int Actor_No)
{ short newk,y;
y=25;
for (newk=-1;newk!=KEY_ESC&&newk!=KEY_ALT;) {
Windows_draw(30,20,5,5,0);
Choice_box(35,y,8);
lOutToScr(&ls,0,0,0,0,319,239);
lkgetch(&newk);
switch (newk) {
case KEY_UP: Windows_draw(30,20,5,5,0);
y=y-20;
if (y<=30) y=25;
Choice_box(35,y,8);
lOutToScr(&ls,0,0,0,0,319,239);
break;
case KEY_DOWN: Windows_draw(30,20,5,5,0);
y=y+20;
if (y>=195) y=195;
Choice_box(35,y,8);
lOutToScr(&ls,0,0,0,0,319,239);
break;
case KEY_SPACE:
case KEY_ENTER: return 1;
break;
}
}
return 0;
}
void Magic_Name_View(int Actor_No,int Magic_No)
{
if (ac[Actor_No].mgc[Magic_No]=0);
}
int Choice_goods()
{short newk,y;
lBlitFast(&layer.layers[0],0,0, 0,0,319,239,&ls,0);
y=express.goods_choice(1,0);
voc.regist_msg("choice goods id=%d",y);
return y;
}
void Failed_Fight()
{ while (game_key(0)||game_key(1));
while (lkpressed()) lkgetch(0);
lActiveSurface(&ls);
lBlitFast(&ls,0,0,0,240,319,479,&ls,0);
Fighter_View();
Windows_draw(100,40,3,3,0);
lsetColor(240);
louttextxy(116,66,"战斗失败");
lsetColor(22);
louttextxy(115,65,"战斗失败");
lOutToScr(&ls,0,0,0,0,319,239);
while (game_key(0));
while (!game_key(0));
}
void Victory_Fight(int mode)
{if (ac[0].hp<=0) return;
while (game_key(0)||game_key(1));
while (lkpressed()) lkgetch(0);
if (mode) {
lActiveSurface(&ls);
lBlitFast(&ls,0,0,0,240,319,479,&ls,0);
Fighter_View();
Windows_draw(100,40,3,3,0);
lsetColor(240);
louttextxy(116,66,"战斗胜利");
lsetColor(22);
louttextxy(115,65,"战斗胜利");
lOutToScr(&ls,0,0,0,0,319,239);
while (game_key(0));
while (!game_key(0));
}
else {
lActiveSurface(&ls);
lBlitFast(&ls,0,0,0,240,319,479,&ls,0);
Fighter_View();
Windows_draw(100,40,3,3,0);
lsetColor(240);
louttextxy(116,66,"战斗胜利");
lsetColor(22);
louttextxy(115,65,"战斗胜利");
lOutToScr(&ls,0,0,0,0,319,239);
while (game_key(0));
while (!game_key(0));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -