00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <config.h>
00035
00036 #include "combat.h"
00037 #include "commands.h"
00038 #include "land.h"
00039 #include "mission.h"
00040 #include "path.h"
00041 #include "ship.h"
00042
00043 int
00044 lboa(void)
00045 {
00046 struct combat off[1];
00047 struct combat def[1];
00048 struct emp_qelem olist;
00049 struct emp_qelem dlist;
00050 int ototal;
00051 int a_engineer = 0;
00052 int a_spy = 0;
00053 struct sctstr sect;
00054 struct lndstr land;
00055 char *p;
00056 char buf[1024];
00057
00058 att_combat_init(def, EF_LAND);
00059
00060
00061
00062
00063
00064
00065 if (!(p = getstarg(player->argp[1], "Victim land unit #? ", buf)) ||
00066 (def->lnd_uid = atoi(p)) < 0)
00067 return RET_SYN;
00068
00069
00070
00071
00072
00073
00074
00075 if (!(p = getstarg(player->argp[2], "Boarding party from? ", buf)))
00076 return RET_SYN;
00077 if (issector(p)) {
00078 att_combat_init(off, EF_SECTOR);
00079 if (!sarg_xy(p, &off->x, &off->y))
00080 return RET_SYN;
00081 getsect(off->x, off->y, §);
00082 if (sect.sct_own != player->cnum) {
00083 pr("You don't own %s!\n", xyas(off->x, off->y, player->cnum));
00084 return RET_SYN;
00085 }
00086 if (sect.sct_mobil <= 0) {
00087 pr("You don't have any mobility in %s!\n",
00088 xyas(off->x, off->y, player->cnum));
00089 return RET_SYN;
00090 }
00091 } else {
00092 pr("You can only board land units from a sector.\n");
00093 return RET_SYN;
00094 }
00095 if (att_abort(A_LBOARD, off, def)) {
00096 pr("Land unit boarding aborted\n");
00097 return RET_OK;
00098 }
00099
00100
00101
00102 if (att_show(def))
00103 return RET_FAIL;
00104
00105
00106
00107 att_ask_offense(A_LBOARD, off, def, &olist, &a_spy, &a_engineer);
00108 if (att_abort(A_LBOARD, off, def)) {
00109 pr("Land unit boarding aborted\n");
00110 att_empty_attack(A_LBOARD, 0, def);
00111 return att_free_lists(&olist, 0);
00112 }
00113
00114 ototal = att_get_offense(A_LBOARD, off, &olist, def);
00115 if (att_abort(A_LBOARD, off, def)) {
00116 pr("Land unit boarding aborted\n");
00117 att_empty_attack(A_LBOARD, 0, def);
00118 return att_free_lists(&olist, 0);
00119 }
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 att_get_defense(&olist, def, &dlist, a_spy, ototal);
00130
00131
00132
00133
00134
00135 if (!(att_fight(A_LBOARD, off, &olist, 1.0, def, &dlist, 1.0))) {
00136 getland(def->lnd_uid, &land);
00137
00138
00139
00140
00141
00142 }
00143
00144 return RET_OK;
00145 }