|
发表于 2007-1-2 14:05:40
|
显示全部楼层
终于将人物属性计算部分给破译了!
终于将人物属性计算部分给破译了!
先记住这两个辅助函数的作用:- // 从位串a中提取若干位
- function gbt(a, b) {
- if (a.length < b) { // 在计算人物属性时不会超过128位的
- if (users[0].hash < users[1].hash) {
- to_ary = to_ary.concat(md5.md5array(users[0].uname + users[1].uname));
- to_ary = to_ary.concat(md5.md5array(users[1].uname + users[0].uname));
- to_ary = to_ary.concat(md5.md5array(users[0].uname + users[1].hash));
- to_ary = to_ary.concat(md5.md5array(users[1].hash + users[0].uname));
- } else {
- to_ary = to_ary.concat(md5.md5array(users[1].uname + users[0].uname));
- to_ary = to_ary.concat(md5.md5array(users[0].uname + users[1].uname));
- to_ary = to_ary.concat(md5.md5array(users[1].uname + users[0].hash));
- to_ary = to_ary.concat(md5.md5array(users[0].hash + users[1].uname));
- }
- a = to_ary;
- }
- var sum = 0;
- var f = 1;
- var I = 0;
- while (I < b) {
- sum = _sum + (a.shift() * f);
- f = f * 2;
- I++;
- }
- return sum;
- }
- // 从位串a中提取若干位(比例方式)
- function gbr(a, b) {
- return (gbt(a, b) / (Math.pow(2, b) - 1));
- }
复制代码
人物属性计算:- function inituser() {
- /* 基本属性 */
- var Idx = 0;
- while (Idx < 2) {
- users[Idx].uname = users[Idx].uname_txt.text;
- users[Idx].un = ("<FONT COLOR=\\'#000099\\'>[" + users[Idx].uname) + "]</FONT>";
- users[Idx].hash = md5.hash(users[Idx].uname);
- users[Idx].hash_ary = md5.md5array(users[Idx].uname);
- var fixspd = 0; // 最大值: 0.1 + 0.1*0.9 + 0.1*0.9^2 ... = 0.999998609915477
- var f = 0.1;
- var I = 0;
- while (I < 128) {
- fixspd = fixspd + (f * users[Idx].hash_ary[I]);
- f = f * 0.9;
- I++;
- }
- gbt(users[Idx].hash_ary, 55); // 0+55 = 55
- users[Idx].zg = new Array (2);
- users[Idx].zp = new Array (7);
- I = 0;
- while (I < 8) {
- users[Idx].zp[I] = 0;
- I++;
- }
- users[Idx].zg[0] = gbt(users[Idx].hash_ary, 3); // 55+3 = 58
- users[Idx].zg[1] = gbt(users[Idx].hash_ary, 3); // 58+3 = 61
- users[Idx].zp[users[Idx].zg[0]] = gbt(users[Idx].hash_ary, 4) + 1; // 61+4 = 65
- var newzg1 = gbt(users[Idx].hash_ary, 4) + 1; // 65+4 = 69
- if (users[Idx].zg[0] == users[Idx].zg[1]) {
- if (users[Idx].zp[users[Idx].zg[1]] < newzg1) {
- users[Idx].zp[users[Idx].zg[1]] = newzg1;
- }
- } else {
- users[Idx].zp[users[Idx].zg[1]] = newzg1;
- }
- users[Idx].mhp = 145 + gbt(users[Idx].hash_ary, 8); // 69+8 = 77
- gbt(users[Idx].hash_ary, 1); // 77+1 = 78
- users[Idx].atk = 37 + gbt(users[Idx].hash_ary, 6);
- users[Idx].def = 37 + gbt(users[Idx].hash_ary, 6);
- users[Idx].spd = 37 + gbt(users[Idx].hash_ary, 6);
- users[Idx].acr = 37 + gbt(users[Idx].hash_ary, 6);
- users[Idx].luk = 37 + gbt(users[Idx].hash_ary, 6); // 78 + 6*5 = 108
- users[Idx].cdef = 0;
- users[Idx].cbit = 0;
- users[Idx].cpos = 0;
- users[Idx].cup = 0;
- users[Idx].ccrs = 0;
- users[Idx].ccnt = 0;
- users[Idx].cang = 0;
- users[Idx].cslp = 0;
- if (gbt(users[Idx].hash_ary, 2) == 0) {
- users[Idx].cdef = 1;
- }
- if (gbt(users[Idx].hash_ary, 2) == 1) {
- users[Idx].cbit = 1;
- }
- if (gbt(users[Idx].hash_ary, 2) == 0) {
- users[Idx].cpos = 1;
- }
- if (gbt(users[Idx].hash_ary, 2) == 3) {
- users[Idx].cup = 1;
- }
- if (gbt(users[Idx].hash_ary, 2) == 0) {
- users[Idx].ccrs = 1;
- }
- if (gbt(users[Idx].hash_ary, 2) == 2) {
- users[Idx].ccnt = 1;
- }
- if (gbt(users[Idx].hash_ary, 2) == 1) {
- users[Idx].cang = 1;
- }
- if (gbt(users[Idx].hash_ary, 2) == 1) { // 108 + 2*8 = 124
- users[Idx].cslp = 1;
- }
- users[Idx].matk = 0;
- users[Idx].magic = "";
- users[Idx].spdup = 0;
- users[Idx].defup = 0;
- trace (((((((((users[Idx].uname + users[Idx].zg[0]) + "(") + users[Idx].zp[users[Idx].zg[0]]) + ")") + users[Idx].zg[1]) + "(") + users[Idx].zp[users[Idx].zg[1]]) + ")") + users[Idx].cdef);
- I++;
- }
- /* 计算装备的效果。略 */
- /* 修正&显示 */
- Idx = 0;
- while (Idx < 2) {
- users[Idx].sum = (((((users[Idx].mhp / 4) + users[Idx].atk) + users[Idx].def) + users[Idx].spd) + users[Idx].acr) + users[Idx].luk;
- users[Idx].sum = users[Idx].sum / 20;
- tskillsum = ((((((users[Idx].cdef + users[Idx].cbit) + users[Idx].cpos) + users[Idx].cup) + users[Idx].ccrs) + users[Idx].ccnt) + users[Idx].cang) + users[Idx].cslp;
- tskilldisp = ((((((("" + users[Idx].cdef) + users[Idx].cbit) + users[Idx].cpos) + users[Idx].cup) + users[Idx].ccrs) + users[Idx].ccnt) + users[Idx].cang) + users[Idx].cslp;
- users[Idx].sum = users[Idx].sum + tskillsum;
- tface = "start2";
- if (users[Idx].sum < 19) {
- tface = "start1";
- }
- if (users[Idx].sum > 25) {
- tface = "start3";
- }
- users[Idx].face.gotoAndStop(tface);
- users[Idx].disp = (((((((((((users[Idx].uname + " HP:") + Math.ceil(users[Idx].mhp)) + " 攻:") + Math.ceil(users[Idx].atk)) + " 防:") + Math.ceil(users[Idx].def)) + " 速:") + Math.ceil(users[Idx].spd)) + " 技:") + Math.ceil(users[Idx].acr)) + " 运:") + Math.ceil(users[Idx].luk);
- if (users[Idx].item != "") {
- users[Idx].disp = users[Idx].disp + (" 装备:" + users[Idx].item);
- }
- if ((gversion > 1.05) && (users[Idx].uname.indexOf(fjjstr) > -1)) {
- users[Idx].fjj = 1;
- users[Idx].mhp = Math.floor(users[Idx].mhp * 0.8);
- } else {
- users[Idx].fjj = 0;
- }
- users[Idx].mhp = Math.ceil(users[Idx].mhp);
- users[Idx].hp = users[Idx].mhp;
- users[Idx].hp_txt.text = users[Idx].hp;
- users[Idx].mhp_txt.text = users[Idx].mhp;
- users[Idx].atk_txt.text = Math.ceil(users[Idx].atk);
- users[Idx].def_txt.text = Math.ceil(users[Idx].def);
- users[Idx].spd_txt.text = Math.ceil(users[Idx].spd);
- users[Idx].acr_txt.text = Math.ceil(users[Idx].acr);
- users[Idx].luk_txt.text = Math.ceil(users[Idx].luk);
- users[Idx].atk_txt.textColor = 0;
- users[Idx].def_txt.textColor = 0;
- users[Idx].spd_txt.textColor = 0;
- users[Idx].acr_txt.textColor = 0;
- users[Idx].luk_txt.textColor = 0;
- users[Idx].spd = users[Idx].spd + fixspd;
- users[Idx].acr = users[Idx].acr / 100;
- users[Idx].luk = users[Idx].luk / 100;
- I++;
- }
- if (users[1].spd == users[0].spd) {
- if (users[0].uname > users[1].uname) {
- users[0].spd = users[0].spd + 0.001;
- } else {
- users[1].spd = users[1].spd + 0.001;
- }
- }
- }
复制代码
属性说明:.mhp:[命]生命
.atk:[攻]攻击
.def:[防]防御
.spd:[速]速度
.acr:[技]命中
.luk:[运]幸运
.cdef:[抗]防御
.cbit:[咬]发狂了,咬一口
.cpos:[毒]投毒
.cup :[翻]垂死抗争。属性提高40%
.ccrs:[咒]诅咒。属性降低20%
.ccnt:[绊]绊倒
.cang:[暴]按在地上一顿暴打
.cslp:[晕]打晕了,趁机恢复了体力
连击只与速度有关
所以最强的MD5为:
0~55位:(任意)
56~69位:用于计算zg,具体效果不清楚
70~77位:全为1。mhp=145+255 = 400
78位:(任意)
79~84位:全为1。atk=37+63=100
85~90位:全为1。def=37+63=100
91~96位:全为1。spd=37+63=100
97~102位:全为1。acr=37+63=100
103~108位:全为1。luk=37+63=100
109~110位:为0
111~112位:为1
113~114位:为0
115~116位:为3
117~118位:为0
119~120位:为2
121~122位:为1
123~124位:为1
125~127位:(任意)
即:
000000000000000030BFFFFFFFFFFF0F:掩码
________________3_BFFFFFFFFD32_5:匹配 |
|