データベースは、プログラムのどこかに固めて書いておきます。別ファイルにする意義は感じられないので、プログラム内にべた書きしておきます。所持品は、冒険を進めていくうちに手に入るものをevent、マーリンの秘密の隠れ家2で手に入る装備品をequip、マーリンの秘密の隠れ家3で手に入る魔法の品をmagicの3つに分けています。分ける必要はあまりないですが、気分の問題で分けてみました。eventの眠り玉とmagicの眠り玉は効果の強弱に違いがあったが、その処理は分けなくても内部のID番号さえ違うようにしていれば処理できる。labelプロパティは、ボタンに表示される文字列として使われます。ポイントとしては、id番号0はダミーにしておいて、ダミーを所持している部分は表示しないように扱うところ?

var data_event = [
    {id_num: 0,	name: "空欄",                 comment: "空欄",                              label: "空欄"},
    {id_num: 1,	name: "E・J",                 comment: "基準点3 追加被害点5",               label: "斬る"},		// 55,60
    {id_num: 2,	name: "首に刺さったボルト",   comment: "マーリンの人体実験用",              label: "ふれる"},		// 33
    {id_num: 3,	name: "眠り玉",               comment: "12回x人のあいだ敵を眠らせる",       label: "割る"},	// 33,34
    {id_num: 4,	name: "ノコギリ草",           comment: "実はサソリ毒の唯一の解毒剤",        label: "食べる"  },	//  18
    {id_num: 5,	name: "羊皮紙",               comment: "巨人が踊っているような奇妙な絵",    label: "見せる"},	//  10
    {id_num: 6,	name: "金貨",                 comment: "買物やワイロに使う",                label: "払う"}, // 79,65,88,117,125,170
    {id_num: 7,	name: "治療薬",               comment: "サイコロ2個生命点回復",             label: "飲む"},	 // 8,34
    {id_num: 8,	name: "通行許可硬貨",         comment: "片面にXと幼稚につづられている",     label: "渡す"},	 // 8
    {id_num: 9,	name: "サクラの花",           comment: "門を守っている男に渡す",            label: "渡す"},	// 56
    {id_num:10,	name: "楕円のメダル",         comment: "表裏に絵模様、真ん中に穴",          label: "唱える"},	// 132
    {id_num:11,	name: "警告球",               comment: "銀安全、黄危険、赤大危険、金聖剣",  label: "見る"},	//  98
    {id_num:12,	name: "ハチミツ",             comment: "サイコロ2個の2倍生命点回復",        label: "食べる"  },	// 49
    {id_num:13,	name: "稲妻の矢",             comment: "サイコロ2個6以上で生命点半減",      label: "放つ"  },	// 97
    {id_num:14,	name: "魔法のラッパ",         comment: "サイコロ2個6以上で10被害点",        label: "吹く"  },	// 97
    {id_num:15,	name: "ドラゴン・ファイア錠", comment: "確実に35被害点",                    label: "飲む"  },	// 97
    {id_num:16,	name: "ブロンの歯",           comment: "ブロンが襲ってこなくなる",          label: "使う"  },	// 42,116
    {id_num:17,	name: "ルビー",               comment: "象牙の杖が力の発揮に必要",          label: "使う"  },	// 30
    {id_num:18,	name: "象牙の杖",             comment: "先に宝石をはめ込む穴がある",        label: "使う"  },	// 106
    {id_num:19,	name: "音楽堂のチケット",     comment: "市立音楽堂 入場を許可す-無料",      label: "渡す"  },	// 107
    {id_num:20,	name: "博物館のチケット",     comment: "市立博物館の無料入場券",            label: "渡す"  },	// 134
    {id_num:21,	name: "八角形の銅貨",         comment: "王室発行-ブラッグワート王バンザイ", label: "払う"  },	// 143,160,164,170,
    {id_num:22,	name: "八角形の合金の硬貨",   comment: "王室発行-ブロッグワート王バンザイ", label: "払う"  },	// 125,136,175,161,162,167
    {id_num:23,	name: "エクスカリバー",       comment: "追加被害点10",                      label: "斬る"  } // 171
];	//
var data_equip = [
    {id_num: 0,	name: "空欄",         comment: "",            label: "空欄"},
    {id_num: 1,	name: "斧",           comment: "木を切る",    label: "切る"},
    {id_num: 2,	name: "包帯",         comment: "",            label: "使う"},
    {id_num: 3,	name: "長靴",         comment: "",            label: "使う"},
    {id_num: 4,	name: "つけ髭",       comment: "",            label: "つける"},
    {id_num: 5,	name: "ハンマー",     comment: "釘を打つ",    label: "使う"},
    {id_num: 6,	name: "ハープ",       comment: "",            label: "奏でる"},
    {id_num: 7,	name: "ランタン",     comment: "",            label: "使う"},
    {id_num: 8,	name: "ギター",       comment: "",            label: "弾く"},
    {id_num: 9,	name: "木槌",         comment: "釘を打つ",    label: "打つ"},
    {id_num:10,	name: "大釘",         comment: "",            label: "使う"},
    {id_num:11,	name: "三つの小笛",   comment: "",            label: "吹く"},
    {id_num:12,	name: "軟膏",         comment: "生命点3回復", label: "塗る"},
    {id_num:13,	name: "カボチャ",     comment: "",            label: "使う"},
    {id_num:14,	name: "水晶板",       comment: "",            label: "見せる"},
    {id_num:15,	name: "羽根ペン",     comment: "",            label: "使う"},
    {id_num:16,	name: "食料",         comment: "一週間分",    label: "使う"},
    {id_num:17,	name: "ロープ",       comment: "150m巻",      label: "使う"},
    {id_num:18,	name: "袋詰めの穀物", comment: "",            label: "使う"},
    {id_num:19,	name: "サンダル",     comment: "",            label: "使う"},
    {id_num:20,	name: "ノコギリ",     comment: "木を切る",    label: "切る"},
    {id_num:21,	name: "羊皮の胴着",   comment: "",            label: "着る"},
    {id_num:22,	name: "ほくち箱",     comment: "",            label: "着火"},
    {id_num:23,	name: "水袋",         comment: "水入り",      label: "使う"},
    {id_num:24,	name: "バネつき靴",   comment: "大ジャンプ",  label: "跳ねる"}
];	//
var data_magic = [
    {id_num: 0,	name: "空欄",               comment: "空欄",                                   label: "空欄"},
    {id_num: 1,	name: "魔法の削り骨",       comment: "生命点5点消費。目の前の人を即死",        label: "削る"},
    {id_num: 2,	name: "首に刺さったボルト", comment: "右側を触れば敵が12で感電死",             label: "触れる"},
    {id_num: 3,	name: "スピードアップ靴",   comment: "戦闘のあいだ2回連続攻撃",                label: "履く"},
    {id_num: 4,	name: "悪魔を呼ぶ死の鐘",   comment: "フレッド召還。3-6で味方、1-2で敵",       label: "鳴らす"},
    {id_num: 5,	name: "エジプトの死仮面",   comment: "戦いを避ける。生命点1点失う。",          label: "かぶる"},
    {id_num: 6,	name: "太陽神の目",         comment: "人間の敵に6回連続攻撃。生命点10消費",    label: "使う"},
    {id_num: 7,	name: "笑い球",             comment: "敵3人を3回連続攻撃",                     label: "割る"},
    {id_num: 8,	name: "稲妻の杖",           comment: "必中。サイコロ2個の2倍の被害点",         label: "使う"},
    {id_num: 9,	name: "幸運の金貨",         comment: "一度の闘いで3回被害点+2",                label: "使う"},
    {id_num:10,	name: "火の玉",             comment: "サイコロ2個6以上で75被害点",             label: "放つ"},
    {id_num:11,	name: "友好の仮面",         comment: "セクション前につけると友好反応を得る",   label: "つける"},
    {id_num:12,	name: "破壊球",             comment: "4-6で敵全滅、1-3で自死",                 label: "使う"},
    {id_num:13,	name: "脳波兜",             comment: "敵を7回連続攻撃、敵からの被害点半分",    label: "かぶる"},
    {id_num:14,	name: "虹の泡のパイプ",     comment: "大量の虹の泡を大量発生。とても美しい",   label: "ふかす"},
    {id_num:15,	name: "復活の杖",           comment: "生命点15消費。サイコロ2個9以上で14回避", label: "使う"},
    {id_num:16,	name: "泡渦巻き",           comment: "二回だけ被害点をはね返せる",             label: "使う"},
    {id_num:17,	name: "投げ針",             comment: "敵の名前と位置が分かれば、生命点半減",   label: "投げる"},
    {id_num:18,	name: "眠り玉",             comment: "3回x人眠らせる",                         label: "割る"},
    {id_num:19,	name: "友好オイル",         comment: "異性の人間あるいは小人の友好反応を得る", label: "塗る"},
    {id_num:20,	name: "即死剣",             comment: "11か12で即死。EJは3回参戦拒否",          label: "斬る"}
];	//

参考までに、敵のデータベースはこれです。

var enemy_data = [
    {id_num: 0,	name: "ダミー",             max_LIFE_POINT:  0, LIFE_POINT:  0, attack_base: 6, extra_damage: 0,	defence: 0, attack_way: "素手",                 Section:  "0", Bribery_amount: 0},
    {id_num: 1,	name: "間抜けな百姓",       max_LIFE_POINT: 15, LIFE_POINT: 15, attack_base: 7, extra_damage: 3,	defence: 0, attack_way: "棍棒",                 Section: "46", Bribery_amount: 0},
    {id_num: 2,	name: "間抜けな百姓",       max_LIFE_POINT: 15, LIFE_POINT: 15, attack_base: 6, extra_damage: 0,	defence: 0, attack_way: "素手",                 Section: "75", Bribery_amount: 0},
    {id_num: 3,	name: "ずんぐりした百姓",   max_LIFE_POINT: 26, LIFE_POINT: 26, attack_base: 6, extra_damage: 4,	defence: 0, attack_way: "棍棒",                 Section: "66", Bribery_amount: 0},
    {id_num: 4,	name: "乱暴な百姓",         max_LIFE_POINT: 20, LIFE_POINT: 20, attack_base: 6, extra_damage: 3,	defence: 0, attack_way: "棍棒",                 Section: "83", Bribery_amount: 0},
    {id_num: 5,	name: "盗賊",               max_LIFE_POINT: 15, LIFE_POINT: 15, attack_base: 5, extra_damage: 2,	defence: 0, attack_way: "短剣",                 Section: "41", Bribery_amount: 0},
    {id_num: 6,	name: "醜い百姓",           max_LIFE_POINT: 30, LIFE_POINT: 30, attack_base: 6, extra_damage: 2,	defence: 0, attack_way: "干し草用フォーク",     Section: "70", Bribery_amount: 0},
    {id_num: 7,	name: "黒衣の祭司",         max_LIFE_POINT: 20, LIFE_POINT: 20, attack_base: 3, extra_damage: 3,	defence: 0, attack_way: "鎌",                   Section: "16", Bribery_amount: 300},
    {id_num: 8,	name: "巨人",               max_LIFE_POINT:499, LIFE_POINT:499, attack_base: 4, extra_damage:15,	defence: 0, attack_way: "棍棒",                 Section: "56", Bribery_amount: 0},
    {id_num: 9,	name: "食屍鬼",             max_LIFE_POINT: 48, LIFE_POINT: 48, attack_base: 4, extra_damage: 5,	defence: 0, attack_way: "戦棍",                 Section:"105", Bribery_amount: 0},
    {id_num:10,	name: "砂のドラゴン",       max_LIFE_POINT: 55, LIFE_POINT: 55, attack_base: 7, extra_damage: 5,        defence: 4, attack_way: "噛みつき",             Section: "17", Bribery_amount: 100},
    {id_num:11,	name: "野蛮人",             max_LIFE_POINT: 12, LIFE_POINT: 12, attack_base: 5, extra_damage: 3,	defence: 0, attack_way: "剣",                   Section: "19", Bribery_amount: 100},
    {id_num:12,	name: "三つ目獣",           max_LIFE_POINT: 70, LIFE_POINT: 70, attack_base: 5, extra_damage: 4,	defence: 0, attack_way: "かぎ爪",               Section: "36", Bribery_amount: 0},
    {id_num:13,	name: "兵士ベン",           max_LIFE_POINT: 30, LIFE_POINT: 30, attack_base: 5, extra_damage: 3,	defence: 0, attack_way: "短剣",                 Section: "36", Bribery_amount: 0},
    {id_num:14,	name: "ブロン",             max_LIFE_POINT: 20, LIFE_POINT: 20, attack_base: 5, extra_damage: 3,	defence: 0, attack_way: "歯",                   Section:"116", Bribery_amount: 0},
    {id_num:15,	name: "サソリ",             max_LIFE_POINT:  3, LIFE_POINT:  3, attack_base: 6, extra_damage: 0,	defence: 0, attack_way: "毒針",                 Section: "73", Bribery_amount: 0},
    {id_num:16,	name: "見えない敵",         max_LIFE_POINT: 45, LIFE_POINT: 45, attack_base: 5, extra_damage: 6,	defence: 0, attack_way: "バカ力",               Section: "82", Bribery_amount: 0},
    {id_num:17,	name: "魔女ミニー",         max_LIFE_POINT: 20, LIFE_POINT: 20, attack_base: 6, extra_damage: 0,	defence: 0, attack_way: "稲妻の矢",             Section: "78", Bribery_amount: 0},
    {id_num:18,	name: "魔女アギー",         max_LIFE_POINT: 20, LIFE_POINT: 20, attack_base: 6, extra_damage: 0,	defence: 0, attack_way: "魔法のラッパ",         Section: "78", Bribery_amount: 0},
    {id_num:19,	name: "魔女スクロッグ",     max_LIFE_POINT: 20, LIFE_POINT: 20, attack_base: 0, extra_damage:25,	defence: 0, attack_way: "ドラゴン・ファイア錠", Section: "78", Bribery_amount: 0},
    {id_num:20,	name: "狼",                 max_LIFE_POINT: 25, LIFE_POINT: 25, attack_base: 5, extra_damage: 2,	defence: 0, attack_way: "鋭い牙",               Section: "20", Bribery_amount: 0},
    {id_num:21,	name: "カメレオン怪人",     max_LIFE_POINT: 30, LIFE_POINT: 30, attack_base: 6, extra_damage: 2,	defence: 1, attack_way: "長い舌",               Section: "54", Bribery_amount: 0},
    {id_num:22,	name: "悪魔の落とし子",     max_LIFE_POINT: 80, LIFE_POINT: 80, attack_base: 3, extra_damage: 2,	defence: 0, attack_way: "素手",                 Section: "114",Bribery_amount: 20000000},
    {id_num:23,	name: "パトロール警官",     max_LIFE_POINT: 15, LIFE_POINT: 15, attack_base: 5, extra_damage: 2,	defence: 0, attack_way: "警棒",                 Section: "85", Bribery_amount: 0},
    {id_num:24,	name: "見張り",             max_LIFE_POINT: 15, LIFE_POINT: 15, attack_base: 5, extra_damage: 3,	defence: 0, attack_way: "剣",                   Section: "93", Bribery_amount: 0},
    {id_num:25,	name: "僧",                 max_LIFE_POINT: 25, LIFE_POINT: 25, attack_base: 4, extra_damage: 3,	defence: 0, attack_way: "戦棍",                 Section:"110", Bribery_amount: 0},
    {id_num:26,	name: "こそ泥サム",         max_LIFE_POINT: 25, LIFE_POINT: 25, attack_base: 5, extra_damage: 2,	defence: 0, attack_way: "短剣",                 Section:"129", Bribery_amount: 0},
    {id_num:27,	name: "アドルフ",           max_LIFE_POINT:100, LIFE_POINT:100, attack_base: 6, extra_damage: 1,	defence: 0, attack_way: "ばか力",               Section:"131", Bribery_amount: 0},
    {id_num:28,	name: "マオ",               max_LIFE_POINT:100, LIFE_POINT:100, attack_base: 7, extra_damage: 2,	defence: 0, attack_way: "中国拳法",             Section:"146", Bribery_amount: 0},
    {id_num:29,	name: "警官",               max_LIFE_POINT: 15, LIFE_POINT: 15, attack_base: 5, extra_damage: 2,	defence: 0, attack_way: "警棒",                 Section:"154", Bribery_amount: 0},
    {id_num:30,	name: "ゼリー・モンスター", max_LIFE_POINT: 10, LIFE_POINT: 10, attack_base: 7, extra_damage: 0,	defence: 0, attack_way: "溶かす",               Section: "216",Bribery_amount: 0},
    {id_num:31,	name: "ワニガエル獣",       max_LIFE_POINT: 85, LIFE_POINT: 85, attack_base: 4, extra_damage: 5,	defence: 4, attack_way: "牙とかぎ爪",           Section: "171",Bribery_amount: 0},
    {id_num:32,	name: "フレッド",           max_LIFE_POINT: 66, LIFE_POINT: 66, attack_base: 4, extra_damage: 7,	defence: 0, attack_way: "かぎ爪と牙",           Section:"Fred",Bribery_amount: 0},
    {id_num:33,	name: "骸骨",               max_LIFE_POINT: 10, LIFE_POINT: 10, attack_base: 4, extra_damage: 0,	defence: 0, attack_way: "骨",                   Section: "D7", Bribery_amount: 0},
    {id_num:34,	name: "亡霊",               max_LIFE_POINT:  2, LIFE_POINT:  2, attack_base: 2, extra_damage: 0,	defence: 0, attack_way: "冷たい手",             Section: "D8", Bribery_amount: 0}
];

ピップの所持品の表現方法は、ID番号とその数だけを持つようにしています。枠は一定です。新たなものを手に入れると枠を増やし、使い切ると枠を減らす処理は面倒くさいので、最大種類数が入るように、はじめから必要十分な枠を確保しておきます。

var Pip_event = [
    {id_num: 0, num: 0}, // 1
    {id_num: 0, num: 0}, // 2
    {id_num: 0, num: 0}, // 3
    {id_num: 0, num: 0}, // 4
    {id_num: 0, num: 0}, // 5
    {id_num: 0, num: 0}, // 6
    {id_num: 0, num: 0}, // 7
    {id_num: 0, num: 0}, // 8
    {id_num: 0, num: 0}, // 9
    {id_num: 0, num: 0}, //10
    {id_num: 0, num: 0}, //11
    {id_num: 0, num: 0}, //12
    {id_num: 0, num: 0}, //13
    {id_num: 0, num: 0}, //14
    {id_num: 0, num: 0}, //15
    {id_num: 0, num: 0}, //16
    {id_num: 0, num: 0}, //17
    {id_num: 0, num: 0}, //18
    {id_num: 0, num: 0}, //19
    {id_num: 0, num: 0}, //20
    {id_num: 0, num: 0}, //21
    {id_num: 0, num: 0}, //22
    {id_num: 0, num: 0}  //23
];
var Pip_equip = [
    {id_num: 0, num: 0}, // 1
    {id_num: 0, num: 0}, // 2
    {id_num: 0, num: 0}, // 3
    {id_num: 0, num: 0}, // 4
    {id_num: 0, num: 0}, // 5
    {id_num: 0, num: 0}, // 6
    {id_num: 0, num: 0}, // 7
    {id_num: 0, num: 0}, // 8
    {id_num: 0, num: 0}, // 9
    {id_num: 0, num: 0}, //10
    {id_num: 0, num: 0}, //11
    {id_num: 0, num: 0}, //12
    {id_num: 0, num: 0}, //13
    {id_num: 0, num: 0}, //14
    {id_num: 0, num: 0}, //15
    {id_num: 0, num: 0}, //16
    {id_num: 0, num: 0}, //17
    {id_num: 0, num: 0}, //18
    {id_num: 0, num: 0}, //19
    {id_num: 0, num: 0}, //20
    {id_num: 0, num: 0}, //21
    {id_num: 0, num: 0}, //22
    {id_num: 0, num: 0}, //23
    {id_num: 0, num: 0}  //24
]; //空欄
var Pip_magic = [
    {id_num: 0, num: 0}, // 1
    {id_num: 0, num: 0}, // 2
    {id_num: 0, num: 0}, // 3
    {id_num: 0, num: 0}, // 4
    {id_num: 0, num: 0}, // 5
    {id_num: 0, num: 0}, // 6
    {id_num: 0, num: 0}, // 7
    {id_num: 0, num: 0}, // 8
    {id_num: 0, num: 0}, // 9
    {id_num: 0, num: 0}, //10
    {id_num: 0, num: 0}, //11
    {id_num: 0, num: 0}, //12
    {id_num: 0, num: 0}, //13
    {id_num: 0, num: 0}, //14
    {id_num: 0, num: 0}, //15
    {id_num: 0, num: 0}, //16
    {id_num: 0, num: 0}, //17
    {id_num: 0, num: 0}, //18
    {id_num: 0, num: 0}, //19
    {id_num: 0, num: 0}  //20
]; //空欄

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

最終更新:2012年04月03日 17:07