Frame 2
function set_dice_anime(n) {
dice_anime = n;
}
function new_map() {
var i;
var j;
game.make_map();
i = 0;
while (i < 32) {
mc = eval ("mcArea" + i);
mcd = eval ("mcAreaDice" + i);
if ((i > 0) && (game.adat[i].size > 0)) {
mc._visible = true;
mc.clear();
mc._x = (400 - ((game.XMAX * cel_w) / 2)) - (cel_w / 4);
mc._y = ((300 - ((game.YMAX * cel_h) / 2)) - (cel_h / 4)) - 32;
delete mc.onPress;
mcd._visible = true;
cn = game.adat[i].cpos;
mcd._x = mc._x + cpos_x[cn];
mcd._y = mc._y + cpos_y[cn];
delete mcd.onPress;
draw_area(i, 0);
} else {
mc._visible = false;
mcd._visible = false;
}
i++;
}
var prio = new Array(game.AREA_MAX);
i = 0;
while (i < game.AREA_MAX) {
prio[i] = i;
i++;
}
i = 1;
while (i < (game.AREA_MAX - 1)) {
j = i + 1;
while (j < game.AREA_MAX) {
var p1 = prio[i];
var p2 = prio[j];
if (game.adat[p1].size == 0) {
} else if (game.adat[p2].size == 0) {
} else if (game.adat[p1].cpos > game.adat[p2].cpos) {
var tmp = prio[i];
prio[i] = prio[j];
prio[j] = tmp;
}
j++;
}
i++;
}
i = 1;
while (i < (game.AREA_MAX - 1)) {
var a1 = prio[i];
if (game.adat[a1].size == 0) {
} else {
mc1 = eval ("mcAreaDice" + a1);
j = i + 1;
while (j < game.AREA_MAX) {
var a2 = prio[j];
if (game.adat[a2].size == 0) {
} else {
var d1 = mc1.getDepth();
mc2 = eval ("mcAreaDice" + a2);
var d2 = mc2.getDepth();
if (d1 > d2) {
mc1.swapDepths(mc2);
}
}
j++;
}
}
i++;
}
}
function draw_area(area, paint_mode) {
if (game.adat[area].size == 0) {
return(undefined);
}
var i;
var j;
var cnt = 0;
var c = game.adat[area].line_cel[cnt];
var d = game.adat[area].line_dir[cnt];
col = [11763710, 11796225, 37634, 16744446, 16744193, 11796478, 16776961, 16734296];
ax = [cel_w / 2, cel_w, cel_w, cel_w / 2, 0, 0, cel_w / 2];
ax_left = [cel_w / 2, cel_w, cel_w, cel_w / 2, (-cel_w) / 2, (-cel_w) / 2, cel_w / 2];
s = 3;
ay = [-s, s, cel_h - s, cel_h + s, cel_h - s, s, -s];
ay_top = [(-cel_h) / 2, (-cel_h) / 2, cel_h - s, cel_h + s, cel_h - s, (-cel_h) / 2, (-cel_h) / 2];
var mc = eval ("mcArea" + area);
mc.clear();
var line_color = 2236996;
if (paint_mode) {
line_color = 16711680 /* 0xFF0000 */;
}
mc.lineStyle(4, line_color, 100);
var color = col[game.adat[area].arm];
if (paint_mode) {
color = 0;
}
mc.beginFill(color, 100);
var px = ax[d];
var py = ay[d];
mc.moveTo(cpos_x[c] + px, cpos_y[c] + py);
var i = 0;
while (i < 100) {
var px = ax[d + 1];
var py = ay[d + 1];
mc.lineTo(cpos_x[c] + px, cpos_y[c] + py);
cnt++;
c = game.adat[area].line_cel[cnt];
d = game.adat[area].line_dir[cnt];
if ((c == game.adat[area].line_cel[0]) && (d == game.adat[area].line_dir[0])) {
break;
}
i++;
}
i = 0;
while (i < 32) {
var c = game.adat[i].arm;
if (game.adat[i].dice == 0) {
} else {
mc = eval ("mcAreaDice" + i);
mc.gotoAndStop((c * 10) + game.adat[i].dice);
}
i++;
}
}
function swap_area_mc(area) {
var max = -16384;
var i = 0;
while (i < game.AREA_MAX) {
if (i == old_area) {
} else {
mc = eval ("mcArea" + i);
var d = mc.getDepth();
if (d > max) {
max = d;
}
}
i++;
}
mc = eval ("mcArea" + area);
mc.swapDepths(max);
old_area = area;
}
function enable_area_click() {
var i = 0;
while (i < 32) {
mc = eval ("mcArea" + i);
delete mc.onPress;
mcd = eval ("mcAreaDice" + i);
delete mcd.onPress;
i++;
}
}
function draw_player_data() {
var i;
var pnum = 0;
i = 0;
while (i < 8) {
mc = eval ("mcPlayer" + i);
mc._visible = false;
var p = game.jun[i];
if (game.player[p].area_tc > 0) {
mc._visible = true;
pnum++;
}
i++;
}
var c = 0;
i = 0;
while (i < 8) {
var p = game.jun[i];
if (game.player[p].area_tc == 0) {
} else {
mc = eval ("mcPlayer" + i);
w = 100;
mc._x = (400 - (((pnum - 1) * w) / 2)) + (c * w);
mc._y = 568;
mc.gotoAndStop(1);
mc.area_tc_txt = game.player[p].area_tc;
mc.gotoAndStop(((i == game.ban) ? 2 : 1));
mcp = eval (("mcPlayer" + i) + ".mcDice");
mcp.gotoAndStop((p * 10) + 1);
c++;
}
i++;
}
}
function start_game() {
game.start_game();
gotoAndStop ("start_player");
}
function next_player() {
do {
game.ban++;
if (game.ban >= game.pmax) {
game.ban = 0;
}
var _local1 = game.jun[game.ban];
} while (!game.player[_local1].area_tc);
if (game.get_pn() == game.user) {
sndTurn.start();
}
gotoAndStop ("start_player");
}
game = new dw.Game();
dice_anime = 0;
cpos_x = new Array(game.XMAX);
cpos_y = new Array(game.YMAX);
cel_w = 23;
cel_h = 14;
old_area = 0;
c = 0;
i = 0;
while (i < game.YMAX) {
j = 0;
while (j < game.XMAX) {
cpos_x[c] = j * cel_w;
if (i % 2) {
cpos_x[c] = cpos_x[c] + (cel_w / 2);
}
cpos_y[c] = i * cel_h;
c++;
j++;
}
i++;
}
Frame 3
sndTurn = new Sound();
sndTurn.attachSound("myturn.wav");
sndClick = new Sound();
sndClick.attachSound("click.wav");
sndSuccess = new Sound();
sndSuccess.attachSound("success.wav");
sndFail = new Sound();
sndFail.attachSound("fail.wav");
sndDice = new Sound();
sndDice.attachSound("dice.wav");
Frame 4
gotoAndStop ("title");
Frame 6
this.stop();
enable_area_click();
Frame 11
this.stop();
i = 0;
while (i < game.AREA_MAX) {
eval ("mcArea" + i)._visible = false;
eval ("mcAreaDice" + i)._visible = false;
i++;
}
enable_area_click();
mcMakeMap.gotoAndPlay(1);
Frame 16
draw_player_data();
if (game.jun[game.ban] == game.user) {
gotoAndStop ("man");
} else {
gotoAndPlay ("com");
}
Frame 22
function start_first_click() {
var i = 1;
while (i < 32) {
mc = eval ("mcArea" + i);
mcd = eval ("mcAreaDice" + i);
var f = 0;
if (game.adat[i].arm == game.jun[game.ban]) {
f = 1;
var c = 0;
var j = 1;
while (j < 32) {
if (game.adat[j].size == 0) {
} else if (game.adat[j].arm == game.adat[i].arm) {
} else if (game.adat[i].join[j]) {
c++;
}
j++;
}
if (c == 0) {
f = 0;
}
}
if (game.adat[i].dice < 2) {
f = 0;
}
if (f) {
mc.onPress = function () {
var _local2 = Number(this._name.slice(6));
first_click(_local2);
};
mcd.onPress = function () {
var _local2 = Number(this._name.slice(10));
first_click(_local2);
};
} else {
delete mc.onPress;
delete mcd.onPress;
}
i++;
}
}
function first_click(an) {
sndClick.start();
draw_area(an, 1);
old_area = 0;
swap_area_mc(an);
game.area_from = an;
start_second_click();
}
function start_second_click() {
var i = 1;
while (i < 32) {
mc = eval ("mcArea" + i);
mcd = eval ("mcAreaDice" + i);
delete mc.onPress;
delete mcd.onPress;
if (i == game.area_from) {
mc.onPress = function () {
var _local2 = Number(this._name.slice(6));
click_cancel(_local2);
};
mcd.onPress = function () {
var _local2 = Number(this._name.slice(10));
click_cancel(_local2);
};
}
if (game.adat[game.area_from].join[i] && (game.adat[i].arm != game.jun[game.ban])) {
mc.onPress = function () {
var _local2 = Number(this._name.slice(6));
second_click(_local2);
};
mcd.onPress = function () {
var _local2 = Number(this._name.slice(10));
second_click(_local2);
};
}
i++;
}
}
function click_cancel(an) {
sndClick.start();
draw_area(an, 0);
swap_area_mc(an);
start_first_click();
}
function second_click(an) {
sndClick.start();
draw_area(an, 1);
swap_area_mc(an);
var i = 1;
while (i < 32) {
mc = eval ("mcArea" + i);
mcd = eval ("mcAreaDice" + i);
delete mc.onPress;
delete mcd.onPress;
i++;
}
game.area_to = an;
gotoAndStop ("battle");
}
this.stop();
start_first_click();
btEndTurn.onRelease = function () {
var i = 1;
while (i < 32) {
mc = eval ("mcArea" + i);
mcd = eval ("mcAreaDice" + i);
delete mc.onPress;
delete mcd.onPress;
i++;
}
draw_area(game.area_from, 0);
gotoAndPlay ("supply");
};
Frame 27
if (game.com_thinking() == 0) {
gotoAndPlay ("supply");
}
Frame 28
an = game.area_from;
draw_area(an, 1);
old_area = 0;
swap_area_mc(an);
Frame 31
an = game.area_to;
draw_area(an, 1);
swap_area_mc(an);
Frame 34
gotoAndStop ("battle");
Frame 35
function after_battle(defeat) {
if (defeat) {
sndSuccess.start();
} else {
sndFail.start();
}
var _local3 = game.adat[game.area_from].arm;
var _local5 = game.adat[game.area_to].arm;
if (defeat) {
game.adat[game.area_to].dice = game.adat[game.area_from].dice - 1;
game.adat[game.area_from].dice = 1;
game.adat[game.area_to].arm = _local3;
game.set_area_tc(_local3);
game.set_area_tc(_local5);
} else {
game.adat[game.area_from].dice = 1;
}
draw_area(game.area_from, 0);
draw_area(game.area_to, 0);
game.set_his(game.area_from, game.area_to, defeat);
if (game.player[game.user].area_tc == 0) {
draw_player_data();
gotoAndStop ("gameover");
} else {
var _local2 = 0;
var _local1 = 0;
while (_local1 < game.pmax) {
if (game.player[_local1].area_tc > 0) {
_local2++;
}
_local1++;
}
if (_local2 == 1) {
draw_player_data();
gotoAndStop ("youwin");
} else {
gotoAndStop ("start_player");
}
}
}
this.stop();
mcBattle.gotoAndPlay(1);
Frame 42
function start_supply() {
var pn = game.jun[game.ban];
game.set_area_tc(pn);
game.player[pn].stock = game.player[pn].stock + game.player[pn].area_tc;
if (game.player[pn].stock > game.STOCK_MAX) {
game.player[pn].stock = game.STOCK_MAX;
}
var i = 0;
while (i < game.STOCK_MAX) {
mc = eval ("mcSupply.mcStock" + i);
if (i < game.player[pn].stock) {
mc._visible = true;
mc.gotoAndStop((pn * 10) + 2);
mc._x = 20 + ((i % 32) * 24);
mc._y = 490 + (Math.floor(i / 32) * 28);
} else {
mc._visible = false;
}
i++;
}
}
function supply_dice() {
var pn = game.jun[game.ban];
list = new Array(game.AREA_MAX);
c = 0;
var i = 0;
while (i < game.AREA_MAX) {
if (game.adat[i].size == 0) {
} else if (game.adat[i].arm != pn) {
} else if (game.adat[i].dice >= 8) {
} else {
list[c] = i;
c++;
}
i++;
}
if ((c == 0) || (game.player[pn].stock <= 0)) {
return(1);
}
game.player[pn].stock--;
var an = list[Math.floor(Math.random() * c)];
game.adat[an].dice++;
draw_area(an, 0);
i = 0;
while (i < game.STOCK_MAX) {
mc = eval ("mcSupply.mcStock" + i);
if (i < game.player[pn].stock) {
mc._visible = true;
} else {
mc._visible = false;
}
i++;
}
game.set_his(an, 0, 0);
return(0);
}
function end_supply() {
next_player();
}
this.stop();
mcSupply.gotoAndPlay(1);
Frame 48
this.stop();
mcGameover.gotoAndPlay(1);
Frame 57
this.stop();
mcYouwin.gotoAndPlay(1);
Frame 64
function start_history() {
i = 0;
while (i < game.AREA_MAX) {
if (adat[i].size == 0) {
} else {
game.adat[i].dice = game.his_dice[i];
game.adat[i].arm = game.his_arm[i];
draw_area(i, 0);
}
i++;
}
replay_c = 0;
enable_area_click();
mcHistory.gotoAndPlay(1);
}
function his_is_battle() {
return(game.his[replay_c].to);
}
function his_from() {
var _local1 = game.his[replay_c].from;
draw_area(_local1, 1);
old_area = 0;
swap_area_mc(_local1);
}
function his_to() {
var _local1 = game.his[replay_c].to;
draw_area(_local1, 1);
swap_area_mc(_local1);
}
function his_res() {
var _local1 = game.his[replay_c].from;
var _local2 = game.his[replay_c].to;
if (game.his[replay_c].res) {
game.adat[_local2].dice = game.adat[_local1].dice - 1;
game.adat[_local1].dice = 1;
game.adat[_local2].arm = game.adat[_local1].arm;
sndSuccess.start();
} else {
game.adat[_local1].dice = 1;
sndFail.start();
}
draw_area(_local1, 0);
draw_area(_local2, 0);
}
function his_supply() {
var _local1 = game.his[replay_c].from;
game.adat[_local1].dice++;
draw_area(_local1, 0);
}
function his_next() {
replay_c++;
if (replay_c > game.his_c) {
return(1);
}
return(0);
}
this.stop();
start_history();
Symbol 165 MovieClip [__Packages.dw.Game] Frame 0
class dw.Game
{
var AREA_MAX, adat, player, jun, cel_max, cel, num, rcel, join, ban, his, his_c, his_arm, his_dice, chk, next_f, tc, list_from, list_to, area_from, area_to;
function Game () {
var _local2;
var _local3;
AREA_MAX = 32;
adat = new Array(32);
player = new Array(8);
jun = new Array(8);
cel_max = XMAX * YMAX;
cel = new Array(cel_max);
num = new Array(cel_max);
rcel = new Array(cel_max);
_local2 = 0;
while (_local2 < cel_max) {
num[_local2] = _local2;
_local2++;
}
join = new Array(cel_max);
_local2 = 0;
while (_local2 < cel_max) {
join[_local2] = new dw.JoinData();
_local3 = 0;
while (_local3 < 6) {
join[_local2].dir[_local3] = next_cel(_local2, _local3);
_local3++;
}
_local2++;
}
}
function start_game() {
var _local2;
_local2 = 0;
while (_local2 < 8) {
jun[_local2] = _local2;
_local2++;
}
_local2 = 0;
while (_local2 < pmax) {
var _local3 = Math.floor(Math.random() * pmax);
var _local4 = jun[_local2];
jun[_local2] = jun[_local3];
jun[_local3] = _local4;
_local2++;
}
ban = 0;
_local2 = 0;
while (_local2 < 8) {
player[_local2] = new dw.PlayerData();
_local2++;
}
_local2 = 0;
while (_local2 < 8) {
set_area_tc(_local2);
_local2++;
}
his = new Array();
his_c = 0;
his_arm = new Array(AREA_MAX);
his_dice = new Array(AREA_MAX);
_local2 = 0;
while (_local2 < AREA_MAX) {
his_arm[_local2] = adat[_local2].arm;
his_dice[_local2] = adat[_local2].dice;
_local2++;
}
}
function get_pn() {
return(jun[ban]);
}
function make_map() {
var _local2;
var _local3;
var _local6;
var _local12;
var _local22;
_local2 = 0;
while (_local2 < cel_max) {
var _local19 = Math.floor(Math.random() * cel_max);
var _local23 = num[_local2];
num[_local2] = num[_local19];
num[_local19] = _local23;
_local2++;
}
_local2 = 0;
while (_local2 < cel_max) {
cel[_local2] = 0;
rcel[_local2] = 0;
_local2++;
}
_local22 = 1;
rcel[Math.floor(Math.random() * cel_max)] = 1;
do {
var _local4;
var _local14 = 9999;
_local2 = 0;
while (_local2 < cel_max) {
if (cel[_local2] > 0) {
} else if (num[_local2] > _local14) {
} else if (rcel[_local2] == 0) {
} else {
_local14 = num[_local2];
_local4 = _local2;
}
_local2++;
}
if (_local14 == 9999) {
break;
}
var _local21 = percolate(_local4, 8, _local22);
if (_local21 == 0) {
break;
}
_local22++;
} while (_local22 < AREA_MAX);
_local2 = 0;
while (_local2 < cel_max) {
if (cel[_local2] > 0) {
} else {
var _local10 = 0;
var _local16 = 0;
_local6 = 0;
while (_local6 < 6) {
_local4 = join[_local2].dir[_local6];
if (_local4 < 0) {
} else if (cel[_local4] == 0) {
_local10 = 1;
} else {
_local16 = cel[_local4];
}
_local6++;
}
if (_local10 == 0) {
cel[_local2] = _local16;
}
}
_local2++;
}
_local2 = 0;
while (_local2 < AREA_MAX) {
adat[_local2] = new dw.AreaData();
_local2++;
}
_local2 = 0;
while (_local2 < cel_max) {
_local22 = cel[_local2];
if (_local22 > 0) {
adat[_local22].size++;
}
_local2++;
}
_local2 = 1;
while (_local2 < AREA_MAX) {
if (adat[_local2].size <= 5) {
adat[_local2].size = 0;
}
_local2++;
}
_local2 = 0;
while (_local2 < cel_max) {
_local22 = cel[_local2];
if (adat[_local22].size == 0) {
cel[_local2] = 0;
}
_local2++;
}
_local2 = 1;
while (_local2 < AREA_MAX) {
adat[_local2].left = XMAX;
adat[_local2].right = -1;
adat[_local2].top = YMAX;
adat[_local2].bottom = -1;
adat[_local2].len_min = 9999;
_local2++;
}
_local12 = 0;
_local2 = 0;
while (_local2 < YMAX) {
_local3 = 0;
while (_local3 < XMAX) {
_local22 = cel[_local12];
if (_local22 > 0) {
if (_local3 < adat[_local22].left) {
adat[_local22].left = _local3;
}
if (_local3 > adat[_local22].right) {
adat[_local22].right = _local3;
}
if (_local2 < adat[_local22].top) {
adat[_local22].top = _local2;
}
if (_local2 > adat[_local22].bottom) {
adat[_local22].bottom = _local2;
}
}
_local12++;
_local3++;
}
_local2++;
}
_local2 = 1;
while (_local2 < AREA_MAX) {
adat[_local2].cx = Math.floor((adat[_local2].left + adat[_local2].right) / 2);
adat[_local2].cy = Math.floor((adat[_local2].top + adat[_local2].bottom) / 2);
_local2++;
}
_local12 = 0;
var _local8;
var _local7;
var _local11;
_local2 = 0;
while (_local2 < YMAX) {
_local3 = 0;
while (_local3 < XMAX) {
_local22 = cel[_local12];
if (_local22 > 0) {
_local8 = adat[_local22].cx - _local3;
if (_local8 < 0) {
_local8 = -_local8;
}
_local7 = adat[_local22].cy - _local2;
if (_local7 < 0) {
_local7 = -_local7;
}
_local11 = _local8 + _local7;
var _local10 = 0;
_local6 = 0;
while (_local6 < 6) {
_local4 = join[_local12].dir[_local6];
if (_local4 > 0) {
var _local5 = cel[_local4];
if (_local5 != _local22) {
_local10 = 1;
adat[_local22].join[_local5] = 1;
}
}
_local6++;
}
if (_local10) {
_local11 = _local11 + 4;
}
if (_local11 < adat[_local22].len_min) {
adat[_local22].len_min = _local11;
adat[_local22].cpos = (_local2 * XMAX) + _local3;
}
}
_local12++;
_local3++;
}
_local2++;
}
_local2 = 0;
while (_local2 < AREA_MAX) {
adat[_local2].arm = -1;
_local2++;
}
var _local18 = 0;
var _local20 = new Array(AREA_MAX);
while (true) {
_local12 = 0;
_local2 = 1;
while (_local2 < AREA_MAX) {
if (adat[_local2].size == 0) {
} else if (adat[_local2].arm >= 0) {
} else {
_local20[_local12] = _local2;
_local12++;
}
_local2++;
}
if (_local12 == 0) {
break;
}
_local22 = _local20[Math.floor(Math.random() % _local12)];
adat[_local22].arm = _local18;
_local18++;
if (_local18 >= pmax) {
_local18 = 0;
}
}
chk = new Array(AREA_MAX);
_local2 = 0;
while (_local2 < AREA_MAX) {
chk[_local2] = 0;
_local2++;
}
_local2 = 0;
while (_local2 < cel_max) {
var _local9 = cel[_local2];
if (_local9 == 0) {
} else if (chk[_local9]) {
} else {
_local6 = 0;
while (_local6 < 6) {
if (chk[_local9]) {
break;
}
var _local13 = join[_local2].dir[_local6];
if (_local13 >= 0) {
if (cel[_local13] != _local9) {
set_area_line(_local2, _local6);
chk[_local9] = 1;
}
}
_local6++;
}
}
_local2++;
}
var _local24 = 0;
_local2 = 1;
while (_local2 < AREA_MAX) {
if (adat[_local2].size > 0) {
_local24++;
adat[_local2].dice = 1;
}
_local2++;
}
_local24 = _local24 * (put_dice - 1);
var _local15 = 0;
_local2 = 0;
while (_local2 < _local24) {
var _local17 = new Array(AREA_MAX);
_local12 = 0;
_local3 = 1;
while (_local3 < AREA_MAX) {
if (adat[_local3].size == 0) {
} else if (adat[_local3].arm != _local15) {
} else if (adat[_local3].dice >= 8) {
} else {
_local17[_local12] = _local3;
_local12++;
}
_local3++;
}
if (_local12 == 0) {
break;
}
_local22 = _local17[Math.floor(Math.random() * _local12)];
adat[_local22].dice++;
_local15++;
if (_local15 >= pmax) {
_local15 = 0;
}
_local2++;
}
_local2 = 0;
while (_local2 < AREA_MAX) {
_local2++;
}
}
function percolate(pt, cmax, an) {
if (cmax < 3) {
cmax = 3;
}
var _local2;
var _local11;
var _local3;
var _local6 = pt;
next_f = new Array(cel_max);
_local2 = 0;
while (_local2 < cel_max) {
next_f[_local2] = 0;
_local2++;
}
var _local7 = 0;
do {
cel[_local6] = an;
_local7++;
_local2 = 0;
while (_local2 < 6) {
var _local4 = join[_local6].dir[_local2];
if (_local4 < 0) {
} else {
next_f[_local4] = 1;
}
_local2++;
}
var _local5 = 9999;
_local2 = 0;
while (_local2 < cel_max) {
if (next_f[_local2] == 0) {
} else if (cel[_local2] > 0) {
} else if (num[_local2] > _local5) {
} else {
_local5 = num[_local2];
_local6 = _local2;
}
_local2++;
}
if (_local5 == 9999) {
break;
}
} while (_local7 < cmax);
_local2 = 0;
while (_local2 < cel_max) {
if (next_f[_local2] == 0) {
} else if (cel[_local2] > 0) {
} else {
cel[_local2] = an;
_local7++;
_local3 = 0;
while (_local3 < 6) {
var _local4 = join[_local2].dir[_local3];
if (_local4 < 0) {
} else {
rcel[_local4] = 1;
}
_local3++;
}
}
_local2++;
}
return(_local7);
}
function set_area_line(old_cel, old_dir) {
var _local4 = old_cel;
var _local2 = old_dir;
var _local7 = cel[_local4];
var _local6 = 0;
adat[_local7].line_cel[_local6] = _local4;
adat[_local7].line_dir[_local6] = _local2;
_local6++;
var _local5 = 0;
while (_local5 < 100) {
_local2++;
if (_local2 >= 6) {
_local2 = 0;
}
var _local3 = join[_local4].dir[_local2];
if (_local3 >= 0) {
if (cel[_local3] == _local7) {
_local4 = _local3;
_local2 = _local2 - 2;
if (_local2 < 0) {
_local2 = _local2 + 6;
}
}
}
adat[_local7].line_cel[_local6] = _local4;
adat[_local7].line_dir[_local6] = _local2;
_local6++;
if ((_local4 == old_cel) && (_local2 == old_dir)) {
break;
}
_local5++;
}
}
function next_cel(opos, dir) {
var _local8 = opos % XMAX;
var _local7 = Math.floor(opos / XMAX);
var _local4 = _local7 % 2;
var _local2 = 0;
var _local3 = 0;
switch (dir) {
case 0 :
_local2 = (_local4 ? 1 : 0);
_local3 = -1;
break;
case 1 :
_local2 = 1;
break;
case 2 :
_local2 = (_local4 ? 1 : 0);
_local3 = 1;
break;
case 3 :
_local2 = (_local4 ? 0 : -1);
_local3 = 1;
break;
case 4 :
_local2 = -1;
break;
case 5 :
_local2 = (_local4 ? 0 : -1);
_local3 = -1;
}
var _local6 = _local8 + _local2;
var _local5 = _local7 + _local3;
if ((((_local6 < 0) || (_local5 < 0)) || (_local6 >= XMAX)) || (_local5 >= YMAX)) {
return(-1);
}
return((_local5 * XMAX) + _local6);
}
function set_area_tc(pn) {
player[pn].area_tc = 0;
var _local2;
var _local3;
chk = new Array(AREA_MAX);
_local2 = 0;
while (_local2 < AREA_MAX) {
chk[_local2] = _local2;
_local2++;
}
do {
var _local4 = 0;
_local2 = 1;
while (_local2 < AREA_MAX) {
if (adat[_local2].size == 0) {
} else if (adat[_local2].arm != pn) {
} else {
_local3 = 1;
while (_local3 < AREA_MAX) {
if (adat[_local3].size == 0) {
} else if (adat[_local3].arm != pn) {
} else if (adat[_local2].join[_local3] == 0) {
} else if (chk[_local3] == chk[_local2]) {
} else {
if (chk[_local2] > chk[_local3]) {
chk[_local2] = chk[_local3];
} else {
chk[_local3] = chk[_local2];
}
_local4 = 1;
break;
}
_local3++;
}
if (_local4) {
break;
}
}
_local2++;
}
} while (_local4 != 0);
tc = new Array(AREA_MAX);
_local2 = 0;
while (_local2 < AREA_MAX) {
tc[_local2] = 0;
_local2++;
}
_local2 = 1;
while (_local2 < AREA_MAX) {
if (adat[_local2].size == 0) {
} else if (adat[_local2].arm != pn) {
} else {
tc[chk[_local2]]++;
}
_local2++;
}
var _local6 = 0;
_local2 = 0;
while (_local2 < AREA_MAX) {
if (tc[_local2] > _local6) {
_local6 = tc[_local2];
}
_local2++;
}
player[pn].area_tc = _local6;
}
function com_thinking() {
var _local2;
var _local3;
_local2 = 0;
while (_local2 < 8) {
player[_local2].area_c = 0;
player[_local2].dice_c = 0;
_local2++;
}
var _local11 = 0;
_local2 = 1;
while (_local2 < AREA_MAX) {
if (adat[_local2].size == 0) {
} else {
var _local10 = adat[_local2].arm;
player[_local10].area_c++;
player[_local10].dice_c = player[_local10].dice_c + adat[_local2].dice;
_local11 = _local11 + adat[_local2].dice;
}
_local2++;
}
_local2 = 0;
while (_local2 < 8) {
player[_local2].dice_jun = _local2;
_local2++;
}
_local2 = 0;
while (_local2 < 7) {
_local3 = _local2 + 1;
while (_local3 < 8) {
if (player[_local2].dice_c < player[_local3].dice_c) {
var _local7 = player[_local2].dice_jun;
player[_local2].dice_jun = player[_local3].dice_jun;
player[_local3].dice_jun = _local7;
}
_local3++;
}
_local2++;
}
var _local5 = -1;
_local2 = 0;
while (_local2 < 8) {
if (player[_local2].dice_c > ((_local11 * 2) / 5)) {
_local5 = _local2;
}
_local2++;
}
list_from = new Array(AREA_MAX * AREA_MAX);
list_to = new Array(AREA_MAX * AREA_MAX);
var _local6 = 0;
var _local9 = jun[ban];
_local2 = 1;
while (_local2 < AREA_MAX) {
if (adat[_local2].size == 0) {
} else if (adat[_local2].arm != _local9) {
} else if (adat[_local2].dice <= 1) {
} else {
_local3 = 1;
for ( ; _local3 < AREA_MAX ; _local3++) {
if (adat[_local3].size == 0) {
} else if (adat[_local3].arm == _local9) {
} else if (adat[_local2].join[_local3] == 0) {
} else if (_local5 >= 0) {
if ((adat[_local2].arm != _local5) && (adat[_local3].arm != _local5)) {
continue;
}
} else if (adat[_local3].dice > adat[_local2].dice) {
} else if (adat[_local3].dice == adat[_local2].dice) {
var _local8 = adat[_local3].arm;
var _local4 = 0;
if (player[_local9].dice_jun == 0) {
_local4 = 1;
}
if (player[_local8].dice_jun == 0) {
_local4 = 1;
}
if ((Math.random() * 10) > 1) {
_local4 = 1;
}
if (_local4 == 0) {
continue;
}
} else {
list_from[_local6] = _local2;
list_to[_local6] = _local3;
_local6++;
}
}
}
_local2++;
}
if (_local6 == 0) {
return(0);
}
var _local12 = Math.floor(Math.random() * _local6);
area_from = list_from[_local12];
area_to = list_to[_local12];
}
function set_his(from, to, res) {
his[his_c] = new dw.HistoryData();
his[his_c].from = from;
his[his_c].to = to;
his[his_c].res = res;
his_c++;
}
var XMAX = 32;
var YMAX = 28;
var pmax = 7;
var user = 0;
var put_dice = 3;
var STOCK_MAX = 64;
}
Symbol 166 MovieClip [__Packages.dw.JoinData] Frame 0
class dw.JoinData
{
var dir;
function JoinData () {
dir = new Array(6);
}
}
Symbol 167 MovieClip [__Packages.dw.PlayerData] Frame 0
class dw.PlayerData
{
function PlayerData () {
}
var area_c = 0;
var area_tc = 0;
var dice_c = 0;
var dice_jun = 0;
var stock = 0;
}
Symbol 168 MovieClip [__Packages.dw.AreaData] Frame 0
class dw.AreaData
{
var line_cel, line_dir, join;
function AreaData () {
line_cel = new Array(100);
line_dir = new Array(100);
join = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
}
var size = 0;
var cpos = 0;
var arm = 0;
var dice = 0;
var left = 0;
var right = 0;
var top = 0;
var bottom = 0;
var cx = 0;
var cy = 0;
var len_min = 0;
}
Symbol 169 MovieClip [__Packages.dw.HistoryData] Frame 0
class dw.HistoryData
{
function HistoryData () {
}
}
Symbol 9 Button
on (release) {
_parent.gotoAndStop("map");
}
Symbol 12 Button
on (release) {
getURL ("http://www.gamedesign.jp/");
}
Symbol 36 MovieClip Frame 1
this.stop();
Symbol 37 MovieClip Frame 1
stop();
dl = [0, 1, 2, 3, 4, 5, 6, 7];
i = 0;
while (i < 8) {
r = Math.floor(Math.random() * 8);
tmp = dl[i];
dl[i] = dl[r];
dl[r] = tmp;
i++;
}
i = 0;
while (i < 3) {
mc = eval ("mc" + i);
col = dl[i];
n = Math.floor(Math.random() * 6);
mc.gotoAndStop((1 + (col * 10)) + n);
i++;
}
Symbol 41 Button
on (release) {
_parent.click_button(Number(this._name.slice(1)));
}
Symbol 43 MovieClip Frame 1
stop();
Symbol 46 MovieClip Frame 1
function select_num(n) {
i = 0;
while (i < 7) {
mc = eval ("p" + i);
col = ((i == n) ? 13369344 : 10066329);
mc.tf.textColor = col;
i++;
}
}
function click_button(n) {
select_num(n);
_parent._parent.game.pmax = n + 2;
}
stop();
i = 0;
while (i < 7) {
mc = eval ("p" + i);
mc.tf.text = i + 2;
i++;
}
select_num(_parent._parent.game.pmax - 2);
Symbol 48 MovieClip Frame 1
this.stop();
Symbol 50 MovieClip Frame 1
_visible = false;
Symbol 119 MovieClip Frame 1
stop();
Symbol 129 MovieClip Frame 2
_parent.new_map();
Symbol 129 MovieClip Frame 3
this.stop();
btYes.onRelease = function () {
_parent.start_game();
};
btNo.onRelease = function () {
gotoAndPlay (1);
};
Symbol 132 Button
on (release) {
gotoAndStop ("title");
}
Symbol 136 MovieClip Frame 1
this.stop();
Symbol 142 MovieClip Frame 1
stop();
ban = 0;
dn = [0, 0];
arm = [0, 0];
arm[0] = _parent.game.adat[_parent.game.area_from].arm;
arm[1] = _parent.game.adat[_parent.game.area_to].arm;
dmax = [0, 0];
dmax[0] = _parent.game.adat[_parent.game.area_from].dice;
dmax[1] = _parent.game.adat[_parent.game.area_to].dice;
deme = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
sum = [0, 0];
i = 0;
while (i < 2) {
sum[i] = 0;
j = 0;
while (j < dmax[i]) {
deme[i][j] = Math.floor(Math.random() * 6);
sum[i] = sum[i] + (1 + deme[i][j]);
j++;
}
i++;
}
i = 0;
while (i < 2) {
j = 0;
while (j < 8) {
mc = eval ((("dice" + i) + "_") + j);
mc._visible = false;
j++;
}
i++;
}
tf0.text = "";
tf1.text = "";
cnt = 0;
wait = 0;
onEnterFrame = function () {
cnt++;
if (cnt <= wait) {
return(undefined);
}
cnt = 0;
if (ban >= 2) {
delete onEnterFrame;
gotoAndStop ("end");
}
var i;
var mc;
if (dn[ban] < dmax[ban]) {
_parent.sndDice.start();
i = 0;
while (i < dmax[ban]) {
mc = eval ((("dice" + ban) + "_") + i);
if (i <= dn[ban]) {
pat = (arm[ban] * 10) + deme[ban][i];
} else {
pat = (arm[ban] * 10) + Math.floor(Math.random() * 6);
}
mc.gotoAndStop(1 + pat);
mc._visible = true;
i++;
}
dn[ban]++;
wait = 1;
if (_parent.game.get_pn() != _parent.game.user) {
wait = 0;
}
} else {
eval ("tf" + ban).text = sum[ban];
if (ban == 0) {
tf0._x = 418 + (35 * dmax[0]);
} else {
tf1._x = 322 - (35 * dmax[1]);
}
ban++;
wait = 12;
if (_parent.game.get_pn() != _parent.game.user) {
wait = 2;
}
}
};
Symbol 142 MovieClip Frame 15
stop();
defeat = 0;
if (sum[0] > sum[1]) {
defeat = 1;
}
_parent.after_battle(defeat);
Symbol 144 MovieClip Frame 1
_parent.start_supply();
Symbol 144 MovieClip Frame 2
if (_parent.supply_dice()) {
gotoAndPlay ("wait");
}
Symbol 144 MovieClip Frame 4
gotoAndPlay ("supply");
Symbol 144 MovieClip Frame 23
_parent.end_supply();
Symbol 150 Button
on (release) {
_parent.gotoAndStop("title");
}
Symbol 152 Button
on (release) {
_parent.gotoAndStop("history");
}
Symbol 154 MovieClip Frame 50
this.stop();
Symbol 158 MovieClip Frame 11
mcWinlogo._visible = true;
Symbol 158 MovieClip Frame 13
mcWinlogo._visible = false;
Symbol 158 MovieClip Frame 14
mcWinlogo._visible = true;
Symbol 158 MovieClip Frame 16
mcWinlogo._visible = false;
Symbol 158 MovieClip Frame 17
mcWinlogo._visible = true;
Symbol 158 MovieClip Frame 19
mcWinlogo._visible = false;
Symbol 158 MovieClip Frame 20
mcWinlogo._visible = true;
Symbol 158 MovieClip Frame 40
this.stop();
Symbol 163 Button
on (release) {
getURL ("http://www.gamedesign.jp/");
}
Symbol 164 MovieClip Frame 1
mcBar.mcSlider._x = (400 * _parent.replay_c) / _parent.game.his_c;
mcBar.mcSlider._y = 0;
if (_parent.his_is_battle()) {
gotoAndPlay ("battle");
} else {
gotoAndPlay ("supply");
}
Symbol 164 MovieClip Frame 5
_parent.his_from();
Symbol 164 MovieClip Frame 7
_parent.his_to();
Symbol 164 MovieClip Frame 12
_parent.his_res();
Symbol 164 MovieClip Frame 14
if (_parent.his_next()) {
gotoAndStop ("end");
} else {
gotoAndPlay (1);
}
Symbol 164 MovieClip Frame 15
_parent.his_supply();
Symbol 164 MovieClip Frame 16
if (_parent.his_next()) {
gotoAndStop ("end");
} else {
gotoAndPlay (1);
}
Symbol 164 MovieClip Frame 20
this.stop();
mcReplay.gotoAndStop(1);