Skill Seal v1.0
IntroductionAllows for more control over sealing skills. Additionally, sealed skills may be unsealed, allowing them to be used as per normal.
How to use
Save it as APHO_SkillSeal.js and put it in your plugin folder.
The following notetags are available:
Skill notetags:
<sealed>
The skill will always be sealed by default, and may only be used if another effect unseals it.
Skills, Actors, Classes, Enemies, & States notetags:
<nullseal>
Nullifies all 'seal skill' or 'seal skill type' effects.
For skills, affects only that skill; otherwise, affects all user's skills.
Actors, Classes, Enemies, & States notetags:
<sealp>, <sealm>, <sealc>
Seals all physical, magical, or certain hit skills.
Excludes skills in the list specified in the plugin parameters.
<sealtag:x>
Seals all skills with the notetag <x>. Separate multiple tags with a comma.
<sealeval>
//code
</sealeval>
Evaluates code to determine if skills should be sealed.
You may use 'skill' for the skill object, 'a' for the skill's user, or excludelist for the exclude list defined in the plugin parameters.
Must evaluate to either true (sealed) or false (not sealed).
Spoiler: EXAMPLES<sealeval>
skill.id % 2 == 0
</sealeval>
This will seal all skills with an ID divisible by 2 (even ID skills).
Odd ID skills will still be usable.
<sealeval>
a.hpRate() < 0.5
</sealeval>
This will seal all skills while the user's HP is below 50%.
<sealeval>
!excludelist.includes(skill.id)
</sealeval>
If excludelist is not excluded from seal eval, this will seal all skills except those in the excludelist.
<unseal:x>
Unseals skill ID x. Separate multiple values with a comma.
<unsealtype:x>
Unseals all skills of skill type x. x is the number of the skill type.
Separate multiple values with a comma.
<unsealp>, <unsealm>, <unsealc>
Unseals all physical, magical, or certain hit skills.
<unsealtag:x>
Unseals all skills with the notetag <x>. Separate multiple tags with a comma.
<unsealeval>
//code
</unsealeval>
Evaluates code to determine if skills should be unsealed.
You may use 'skill' for the skill object, 'a' for the skill's user, or excludelist for the exclude list defined in the plugin parameters.
Must evaluate to either true (unsealed) or false (not unsealed).
Script
Spoiler: code JavaScript:
//==========================================
// APHO_SkillSeal.js
//==========================================
/*:
* @title Skill Seal
* @author Apho
* @plugindesc v1.0 Allows for more control over sealing skills.
*
* @param ExcludeFromSeal
* @text Exclude from Sealing
* @type string
* @desc List of skills that should be excluded from sealing. Separate values with a comma. See notes for more details.
* @default 1,2
*
* @param ExcludeFromEval
* @parent ExcludeFromSeal
* @text Exclude from <sealeval>
* @type boolean
* @desc Also exclude from <sealeval>?
* @default true
*
* @help
* Allows for more control over sealing skills. Additionally, sealed skills may
* be unsealed, allowing them to be used as per normal.
*
* The following notetags are available:
* Skill notetags:
* <sealed>
* The skill will always be sealed by default, and may only be used if another
* effect unseals it.
*
* Skills, Actors, Classes, Enemies, & States notetags:
* <nullseal>
* Nullifies all 'seal skill' or 'seal skill type' effects.
* For skills, affects only that skill; otherwise, affects all user's skills.
*
* Actors, Classes, Enemies, & States notetags:
* <sealp>, <sealm>, <sealc>
* Seals all physical, magical, or certain hit skills.
* Excludes skills in the list specified in the plugin parameters.
*
* <sealtag:x>
* Seals all skills with the notetag <x>. Separate multiple tags with a comma.
*
* <sealeval>
* //code
* </sealeval>
* Evaluates code to determine if skills should be sealed.
* You may use 'skill' for the skill object, 'a' for the skill's user, or
* excludelist for the exclude list defined in the plugin parameters.
* Must evaluate to either true (sealed) or false (not sealed).
*
* EXAMPLES:
* <sealeval>
* skill.id % 2 == 0
* </sealeval>
* This will seal all skills with an ID divisible by 2 (even ID skills).
* Odd ID skills will still be usable.
*
* <sealeval>
* a.hpRate() < 0.5
* </sealeval>
* This will seal all skills while the user's HP is below 50%.
*
* <sealeval>
* !excludelist.includes(skill.id)
* </sealeval>
* If excludelist is not excluded from seal eval, this will seal all skills
* except those in the excludelist.
*
* <unseal:x>
* Unseals skill ID x. Separate multiple values with a comma.
*
* <unsealtype:x>
* Unseals all skills of skill type x. x is the number of the skill type.
* Separate multiple values with a comma.
*
* <unsealp>, <unsealm>, <unsealc>
* Unseals all physical, magical, or certain hit skills.
*
* <unsealtag:x>
* Unseals all skills with the notetag <x>. Separate multiple tags with a comma.
*
* <unsealeval>
* //code
* </unsealeval>
* Evaluates code to determine if skills should be unsealed.
* You may use 'skill' for the skill object, 'a' for the skill's user, or
* excludelist for the exclude list defined in the plugin parameters.
* Must evaluate to either true (unsealed) or false (not unsealed).
*
* NOTES
* - Unsealing takes priority over sealing.
* - 'Exclude from Sealing' applies only to sealp/m/c, as well as <sealeval>
* if specified in plugin parameters. You can still seal the skills via the
* default 'seal skill/skill type' functionality or by using any of the other
* sealing notetags.
*
* TERMS OF USE
* - Free for commercial and non-commercial use, as long as I get a free copy
* of the game.
* - Edits allowed for personal use.
* - Do not repost or claim as your own, even if edited.
*
* VERSION HISTORY
* v1.1 - 2023/12/29 - Compatibility fix for actor cooldowns with Skill Cooldowns Visustella MZ.
* v1.0 - 2023/07/18 - Initial release.
*/
(function(){
var parameters = PluginManager.parameters('APHO_SkillSeal');
var ExcludeFromSeal = parameters['ExcludeFromSeal'].split(",").map(Number);
var ExcludeFromEval = JSON.parse(parameters['ExcludeFromEval']);
var Imported_VisuMZ_3_SkillCooldowns = $plugins.filter(function(p) { return p.name === 'VisuMZ_3_SkillCooldowns' && p.status === true; }).length > 0
CheckSealEval = function(notetag, skill, a)
{
let excludelist = ExcludeFromSeal;
if(ExcludeFromEval && excludelist.includes(skill.id)) return false;
const SealEvalOpen = '<sealeval>';
const SealEvalClose = '</sealeval>';
let ReadSealEval = false;
let SealEvalInfo = "";
for (var n = 0; n < notetag.length; n++)
{
let NoteData = notetag.split(/[\r\n]+/);
let line = NoteData;
if (line && line.match(SealEvalOpen))
{
ReadSealEval = true;
}
else if (line && line.match(SealEvalClose))
{
ReadSealEval = false;
}
else if (ReadSealEval == true)
{
SealEvalInfo += line + '\n';
}
}
return eval(SealEvalInfo)
};
CheckUnsealEval = function(notetag, skill, a)
{
let excludelist = ExcludeFromSeal;
const UnsealEvalOpen = '<unsealeval>';
const UnsealEvalClose = '</unsealeval>';
let ReadUnsealEval = false;
let UnsealEvalInfo = "";
for (var n = 0; n < notetag.length; n++)
{
let NoteData = notetag.split(/[\r\n]+/);
let line = NoteData;
if (line && line.match(UnsealEvalOpen))
{
ReadUnsealEval = true;
}
else if (line && line.match(UnsealEvalClose))
{
ReadUnsealEval = false;
}
else if (ReadUnsealEval == true)
{
UnsealEvalInfo += line + '\n';
}
}
return eval(UnsealEvalInfo)
};
const Game_BattlerBase_meetsSkillConditions = Game_BattlerBase.prototype.meetsSkillConditions;
Game_BattlerBase.prototype.meetsSkillConditions = function(skill) {
if(Imported_VisuMZ_3_SkillCooldowns)
{
try
{
if((this.isActor() && $actorGetSkillCooldown(this._actorId, skill.id) > 0))
{
return false;
}
}catch(e){console.log('VS Skill Cooldown MZ Compatibility Error')}
}
let seal = skill.meta.sealed || false;
if(this.isEnemy())
{
if((this.enemy().meta.sealp && skill.hitType == 1) || (this.enemy().meta.sealm && skill.hitType == 2) || (this.enemy().meta.sealc && skill.hitType == 0))
{
if(!ExcludeFromSeal.includes(skill.id)) seal = true;
}
if(this.enemy().meta.sealtag)
{
let TagsToSeal = this.enemy().meta.sealtag.split(",");
for(var n1 = 0; n1 < TagsToSeal.length; n1++)
{
if(TagsToSeal in skill.meta)
{
seal = true;
break;
}
}
}
if(this.enemy().meta.sealeval && !seal) seal = CheckSealEval(this.enemy().note, skill, this);
}else if(this.isActor())
{
if((this.actor().meta.sealp && skill.hitType == 1) || (this.actor().meta.sealm && skill.hitType == 2) || (this.actor().meta.sealc && skill.hitType == 0))
{
if(!ExcludeFromSeal.includes(skill.id)) seal = true;
}
if(($dataClasses.meta.sealp && skill.hitType == 1) || ($dataClasses.meta.sealm && skill.hitType == 2) || ($dataClasses.meta.sealc && skill.hitType == 0))
{
if(!ExcludeFromSeal.includes(skill.id)) seal = true;
}
if(this.actor().meta.sealtag)
{
let TagsToSeal = this.actor().meta.sealtag.split(",");
for(var n1 = 0; n1 < TagsToSeal.length; n1++)
{
if(TagsToSeal in skill.meta)
{
seal = true;
break;
}
}
}
if($dataClasses.meta.sealtag)
{
let TagsToSeal = $dataClasses.meta.sealtag.split(",");
for(var n1 = 0; n1 < TagsToSeal.length; n1++)
{
if(TagsToSeal in skill.meta)
{
seal = true;
break;
}
}
}
if(this.actor().meta.sealeval && !seal) seal = CheckSealEval(this.actor().note, skill, this);
if($dataClasses.meta.sealeval && !seal) seal = CheckSealEval($dataClasses.note, skill, this);
}
if(!seal)
{
for(var n = 0; n < this.states().length; n++)
{
if((this.states().meta.sealp && skill.hitType == 1) || (this.states().meta.sealm && skill.hitType == 2) || (this.states().meta.sealc && skill.hitType == 0))
{
if(!ExcludeFromSeal.includes(skill.id))
{
seal = true;
break;
}
}
if(this.states().meta.sealtag)
{
let TagsToSeal = this.states().meta.sealtag.split(",");
for(var n1 = 0; n1 < TagsToSeal.length; n1++)
{
if(TagsToSeal in skill.meta)
{
seal = true;
break;
}
if(seal) break;
}
}
if(this.states().meta.sealeval && !seal)
{
seal = CheckSealEval(this.states().note, skill, this);
if(seal) break;
}
}
}
if(!Game_BattlerBase_meetsSkillConditions.call(this, skill) || seal)
{
let unseal = skill.meta.nullseal || false;
if(this.isEnemy())
{
if(this.enemy().meta.nullseal || (this.enemy().meta.unsealp && skill.hitType == 1) || (this.enemy().meta.unsealm && skill.hitType == 2) || (this.enemy().meta.unsealc && skill.hitType == 0)) unseal = true;
if(this.enemy().meta.unseal)
{
let SkillsToUnseal = this.enemy().meta.unseal.split(",");
for(var n1 = 0; n1 < SkillsToUnseal.length; n1++)
{
if(SkillsToUnseal == skill.id)
{
unseal = true;
break;
}
}
}
if(this.enemy().meta.unsealtype)
{
let TypesToUnseal = this.enemy().meta.unsealtype.split(",");
for(var n1 = 0; n1 < TypesToUnseal.length; n1++)
{
if(TypesToUnseal == skill.stypeId)
{
unseal = true;
break;
}
}
}
if(this.enemy().meta.unsealtag)
{
let TagsToUnseal = this.enemy().meta.unsealtag.split(",");
for(var n1 = 0; n1 < TagsToUnseal.length; n1++)
{
if(TagsToUnseal in skill.meta)
{
unseal = true;
break;
}
}
}
if(this.enemy().meta.unsealeval && !unseal) unseal = CheckUnsealEval(this.enemy().note, skill, this);
}else if(this.isActor())
{
if(this.actor().meta.nullseal || $dataClasses.meta.nullseal) unseal = true;
if(skill.hitType == 1 && (this.actor().meta.unsealp || $dataClasses.meta.unsealp)) unseal = true;
if(skill.hitType == 2 && (this.actor().meta.unsealm || $dataClasses.meta.unsealm)) unseal = true;
if(skill.hitType == 0 && (this.actor().meta.unsealc || $dataClasses.meta.unsealc)) unseal = true;
if(this.actor().meta.unseal)
{
let SkillsToUnseal = this.actor().meta.unseal.split(",");
for(var n1 = 0; n1 < SkillsToUnseal.length; n1++)
{
if(SkillsToUnseal == skill.id)
{
unseal = true;
break;
}
}
}
if($dataClasses.meta.unseal)
{
let SkillsToUnseal = $dataClasses.meta.unseal.split(",");
for(var n1 = 0; n1 < SkillsToUnseal.length; n1++)
{
if(SkillsToUnseal == skill.id)
{
unseal = true;
break;
}
}
}
if(this.actor().meta.unsealtype)
{
let TypesToUnseal = this.actor().meta.unsealtype.split(",");
for(var n1 = 0; n1 < TypesToUnseal.length; n1++)
{
if(TypesToUnseal == skill.stypeId)
{
unseal = true;
break;
}
}
}
if($dataClasses.meta.unsealtype)
{
let TypesToUnseal = $dataClasses.meta.unsealtype.split(",");
for(var n1 = 0; n1 < TypesToUnseal.length; n1++)
{
if(TypesToUnseal == skill.id)
{
unseal = true;
break;
}
}
}
if(this.actor().meta.unsealtag)
{
let TagsToUnseal = this.actor().meta.unsealtag.split(",");
for(var n1 = 0; n1 < TagsToUnseal.length; n1++)
{
if(TagsToUnseal in skill.meta)
{
unseal = true;
break;
}
}
}
if($dataClasses.meta.unsealtag)
{
let TagsToUnseal = $dataClasses.meta.unsealtag.split(",");
for(var n1 = 0; n1 < TagsToUnseal.length; n1++)
{
if(TagsToUnseal in skill.meta)
{
unseal = true;
break;
}
}
}
if(this.actor().meta.unsealeval && !unseal) unseal = CheckUnsealEval(this.actor().note, skill, this);
if($dataClasses.meta.unseal && !unseal) unseal = CheckUnsealEval($dataClasses.note, skill, this);
}
if(!unseal)
{
for(var n = 0; n < this.states().length; n++)
{
if((this.states().meta.nullseal) || (this.states().meta.unsealp && skill.hitType == 1) || (this.states().meta.unsealm && skill.hitType == 2) || (this.states().meta.unsealc && skill.hitType == 0))
{
unseal = true;
break;
}
if(this.states().meta.unseal)
{
let SkillsToUnseal = this.states().meta.unseal.split(",");
for(var n1 = 0; n1 < SkillsToUnseal.length; n1++)
{
if(SkillsToUnseal == skill.id)
{
unseal = true;
break;
}
}
if(unseal) break;
}
if(this.states().meta.unsealtype)
{
let TypesToUnseal = this.states().meta.unsealtype.split(",");
for(var n1 = 0; n1 < TypesToUnseal.length; n1++)
{
if(TypesToUnseal == skill.stypeId)
{
unseal = true;
break;
}
}
if(unseal) break;
}
if(this.states().meta.unsealtag)
{
let TagsToUnseal = this.states().meta.unsealtag.split(",");
for(var n1 = 0; n1 < TagsToUnseal.length; n1++)
{
if(TagsToUnseal in skill.meta)
{
unseal = true;
break;
}
}
if(unseal) break;
}
if(this.states().meta.unsealeval && !unseal)
{
unseal = CheckUnsealEval(this.states().note, skill, this);
if(unseal) break;
}
}
}
if(!unseal)
{
return false;
}else if((this.meetsUsableItemConditions(skill) &&
this.isSkillWtypeOk(skill) && this.canPaySkillCost(skill)))
{
return true;
}
}
return Game_BattlerBase_meetsSkillConditions.call(this, skill);
};
})();
Notes
[*]Unsealing takes priority over sealing.
[*]'Exclude from Sealing' applies only to sealp/m/c, as well as <sealeval> if specified in plugin parameters. You can still seal the skills via the default 'seal skill/skill type' functionality or by using any of the other sealing notetags.
Terms of use
[*]Free for commercial and non-commercial use, as long as I get a free copy of the game.
[*]Edits allowed for personal use.
[*]Do not repost or claim as your own, even if edited.
[*]Do not use for training AI models. This includes, but is not limited to, inputting the plugin contents or part thereof into AI models that train on user input.
Version history
v1.1 - 2023/12/29 - Compatibility fix for actor cooldowns with Skill Cooldowns Visustella MZ.
v1.0 - 2023/7/18- Initial release.
Download link
GitHub
本贴来自国际rpgmaker官方论坛作者:AphoticAmaranth处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/skill-seal-v1-0.159448/
页:
[1]