Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Maliki's Character Specific TP
- // MalCharTP.js
- // version 1.3
- //=============================================================================
- /*:
- * @plugindesc Version 1.2 Allows you to manipulate individual Actor TP
- * @author Maliki79
- *
- * @param TPMax
- * @desc The highest ANY actor or enemy MAX TP can be raised to.
- * Default: 100
- * @default 100
- *
- * @help
- * All Actors will start with TP not visible in battles.
- * To show an actor's TP, make the following Script Call:
- * $gameSystem.showCharTP(x);
- * with x being the ID of the actor. Make sure you first turn on TP in the database!
- * To hide an actor's TP, make the following Script Call:
- * $gameSystem.hideCharTP(x);
- * Note that TP will still be present on actors whether visible or not.
- *
- * Individual Actor and Enemy TP can also be set to a number other than 100.
- * To do this, you must set the amount of Max TP the actor/enemy will gain.
- * Using the notetag
- * <tpChange: x>
- * in Actor and Enemy notes will change the amount of Max TP using 100 as the base number.
- * For example, If Actor 1 has the tag <tpChange: 25> , then he will start battles with a max TP of 125.
- * You can also use the tags on Equip items and States to allow temporary changes.
- * The values can also be negative numbers, but the lowest Max TP can be is 1.
- */
- var Mal = Mal || {};
- Mal.Parameters = PluginManager.parameters('MalCharTp');
- Mal.CharTp = {};
- Mal.CharTp.max = Mal.Parameters['TPMax'];
- //begin database setup
- var MalTPDatabaseLoad = DataManager.isDatabaseLoaded;
- DataManager.isDatabaseLoaded = function() {
- if (!MalTPDatabaseLoad.call(this)) return false;
- if (!DataManager._malTP_DatabaseLoaded) {
- this.processTPNotetags($dataActors);
- this.processTPNotetags2($dataActors);
- this.processTPNotetags($dataEnemies);
- this.processTPNotetags($dataWeapons);
- this.processTPNotetags($dataArmors);
- this.processTPNotetags($dataStates);
- this.processTPNotetags($dataItems);
- this.processTPNotetags($dataSkills);
- DataManager._malTP_DatabaseLoaded = true;
- }
- return true;
- };
- DataManager.processTPNotetags = function(group) {
- for (var n = 1; n < group.length; n++) {
- var obj = group[n];
- obj.tpChange = 0;
- this.createTpValues(obj);
- }
- };
- DataManager.processTPNotetags2 = function(group) {
- for (var n = 1; n < group.length; n++) {
- var obj = group[n];
- obj.showTP = false;
- }
- };
- DataManager.createTpValues = function(object) {
- var noteread = object.note;
- while(noteread.indexOf("tpChange") > -1)
- {
- var notereg = noteread.split("<tpChange: ");
- var match = notereg[1].split(" ");
- match = notereg[1].split(">");
- var tpChange = Number(match[0]);
- noteread = noteread.replace("tpChange", " ");
- object.tpChange += tpChange;
- }
- };
- //End Database setup
- var malTPActorSetup = Game_Actor.prototype.setup;
- Game_Actor.prototype.setup = function(actorId) {
- malTPActorSetup.call(this, actorId);
- this.tpChange = $dataActors[actorId].tpChange;
- this.showTP = $dataActors[actorId].showTP;
- };
- Game_System.prototype.showCharTP = function(actorId) {
- var actor = $gameActors.actor(actorId);
- actor.showTP = true;
- };
- Game_System.prototype.hideCharTP = function(actorId) {
- var actor = $gameActors.actor(actorId);
- actor.showTP = false;
- };
- var malTPEnemySetup = Game_Enemy.prototype.setup;
- Game_Enemy.prototype.setup = function(enemyId, x, y) {
- malTPEnemySetup.call(this, enemyId, x, y);
- this.tpChange = $dataEnemies[this._enemyId].tpChange;
- };
- Game_BattlerBase.prototype.maxTp = function() {
- var max = Number(Mal.CharTp.max);
- var pretp = max;
- if (this.isActor() ) {
- for(var i = 0; i < this.equips().length; ++i) {
- if (this.equips()[i]) {
- pretp += this.equips()[i].tpChange;
- }
- }
- pretp += Number(this.actor().tpChange);
- }
- for(var i = 0; i < this.states().length; ++i) {
- pretp += Number(this.states()[i].tpChange);
- }
- if (this.isEnemy() ) pretp += Number(this.enemy().tpChange);
- return pretp.clamp(0, max);
- };
- var malTPsetTP = Game_BattlerBase.prototype.setTp;
- Game_BattlerBase.prototype.setTp = function(tp) {
- var max = Mal.CharTp.max;
- malTPsetTP.call(this, tp);
- this._tp = Math.max(tp, 0);
- this.refresh();
- };
- Window_BattleStatus.prototype.drawGaugeArea = function(rect, actor) {
- if ($dataSystem.optDisplayTp && actor.showTP) {
- this.drawGaugeAreaWithTp(rect, actor);
- } else {
- this.drawGaugeAreaWithoutTp(rect, actor);
- }
- };
Add Comment
Please, Sign In to add comment