slave-princess-charlotte/data/Plugin/window-skillinfoExtra.js
2025-10-12 13:17:46 -05:00

464 lines
17 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

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.

/*--------------------------------------------------------------------------
スキルの説明欄に発動条件が表示されます。
使用方法:
スキルのカスタムパラメータに{EC_NowHP:'0-50%'}のように設定します。
(詳しくは別紙参照)
※必ずTemporaryDataVirtualAttack.jsとセットで入れてください。
作成者:o-to
更新履歴:
2015/05/30:新規作成
2015/06/13:設定数に応じてウィンドウの高さを自動調整
2015/11/09:公式の定義削除により、表示がundefinedになっていた箇所を修正
2015/12/06:コマンドスキル追加、スキル発動回数制限等の条件を作成
2016/01/11:
「MP&必殺ゲージ追加」スクリプト対応
熟練度と体格を判定に入れられるように修正
2016/04/24:
処理の大部分を修正
エディタ側の発動率にて残りHP低下率を設定時にエラーとなる不具合を修正
エディタ側の有効な相手を設定時に説明文が被る不具合を修正
2016/05/03:
相手が物理か魔法かで発動の設定時のスキル情報の表示に不具合が出ていたので修正
2017/02/05:
forループ用に使用している変数の宣言忘れしている箇所を修正
※同じように宣言忘れしている別スクリプトがあった場合、意図せぬ動作が起こるため
--------------------------------------------------------------------------*/
var ViewTest = 0;
var ViewSkill = 0;
(function() {
SkillInfoWindow.drawWindowContent = function(x, y) {
var text, skillText, count;
var length = this._getTextLength();
var textui = this.getWindowTextUI();
var color = textui.getColor();
var font = textui.getFont();
if (this._skill === null) {
return;
}
this._drawName(x, y, this._skill, length, color, font);
y += ItemInfoRenderer.getSpaceY();
TextRenderer.drawKeywordText(x, y, this._skill.custom.text, length, ColorValue.KEYWORD, font);
y += ItemInfoRenderer.getSpaceY();
if (this._isInvocationType()) {
this._drawInvocationValue(x, y, this._skill, length, color, font);
y += ItemInfoRenderer.getSpaceY();
}
if (this._aggregationViewer !== null) {
count = this._aggregationViewer.getAggregationViewerCount();
if (count !== 0) {
this._aggregationViewer.drawAggregationViewer(x, y, this._getMatchName());
y += ItemInfoRenderer.getSpaceY() * this._aggregationViewer.getAggregationViewerCount();
}
}
};
var alias1 = SkillInfoWindow._drawInvocationValue;
SkillInfoWindow._drawInvocationValue = function(x, y, skill, length, color, font) {
var text, text2='';
var value = skill.getInvocationValue();
var type = skill.getInvocationType();
var DefaultPercent = 0;
// 発動率の設定が無い時は公式の関数の方で処理を行う
if( OT_SkillInfoExtraWindow.GetExtraConfigPercentSettingSum(skill) == 0 )
{
alias1.call(this, x, y, skill, length, color, font);
return;
}
TextRenderer.drawKeywordText(x, y, StringTable.SkillWord_Invocation, length, ColorValue.KEYWORD, font);
x += ItemInfoRenderer.getSpaceX();
if (type === InvocationType.HPDOWN) {
text = ParamGroup.getParameterName(ParamGroup.getParameterIndexFromType(ParamType.MHP)) + value + StringTable.SkillWord_Less;
}
else if (type === InvocationType.ABSOLUTE) {
text = value + StringTable.SignWord_Percent;
}
else
{
if (type === InvocationType.LV) {
text = StringTable.Status_Level;
}
else {
text = ParamGroup.getParameterName(ParamGroup.getParameterIndexFromType(type));
}
// デフォルト確率
if( skill.custom.EC_DefaultPercent != null )
{
DefaultPercent = skill.custom.EC_DefaultPercent;
text2 = DefaultPercent + '';
}
// 補正値
if( skill.custom.EC_Correction != null )
{
value = value * skill.custom.EC_Correction;
}
text = '(' + text;
if (value > 1 || 1 > value) {
text += ' ' + StringTable.SignWord_Multiple + '' + value;
}
text += ')' + StringTable.SignWord_Percent;
}
text = text2 + text;
TextRenderer.drawKeywordText(x, y, text, -1, color, font);
}
var alias2 = SkillInfoWindow.getWindowHeight;
SkillInfoWindow.getWindowHeight = function() {
var count = 0;
var y = alias2.call(this);
if (this._skill === null) {
return y;
}
//発動条件を設定している時
count += OT_SkillInfoExtraWindow.GetExtraConfigConditionSettingSum( this._skill );
if(count > 0) count++;
//その他設定を設定している時
count += OT_SkillInfoExtraWindow.GetExtraConfigOtherSettingSum( this._skill );
return y + (count * OT_SkillInfoExtraWindow.getSpaceY());
}
var alias3 = SkillInfoWindow.drawWindowContent;
SkillInfoWindow.drawWindowContent = function(x, y) {
var text, skillText;
var length = this._getTextLength();
var textui = this.getWindowTextUI();
var color = textui.getColor();
var font = textui.getFont();
var skill = null;
var msg = '';
var skill = this._skill;
alias3.call(this, x, y);
if (skill === null) {
return;
}
y += alias2.call(this) - OT_SkillInfoExtraWindow.getSpaceY();
var objRendererPos = [x, y];
var ary = [];
//コマンドスキル
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getCommandSkillMessage(skill.custom.EC_Command), length, ColorValue.KEYWORD, font);
//発動率下限、上限を設定している場合
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getScopePercentMessage(skill.custom.EC_ScopePercent), length, ColorValue.KEYWORD, font);
//発動回数が決まっている場合
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getTriggerCountMessage(skill.custom.EC_TriggerCountMap, skill.custom.EC_TriggerCountTurn, skill.custom.EC_TriggerCountBattle), length, ColorValue.KEYWORD, font);
//見切り無視のスキル
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getAbandonIgnoreMessage(skill.custom.EC_isAbandonIgnore), length, ColorValue.KEYWORD, font);
//消費EPと消費FPの設定がある
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getUsePointMessage(skill.custom.EC_UseEP, skill.custom.EC_UseFP), length, ColorValue.KEYWORD, font);
if( OT_SkillInfoExtraWindow.GetExtraConfigConditionSettingSum( skill ) > 0 )
{
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, '発動条件', length, ColorValue.KEYWORD, font);
//---旧設定---------------------------------------
// 現HPが設定範囲内なら発動可
// 旧設定用
if( skill.custom.EC_NowHP != null )
{
msg = EC_SituationRenderer.getParamRangeMessage(EC_DefineStatus.HP, skill.custom.EC_NowHP);
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, msg, length, color, font);
}
// 相手の現HPが設定範囲内なら発動可
// 旧設定用
if( skill.custom.EC_OpponentNowHP != null )
{
msg = EC_DefineString.Opponent + EC_SituationRenderer.getParamRangeMessage(EC_DefineStatus.HP, skill.custom.EC_OpponentNowHP);
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, msg, length, color, font);
}
// 近接か間接で発動判定
// 旧設定用
if( skill.custom.EC_isDirectAttack != null )
{
msg = '';
if( skill.custom.EC_isDirectAttack )
{
msg = '相手が隣接している';
}
else
{
msg = '相手が隣接していない';
}
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, msg, length, color, font);
}
// 物理か魔法かで発動判定
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getPhysicsMessage(skill.custom.EC_isPhysics), length, color, font);
// 相手が物理か魔法かで発動判定
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getPhysicsMessage(skill.custom.EC_isOpponentPhysics, true), length, color, font);
//---戦闘時の状況に応じて発動可かの設定---------------------------------------
// 特定のターンで発動可能
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getTurnMessage(skill.custom.EC_StartTurn, skill.custom.EC_EndTurn, skill.custom.EC_TimesTurn), length, color, font);
// 先攻か後攻かで発動可能
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getSrcMessage(skill.custom.EC_isSrc), length, color, font);
// スキル発動までの攻撃回数が一定回数で発動
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getAttackCountMessage(skill.custom.EC_AttackCount), length, color, font);
// スキル発動までの相手の攻撃回数が一定回数で発動
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getAttackCountMessage(skill.custom.EC_OpponentAttackCount, true), length, color, font);
// 相手との距離で発動判定
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getRangeMessage(skill.custom.EC_Range), length, color, font);
// 同行が設定範囲内なら発動可
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getFusionMessage(skill.custom.EC_FusionID), length, color, font);
// 相手の同行が設定範囲内なら発動可
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getFusionMessage(skill.custom.EC_OpponentFusionID, true), length, color, font);
// 兵種が設定範囲内なら発動可
//OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getClassTypeMessage(skill.custom.EC_ClassType), length, color, font);
// 相手の兵種が設定範囲内なら発動可
//OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getClassTypeMessage(skill.custom.EC_OpponentClassType, true), length, color, font);
// ステートが設定範囲内なら発動可
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getStateMessage(skill.custom.EC_StateID), length, color, font);
// 相手のステートが設定範囲内なら発動可
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getStateMessage(skill.custom.EC_OpponentStateID, true), length, color, font);
// 武器タイプが設定範囲内なら発動可
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getWeaponTypeMessage(skill.custom.EC_WeaponType), length, color, font);
// 相手の武器タイプが設定範囲内なら発動可
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, EC_SituationRenderer.getWeaponTypeMessage(skill.custom.EC_OpponentWeaponType, true), length, color, font);
// ステータスが設定範囲内なら発動可
if(skill.custom.EC_NowStatus != null)
{
msg = EC_DefineString.NowStatus;
ary = EC_SituationRenderer.getArrayParamMessage(skill.custom.EC_NowStatus, 22);
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, msg, length, color, font);
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, ary, length, ColorValue.LIGHT, font);
}
// 相手のステータスが設定範囲内なら発動可
if(skill.custom.EC_OpponentNowStatus != null)
{
msg = EC_DefineString.Opponent + EC_DefineString.NowStatus;
ary = EC_SituationRenderer.getArrayParamMessage(skill.custom.EC_OpponentNowStatus, 22);
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, msg, length, color, font);
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, ary, length, ColorValue.LIGHT, font);
}
//---相手のステータスより上なら発動
if(skill.custom.EC_OverStatus != null)
{
msg = EC_DefineString.OverStatus;
ary = EC_SituationRenderer.getArrayParamMessage(skill.custom.EC_OverStatus, 22);
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, msg, length, color, font);
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, ary, length, ColorValue.LIGHT, font);
}
//---相手のステータスより下なら発動
if(skill.custom.EC_UnderStatus != null)
{
msg = EC_DefineString.UnderStatus;
ary = EC_SituationRenderer.getArrayParamMessage(skill.custom.EC_UnderStatus, 22);
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, msg, length, color, font);
OT_SkillInfoExtraWindow.rendererMessage(objRendererPos, ary, length, ColorValue.LIGHT, font);
}
}
}
// スキルウィンドウの描画
var alias4 = SkillInfoWindow.drawWindow;
SkillInfoWindow.drawWindow = function(x, y) {
var width = this.getWindowWidth();
var height = this.getWindowHeight();
var textui = this.getWindowTextUI();
var pic = textui.getUIImage();
// 画面下の説明文とかぶらないようにウィンドウの位置をずらす
if( (y+height) > ( root.getGameAreaHeight() - UIFormat.SCREENFRAME_HEIGHT ) )
{
y = ( root.getGameAreaHeight() - UIFormat.SCREENFRAME_HEIGHT ) - (height);
// 画面上からはみ出てしまわないように調整
if( y < 0 ) y = 0;
}
alias4.call(this, x, y)
}
var OT_SkillInfoExtraWindow = {
//発動率の設定の数を取得
GetExtraConfigPercentSettingSum: function( skill )
{
var count = 0;
if( skill.custom.EC_DefaultPercent != null ) count++;
if( skill.custom.EC_Correction != null ) count++;
if( skill.custom.EC_ScopePercent != null ) count++;
return count;
},
//発動条件の設定の数を取得
GetExtraConfigConditionSettingSum: function( skill )
{
var count = 0;
var ary = [];
if( skill.custom.EC_NowHP != null ) count++;
if( skill.custom.EC_OpponentNowHP != null ) count++;
if( skill.custom.EC_isDirectAttack != null ) count++;
if( skill.custom.EC_isSrc != null ) count++;
if( skill.custom.EC_isPhysics != null ) count++;
if( skill.custom.EC_isOpponentPhysics != null ) count++;
if( skill.custom.EC_StartTurn != null || skill.custom.EC_EndTurn != null || skill.custom.EC_TimesTurn != null) count++;
if( skill.custom.EC_AttackCount != null ) count++;
if( skill.custom.EC_OpponentAttackCount != null ) count++;
if( skill.custom.EC_Range != null ) count++;
if( skill.custom.EC_FusionID != null ) count++;
if( skill.custom.EC_OpponentFusionID != null ) count++;
//if( skill.custom.EC_ClassType != null ) count++;
//if( skill.custom.EC_OpponentClassType != null ) count++;
if( skill.custom.EC_StateID != null ) count++;
if( skill.custom.EC_OpponentStateID != null ) count++;
if( skill.custom.EC_WeaponType != null ) count++;
if( skill.custom.EC_OpponentWeaponType != null ) count++;
//---ステータスが一定範囲
ary = EC_SituationRenderer.getArrayParamMessage(skill.custom.EC_NowStatus, 22);
if(ary.length > 0)
{
count += ary.length + 1;
}
//---相手のステータスが一定範囲
ary = EC_SituationRenderer.getArrayParamMessage(skill.custom.EC_OpponentNowStatus, 22);
if(ary.length > 0)
{
count += ary.length + 1;
}
//---相手のステータスより上
ary = EC_SituationRenderer.getArrayParamMessage(skill.custom.EC_OverStatus, 22);
if(ary.length > 0)
{
count += ary.length + 1;
}
//---相手のステータスより下
ary = EC_SituationRenderer.getArrayParamMessage(skill.custom.EC_UnderStatus, 22);
if(ary.length > 0)
{
count += ary.length + 1;
}
return count;
},
//その他設定の数を取得
GetExtraConfigOtherSettingSum: function( skill )
{
var count = 0;
//発動率下限、上限を設定している場合
if( skill.custom.EC_ScopePercent != null ) count++;
//見切り無視のスキルの場合
if( skill.custom.EC_isAbandonIgnore != null && skill.custom.EC_isAbandonIgnore == true ) count++;
//発動回数が決まっている場合
if( skill.custom.EC_TriggerCountMap != null || skill.custom.EC_TriggerCountTurn != null || skill.custom.EC_TriggerCountBattle != null ) count++;
//消費EPと消費FPの設定がある
if( skill.custom.EC_UseEP != null || skill.custom.EC_UseFP != null ) count++;
//コマンド発動型
if( OT_isCommandSkill(skill) ) count++;
return count;
},
rendererMessage: function(obj, msg, length, color, font) {
if( msg != '' )
{
EC_SituationRenderer.rendererMessage(obj, msg, length, color, font, [0, OT_SkillInfoExtraWindow.getSpaceY()]);
}
},
rendererDoubleMessage: function(obj, msg, msg2, length) {
if( msg != '' )
{
var textui = this.getWindowTextUI();
var color = textui.getColor();
var font = textui.getFont();
EC_SituationRenderer.rendererMessage(obj, msg, length, color, font, [0, OT_SkillInfoExtraWindow.getSpaceY()]);
EC_SituationRenderer.rendererMessage(obj, msg2, length, ColorValue.LIGHT, font, [0, OT_SkillInfoExtraWindow.getSpaceY()]);
}
},
getSpaceY : function( skill )
{
//25
return ItemInfoRenderer.getSpaceY();
}
};
function GetStringLen(str) {
var len = 0;
var str = escape(str);
for (var j = 0; j < str.length; j++, len++) {
if (str.charAt(j) == "%") {
if (str.charAt(++j) == "u") {
j += 3;
len++;
}
j++;
}
}
return len;
};
})();