Skip to content

Instantly share code, notes, and snippets.

@gozen-bro3
Created February 13, 2014 02:14
Show Gist options
  • Save gozen-bro3/8968530 to your computer and use it in GitHub Desktop.
Save gozen-bro3/8968530 to your computer and use it in GitHub Desktop.
ブラウザ三国志 スキル込計算スクリプト
// ==UserScript==
// @name bro3_atk_calc
// @namespace http://bro3nahahiro.wordpress.com/
// @description ブラウザ三国志 スキル込計算スクリプト
// @include http://*.3gokushi.jp/card/deck.php*
// @version 1.0.5
// ==/UserScript==
/*-----------------------------------------------------------
【Version】
最終更新:2013/05/24
1.0.5 課金UPの計算を修正
1.0.4 飛蹄進軍等のスキルの速度を取得出来るよう修正
1.0.3 デッキに1枚もセットされていない時に、スキルの位置が
おかしくなるのを修正
1.0.2 飛蹄進軍等のスキルを取得出来るよう修正
1.0.1 パッシブ絡みのバグ修正
1.0.0 スクリプト作成
-----------------------------------------------------------*/
/*=======================================================
初期処理
=========================================================*/
//デッキセット済みClass取得
var deckSet_ctl = document.getElementsByClassName("control");
//○枚目カウント用
var cardcnt = 0;
//デッキセット済カウント用
var deckcnt = 0;
var skil1 = new Array(); //スキル1効果
var skil2 = new Array(); //スキル2効果
var skil3 = new Array(); //スキル3効果
var skilcnt1 = 0;
var skilcnt2 = 0;
var skilcnt3 = 0;
var card_type = new Array(); //兵科
/*=====================================
* 変更前ステータス
*====================================*/
var card_att = new Array(); //攻撃力
var card_int = new Array(); //知力
var card_wdef = new Array(); //歩防御
var card_sdef = new Array(); //槍防御
var card_bdef = new Array(); //弓防御
var card_rdef = new Array(); //馬防御
var card_speed = new Array(); //移動速度
//カード裏情報取得用
var deck_CBack = document.getElementsByClassName("card_back");
/*var sts_atk = document.getElementsByClassName("status_att");
var sts_atk1 = document.getElementsByClassName("statusParameter1");
var sts_atk2 = sts_atk1[0].getElementsByTagName("td");
sts_atk2[1].innerHTML = "<span style=\"color:#FF0000;\">999999</span>";
var img = document.getElementsByClassName("soltype")[0].getElementsByTagName("img")[0].alt;*/
/*=======================================================
表示関連 初期処理
=========================================================*/
//デッキセット済&カード表示用
for (i = 0; i < deckSet_ctl.length; i++) {
html = SkilSet(i);
deckSet_ctl[i].innerHTML = html + deckSet_ctl[i].innerHTML;
var deckSkil = document.getElementById("deckSkil" + i);
deckSkil.addEventListener("change", function(){var e = this.className;SkilSelect(e);}, true);
var p_chk = document.getElementById("p_chk" + i);
p_chk.addEventListener("click", function(){var e = this.className;SkilSelect(e);}, true);
var kakinAtt = document.getElementById("kakinAtt" + i);
kakinAtt.addEventListener("click", function(){var e = this.className;SkilSelect(e);}, true);
var kakinDef = document.getElementById("kakinDef" + i);
kakinDef.addEventListener("click", function(){var e = this.className;SkilSelect(e);}, true);
cardcnt = cardcnt + 1;
deckcnt = i;
}
//カード表示以外の場合
var sortflg = document.getElementsByClassName("sortTotal");
if (sortflg[0].value != 1) {
var othercard = document.getElementsByClassName("otherDetail");
var stscard = document.getElementsByClassName("statusDetail");
var wk = document.getElementsByClassName("cardStatusDetail");
//alert(wk[0].clientHeight);
if (cardcnt == 0) {
deckcnt = -1;
}
for (i = 0; i < othercard.length; i++) {
wk[i].style.marginBottom = "45px";
html = SkilSet((i + deckcnt + 1));
othercard[i].innerHTML = html + othercard[i].innerHTML;
var deckSkil = document.getElementById("deckSkil" + (i + deckcnt + 1));
deckSkil.addEventListener("change", function(){var e = this.className;SkilSelect(e);}, true);
var p_chk = document.getElementById("p_chk" + (i + deckcnt + 1));
p_chk.addEventListener("click", function(){var e = this.className;SkilSelect(e);}, true);
var kakinAtt = document.getElementById("kakinAtt" + (i + deckcnt + 1));
kakinAtt.addEventListener("click", function(){var e = this.className;SkilSelect(e);}, true);
var kakinDef = document.getElementById("kakinDef" + (i + deckcnt + 1));
kakinDef.addEventListener("click", function(){var e = this.className;SkilSelect(e);}, true);
cardcnt = cardcnt + 1;
}
}
/*------------+---------------------------------------------------------+
* スキル取得&コンボボックス作成処理 |
*------------+---------------------------------------------------------+
* cnt | カード取得用カウント |
*------------+---------------------------------------------------------+
* 戻り値 | |
*------------+---------------------------------------------------------*/
function SkilSet(cnt) {
var passiveFlg1 = 0; //パッシブ有無フラグ
var passiveFlg2 = 0; //パッシブ有無フラグ
var passiveFlg3 = 0; //パッシブ有無フラグ
//スキル名(Lv込)取得
if (deck_CBack[cnt].getElementsByClassName("skillName1 red").length > 0) {
passiveFlg1 = 1;
var wkskil1 = "";
var wkskil1_1 = document.getElementsByClassName("skill1");
skil1[cardcnt] = wkskil1_1[skilcnt1].innerHTML;
skilcnt1 = skilcnt1 + 1;
} else if (deck_CBack[cnt].getElementsByClassName("skillName1").length > 0) {
var wkskil1 = deck_CBack[cnt].getElementsByClassName("skillName1");
var wkskil1_1 = document.getElementsByClassName("skill1");
skil1[cardcnt] = wkskil1_1[skilcnt1].innerHTML;
skilcnt1 = skilcnt1 + 1;
} else {
var wkskil1 = "";
skil1[cardcnt] = "";
}
if (deck_CBack[cnt].getElementsByClassName("skillName2 red").length > 0) {
passiveFlg2 = 1;
var wkskil2 = "";
var wkskil2_1 = document.getElementsByClassName("skill2");
skil2[cardcnt] = wkskil2_1[skilcnt2].innerHTML;
skilcnt2 = skilcnt2 + 1;
} else if (deck_CBack[cnt].getElementsByClassName("skillName2").length > 0) {
var wkskil2 = deck_CBack[cnt].getElementsByClassName("skillName2");
var wkskil2_1 = document.getElementsByClassName("skill2");
skil2[cardcnt] = wkskil2_1[skilcnt2].innerHTML;
skilcnt2 = skilcnt2 + 1;
} else {
var wkskil2 = "";
skil2[cardcnt] = "";
}
if (deck_CBack[cnt].getElementsByClassName("skillName3 red").length > 0) {
passiveFlg3 = 1;
var wkskil3 = "";
var wkskil3_1 = document.getElementsByClassName("skill3");
skil3[cardcnt] = wkskil3_1[skilcnt3].innerHTML;
skilcnt3 = skilcnt3 + 1;
} else if (deck_CBack[cnt].getElementsByClassName("skillName3").length > 0) {
var wkskil3 = deck_CBack[cnt].getElementsByClassName("skillName3");
var wkskil3_1 = document.getElementsByClassName("skill3");
skil3[cardcnt] = wkskil3_1[skilcnt3].innerHTML;
skilcnt3 = skilcnt3 + 1;
} else {
var wkskil3 = "";
skil3[cardcnt] = "";
}
//兵科取得
card_type[cardcnt] = document.getElementsByClassName("soltype")[cardcnt].getElementsByTagName("img")[0].alt;
/*=====================================
* 変更前ステータス取得
*====================================*/
card_att[cardcnt] = document.getElementsByClassName("status_att")[cardcnt].innerHTML; //攻撃力
card_int[cardcnt] = document.getElementsByClassName("status_int")[cardcnt].innerHTML; //知力
card_wdef[cardcnt] = document.getElementsByClassName("status_wdef")[cardcnt].innerHTML; //歩防御
card_sdef[cardcnt] = document.getElementsByClassName("status_sdef")[cardcnt].innerHTML; //槍防御
card_bdef[cardcnt] = document.getElementsByClassName("status_bdef")[cardcnt].innerHTML; //弓防御
card_rdef[cardcnt] = document.getElementsByClassName("status_rdef")[cardcnt].innerHTML; //馬防御
card_speed[cardcnt] = document.getElementsByClassName("status_speed")[cardcnt].innerHTML; //移動速度
//コンボボックスにセット
var html = "";
html += "<div style=\"height:30px;width:220px;display:table;display:table-cell;vertical-align:middle;margin:auto;\">\n";
html += "<select name=\"deckSkil" + cnt + "\" style=\"width:200px;\" id=\"deckSkil" + cnt + "\" class=\"" + cnt + "\">\n";
html += "<option value=\"0\">指定無し</option>\n";
if (wkskil1 != "") {
html += "<option value=\"1\">" + wkskil1[0].innerHTML.substring(2) + "</option>\n";
}
if (wkskil2 != "") {
html += "<option value=\"2\">" + wkskil2[0].innerHTML.substring(2) + "</option>\n";
}
if (wkskil3 != "") {
html += "<option value=\"3\">" + wkskil3[0].innerHTML.substring(2) + "</option>\n";
}
html += "</select><br />\n";
if (passiveFlg1 == 0 && passiveFlg2 == 0 && passiveFlg3 == 0) {
html += "<input type=\"checkbox\" id=\"p_chk" + cnt + "\"disabled=\"disabled\" class=\"" + cnt + "\" />パッシブ \n";
} else {
html += "<input type=\"checkbox\" id=\"p_chk" + cnt + "\" class=\"" + cnt + "\" />パッシブ \n";
}
html += "<input type=\"checkbox\" id=\"kakinAtt" + cnt + "\" class=\"" + cnt + "\" />攻撃課金 <input type=\"checkbox\" id=\"kakinDef" + cnt + "\" class=\"" + cnt + "\" />防御課金\n";
html += "</div>\n";
return html;
}
/*------------+---------------------------------------------------------+
* スキル選択後処理 |
*------------+---------------------------------------------------------+
* l | 選択コンボボックス番号 |
*------------+---------------------------------------------------------+
* 戻り値 | |
*------------+---------------------------------------------------------*/
function SkilSelect(l) {
var val = document.getElementById("deckSkil" + l).value;
var passiveFlg = document.getElementById("p_chk" + l).checked;
var kakinFlg = document.getElementById("kakinAtt" + l).checked;
var kakinFlg2 = document.getElementById("kakinDef" + l).checked;
var skil_res = "";
if (val == 1) {
skil_res = skil1[l];
} else if (val == 2) {
skil_res = skil2[l];
} else if (val == 3) {
skil_res = skil3[l];
}
//フラグが無ければステータスALLクリアし抜ける
if (skil_res == "" && passiveFlg == false && kakinFlg == false && kakinFlg2 == false) {
document.getElementsByClassName("status_att")[l].innerHTML = card_att[l]; //攻撃力
document.getElementsByClassName("status_int")[l].innerHTML = card_int[l]; //知力
document.getElementsByClassName("status_wdef")[l].innerHTML = card_wdef[l]; //歩防御
document.getElementsByClassName("status_sdef")[l].innerHTML = card_sdef[l]; //槍防御
document.getElementsByClassName("status_bdef")[l].innerHTML = card_bdef[l]; //弓防御
document.getElementsByClassName("status_rdef")[l].innerHTML = card_rdef[l]; //馬防御
document.getElementsByClassName("status_speed")[l].innerHTML = card_speed[l]; //移動速度
//カード表示以外の場合
/*var sortflg = document.getElementsByClassName("sortTotal");
if (sortflg[0].value != 1) {*/
if (deckcnt < l) {
var sts_atk1 = document.getElementsByClassName("statusParameter1");
var sts_atk2 = sts_atk1[(l - deckcnt - 1)].getElementsByTagName("td");
sts_atk2[1].innerHTML = card_att[l];
sts_atk2[3].innerHTML = card_int[l];
sts_atk2[5].innerHTML = card_wdef[l];
sts_atk2[7].innerHTML = card_sdef[l];
sts_atk2[9].innerHTML = card_bdef[l];
sts_atk2[11].innerHTML = card_rdef[l];
sts_atk2[13].innerHTML = card_speed[l];
}
return;
}
/*=====================================
* 正規表現用セット
*====================================*/
//var re1 = /\d+(?:\.\d+)[%%%]?/; //スキル効果(小数点含む)
var re1 = /\d+(?:\.\d+)?[%%%]?/; //スキル効果(小数点含む)
/*=====================================
* 各上昇率用セット
*====================================*/
var wk_att_skil = 0;
var wk_def_skil = 0;
var wk_spe_skil = 0;
var att_skilnum = 0;
var def_skilnum = 0;
var spd_skilnum = 0;
var atk_kakinFlg = 0;
var def_kakinFlg = 0;
if (passiveFlg == true) {
//パッシブ取得
var p_skil = new Array();
/*if (deck_CBack[l].getElementsByClassName("skillName1").length > 0) {
var wkskil1_1 = document.getElementsByClassName("skill1");
p_skil[0] = wkskil1_1[l].innerHTML;
} else {
p_skil[0] = "";
}
if (deck_CBack[l].getElementsByClassName("skillName2").length > 0) {
var wkskil2_1 = document.getElementsByClassName("skill2");
p_skil[1] = wkskil2_1[l].innerHTML;
} else {
p_skil[1] = "";
}
if (deck_CBack[l].getElementsByClassName("skillName3").length > 0) {
var wkskil3_1 = document.getElementsByClassName("skill3");
p_skil[2] = wkskil3_1[l].innerHTML;
} else {
p_skil[2] = "";
}*/
p_skil[0] = skil1[l];
p_skil[1] = skil2[l];
p_skil[2] = skil3[l];
for (i = 0; i < 3; i++) {
var wkskil_res = p_skil[i];
wk_att_skil = 0;
wk_def_skil = 0;
wk_spe_skil = 0;
wkcnt0 = wkskil_res.indexOf("自動");
if (wkskil_res != "" && wkcnt0 > -1) {
//攻撃力用
wkcnt0 = wkskil_res.indexOf("攻撃力");
if (wkcnt0 > -1) {
wkcnt1 = wkskil_res.indexOf("武将の攻撃力");
if (wkcnt1 > -1) {
wkcnt2 = wkskil_res.indexOf("兵科");
if (wkcnt2 > -1) {
wkcnt3 = wkskil_res.indexOf(card_type[l]);
if (wkcnt3 > -1) {
wk_skil = wkskil_res.substring(wkcnt3);
wk_att_skil = String(wk_skil.match(re1));
wk_att_skil = parseFloat(wk_att_skil.substring(0, (wk_att_skil.length - 1))) / 100;
}
} else {
wk_skil = wkskil_res.substring(wkcnt1);
wk_att_skil = String(wk_skil.match(re1));
wk_att_skil = parseFloat(wk_att_skil.substring(0, (wk_att_skil.length - 1))) / 100;
}
} else {
wkcnt2 = wkskil_res.indexOf("兵科");
if (wkcnt2 > -1) {
} else {
wk_skil = wkskil_res.substring(wkcnt0);
wk_att_skil = String(wk_skil.match(re1));
wk_att_skil = parseFloat(wk_att_skil.substring(0, (wk_att_skil.length - 1))) / 100;
}
}
}
//防御力用
wkcnt1 = wkskil_res.indexOf("武将の防御力");
if (wkcnt1 > -1) {
wkcnt2 = wkskil_res.indexOf("兵科");
if (wkcnt2 > -1) {
wkcnt3 = wkskil_res.indexOf(card_type[l]);
if (wkcnt3 > -1) {
wk_skil = wkskil_res.substring(wkcnt3);
wk_def_skil = String(wk_skil.match(re1));
wk_def_skil = parseFloat(wk_def_skil.substring(0, (wk_def_skil.length - 1))) / 100;
}
} else {
wk_skil = wkskil_res.substring(wkcnt1);
wk_def_skil = String(wk_skil.match(re1));
wk_def_skil = parseFloat(wk_def_skil.substring(0, (wk_def_skil.length - 1))) / 100;
}
}
//移速用
wkcnt1 = wkskil_res.indexOf("移動速度");
if (wkcnt1 > -1) {
wkcnt2 = wkskil_res.indexOf("兵科");
if (wkcnt2 > -1) {
wkcnt3 = wkskil_res.indexOf(card_type[l]);
if (wkcnt3 > -1) {
wk_skil = wkskil_res.substring(wkcnt3);
wk_spe_skil = String(wk_skil.match(re1));
wk_spe_skil = parseFloat(wk_spe_skil.substring(0, (wk_spe_skil.length - 1))) / 100;
}
} else {
wkcnt3 = wkskil_res.indexOf("移動速度が半分");
if (wkcnt3 > -1) {
wk_spe_skil = 99999;
} else {
wkcnt3 = wkskil_res.indexOf("移動速度が半減");
if (wkcnt3 > -1) {
wk_spe_skil = 99999;
} else {
wk_skil = wkskil_res.substring(wkcnt1);
wk_spe_skil = String(wk_skil.match(re1));
wk_spe_skil = parseFloat(wk_spe_skil.substring(0, (wk_spe_skil.length - 1))) / 100;
}
}
}
}
}
att_skilnum = att_skilnum + wk_att_skil;
def_skilnum = def_skilnum + wk_def_skil;
spd_skilnum = spd_skilnum + wk_spe_skil;
}
}
if (kakinFlg == true) {
//att_skilnum = att_skilnum + (10 / 100);
atk_kakinFlg = 1;
}
if (kakinFlg2 == true) {
//def_skilnum = def_skilnum + (10 / 100);
def_kakinFlg = 1;
}
if (skil_res != "") {
var wk_skil = "";
var wkcnt0 = 0;
var wkcnt1 = 0;
var wkcnt2 = 0;
var wkcnt3 = 0;
wk_att_skil = 0;
wk_def_skil = 0;
wk_spe_skil = 0;
//攻撃力用
wkcnt0 = skil_res.indexOf("武将および全兵科の攻撃力");
if (wkcnt0 > -1) {
wk_skil = skil_res.substring(wkcnt0);
wk_att_skil = String(wk_skil.match(re1));
wk_att_skil = parseFloat(wk_att_skil.substring(0, (wk_att_skil.length - 1))) / 100;
} else {
wkcnt0 = skil_res.indexOf("攻撃力");
if (wkcnt0 > -1) {
wkcnt1 = skil_res.indexOf("武将の攻撃力");
if (wkcnt1 > -1) {
wkcnt2 = skil_res.indexOf("兵科");
if (wkcnt2 > -1) {
wkcnt3 = skil_res.indexOf(card_type[l]);
if (wkcnt3 > -1) {
wk_skil = skil_res.substring(wkcnt3);
wk_att_skil = String(wk_skil.match(re1));
wk_att_skil = parseFloat(wk_att_skil.substring(0, (wk_att_skil.length - 1))) / 100;
}
} else {
wk_skil = skil_res.substring(wkcnt1);
wk_att_skil = String(wk_skil.match(re1));
wk_att_skil = parseFloat(wk_att_skil.substring(0, (wk_att_skil.length - 1))) / 100;
}
} else {
wkcnt2 = skil_res.indexOf("兵科");
if (wkcnt2 > -1) {
} else {
wk_skil = skil_res.substring(wkcnt0);
wk_att_skil = String(wk_skil.match(re1));
wk_att_skil = parseFloat(wk_att_skil.substring(0, (wk_att_skil.length - 1))) / 100;
}
}
}
}
//防御力用
wkcnt1 = skil_res.indexOf("武将の防御力");
if (wkcnt1 > -1) {
wkcnt2 = skil_res.indexOf("兵科");
if (wkcnt2 > -1) {
wkcnt3 = skil_res.indexOf(card_type[l]);
if (wkcnt3 > -1) {
wk_skil = skil_res.substring(wkcnt3);
wk_def_skil = String(wk_skil.match(re1));
wk_def_skil = parseFloat(wk_def_skil.substring(0, (wk_def_skil.length - 1))) / 100;
}
} else {
wk_skil = skil_res.substring(wkcnt1);
wk_def_skil = String(wk_skil.match(re1));
wk_def_skil = parseFloat(wk_def_skil.substring(0, (wk_def_skil.length - 1))) / 100;
}
}
//移速用
wkcnt1 = skil_res.indexOf("移動速度");
if (wkcnt1 > -1) {
wkcnt2 = skil_res.indexOf("兵科");
if (wkcnt2 > -1) {
wkcnt3 = skil_res.indexOf(card_type[l]);
if (wkcnt3 > -1) {
wk_skil = skil_res.substring(wkcnt3);
wk_spe_skil = String(wk_skil.match(re1));
wk_spe_skil = parseFloat(wk_spe_skil.substring(0, (wk_spe_skil.length - 1))) / 100;
} else {
wkcnt0 = skil_res.indexOf("武将および全兵科の攻撃力");
if (wkcnt0 > -1) {
wk_skil = skil_res.substring(wkcnt1);
wk_spe_skil = String(wk_skil.match(re1));
wk_spe_skil = parseFloat(wk_spe_skil.substring(0, (wk_spe_skil.length - 1))) / 100;
}
}
} else {
wkcnt3 = skil_res.indexOf("移動速度が半分");
if (wkcnt3 > -1) {
wk_spe_skil = 99999;
} else {
wkcnt3 = skil_res.indexOf("移動速度が半減");
if (wkcnt3 > -1) {
wk_spe_skil = 99999;
} else {
wk_skil = skil_res.substring(wkcnt1);
wk_spe_skil = String(wk_skil.match(re1));
wk_spe_skil = parseFloat(wk_spe_skil.substring(0, (wk_spe_skil.length - 1))) / 100;
}
}
}
}
att_skilnum = att_skilnum + wk_att_skil;
def_skilnum = def_skilnum + wk_def_skil;
if (wk_spe_skil != 99999) {
spd_skilnum = spd_skilnum + wk_spe_skil;
}
}
//攻撃用
if (att_skilnum != 0 || atk_kakinFlg == 1) {
var wkcalc1 = 0;
if (atk_kakinFlg == 0) {
wkcalc1 = Math.ceil((parseFloat(card_att[l]) * att_skilnum) + parseFloat(card_att[l]));
} else if (atk_kakinFlg == 1 && att_skilnum != 0) {
wkcalc1 = Math.ceil((parseFloat(card_att[l]) * att_skilnum) + parseFloat(card_att[l]));
wkcalc1 = Math.ceil((wkcalc1 * 0.1) + wkcalc1);
} else if (atk_kakinFlg == 1 && att_skilnum == 0) {
wkcalc1 = Math.ceil((parseFloat(card_att[l]) * 0.1) + parseFloat(card_att[l]));
}
var sts_atk = document.getElementsByClassName("status_att");
sts_atk[l].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc1 + "</span>";
//カード表示以外の場合
/*var sortflg = document.getElementsByClassName("sortTotal");
if (sortflg[0].value != 1) {*/
if (deckcnt < l) {
var sts_atk1 = document.getElementsByClassName("statusParameter1");
var sts_atk2 = sts_atk1[(l - deckcnt - 1)].getElementsByTagName("td");
sts_atk2[1].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc1 + "</span>";
}
} else {
document.getElementsByClassName("status_att")[l].innerHTML = card_att[l]; //攻撃力
//カード表示以外の場合
/*var sortflg = document.getElementsByClassName("sortTotal");
if (sortflg[0].value != 1) {*/
if (deckcnt < l) {
var sts_atk1 = document.getElementsByClassName("statusParameter1");
var sts_atk2 = sts_atk1[(l - deckcnt - 1)].getElementsByTagName("td");
sts_atk2[1].innerHTML = card_att[l];
}
}
//防御用
if (def_skilnum != 0 || def_kakinFlg == 1) {
var wkcalc2 = 0;
var wkcalc3 = 0;
var wkcalc4 = 0;
var wkcalc5 = 0;
if (def_kakinFlg == 0) {
wkcalc2 = Math.ceil((parseFloat(card_wdef[l]) * def_skilnum) + parseFloat(card_wdef[l]));
wkcalc3 = Math.ceil((parseFloat(card_sdef[l]) * def_skilnum) + parseFloat(card_sdef[l]));
wkcalc4 = Math.ceil((parseFloat(card_bdef[l]) * def_skilnum) + parseFloat(card_bdef[l]));
wkcalc5 = Math.ceil((parseFloat(card_rdef[l]) * def_skilnum) + parseFloat(card_rdef[l]));
} else if (def_kakinFlg == 1 && def_skilnum != 0) {
wkcalc2 = Math.ceil((parseFloat(card_wdef[l]) * def_skilnum) + parseFloat(card_wdef[l]));
wkcalc3 = Math.ceil((parseFloat(card_sdef[l]) * def_skilnum) + parseFloat(card_sdef[l]));
wkcalc4 = Math.ceil((parseFloat(card_bdef[l]) * def_skilnum) + parseFloat(card_bdef[l]));
wkcalc5 = Math.ceil((parseFloat(card_rdef[l]) * def_skilnum) + parseFloat(card_rdef[l]));
wkcalc2 = Math.ceil((wkcalc2 * 0.1) + wkcalc2);
wkcalc3 = Math.ceil((wkcalc3 * 0.1) + wkcalc3);
wkcalc4 = Math.ceil((wkcalc4 * 0.1) + wkcalc4);
wkcalc5 = Math.ceil((wkcalc5 * 0.1) + wkcalc5);
} else if (def_kakinFlg == 1 && def_skilnum == 0) {
wkcalc2 = Math.ceil((parseFloat(card_wdef[l]) * 0.1) + parseFloat(card_wdef[l]));
wkcalc3 = Math.ceil((parseFloat(card_sdef[l]) * 0.1) + parseFloat(card_sdef[l]));
wkcalc4 = Math.ceil((parseFloat(card_bdef[l]) * 0.1) + parseFloat(card_bdef[l]));
wkcalc5 = Math.ceil((parseFloat(card_rdef[l]) * 0.1) + parseFloat(card_rdef[l]));
}
document.getElementsByClassName("status_wdef")[l].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc2 + "</span>"; //歩防御
document.getElementsByClassName("status_sdef")[l].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc3 + "</span>"; //槍防御
document.getElementsByClassName("status_bdef")[l].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc4 + "</span>"; //弓防御
document.getElementsByClassName("status_rdef")[l].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc5 + "</span>"; //馬防御
//カード表示以外の場合
/*var sortflg = document.getElementsByClassName("sortTotal");
if (sortflg[0].value != 1) {*/
if (deckcnt < l) {
var sts_atk1 = document.getElementsByClassName("statusParameter1");
var sts_atk2 = sts_atk1[(l - deckcnt - 1)].getElementsByTagName("td");
sts_atk2[5].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc2 + "</span>";
sts_atk2[7].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc3 + "</span>";
sts_atk2[9].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc4 + "</span>";
sts_atk2[11].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc5 + "</span>";
}
} else {
document.getElementsByClassName("status_wdef")[l].innerHTML = card_wdef[l]; //歩防御
document.getElementsByClassName("status_sdef")[l].innerHTML = card_sdef[l]; //槍防御
document.getElementsByClassName("status_bdef")[l].innerHTML = card_bdef[l]; //弓防御
document.getElementsByClassName("status_rdef")[l].innerHTML = card_rdef[l]; //馬防御
//カード表示以外の場合
/*var sortflg = document.getElementsByClassName("sortTotal");
if (sortflg[0].value != 1) {*/
if (deckcnt < l) {
var sts_atk1 = document.getElementsByClassName("statusParameter1");
var sts_atk2 = sts_atk1[(l - deckcnt - 1)].getElementsByTagName("td");
sts_atk2[5].innerHTML = card_wdef[l];
sts_atk2[7].innerHTML = card_sdef[l];
sts_atk2[9].innerHTML = card_bdef[l];
sts_atk2[11].innerHTML = card_rdef[l];
}
}
//速度用
if (spd_skilnum != 0 || wk_spe_skil == 99999) {
var wkcalc6 = 0;
if (wk_spe_skil != 99999) {
//wkcalc6 = Math.floor((parseFloat(card_speed[l]) * spd_skilnum) + parseFloat(card_speed[l]));
wkcalc6 = (parseFloat(card_speed[l]) * spd_skilnum) + parseFloat(card_speed[l]);
} else {
//wkcalc6 = (Math.floor((parseFloat(card_speed[l]) * spd_skilnum) + parseFloat(card_speed[l]))) / 2;
wkcalc6 = ((parseFloat(card_speed[l]) * spd_skilnum) + parseFloat(card_speed[l])) / 2;
}
document.getElementsByClassName("status_speed")[l].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc6.toFixed(1) + "</span>"; //移動速度
//カード表示以外の場合
/*var sortflg = document.getElementsByClassName("sortTotal");
if (sortflg[0].value != 1) {*/
if (deckcnt < l) {
var sts_atk1 = document.getElementsByClassName("statusParameter1");
var sts_atk2 = sts_atk1[(l - deckcnt - 1)].getElementsByTagName("td");
sts_atk2[13].innerHTML = "<span style=\"color:#FF0000;\">" + wkcalc6.toFixed(1) + "</span>";
}
} else {
document.getElementsByClassName("status_speed")[l].innerHTML = card_speed[l]; //移動速度
//カード表示以外の場合
/*var sortflg = document.getElementsByClassName("sortTotal");
if (sortflg[0].value != 1) {*/
if (deckcnt < l) {
var sts_atk1 = document.getElementsByClassName("statusParameter1");
var sts_atk2 = sts_atk1[(l - deckcnt - 1)].getElementsByTagName("td");
sts_atk2[13].innerHTML = card_speed[l];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment