• R/O
  • SSH
  • HTTPS

thief: Commit


Commit MetaInfo

Revision39 (tree)
Time2012-02-02 23:47:44
Authorseussnu

Log Message

0.0.8-alpha5
・ 変数名を修正
・ スペースの有無を統一

Change Summary

Incremental Difference

--- thief.js (revision 38)
+++ thief.js (revision 39)
@@ -76,14 +76,14 @@
7676 hist : [],
7777 adventurer : null, // Player
7878 size : {
79- Window : {width:Number.NaN, height:Number.NaN},
80- Main : {width:Number.NaN, height:Number.NaN}, // Input, Message, Map, Status
81- Input : {width:Number.NaN, height:Number.NaN}, // 入力欄
82- Message : {width:Number.NaN, height:Number.NaN}, // メッセージ欄(入力上部)
83- Map : {width:Number.NaN, height:Number.NaN}, // マップ
84- Status : {width:Number.NaN, height:Number.NaN}, // ステータス
85- Infomation : {width:Number.NaN, height:Number.NaN}, // 情報出力(インベントリの内容など)
86- Debug : {width:Number.NaN, height:Number.NaN} // デバッグ情報
79+ Window : {width : Number.NaN, height : Number.NaN},
80+ Main : {width : Number.NaN, height : Number.NaN}, // Input, Message, Map, Status
81+ Input : {width : Number.NaN, height : Number.NaN}, // 入力欄
82+ Message : {width : Number.NaN, height : Number.NaN}, // メッセージ欄(入力上部)
83+ Map : {width : Number.NaN, height : Number.NaN}, // マップ
84+ Status : {width : Number.NaN, height : Number.NaN}, // ステータス
85+ Infomation : {width : Number.NaN, height : Number.NaN}, // 情報出力(インベントリの内容など)
86+ Debug : {width : Number.NaN, height : Number.NaN} // デバッグ情報
8787 }
8888 },
8989
@@ -153,7 +153,7 @@
153153 symbolName : 'symbolName',
154154 alphabet : 'alphabet',
155155 actObjectList : 'actObjectList',
156- active : 'active',
156+ isActive : 'isActive',
157157 ct : 'ct',
158158 maxct : 'maxct',
159159 dex : 'dex',
@@ -173,8 +173,8 @@
173173 // Override
174174 //
175175
176-//noinspection JSUnusedGlobalSymbols
177-window.onload = function(onload) {
176+//noinspection JSUnusedGlobalSymbols,JSValidateTypes
177+window.onload = function (onload) {
178178 return function () {
179179 if (!!onload) {
180180 onload();
@@ -184,8 +184,8 @@
184184 }(window.onload);
185185
186186 //noinspection JSUnusedGlobalSymbols
187-window.onresize = function(onresize) {
188- return function() {
187+window.onresize = function (onresize) {
188+ return function () {
189189
190190 if (!!onresize) {
191191 onresize();
@@ -226,8 +226,8 @@
226226
227227
228228 //noinspection JSUnusedGlobalSymbols
229-document.onkeypress = function(onkeypress) {
230- return function(event) {
229+document.onkeypress = function (onkeypress) {
230+ return function (event) {
231231 if (!!onkeypress) {
232232 onkeypress(event);
233233 }
@@ -238,8 +238,8 @@
238238 }(document.onkeypress);
239239
240240 if (!Object.create) {
241- Object.create = function(o) {
242- var func = function() {
241+ Object.create = function (o) {
242+ var func = function () {
243243 };
244244 func.prototype = o;
245245 return new func();
@@ -247,7 +247,7 @@
247247 }
248248
249249 if (!Math.sign) {
250- Math.sign = function(num) {
250+ Math.sign = function (num) {
251251 if (num > 0) {
252252 return 1;
253253 } else {
@@ -261,7 +261,7 @@
261261 }
262262
263263 if (!Math.dice) {
264- Math.dice = function(fre, sides) {
264+ Math.dice = function (fre, sides) {
265265 var val = 0;
266266 for (var i = 0; i < fre; i++) {
267267 val += Math.round(Math.random() * sides + 0.5);
@@ -271,7 +271,7 @@
271271 }
272272
273273 if (!Array.prototype.remove) {
274- Array.prototype.remove = function(o) {
274+ Array.prototype.remove = function (o) {
275275 var len = this.length;
276276 var result = false;
277277 for (var i = 0; i < len; i++) {
@@ -292,13 +292,13 @@
292292 }
293293
294294 if (!Array.prototype.getLast) {
295- Array.prototype.getLast = function() {
295+ Array.prototype.getLast = function () {
296296 return this[this.length - 1];
297297 };
298298 }
299299
300300 if (!Array.prototype.indexOf) {
301- Array.prototype.indexOf = function(elt /*, from*/) {
301+ Array.prototype.indexOf = function (elt /*, from*/) {
302302 var len = this.length;
303303 var from = Number(arguments[1]) || 0;
304304 from = (from < 0) ? Math.ceil(from) : Math.floor(from);
@@ -342,7 +342,7 @@
342342 return this.uniqNumber === obj.uniqNumber;
343343 };
344344
345-THIEF.func.method.removeFromInventory = function(obj) {
345+THIEF.func.method.removeFromInventory = function (obj) {
346346 var objX = obj.x;
347347 var objY = obj.y;
348348 THIEF.html.addDebugMessage(obj.get(THIEF.PROP.displayName) + 'を' + this.get(THIEF.PROP.displayName) + 'のインベントリ座標[' + obj.x + ', ' + obj.y + ']から除外...');
@@ -363,7 +363,7 @@
363363 }
364364 THIEF.html.addDebugMessage('...' + obj.get(THIEF.PROP.displayName) + 'を' + this.get(THIEF.PROP.displayName) + 'のインベントリ座標[' + objX + ', ' + objY + ']から除外完了。');
365365
366- if (this.type === 'level' && obj.active) {
366+ if (this.isLevel && obj.isActive) {
367367 THIEF.html.addDebugMessage('アクティブリストから除外');
368368 this[THIEF.PROP.actObjectList].remove(obj);
369369 }
@@ -371,7 +371,7 @@
371371 return true;
372372 };
373373
374-THIEF.func.method.addToInventory = function(obj, x, y) {
374+THIEF.func.method.addToInventory = function (obj, x, y) {
375375
376376 var result = false;
377377
@@ -421,7 +421,7 @@
421421 this.inventory[i][j].push(obj);
422422 THIEF.html.addDebugMessage('[' + i + ', ' + j + ']に' + obj.get(THIEF.PROP.alphabet) + 'として追加');
423423
424- if (this.type === 'level' && obj.active) {
424+ if (this.isLevel && obj.isActive) {
425425 THIEF.html.addDebugMessage('アクティブリストに追加');
426426 this[THIEF.PROP.actObjectList].push(obj);
427427 }
@@ -448,13 +448,13 @@
448448 var y = Math.round(Math.random() * this.get(THIEF.PROP.inventoryHeight));
449449 point = this.getInventoryFreeSpace(obj, x, y);
450450
451- if (typeof point !== 'undefined' && this.inventory[x][y].getLast().type === THIEF.Data.Obj.$Floor.type) {
451+ if (typeof point !== 'undefined' && this.inventory[x][y].getLast().isFloor) {
452452 //if (point.x === 'number' && typeof point.y === 'number') {
453453 break;
454454 }
455455 }
456456 // ランダムに見つからなければ、左上から順に検索
457- if (typeof point.x !== 'number' && typeof point.y !== 'number') {
457+ if (typeof point !== 'undefined' && typeof point.x !== 'number' && typeof point.y !== 'number') {
458458 point = this.getInventoryFreeSpace(obj);
459459 }
460460
@@ -461,7 +461,7 @@
461461 return point;
462462 };
463463
464-THIEF.func.method.getInventoryFreeSpace = function(obj, _x, _y) {
464+THIEF.func.method.getInventoryFreeSpace = function (obj, _x, _y) {
465465
466466 var invCellSize = this.get(THIEF.PROP.inventoryCellSize) || 10;
467467 var invWidth = this.get(THIEF.PROP.inventoryWidth) || 0;
@@ -495,7 +495,7 @@
495495 if (this.inventory && this.inventory[targetX] && this.inventory[targetX][targetY]) {
496496 if (this.inventory[targetX][targetY].length <= invDepth) {
497497 var lastObj = this.inventory[targetX][targetY].getLast();
498- if (typeof lastObj === 'undefined' || lastObj.type !== THIEF.Data.Obj.$Wall.type && (obj.get(THIEF.PROP.stackable) || lastObj.get(THIEF.PROP.stackable)) /* || !lastObj.get(THIEF.PARAM.mergeable) */) {
498+ if (typeof lastObj === 'undefined' || !lastObj.isWall && (obj.get(THIEF.PROP.stackable) || lastObj.get(THIEF.PROP.stackable)) /* || !lastObj.get(THIEF.PARAM.mergeable) */) {
499499 if (lastObj) {
500500 THIEF.html.addDebugMessage('[' + targetX + ', ' + targetY + ']にある' + lastObj.get(THIEF.PROP.displayName) + 'には重ねられる。');
501501 } else {
@@ -541,7 +541,7 @@
541541 return result;
542542 };
543543
544-THIEF.func.method.attackedBy = function(obj) {
544+THIEF.func.method.attackedBy = function (obj) {
545545
546546 THIEF.html.addDebugMessage(obj.get(THIEF.PROP.displayName) + ' による ' + this.get(THIEF.PROP.displayName) + ' への攻撃処理を開始...');
547547
@@ -581,7 +581,7 @@
581581 THIEF.html.addDebugMessage('死亡処理を開始...');
582582 THIEF.html.addMessage(THIEF.util.getText(THIEF.Data.Text.killBy, this.get(THIEF.PROP.displayName), obj.get(THIEF.PROP.displayName)));
583583 THIEF.global.actLV.removeFromInventory(this);
584- this.action = function() {
584+ this.action = function () {
585585 return true
586586 };
587587 THIEF.html.addDebugMessage('...死亡処理を完了。')
@@ -592,11 +592,11 @@
592592 return true;
593593 };
594594
595-THIEF.func.method.getInventoryXyObjectList = function(x, y) {
595+THIEF.func.method.getInventoryXyObjectList = function (x, y) {
596596 return this.inventory[x][y];
597597 };
598598
599-THIEF.func.method.getInventoryXyLastObject = function(x, y) {
599+THIEF.func.method.getInventoryXyLastObject = function (x, y) {
600600 var obj;
601601
602602 // 必ずしも inventory の配列を完全に持っているとは限らないので注意すること
@@ -606,17 +606,17 @@
606606 return obj;
607607 };
608608
609-THIEF.func.method.removeInventoryObject = function(o) {
609+THIEF.func.method.removeInventoryObject = function (o) {
610610 this.removeInventoryXyObject(o.x, o.y, o);
611611 };
612612
613613
614-THIEF.func.method.removeInventoryXyObject = function(x, y, o) {
614+THIEF.func.method.removeInventoryXyObject = function (x, y, o) {
615615 this.inventory[x][y].remove(o);
616616 };
617617
618618 // ループ処理を加えること
619-THIEF.func.method.getInventoryAlphabets = function() {
619+THIEF.func.method.getInventoryAlphabets = function () {
620620 var alphabets = [];
621621 if (this.inventory) {
622622 for (var i = 0; i < this.get(THIEF.PROP.inventoryWidth); i++) {
@@ -638,11 +638,11 @@
638638 return alphabets;
639639 };
640640
641-THIEF.func.method.getInventoryNonExistAlphabet = function() {
641+THIEF.func.method.getInventoryNonExistAlphabet = function () {
642642 // 常にアルファベットの先頭が利用されないようにしている
643643 var key = THIEF.KEY;
644644 var index = key.a;
645- return function() {
645+ return function () {
646646 var alphabets = this.getInventoryAlphabets();
647647
648648 var counter = 0;
@@ -670,7 +670,7 @@
670670 }();
671671
672672 // 配列を渡してカリー化(?)
673-THIEF.func.method.selecter = function(objs, exec, immediately, abc) {
673+THIEF.func.method.selector = function (objs, exec, immediately, abc) {
674674
675675 var key = THIEF.KEY;
676676 var selected = [];
@@ -714,7 +714,7 @@
714714 }
715715
716716 // 選択用関数返却
717- return function() {
717+ return function () {
718718 var finish = false;
719719 switch (THIEF.global.keycode) {
720720
@@ -787,7 +787,7 @@
787787
788788 };
789789
790-THIEF.func.method.cpu = function() {
790+THIEF.func.method.cpu = function () {
791791
792792 THIEF.html.addDebugMessage('CPU行動開始...');
793793
@@ -818,7 +818,7 @@
818818 return true;
819819 };
820820
821-THIEF.func.method.move = function(dx, dy) {
821+THIEF.func.method.move = function (dx, dy) {
822822
823823 var result;
824824 THIEF.html.addDebugMessage('移動処理 move(' + dx + ', ' + dy + ') を開始...');
@@ -847,7 +847,7 @@
847847 result = true;
848848
849849 } else {
850- if (target.get(THIEF.PROP.active)) {
850+ if (target.get(THIEF.PROP.isActive)) {
851851 THIEF.html.addDebugMessage('active なものが対象なので攻撃してみる。');
852852 target.attackedBy(this);
853853 result = true;
@@ -869,7 +869,7 @@
869869 return false;
870870 };
871871
872-THIEF.func.method.getObjectList = function(compObj, recursive) {
872+THIEF.func.method.getObjectList = function (compObj, recursive) {
873873
874874 var list = [];
875875 if (typeof this.inventory !== "undefined") {
@@ -910,12 +910,12 @@
910910 return list;
911911 };
912912
913-THIEF.func.method.execActiveObjects = function() {
913+THIEF.func.method.execActiveObjects = function () {
914914 var result = true;
915915
916916 if (this[THIEF.PROP.actObjectList]) {
917917 // アクティブリストを降順にソート
918- this[THIEF.PROP.actObjectList].sort(function(a, b) {
918+ this[THIEF.PROP.actObjectList].sort(function (a, b) {
919919 return b.ct - a.ct;
920920 });
921921
@@ -933,7 +933,7 @@
933933 }
934934
935935 // アクティブリストを降順にソート
936- this[THIEF.PROP.actObjectList].sort(function(a, b) {
936+ this[THIEF.PROP.actObjectList].sort(function (a, b) {
937937 return b.ct - a.ct;
938938 });
939939 }
@@ -941,7 +941,7 @@
941941 return result;
942942 };
943943
944-THIEF.func.method.action = function() {
944+THIEF.func.method.action = function () {
945945
946946 THIEF.html.addDebugMessage(this.get(THIEF.PROP.displayName) + ' の行動を開始...');
947947 var result;
@@ -956,7 +956,7 @@
956956 return result;
957957 };
958958
959-THIEF.func.method.decay = function() {
959+THIEF.func.method.decay = function () {
960960
961961 if (this.decayable) {
962962 this.dp--;
@@ -969,7 +969,7 @@
969969 return true;
970970 };
971971
972-THIEF.func.method.manual = function() {
972+THIEF.func.method.manual = function () {
973973
974974 var finish;
975975 var code = THIEF.global.keycode;
@@ -1017,7 +1017,7 @@
10171017 return obj;
10181018 };
10191019
1020-THIEF.func.method.goTheStairs = function(trueIsUpFalseIsDown) {
1020+THIEF.func.method.goTheStairs = function (trueIsUpFalseIsDown) {
10211021 var floor = THIEF.global.actLV.getInventoryXyObjectList(this.x, this.y);
10221022 var stairs;
10231023 var flag = false;
@@ -1099,49 +1099,49 @@
10991099 };
11001100
11011101 THIEF.func.command = {}; // マニュアルコマンドで実行して良いもの
1102-THIEF.func.command.goUp = function() {
1102+THIEF.func.command.goUp = function () {
11031103 return this.move(0, -1);
11041104 };
11051105
1106-THIEF.func.command.goDown = function() {
1106+THIEF.func.command.goDown = function () {
11071107 return this.move(0, 1);
11081108 };
11091109
1110-THIEF.func.command.goLeft = function() {
1110+THIEF.func.command.goLeft = function () {
11111111 return this.move(-1, 0);
11121112 };
11131113
1114-THIEF.func.command.goRight = function() {
1114+THIEF.func.command.goRight = function () {
11151115 return this.move(1, 0);
11161116 };
11171117
1118-THIEF.func.command.goUpperLeft = function() {
1118+THIEF.func.command.goUpperLeft = function () {
11191119 return this.move(-1, -1);
11201120 };
11211121
1122-THIEF.func.command.goUpperRight = function() {
1122+THIEF.func.command.goUpperRight = function () {
11231123 return this.move(1, -1);
11241124 };
11251125
1126-THIEF.func.command.goLowerLeft = function() {
1126+THIEF.func.command.goLowerLeft = function () {
11271127 return this.move(-1, 1);
11281128 };
11291129
1130-THIEF.func.command.goLowerRight = function() {
1130+THIEF.func.command.goLowerRight = function () {
11311131 return this.move(1, 1);
11321132 };
11331133
1134-THIEF.func.command.refreshHTML = function() {
1134+THIEF.func.command.refreshHTML = function () {
11351135 THIEF.html.refresh();
11361136 return false;
11371137 };
11381138
1139-THIEF.func.command.rest = function() {
1139+THIEF.func.command.rest = function () {
11401140 this.ct = 99;
11411141 return true;
11421142 };
11431143
1144-THIEF.func.command.pickup = function() {
1144+THIEF.func.command.pickup = function () {
11451145 var tmp = THIEF.global.actLV.getInventoryXyObjectList(this.x, this.y);
11461146 var finish = true;
11471147 var objs = [];
@@ -1155,7 +1155,7 @@
11551155 if (objs.length > 0) {
11561156 var from = THIEF.global.actLV;
11571157 var to = this;
1158- var exec = function(selected) {
1158+ var exec = function (selected) {
11591159 var result = false;
11601160
11611161 for (var i = 0; i < selected.length; i++) {
@@ -1176,7 +1176,7 @@
11761176 };
11771177
11781178 THIEF.html.addMessage(THIEF.util.getText(THIEF.Data.Text.pickupWhich));
1179- this.action = THIEF.func.method.selecter(objs, exec, false, true);
1179+ this.action = THIEF.func.method.selector(objs, exec, false, true);
11801180 finish = false;
11811181 } else {
11821182 THIEF.html.addMessage(THIEF.util.getText(THIEF.Data.Text.noItemHere));
@@ -1184,7 +1184,7 @@
11841184 return finish;
11851185 };
11861186
1187-THIEF.func.command.drop = function() {
1187+THIEF.func.command.drop = function () {
11881188
11891189 // とりあえず一次元配列化
11901190 var list = [];
@@ -1213,7 +1213,7 @@
12131213 if (list.length > 0) {
12141214 var from = this;
12151215 var to = THIEF.global.actLV;
1216- var exec = function(selected) {
1216+ var exec = function (selected) {
12171217 var act = false;
12181218 if (selected.length > 0) {
12191219 act = true;
@@ -1247,7 +1247,7 @@
12471247 return act;
12481248 };
12491249
1250- this.action = THIEF.func.method.selecter(list, exec, false, false);
1250+ this.action = THIEF.func.method.selector(list, exec, false, false);
12511251 //result = this.action();
12521252 //result = false;
12531253 } else {
@@ -1257,7 +1257,7 @@
12571257 return false;
12581258 };
12591259
1260-THIEF.func.command.showInventory = function() {
1260+THIEF.func.command.showInventory = function () {
12611261
12621262 THIEF.html.addDebugMessage(this.get(THIEF.PROP.displayName) + 'のインベントリ表示を開始...');
12631263
@@ -1287,7 +1287,7 @@
12871287 if (list.length === 0) {
12881288 THIEF.html.addMessage(THIEF.util.getText(THIEF.Data.Text.inventoryIsEmpty));
12891289 } else {
1290- this.action = THIEF.func.method.selecter(list, THIEF.func.method.inputWait, true, false);
1290+ this.action = THIEF.func.method.selector(list, THIEF.func.method.inputWait, true, false);
12911291 }
12921292
12931293 THIEF.html.addDebugMessage('...' + this.get(THIEF.PROP.displayName) + 'のインベントリ表示を完了。');
@@ -1295,7 +1295,7 @@
12951295 return false;
12961296 };
12971297
1298-THIEF.func.command.printHistory = function() {
1298+THIEF.func.command.printHistory = function () {
12991299
13001300 var key = THIEF.KEY;
13011301
@@ -1310,7 +1310,7 @@
13101310
13111311 THIEF.html.addInfomation('<div style="text-align:center;">--Now--</div>');
13121312
1313- this.action = function() {
1313+ this.action = function () {
13141314 var finish = false;
13151315 switch (THIEF.global.keycode) {
13161316
@@ -1373,7 +1373,7 @@
13731373 return false;
13741374 };
13751375
1376-THIEF.func.command.extendedCommand = function() {
1376+THIEF.func.command.extendedCommand = function () {
13771377
13781378 THIEF.html.setInput('#');
13791379
@@ -1393,7 +1393,7 @@
13931393 var line = '';
13941394 var target = '';
13951395
1396- this.action = function() {
1396+ this.action = function () {
13971397 var finish = false;
13981398 var update = false;
13991399 if ((THIEF.KEY.a <= THIEF.global.keycode && THIEF.global.keycode <= THIEF.KEY.z) || (THIEF.KEY.A <= THIEF.global.keycode && THIEF.global.keycode <= THIEF.KEY.Z)) {
@@ -1472,7 +1472,7 @@
14721472 var my = this;
14731473 // メソッド書き換え
14741474 if (list.length > 0) {
1475- var exec = function(selected) {
1475+ var exec = function (selected) {
14761476 var act = false;
14771477 if (selected.length > 0) {
14781478 act = true;
@@ -1505,7 +1505,7 @@
15051505 return act;
15061506 };
15071507
1508- this.action = THIEF.func.method.selecter(list, exec, true, false);
1508+ this.action = THIEF.func.method.selector(list, exec, true, false);
15091509 } else {
15101510 THIEF.html.addMessage(THIEF.util.getText(THIEF.Data.Text.inventoryIsEmpty));
15111511 }
@@ -1513,17 +1513,17 @@
15131513 return false;
15141514 };
15151515
1516-THIEF.func.command.goUpTheStairs = function() {
1516+THIEF.func.command.goUpTheStairs = function () {
15171517 return THIEF.func.method.goTheStairs.call(this, true);
15181518 };
15191519
1520-THIEF.func.command.goDownTheStairs = function() {
1520+THIEF.func.command.goDownTheStairs = function () {
15211521 return THIEF.func.method.goTheStairs.call(this, false);
15221522 };
15231523
15241524 THIEF.util = {};
15251525
1526-THIEF.util.init = function() {
1526+THIEF.util.init = function () {
15271527
15281528 THIEF.html.addDebugMessage('<em>初期化(ターン0)を開始</em>...');
15291529
@@ -1552,7 +1552,7 @@
15521552 };
15531553
15541554
1555-THIEF.util.test = function() {
1555+THIEF.util.test = function () {
15561556
15571557 THIEF.global.adventurer = THIEF.util.factory(THIEF.Data.Obj.Human);
15581558 THIEF.global.adventurer.color = 'red';
@@ -1662,7 +1662,7 @@
16621662 };
16631663
16641664
1665-THIEF.util.getKeyCode = function(e) {
1665+THIEF.util.getKeyCode = function (e) {
16661666
16671667 // Browser bug fix
16681668 if (!e) {
@@ -1679,7 +1679,7 @@
16791679 } else if (document.getElementById) {
16801680 code = parseInt((parseInt(e.keyCode) === 0) ? e.charCode : e.keyCode);
16811681 } else { // document.layers
1682- code = parseInt(e.which);
1682+ code = parseInt(e.which.toString());
16831683 }
16841684
16851685
@@ -1759,12 +1759,12 @@
17591759
17601760 };
17611761
1762-THIEF.util.factory = function() {
1762+THIEF.util.factory = function () {
17631763
17641764 var tree = [];
17651765 var id = 0;
17661766
1767- return function(obj) {
1767+ return function (obj) {
17681768
17691769 //THIEF.html.addDebugMessage('オブジェクトの生成処理を開始...');
17701770 //THIEF.html.addDebugMessage('マスターの有無を確認...');
@@ -1981,7 +1981,7 @@
19811981 THIEF.html.addDebugMessage('...ダンジョンの作成を完了');
19821982 };
19831983
1984-THIEF.util.createLevel = function(dun, lvNum) {
1984+THIEF.util.createLevel = function (dun, lvNum) {
19851985 if (dun[lvNum] && dun[lvNum].created) {
19861986 THIEF.html.addDebugMessage(THIEF.func.method.get.call(dun, THIEF.PROP.name) + 'の第 ' + lvNum + ' レベルは既に作成済み');
19871987 return;
@@ -2114,7 +2114,7 @@
21142114 level.safety = template.safety;
21152115 }
21162116
2117- level.type = 'level';
2117+ level.isLevel = true;
21182118 level.created = true;
21192119 dun[lvNum] = level;
21202120
@@ -2121,7 +2121,7 @@
21212121 THIEF.html.addDebugMessage('...レベルの作成を完了');
21222122 };
21232123
2124-THIEF.util.createMap = function(width, height) {
2124+THIEF.util.createMap = function (width, height) {
21252125
21262126 var i, j;
21272127 var map = [];
@@ -2143,7 +2143,7 @@
21432143 var maxRooms = Math.floor(Math.random() * (width + height) / 10) + (width + height) / 20;
21442144 var anchors = []; // 部屋の起点(一番左上=若い座標)
21452145 var spaceEdges = [
2146- {x:1, y:1}
2146+ {x : 1, y : 1}
21472147 ]; // 左上は常にスペースの角のため
21482148 var roonCount = 0;
21492149 var roop = 0;
@@ -2220,7 +2220,7 @@
22202220 // 壁までの距離が短い方に伸ばすように分割線を引く
22212221 // 長い方に伸ばすように引くと部屋が小さくなるため
22222222 map[ax][ay].push(THIEF.util.factory(THIEF.Data.Obj.DarkFloor));
2223- anchors.push({x:ax, y:ay});
2223+ anchors.push({x : ax, y : ay});
22242224
22252225 if (my < mx) {
22262226 // 縦に引く
@@ -2229,7 +2229,7 @@
22292229 map[ax][i].push(THIEF.util.factory(THIEF.Data.Obj.DarkFloor));
22302230 } else {
22312231 // 上端に付いた場合には、その一つ右は必ず領域の一番左上になる
2232- spaceEdges.push({x:ax + 1, y:i + 1});
2232+ spaceEdges.push({x : ax + 1, y : i + 1});
22332233 break;
22342234 }
22352235 }
@@ -2247,7 +2247,7 @@
22472247 map[i][ay].push(THIEF.util.factory(THIEF.Data.Obj.DarkFloor));
22482248 } else {
22492249 // 左端に付いた場合には、その一つ下は必ず領域の一番左上になる
2250- spaceEdges.push({x:i + 1, y:ay + 1});
2250+ spaceEdges.push({x : i + 1, y : ay + 1});
22512251 break;
22522252 }
22532253 }
@@ -2306,7 +2306,7 @@
23062306 endY++;
23072307 }
23082308
2309- roomsInfo.push({x:x + startX, y:y + startY, width:endX - startX, height:endY - startY});
2309+ roomsInfo.push({x : x + startX, y : y + startY, width : endX - startX, height : endY - startY});
23102310
23112311 // 部屋作成
23122312 for (i = startX; i < endX; i++) {
@@ -2396,53 +2396,53 @@
23962396
23972397 // 不要な通路を削除
23982398
2399- var clearFloor = function(_x, _y) {
2399+ var clearFloor = function (_x, _y) {
24002400 var around;
24012401 var x = _x;
24022402 var y = _y;
24032403 var nextX, nextY;
24042404 var flr = map[x][y].getLast();
2405- if (typeof flr !== 'undefined' && flr.type === THIEF.Data.Obj.$Floor.type) {
2405+ if (typeof flr !== 'undefined' && flr.isFloor) {
24062406 while (true) {
24072407 // 周囲に通路が一つだけか調べる
24082408 around = 0;
2409- if (typeof map[x - 1][y - 1].getLast() !== 'undefined' && map[x - 1][y - 1].getLast().type === THIEF.Data.Obj.$Floor.type) {
2409+ if (typeof map[x - 1][y - 1].getLast() !== 'undefined' && map[x - 1][y - 1].getLast().isFloor) {
24102410 around++;
24112411 nextX = x - 1;
24122412 nextY = y - 1;
24132413 }
2414- if (typeof map[x][y - 1].getLast() !== 'undefined' && map[x][y - 1].getLast().type === THIEF.Data.Obj.$Floor.type) {
2414+ if (typeof map[x][y - 1].getLast() !== 'undefined' && map[x][y - 1].getLast().isFloor) {
24152415 around++;
24162416 nextX = x;
24172417 nextY = y - 1;
24182418 }
2419- if (typeof map[x + 1][y - 1].getLast() !== 'undefined' && map[x + 1][y - 1].getLast().type === THIEF.Data.Obj.$Floor.type) {
2419+ if (typeof map[x + 1][y - 1].getLast() !== 'undefined' && map[x + 1][y - 1].getLast().isFloor) {
24202420 around++;
24212421 nextX = x + 1;
24222422 nextY = y - 1;
24232423 }
2424- if (typeof map[x - 1][y].getLast() !== 'undefined' && map[x - 1][y].getLast().type === THIEF.Data.Obj.$Floor.type) {
2424+ if (typeof map[x - 1][y].getLast() !== 'undefined' && map[x - 1][y].getLast().isFloor) {
24252425 around++;
24262426 nextX = x - 1;
24272427 nextY = y;
24282428 }
24292429 // me
2430- if (typeof map[x + 1][y].getLast() !== 'undefined' && map[x + 1][y].getLast().type === THIEF.Data.Obj.$Floor.type) {
2430+ if (typeof map[x + 1][y].getLast() !== 'undefined' && map[x + 1][y].getLast().isFloor) {
24312431 around++;
24322432 nextX = x + 1;
24332433 nextY = y;
24342434 }
2435- if (typeof map[x - 1][y + 1].getLast() !== 'undefined' && map[x - 1][y + 1].getLast().type === THIEF.Data.Obj.$Floor.type) {
2435+ if (typeof map[x - 1][y + 1].getLast() !== 'undefined' && map[x - 1][y + 1].getLast().isFloor) {
24362436 around++;
24372437 nextX = x - 1;
24382438 nextY = y + 1;
24392439 }
2440- if (typeof map[x][y + 1].getLast() !== 'undefined' && map[x][y + 1].getLast().type === THIEF.Data.Obj.$Floor.type) {
2440+ if (typeof map[x][y + 1].getLast() !== 'undefined' && map[x][y + 1].getLast().isFloor) {
24412441 around++;
24422442 nextX = x;
24432443 nextY = y + 1;
24442444 }
2445- if (typeof map[x + 1][y + 1].getLast() !== 'undefined' && map[x + 1][y + 1].getLast().type === THIEF.Data.Obj.$Floor.type) {
2445+ if (typeof map[x + 1][y + 1].getLast() !== 'undefined' && map[x + 1][y + 1].getLast().isFloor) {
24462446 around++;
24472447 nextX = x + 1;
24482448 nextY = y + 1;
@@ -2482,7 +2482,7 @@
24822482 return map;
24832483 };
24842484
2485-THIEF.util.mapParser = function(fmt) {
2485+THIEF.util.mapParser = function (fmt) {
24862486 var width = fmt[0].length;
24872487 var height = fmt.length;
24882488 var map = [];
@@ -2746,7 +2746,7 @@
27462746 return revP[0];
27472747 };
27482748
2749-THIEF.util.getText = function() {
2749+THIEF.util.getText = function () {
27502750 var text;
27512751 var i, j;
27522752
@@ -2856,7 +2856,7 @@
28562856
28572857 THIEF.html = {};
28582858
2859-THIEF.html.setXy = function(x, y, text) {
2859+THIEF.html.setXy = function (x, y, text) {
28602860 if (0 <= x && x < THIEF.conf.mapWidth && 0 <= y && y < THIEF.conf.mapHeight) {
28612861 document.getElementById(THIEF.conf.id + x + '_' + y).innerHTML = text;
28622862 }
@@ -2863,7 +2863,7 @@
28632863 };
28642864
28652865
2866-THIEF.html.refreshXy = function(x, y) {
2866+THIEF.html.refreshXy = function (x, y) {
28672867 if (THIEF.global.actLV.inventory[x] && THIEF.global.actLV.inventory[x][y]) {
28682868 var obj = THIEF.global.actLV.inventory[x][y].getLast();
28692869 if (obj.color) {
@@ -2876,7 +2876,7 @@
28762876 }
28772877 };
28782878
2879-THIEF.html.refresh = function() {
2879+THIEF.html.refresh = function () {
28802880 THIEF.html.addDebugMessage('再描画を開始...');
28812881 for (var i = 0; i < THIEF.conf.mapWidth; i++) {
28822882 for (var j = 0; j < THIEF.conf.mapHeight; j++) {
@@ -2886,15 +2886,15 @@
28862886 THIEF.html.addDebugMessage('...再描画を完了。');
28872887 };
28882888
2889-THIEF.html.setInput = function(text) {
2889+THIEF.html.setInput = function (text) {
28902890 document.getElementById(THIEF.conf.id + 'Input').innerHTML = text;
28912891 };
28922892
2893-THIEF.html.addInput = function(text) {
2893+THIEF.html.addInput = function (text) {
28942894 document.getElementById(THIEF.conf.id + 'Input').innerHTML += text;
28952895 };
28962896
2897-THIEF.html.addMessage = function(text) {
2897+THIEF.html.addMessage = function (text) {
28982898
28992899 if (text) {
29002900 var log = {};
@@ -2919,27 +2919,27 @@
29192919 document.getElementById(THIEF.conf.id + 'Message' + (THIEF.conf.messageLines - 1)).innerHTML = text || '&nbsp;';
29202920 };
29212921
2922-THIEF.html.clearMessage = function() {
2922+THIEF.html.clearMessage = function () {
29232923 for (var i = 0; i < THIEF.conf.messageLines; i++) {
29242924 document.getElementById(THIEF.conf.id + 'Message' + i).innerHTML = '&nbsp;';
29252925 }
29262926 };
29272927
2928-THIEF.html.clearInfomation = function() {
2928+THIEF.html.clearInfomation = function () {
29292929 document.getElementById(THIEF.conf.id + 'Infomation').innerHTML = '';
29302930 };
29312931
2932-THIEF.html.addInfomation = function(text) {
2932+THIEF.html.addInfomation = function (text) {
29332933 document.getElementById(THIEF.conf.id + 'Infomation').innerHTML += '<p>' + text + '</p>\n';
29342934 };
29352935
29362936 //noinspection JSUnusedGlobalSymbols
2937-THIEF.html.addDebugMessage = function() {
2937+THIEF.html.addDebugMessage = function () {
29382938
29392939 var indent = '';
29402940 var hist = [];
29412941
2942- return function(text) {
2942+ return function (text) {
29432943
29442944 if (THIEF.conf.debugmode) {
29452945 if (typeof text === 'string') {
@@ -2991,7 +2991,7 @@
29912991 };
29922992 */
29932993
2994-THIEF.html.showCommandHelp = function() {
2994+THIEF.html.showCommandHelp = function () {
29952995 var help = '';
29962996 help += '<table border=1>\n';
29972997 help += '<tr><th colspan=3>Command Help</th></tr>\n';
@@ -3001,7 +3001,7 @@
30013001 com.push(name);
30023002 }
30033003 }
3004- com.sort(function(a, b) {
3004+ com.sort(function (a, b) {
30053005 var x = THIEF.Data.Keymap[a].key;
30063006 var y = THIEF.Data.Keymap[b].key;
30073007
@@ -3036,7 +3036,7 @@
30363036 document.getElementById(THIEF.conf.id + 'Footer').innerHTML = help;
30373037 };
30383038
3039-THIEF.html.init = function() {
3039+THIEF.html.init = function () {
30403040
30413041 var line = '';
30423042 var i, j;
@@ -3047,11 +3047,11 @@
30473047 document.getElementsByTagName('head')[0].appendChild(style);
30483048 var sheet = document.styleSheets[0];
30493049 if (sheet.insertRule) {
3050- sheet.addStyle = function(selector, property, value) {
3050+ sheet.addStyle = function (selector, property, value) {
30513051 sheet.insertRule(selector + '{' + property + ':' + value + ';}', sheet.cssRules.length);
30523052 };
30533053 } else {
3054- sheet.addStyle = function(selector, property, value) {
3054+ sheet.addStyle = function (selector, property, value) {
30553055 sheet.addRule(selector, property + ':' + value);
30563056 };
30573057
@@ -3367,7 +3367,7 @@
33673367 ja : 'アイテムを置く',
33683368 en : 'drop your items.'
33693369 },
3370- cmdExecuteCommandDesc : {
3370+ cmdExecuteCommandDesc : {
33713371 ja : '指定したコマンドを実行します',
33723372 en : 'execute command'
33733373 },
@@ -3482,7 +3482,7 @@
34823482 };
34833483
34843484 THIEF.Data.Prop = { // 特殊変数登録用
3485- displayName : function() {
3485+ displayName : function () {
34863486 var text = '';
34873487 if (this.equiped) {
34883488 text += '[E] '
@@ -3576,16 +3576,15 @@
35763576 THIEF.Data.Obj.$ = { // Default
35773577 name : THIEF.Data.Text.objDefaultName,
35783578 symbol : '&#x2573;', // 未登録用印(X に近い)
3579- symbolName : THIEF.Data.Text.objDefaultSymbolName,
3580- type : 'unknown'
3579+ symbolName : THIEF.Data.Text.objDefaultSymbolName
35813580 };
35823581
35833582
35843583 THIEF.Data.Obj.$Monster = {
3585- active : true,
3584+ isActive : true,
35863585 ct : 0,
35873586 maxct : 100,
3588- type : 'monster'
3587+ isMonster : true
35893588 };
35903589
35913590 THIEF.Data.Obj.$Item = {
@@ -3592,10 +3591,9 @@
35923591 stackable : true,
35933592 mergeable : true,
35943593 portable : true,
3595- isItem : true,
35963594 slot : 'Hand', // すべてのアイテムは手に持てる。
35973595 slotName : THIEF.Data.Text.slotNameOfHand,
3598- type : 'item'
3596+ isItem : true
35993597 };
36003598
36013599 THIEF.Data.Obj.$Armor = {
@@ -3606,8 +3604,8 @@
36063604 };
36073605
36083606 THIEF.Data.Obj.$Level = {
3609- active : false,
3610- type : 'level'
3607+ isActive : false,
3608+ isLevel : true
36113609 };
36123610
36133611 THIEF.Data.Obj.$Humanoid = {
@@ -3650,7 +3648,7 @@
36503648
36513649 THIEF.Data.Obj.$Floor = {
36523650 stackable : true,
3653- type : 'floor'
3651+ isFloor : true
36543652 // diggable : true
36553653 };
36563654
@@ -3680,7 +3678,7 @@
36803678
36813679 THIEF.Data.Obj.$Wall = {
36823680 symbol : '&#x2593;', // 濃いドット模様
3683- type : 'wall'
3681+ isWall : true
36843682 //diggable : true
36853683 };
36863684
Show on old repository browser