アイテムの補正計算 実装中
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
attacker = player2Data;
|
||||
defender = player1Data;
|
||||
}
|
||||
// 物理or特殊の判定
|
||||
if (attackData.category === 1) {
|
||||
atk_value = attacker.atk;
|
||||
def_value = defender.def;
|
||||
@@ -51,10 +52,23 @@
|
||||
atk_value = attacker.spatk;
|
||||
def_value = defender.spdef;
|
||||
}
|
||||
|
||||
// debug
|
||||
// ステータスアップアイテム
|
||||
const A = '{"attack":1.5}';
|
||||
const B = '{"defense":1.5}';
|
||||
const C = '{"special_attack":1.5}';
|
||||
const D = '{"special_defense":1.5}';
|
||||
const S = '{"speed":1.5}';
|
||||
const BE = '{"attack":1.3,"defense":1.3,"special_attack":1.3,"special_defense":1.3,"speed":1.5,"condition":"highest_status"}';
|
||||
// 技威力up
|
||||
const E = '{"attack_power":1.3,"condition":"type","type":0}';
|
||||
|
||||
|
||||
// 計算で使用する値をひとまとめにしてみる
|
||||
let data = {
|
||||
level: 50, // 対戦時は基本的にレベル50なのでconstでも良さそう
|
||||
attack_power: attackData.power,
|
||||
attack_power: attackData.power, // 技威力
|
||||
atk_value: atk_value,
|
||||
def_value: def_value,
|
||||
|
||||
@@ -71,6 +85,14 @@
|
||||
? defender.terastype
|
||||
: defender.types,
|
||||
|
||||
// 持ち物情報
|
||||
// effect
|
||||
atk_item_effect: JSON.parse(E), // データの形決まったら調整
|
||||
def_item_effect: JSON.parse(A), // データの形決まったら調整
|
||||
|
||||
// 攻撃側の技が物理(1)or特殊の判定
|
||||
attack_data_category: attackData.category,
|
||||
|
||||
// 技タイプ
|
||||
move_type: JSON.parse(attackData.types),
|
||||
// 範囲の計算で使用する
|
||||
@@ -89,6 +111,16 @@
|
||||
- タイプ一致あり4倍:220~264(セキタンザン)
|
||||
- タイプ一致あり無効: 0~0
|
||||
- タイプ一致あり等倍(半減と抜群): 76~91(これはモロバレルで計算)
|
||||
- タイプ一致こだわりハチマキ: 164~194
|
||||
- タイプ一致テラスタルこだわりハチマキ: 220~260
|
||||
- ハチマキが特殊技に乗らないことを確認
|
||||
- ガブリアスC100(実数値)火炎放射(ハチマキ)=>: キョジオーンD110 => 16~19
|
||||
- メガネが特殊技に乗ることを確認
|
||||
- ガブリアスC100(実数値)火炎放射(メガネ)=>: キョジオーンD110 => 23~28
|
||||
- チョッキの効果が特殊技に乗ることを確認
|
||||
- ガブリアスC100(実数値)火炎放射=>: キョジオーンD110 => 23~28
|
||||
- チョッキの効果が物理に乗らないことを確認
|
||||
- ガブリアスA182(実数値)地震=>: キョジオーンB189 => 110~132
|
||||
*/
|
||||
let d = damage(data);
|
||||
total_max_damage = d.maxDamage;
|
||||
@@ -97,6 +129,15 @@
|
||||
total_min_damage_percentage = (d.minDamage * 100) / defender.hp;
|
||||
}
|
||||
function damage(data) {
|
||||
// アイテムで技の威力が上昇する場合の判定
|
||||
console.log("before data.attack_power:",data.attack_power)
|
||||
data.attack_power *= aktPowerIncreasingItems(data)
|
||||
console.log("after data.attack_power:",data.attack_power)
|
||||
|
||||
// アイテムでステータスが上昇する場合の判定
|
||||
data.atk_value *=atkStatusIncreasingItems(data)// ここでつまってる
|
||||
data.def_value *=defStatusIncreasingItems(data)
|
||||
|
||||
// 基本の計算
|
||||
var step1 = Math.trunc((data.level * 2) / 5 + 2);
|
||||
var step2 = Math.trunc(
|
||||
@@ -107,6 +148,80 @@
|
||||
// 各種補正かけた結果を返す
|
||||
return modify(data);
|
||||
}
|
||||
// アイテムで技の威力補正を計算する
|
||||
function aktPowerIncreasingItems(data){
|
||||
if (data.atk_item_effect.attack_power !== undefined){
|
||||
// const E = '{"attack_power":1.3,"condition":"type","type":}';
|
||||
// タイプ一致アイテム
|
||||
if (data.atk_item_effect.type !== undefined){
|
||||
console.log("タイプ一致", data.atk_item_effect.type, data.atk_type)
|
||||
if (data.atk_item_effect.type === data.atk_type){
|
||||
return data.atk_item_effect.attack_power
|
||||
}
|
||||
}
|
||||
// 対応予定
|
||||
// 物知りメガネとか => 物理特殊一致させる必要がある
|
||||
// 達人の帯 => 抜群のときだけ1.2倍
|
||||
|
||||
// 命の珠は無条件で1.3倍
|
||||
console.log("いのちのたま: ", data.atk_item_effect.attack_power)
|
||||
return data.atk_item_effect.attack_power
|
||||
}
|
||||
return 1
|
||||
}
|
||||
// アイテムでのステータス補正を計算する
|
||||
function atkStatusIncreasingItems(data){
|
||||
// アイテムで技の威力が上がる場合は、上の関数で計算する
|
||||
// Note: ハチマキの効果が特攻に乗らないようにする必要がある
|
||||
// TODO: ブーストエナジーの計算は、挙動がおかしかったら直す(たぶん考慮たりない)
|
||||
if (data.atk_item_effect.condition !== undefined){
|
||||
// ブーストエナジー
|
||||
// 技が物理or特殊で分岐
|
||||
if (data.attack_data_category === 1){
|
||||
return data.atk_item_effect.attack
|
||||
}else {
|
||||
return data.atk_item_effect.special_attack
|
||||
}
|
||||
} else if (data.atk_item_effect.attack !== undefined && data.attack_data_category === 1){
|
||||
// 物理
|
||||
return data.atk_item_effect.attack
|
||||
} else if (data.atk_item_effect.special_attack !== undefined){
|
||||
// 特殊
|
||||
return data.atk_item_effect.special_attack
|
||||
}
|
||||
return 1
|
||||
}
|
||||
function defStatusIncreasingItems(data){
|
||||
console.log(1)
|
||||
if (data.def_item_effect.condition !== undefined){
|
||||
// ブーストエナジー
|
||||
// 技が物理or特殊で分岐
|
||||
if (data.attack_data_category === 1){
|
||||
console.log(2)
|
||||
|
||||
return data.def_item_effect.defense
|
||||
}else {
|
||||
console.log(3)
|
||||
|
||||
return data.def_item_effect.special_defense
|
||||
}
|
||||
}else if (data.def_item_effect.defense !== undefined && data.def_item_effect.special_defense !== undefined){
|
||||
// 進化の輝石
|
||||
// 防御と特防の両方が上がるのでどちらを返してもOK
|
||||
console.log(4)
|
||||
|
||||
return data.def_item_effect.defense
|
||||
} else if (data.def_item_effect.defense === undefined && data.def_item_effect.special_defense !== undefined && data.attack_data_category !==1){
|
||||
// チョッキ
|
||||
// 物理の計算でチョッキの効果を出さないようにするため、防御の計算値がないことと、攻撃が物理ではないことを比較する
|
||||
console.log(5)
|
||||
|
||||
return data.def_item_effect.special_defense
|
||||
}
|
||||
console.log(6)
|
||||
|
||||
return 1
|
||||
}
|
||||
// 全部一気にやると大変なので、一旦基本計算から
|
||||
function modify(data) {
|
||||
// 範囲補正
|
||||
@@ -147,7 +262,7 @@
|
||||
if (is_terastype) {
|
||||
movetype_match = data.move_type.includes(data.atk_terastype);
|
||||
}
|
||||
console.log(type_match, is_terastype, terastype_match);
|
||||
|
||||
// 技のタイプ一致倍率(技のタイプが一致するかどうか)
|
||||
// 本来のタイプ テラスタルタイプ 倍率
|
||||
if (type_match && is_terastype && terastype_match) {
|
||||
@@ -221,6 +336,7 @@
|
||||
}
|
||||
return type_magnification;
|
||||
}
|
||||
// 技名検索
|
||||
async function getItems(keyword) {
|
||||
try {
|
||||
let result = await invoke("autosearch_move", { keyword });
|
||||
|
||||
Reference in New Issue
Block a user