Advertisement
Maliki79

MalBasePowerText

Feb 7th, 2025 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Maliki's Base Power Text
  3. // MalBasePowerText.js
  4. // version 1.0
  5. //=============================================================================
  6. /*:  
  7. * @plugindesc ver1.0 - Allows Devs to calculate the base damage for skills and show them in description windows.  
  8.  * @author Maliki79
  9.  *
  10.  * @param variableUsed
  11.  * @desc The desired Variable to be used for this plugin.
  12.  * Default: 1
  13.  * @default 1
  14.  *
  15.  * @help To use this plugin, you must first choose a dedicated variable from your list in the database.
  16.  * (It might be a good idea to name it in your database as well.)
  17.  *
  18.  * Once done, simply add the variable shortcut to the description of the skill.
  19.  * for example:  Skill does the following base damage: \V[1]
  20.  * assuming the variable used is number 1 in the database.
  21.  *
  22.  * For those that incorporate target stats that need to be removed from the base damage calulations or have multiple hits etc.,
  23.  * another damage formula may be used.
  24.  * use the following notetag in your skill notes:
  25.  * <baseDamageForm: formula>
  26.  * This formula follows the same rules as the normal one, but should not refer to the target at all.
  27.  * (Obviously, this does not take variance into account when showing the Base Power.)
  28.  */
  29.  
  30. let MalBPTvariableUsed = Number(PluginManager.parameters('MalBasePowerText')['variableUsed']);
  31.  
  32. let MalBasePowerSMBActor = Scene_MenuBase.prototype.actor
  33. Scene_MenuBase.prototype.actor = function() {
  34.     $gameParty.focusedActor = this._actor;
  35.     return MalBasePowerSMBActor.call(this);
  36. };
  37.  
  38. let MalBasePowerBMActor = BattleManager.actor;
  39. BattleManager.actor = function() {
  40.     let actor = this._actorIndex >= 0 ? $gameParty.members()[this._actorIndex] : null;
  41.     $gameParty.focusedActor = actor;
  42.     return MalBasePowerBMActor.call(this);
  43. };
  44.  
  45. let MalBasePowerWHsetItem = Window_Help.prototype.setItem
  46. Window_Help.prototype.setItem = function(item) {
  47.     $gameVariables.setValue(MalBPTvariableUsed, this.getBaseDamage(item));
  48.     MalBasePowerWHsetItem.call(this, item);
  49. };
  50.  
  51. Window_Help.prototype.getBaseDamage = function(item) {
  52.     if (!DataManager.isSkill(item)) return 0;
  53.     if (!item) return 0;
  54.     let value = 0;
  55.     let a = $gameParty.focusedActor;
  56.     let b = a; //for now
  57.     let v = $gameVariables._data;
  58.     if (item.meta.baseDamageForm) {
  59.         value = Math.max(eval(item.meta.baseDamageForm), 0);
  60.     } else {
  61.     if (item.damage.formula) value = Math.max(eval(item.damage.formula), 0);
  62.     }
  63.     if (isNaN(value)) value = 0;
  64.     return value;
  65. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement