function PassiveSkillManager() {
throw new Error('This is a static class');
};
(function(){
var parameters = PluginManager.parameters('PassiveSkill');
var passiveSkillTypeId = Number(parameters['Passive Skill Type ID'] || 3);
var addMulitOrder = String(parameters['Add Multi Order'] || 'true') === 'true';
var hidePassiveDisable = String(parameters['Hide Passive Disable'] || 'true') === 'true';
PassiveSkillManager.checkPassive = function(text){
if(text.match(/<(?:パッシブスキル|パッシブ|passive|PS):((.+))>/)){
var reg = RegExp.$1;
var trait = this.makePassive('<'+reg+'>');
if (trait){ return trait }
}
return false;
};
PassiveSkillManager.makePassive = function(reg){
if (reg.match(/<(.+?)(\d+),?([+-]\d+)(%)?>/)){
return this.makeNumTrait([RegExp.$1,RegExp.$2,RegExp.$3,RegExp.$4]);
} else if (reg.match(/<(.+?),?([+-]?\d+)(%)?>/)){
return this.makeParamTrait([RegExp.$1,RegExp.$2,RegExp.$3]);
} else if (reg.match(/<(.+)>/)){
return this.makeExTrait(RegExp.$1);
}
return false;
};
PassiveSkillManager.makeNumTrait = function(ary){
var code = null;
var id = parseInt(ary[1]);
var value = parseInt(ary[2]);
var parc = ary[3];
switch(ary[0]){
case '属性有効度':
case 'ElementRate':
code = parc == '' ? 111 : 11;
break;
case '弱体有効度':
case 'DebuffRate':
code = parc == '' ? 112 : 12;
break;
case 'ステート有効度':
case 'StateRate':
code = parc == '' ? 113 : 13;
break;
case '攻撃時ステート':
case 'AttackState':
code = 32;
break;
};
if (code === null){return false }
value = (value / 100);
if (code < 100){ value += 1 }
return {'code':code,'dataId':id,'value':value};
};
PassiveSkillManager.makeParamTrait = function(ary){
var code = null;
var id = null;
var value = parseInt(ary[1]);
var parc = ary[2];
switch(ary[0]){
// param
case '最大HP':
case '最大HP':
case TextManager.basic(2):
case TextManager.basic(3):
id = 0;
code = parc == '' ? 121 : 21;
break;
case 'MP':
case 'MP':
case TextManager.basic(4):
case TextManager.basic(5):
id = 1;
code = parc == '' ? 121 : 21;
break;
case 'ATK':
case 'ATK':
case '攻撃力':
case TextManager.param[2]:
id = 2;
code = parc == '' ? 121 : 21;
break;
case 'DEF':
case 'DEF':
case '防御力':
case TextManager.param[3]:
id = 3;
code = parc == '' ? 121 : 21;
break;
case 'MAT':
case 'MAT':
case '魔法力':
case TextManager.param[4]:
id = 4;
code = parc == '' ? 121 : 21;
break;
case 'MDF':
case 'MDF':
case '魔法防御':
case TextManager.param[5]:
id = 5;
code = parc == '' ? 121 : 21;
break;
case 'AGI':
case 'AGI':
case '敏捷性':
case TextManager.param[6]:
id = 6;
code = parc == '' ? 121 : 21;
break;
case 'LUK':
case 'LUK':
case '運':
case TextManager.param[7]:
id = 7;
code = parc == '' ? 121 : 21;
break;
// xparams
case 'HIT':
case 'HIT':
case '命中率':
case TextManager.param[8]:
id = 0;
code = 22;
break;
case 'EVA':
case 'EVA':
case '回避率':
id = 1;
code = 22;
break;
case TextManager.param[9]:
case 'CRI':
case 'CRI':
case '会心率':
id = 2;
code = 22;
break;
case 'CEV':
case 'CEV':
case '会心回避率':
id = 3;
code = 22;
break;
case 'MEV':
case 'MEV':
case '魔法回避率':
id = 4;
code = 22;
break;
case 'MRF':
case 'MRF':
case '魔法反射率':
id = 5;
code = 22;
break;
case 'CNT':
case 'CNT':
case '反撃率':
id = 6;
code = 22;
break;
case 'HRG':
case 'HRG':
case 'HP再生率':
case 'HP再生率':
id = 7;
code = 22;
break;
case 'MRG':
case 'MRG':
case 'MP再生率':
case 'MP再生率':
id = 8;
code = 22;
break;
case 'TRG':
case 'TRG':
case 'TP再生率':
case 'TP再生率':
id = 9;
code = 22;
break;
//sparams
case 'TGR':
case 'TGR':
case '狙われ率':
id = 0;
code = parc == '' ? 123 : 23;
break;
case 'GRD':
case 'GRD':
case '防御効果率':
id = 1;
code = parc == '' ? 123 : 23;
break;
case 'REC':
case 'REC':
case '回復効果率':
id = 2;
code = parc == '' ? 123 : 23;
break;
case 'PHA':
case 'PHA':
case '薬の知識':
id = 3;
code : parc == '' ? 123 : 23;
break;
case 'MCR':
case 'MCR':
case 'MP消費率':
case 'MP消費率':
id = 4;
code = parc == '' ? 123 : 23;
break;
case 'TCR':
case 'TCR':
case 'TPチャージ率':
case 'TPチャージ率':
id = 5;
code = parc == '' ? 123 : 23;
break;
case 'PDR':
case 'PDR':
case '物理ダメージ率':
id = 6;
code = parc == '' ? 123 : 23;
break;
case 'MDR':
case 'MDR':
case '魔法ダメージ率':
id = 7;
code = parc == '' ? 123 : 23;
break;
case 'FDR':
case 'FDR':
case '床ダメージ率':
id = 8;
code = parc == '' ? 123 : 23;
break;
case 'EXR':
case 'EXR':
case '経験値獲得率':
id = 9;
code = parc == '' ? 123 : 23;
break;
//その他
case 'ステート無効化':
case 'StateResist':
id = value;
code = 14;
break;
case '攻撃時属性':
case 'AttackElement':
id = value;
code = 31;
break;
case '攻撃速度補正':
case 'AttackSpeed':
id = value;
code = 33;
break;
case '攻撃追加回数':
case 'AttackTimes+':
id = value;
code = 34;
break;
case 'スキルタイプ追加':
case 'AddSkillType':
id = value;
code = 41;
break;
case 'スキルタイプ封印':
case 'SealSkillType':
id = value;
code = 42;
break;
case 'スキル追加':
case 'AddSkill':
id = value;
code = 43;
break;
case 'スキル封印':
case 'SealSkill':
id = value;
code = 44;
break;
case '武器タイプ装備':
case 'EquipWeapon':
id = value;
code = 51;
break;
case '防具タイプ装備':
case 'EquipArmor':
id = value;
code = 52;
break;
case '装備固定':
case 'LockEquip':
id = value;
code = 53;
break;
case '装備封印':
case 'SealEquip':
id = value;
code = 54;
break;
case '行動回数追加':
case 'ActionTime+':
id = value;
code = 61;
break;
default:
}
if (code === null){ return false }
if ((code > 20 && code < 30) || (code === 123)){ value = (value / 100)}
if (code === 21){ value += 1 }
return {'code':code,'dataId':id,'value':value};
};
PassiveSkillManager.makeExTrait = function(reg){
var code = null;
var id = null;
var value = 1;
switch(reg){
case '二刀流':
case 'DualWield':
code = 55;
id = 1;
break;
case '自動戦闘':
case 'AutoBattle':
code = 62;
id = 0;
break;
case '防御':
case 'Guard':
code = 62;
id = 1;
break;
case '身代わり':
case 'Subsitute':
code = 62;
id = 2;
break;
case 'TP持ち越し':
case 'PreserveTP':
code = 62;
id = 3;
break;
case 'エンカウント半減':
case 'EncounterHalf':
code = 64;
id = 0;
break;
case 'エンカウント無効':
case 'EncounterNone':
code = 64;
id = 1;
break;
case '不意打ち無効':
case 'CancelSurprise':
code = 64;
id = 2;
break;
case '先制攻撃率アップ':
case 'RaisePreemptive':
code = 64;
id = 3;
break;
case '獲得金額二倍':
case '獲得金額2倍':
case '獲得金額2倍':
case 'GoldDouble':
code = 64;
id = 4;
break;
case 'アイテム入手率二倍':
case 'アイテム入手率2倍':
case 'アイテム入手率2倍':
case 'ItemDropDouble':
code = 64;
id = 5;
break;
default:
}
if (code === null){return false }
return {'code':code,'dataId':id,'value':value };
};
PassiveSkillManager.initPassiveSkill = function(skill){
if (skill.traits){ return }
skill.traits = [];
var texts = skill.note.split('\n');
for (var i=0;i<texts.length;i++){
var trait = this.checkPassive(texts);
if (trait){ skill.traits.push(trait) }
}
};
var _pS_GActor_traitObjects = Game_Actor.prototype.traitObjects;
Game_Actor.prototype.traitObjects = function() {
var objects = _pS_GActor_traitObjects.call(this);
if (this.traitNest){ return objects }
this.traitNest = true;
this.enableSkills().forEach(function(skill){
PassiveSkillManager.initPassiveSkill(skill);
if (skill.traits != []){ objects.push(skill) }
},this);
this.traitNest = false;
return objects;
};
var _pS_GBBase_addedSkillTypes = Game_BattlerBase.prototype.addedSkillTypes;
Game_BattlerBase.prototype.addedSkillTypes = function(){
var types = _pS_GBBase_addedSkillTypes.call(this);
if (!$gameParty.inBattle()){ return types }
var id = types.indexOf(passiveSkillTypeId);
if (id >= 0){ types.splice(id,1) }
return types;
};