slave-princess-charlotte/data/Plugin/Exp-Correction1.1.js
2025-10-12 13:17:46 -05:00

133 lines
No EOL
3.5 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*----成長期待値スクリプト---作:1-239--------------
ステータスが基準値+補正幅の範囲内に収まるようになります
ちな基準値の計算は以下
初期値 + (成長率 * レベルアップ回数 / 100 ){小数点切り捨て}
例) HP初期値26 HP成長40% 補正±3 初期LV1 のキャラの場合
LV1 26 + (40 * 0 / 100 ) = 26
LV2   26 (26~29)
LV3   26 (26~29)
LV4 26 + (40 * 3 / 100 ) = 27 (26~30)
LV5   27 (26~30)
LV6 26 + (40 * 5 / 100 ) = 28 (26~31)
LV7   28 (26~31)
LV8   28 (26~31)
LV9 26 + (40 * 8 / 100 ) = 29 (26~32)
L10   29 (26~32)
L11 26 + (40 * 10/ 100 ) = 30 (27~33) ←この時点でHPが1回も伸びていない場合
絶対にHPが1上昇する
100%以上の成長率にはたぶん対応していないと思う
というかこのスクリプト自体 低成長率じゃないとあまり意味ないし
【使い方】
ユニットのCPに以下のように入力
{
FirstPoint_0:26,(HP初期値)
FirstPoint_1:5,(力初期値)
FirstPoint_2:0,(魔初期値)
FirstPoint_3:4,(技初期値)
FirstPoint_4:7,(速初期値)
FirstPoint_5:12,(幸初期値)
FirstPoint_6:5,(守初期値)
FirstPoint_7:3,(防初期値)
firstlv:1,(初期レベル)
Correction:2(補正値)
}
・参考 ベルサガwikiとMilele氏の固定成長スクリプト
7/28 高
1/16 1050
-------------------------------------------*/
ExperienceControl._createGrowthArray = function (unit) {
var i, n;
var count = ParamGroup.getParameterCount();
var growthArray = [];
var weapon = ItemControl.getEquippedWeapon(unit);
for (i = 0; i < count; i++) {
// 成長値を求める
n = ParamGroup.getGrowthBonus(unit, i) + ParamGroup.getUnitTotalGrowthBonus(unit, i, weapon);
//root.log('成長値:' + n);
// 実際に上昇する値を設定・iとunitの因数を追加
if (i >= 8) {
growthArray[i] = 0;
} else {
growthArray[i] = this._getGrowthValue(n, unit, i);
}
}
//root.log('===============');
return growthArray;
};
ExperienceControl._getGrowthValue = function (n, unit, index) {
var value, FP, FL, CF, MinCorrection, MaxCorrection;
var isMunus = false;
if (n < 0) {
n *= -1;
isMunus = true;
}
value = Math.floor(n / 100);
value2 = Math.floor(n % 100);
//初期値を求める
eval("FP = unit.custom.FirstPoint_" + index + ";");
if (typeof FP !== 'number') {
FP = 0;
}
//レベルアップ回数を求める
FL = unit.custom.firstlv;
if (typeof FL !== 'number') {
FL = unit.getLv() - 1;
} else {
FL = unit.getLv() - unit.custom.firstlv;
}
CF = 1;//;unit.custom.Correction;
if (typeof CF !== 'number') {
CF = 1;
}
MinCorrection = FP + (n * FL / 100);
MaxCorrection = MinCorrection + CF;
//root.log(unit.getClass().getMaxParameter(index) + ' ' + MaxCorrection)
MaxCorrection = Math.min(DataConfig.getMaxParameter(index), MaxCorrection);
MinCorrection -= CF;
if (n === 0) {
MinCorrection = FP;
MaxCorrection = FP;
}
//root.log('期待値_'+FP+'+('+n+'*'+FL+'/100)=[ '+MinCorrection+' '+MaxCorrection);
//期待値以下の場合強制成長
var NP = unit.getParamValue(index) - MinCorrection;
if (NP < 0) {
value++;
} else {
//期待値以上で無い場合、成長判定を行う
NP = MaxCorrection - unit.getParamValue(index) - 1;
if (NP >= 0) {
if (Probability.getProbability(value2)) {
value = 1;
}
} else {
// root.log('limit');
}
}
if (isMunus) {
value *= -1;
}
return value;
};