├── BugFixPatch ├── README.md ├── SRPG_AIControl ├── SRPG_AoE └── SRPG_DynamicAction.js ├── Demos ├── $Rescue.png ├── BattlePrepareWindow.png ├── FaceBack.png ├── FaceFrame.png ├── SRPG Engine Core Link ├── demo AoE animation-map battle.gif ├── demo AoEAnimation.gif ├── demo action order.gif ├── demo adv interaction-wrap.gif ├── demo adv interaction.gif ├── demo aura skill.gif ├── demo battle prepare-2.gif ├── demo battle prepare.gif ├── demo move method.gif ├── demo rescue.gif ├── demo terrain effect window.gif └── move after action.gif ├── LICENSE ├── README.md ├── SRPG_AIControlPlus.js ├── SRPG_ActionOrder.js ├── SRPG_ActionOrder_SRG.js ├── SRPG_ActorAISkillControl.js ├── SRPG_AdvancedInteraction.js ├── SRPG_AgiAttackControl.js ├── SRPG_AoEAnimation.js ├── SRPG_AuraSkill.js ├── SRPG_BattlePrepare.js ├── SRPG_BattleResultAutoClose.js ├── SRPG_BattleUI.js ├── SRPG_Developer.js ├── SRPG_ExpControl.js ├── SRPG_ModifiedMoveTable.js ├── SRPG_MoveAfterAction.js ├── SRPG_MoveMethod.js ├── SRPG_RemainingMove.js ├── SRPG_Rescue.js ├── SRPG_ShowAoERange.js ├── SRPG_StatusWindow.js ├── SRPG_Summon.js ├── SRPG_TerrainEffectWindow.js └── oldVersions ├── SRPG_AgiAttackControl v 1.01.js ├── SRPG_AoEAnimation.js ├── SRPG_BattlePrepare v1.02.js ├── SRPG_BattlePrepare.js ├── SRPG_BattlePrepare_v1.01.js ├── SRPG_PathfindingChange.js ├── SRPG_StatusWindow.js └── Srpg_DynamicAction /BugFixPatch/README.md: -------------------------------------------------------------------------------- 1 | ### This is a bug fix patch. I'm not the autor of any of these plugins. 2 | Since there are some bugs left in these great plugins and the authors are not active for a long time, I decide to make this folder to put my bug fixed versions here, so that it's easy for everyone to find. 3 | 4 | The files here are mainly bug-fixed for AoE purpose. If you use AoE animation, use the plugins here instead. 5 | 6 | -------------------------------------------------------------------------------- /Demos/$Rescue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/$Rescue.png -------------------------------------------------------------------------------- /Demos/BattlePrepareWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/BattlePrepareWindow.png -------------------------------------------------------------------------------- /Demos/FaceBack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/FaceBack.png -------------------------------------------------------------------------------- /Demos/FaceFrame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/FaceFrame.png -------------------------------------------------------------------------------- /Demos/SRPG Engine Core Link: -------------------------------------------------------------------------------- 1 | https://forums.rpgmakerweb.com/index.php?threads/srpg-engine-add-votes-for-rtp-plugins-for-creating-turn-based-strategy-game.110366/ 2 | -------------------------------------------------------------------------------- /Demos/demo AoE animation-map battle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo AoE animation-map battle.gif -------------------------------------------------------------------------------- /Demos/demo AoEAnimation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo AoEAnimation.gif -------------------------------------------------------------------------------- /Demos/demo action order.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo action order.gif -------------------------------------------------------------------------------- /Demos/demo adv interaction-wrap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo adv interaction-wrap.gif -------------------------------------------------------------------------------- /Demos/demo adv interaction.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo adv interaction.gif -------------------------------------------------------------------------------- /Demos/demo aura skill.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo aura skill.gif -------------------------------------------------------------------------------- /Demos/demo battle prepare-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo battle prepare-2.gif -------------------------------------------------------------------------------- /Demos/demo battle prepare.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo battle prepare.gif -------------------------------------------------------------------------------- /Demos/demo move method.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo move method.gif -------------------------------------------------------------------------------- /Demos/demo rescue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo rescue.gif -------------------------------------------------------------------------------- /Demos/demo terrain effect window.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/demo terrain effect window.gif -------------------------------------------------------------------------------- /Demos/move after action.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShoukangHong/Shoukang_SRPG_plugin/d7f9358ce7d20e61571c78bb634289ecaaa7f7aa/Demos/move after action.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Shoukang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "plugin"), to deal 7 | in the plugin without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the plugin, and to permit persons to whom the plugin is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the plugin. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Website: https://shoukanghong.github.io/Shoukang_SRPG_plugin/ 3 | -------------------------------------------------------------------------------- /SRPG_ActionOrder.js: -------------------------------------------------------------------------------- 1 | //==================================================================================================================== 2 | // SRPG_ActionOrder.js 3 | //-------------------------------------------------------------------------------------------------------------------- 4 | // free to use and edit v1.04 Will reset action sequence if new actor/enemy is added. 5 | //==================================================================================================================== 6 | /*: 7 | * @plugindesc Change the battle mode to sequenece battle based on speed of each battler. 8 | * @author Shoukang 9 | * 10 | * @param speed formula 11 | * @desc default formula to calculate speed. 12 | * @default a.agi 13 | * 14 | * @param face number 15 | * @type number 16 | * @max 14 17 | * @desc number of faces to display in turn indicator window(limited by face size and face padding) 18 | * @default 5 19 | * 20 | * @param face size 21 | * @type number 22 | * @desc size of face in turn indicator window. 23 | * @default 72 24 | * 25 | * @param face padding 26 | * @type number 27 | * @desc padding of face in turn indicator window. 28 | * @default 6 29 | * 30 | * @param face frame 31 | * @type file 32 | * @dir img/system/ 33 | * @desc Image for face frame. Sample: github.com/ShoukangHong/Shoukang_SRPG_plugin/blob/main/Demos/FaceFrame.png 34 | * 35 | * @param face back 36 | * @type file 37 | * @dir img/system/ 38 | * @desc Image for face back. Sample: github.com/ShoukangHong/Shoukang_SRPG_plugin/blob/main/Demos/FaceBack.png 39 | * 40 | * @help 41 | * This plugin changes the battle mode to individual turn order based on the speed of each battler. 42 | * 43 | * Action order rule: 44 | * Imagine a '100 meter dash' competition between all battlers, the first one reached the end will be the next 45 | * battler to act. It will immediately go back to the start point and run again. The other battlers will keep running. 46 | * 47 | * Turn rule: 48 | * If there are n units in battle. A turn would end after n actions. When the turn ends, states, buffs will update and 49 | * event with will start 50 | * 51 | * Tips: 52 | * Event with and will never run, as there the SRPG actor/enemy turn no longer exists. 53 | * a.distToAction is battler a's distance to the action. You can set the value to manipulate turn order. 54 | * The initial value is 100 to repersent the 100 meter dash rule. 55 | * ======================================================================================================================== 56 | * Plugin commands 57 | * $gameSystem.updateActionSequence(); will update action sequence window. 58 | * ========================================================================================================================== 59 | * v1.04 Will reset action sequence if new actor/enemy is added. 60 | * v1.03 Fix event start bug and disable next L/R actor command. 61 | * v1.02 Minor change on some function calls. 62 | * v1.01 Improve turn indicator window 63 | * v1.00 first release! 64 | * ========================================================================================================================= 65 | * Compatibility: 66 | * This plugin needs to be placed above all the other srpg plugins(includin battle prepare) except SRPG_core. 67 | */ 68 | 69 | (function () { 70 | 'use strict'; 71 | var parameters = PluginManager.parameters('SRPG_ActionOrder'); 72 | var _speedFormula = parameters['speed formula'] || 'a.agi'; 73 | var _faceNumber = Number(parameters['face number']) || 5; 74 | var _faceSize = Number(parameters['face size']) || 72; 75 | var _facePadding = Number(parameters['face padding']); 76 | var _faceFrame = parameters['face frame']; 77 | var _faceBack = parameters['face back']; 78 | // =================================================== 79 | // Utils (Helper functions) 80 | // =================================================== 81 | Game_Map.prototype.aliveBattlerEvents = function() { 82 | return $gameMap.events().filter(function(event) { 83 | return event.isAliveBattler(); 84 | }); 85 | }; 86 | 87 | Game_Map.prototype.aliveBattlers = function() { 88 | return this.aliveBattlerEvents().map(function(event){ 89 | return $gameSystem.EventToUnit(event.eventId())[1]; 90 | }) 91 | }; 92 | 93 | Game_CharacterBase.prototype.isBattler = function(){ 94 | var battlerArray = $gameSystem.EventToUnit(this.eventId()) 95 | return !this.isErased() && battlerArray && battlerArray[1] 96 | } 97 | 98 | Game_CharacterBase.prototype.isAliveBattler = function(){ 99 | return this.isBattler() && $gameSystem.EventToUnit(this.eventId())[1].isAlive() 100 | } 101 | 102 | Object.defineProperties(Game_BattlerBase.prototype, { 103 | distToAction: { get: function() { return this._distToAction; }, 104 | set: function(value) {this._distToAction = value}, configurable: true}, 105 | // dta:{ get: function() { return this._distToAction; }, 106 | // set: function(value) {this._distToAction = value}, configurable: true}, 107 | // fairTurnMoved:{ get: function() { return this._fairTurnMoved; }, 108 | // set: function(value) {this._fairTurnMoved = value}, configurable: true} 109 | }); 110 | 111 | Game_BattlerBase.prototype.standardDistToAction = function() { 112 | return 100; //100 meter dash 113 | } 114 | 115 | Game_BattlerBase.prototype.SRPGSpeed = function(){ 116 | var a = this 117 | return eval(_speedFormula) 118 | } 119 | 120 | Game_BattlerBase.prototype.waitTime = function() { 121 | return this.distToAction / this.SRPGSpeed(); 122 | } 123 | 124 | Game_BattlerBase.prototype.waitTimePerAction = function() { 125 | return this.standardDistToAction() / this.SRPGSpeed(); 126 | } 127 | 128 | Game_BattlerBase.prototype.updateDistToAction = function(time) { 129 | this.distToAction -= time * this.SRPGSpeed(); 130 | } 131 | 132 | Game_BattlerBase.prototype.resetDistToAction = function() { 133 | this.distToAction = this.standardDistToAction(); 134 | } 135 | 136 | Game_System.prototype.actionSequence = function() { 137 | return this._actionSequence 138 | } 139 | 140 | Game_System.prototype.actionCount = function() { 141 | return this._actionCount 142 | } 143 | 144 | Game_System.prototype.nextBattler = function() { 145 | return this._actionSequence[0] 146 | } 147 | 148 | Game_System.prototype.setActionSequence = function(array) { 149 | this._actionSequence = array 150 | } 151 | 152 | // =================================================== 153 | // compatibility stuff 154 | // =================================================== 155 | var _Game_System_initialize = Game_System.prototype.initialize; 156 | Game_System.prototype.initialize = function() { 157 | _Game_System_initialize.call(this); 158 | this._actionSequence = []; 159 | this._actionCount = 0 160 | }; 161 | 162 | var _Game_Actor_setup = Game_Actor.prototype.setup; 163 | Game_Actor.prototype.setup = function(actorId) { 164 | _Game_Actor_setup.call(this, actorId); 165 | this.distToAction = this.standardDistToAction(); 166 | }; 167 | 168 | var _Game_Enemy_setup = Game_Enemy.prototype.setup; 169 | Game_Enemy.prototype.setup = function(enemyId, x, y) { 170 | _Game_Enemy_setup.call(this, enemyId, x, y); 171 | this.distToAction = this.standardDistToAction(); 172 | }; 173 | 174 | Game_System.prototype.clearData = function() { 175 | this._EventToUnit = []; 176 | $gameSystem.clearSrpgAllActors(); 177 | while ($gameTemp.isSrpgEventList()) { 178 | $gameTemp.shiftSrpgEventList(); 179 | } 180 | }; 181 | 182 | /**These functions are not needed*/ 183 | Game_System.prototype.getNextLActor = function() {}; 184 | 185 | Game_System.prototype.getNextRActor = function() {}; 186 | 187 | /**This is the best place I can find to reset a newly added battler's flag and wait time.*/ 188 | var _Game_System_setEventToUnit = Game_System.prototype.setEventToUnit 189 | Game_System.prototype.setEventToUnit = function(event_id, type, data) { 190 | _Game_System_setEventToUnit.call(this, event_id, type, data) 191 | if ($gameMap.event(event_id).isBattler()){ 192 | this.EventToUnit(event_id)[1].resetDistToAction(); 193 | this.EventToUnit(event_id)[1].setSrpgTurnEnd(true); 194 | if ($gameSystem.isBattlePhase() !== 'initialize' && $gameSystem.isBattlePhase() !== 'battle_prepare') { 195 | $gameSystem.updateActionSequence(); 196 | } 197 | } 198 | }; 199 | 200 | /**These functions are just srpgNextBattlerAction in sequence battle*/ 201 | Game_System.prototype.srpgStartActorTurn = function() { 202 | this.srpgNextBattlerAction(); 203 | }; 204 | 205 | Game_System.prototype.srpgStartAutoActorTurn = function() { 206 | this.srpgNextBattlerAction(); 207 | }; 208 | 209 | Game_System.prototype.srpgStartEnemyTurn = function() { 210 | this.srpgNextBattlerAction(); 211 | }; 212 | // =================================================== 213 | // Main sequence battle flow 214 | // =================================================== 215 | /**battle start initialize things*/ 216 | var _Game_System_runBattleStartEvent = Game_System.prototype.runBattleStartEvent 217 | Game_System.prototype.runBattleStartEvent = function() { 218 | _Game_System_runBattleStartEvent.call(this) 219 | this._actionCount = 0 220 | $gameMap.aliveBattlers().forEach(function(battler){ 221 | battler.resetDistToAction(); 222 | }); 223 | }; 224 | 225 | /**activate next battler, set battle phase*/ 226 | Game_System.prototype.srpgNextBattlerAction = function() { 227 | if (this.actionSequence().length <= 0){ 228 | $gameSystem.updateActionSequence(); 229 | } 230 | $gameSystem.setBattlerFlags(); 231 | 232 | var nextBattler = this.nextBattler(); 233 | if (nextBattler.isRestricted()){ 234 | nextBattler.resetDistToAction(); 235 | this.updateActionSequence(); 236 | $gameSystem.updateActionCount(); 237 | this.srpgNextBattlerAction(); 238 | return; 239 | } 240 | 241 | if (nextBattler.isActor() && nextBattler.isAutoBattle()){ 242 | this.setBattlePhase('auto_actor_phase'); 243 | this.setSubBattlePhase('auto_actor_command'); 244 | } else if (nextBattler.isActor()){ 245 | var nextEvent = nextBattler.event() 246 | $gameTemp.setAutoMoveDestinationValid(true); 247 | $gameTemp.setAutoMoveDestination(nextEvent.posX(), nextEvent.posY()); 248 | this.setBattlePhase('actor_phase'); 249 | this.setSubBattlePhase('initialize'); 250 | } else { 251 | this.setBattlePhase('enemy_phase'); 252 | this.setSubBattlePhase('enemy_command'); 253 | } 254 | } 255 | 256 | /**finish up battler action, update sequence and action count, call srpgNextBattlerAction*/ 257 | Scene_Map.prototype.srpgAfterAction = function() { 258 | var battler = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]; 259 | battler.srpgCheckFloorEffect($gameTemp.activeEvent().posX(), $gameTemp.activeEvent().posY()); 260 | if (battler.SRPGActionTimes() <= 1) { 261 | battler.setSrpgTurnEnd(true); 262 | } else { 263 | battler.useSRPGActionTimes(1); 264 | } 265 | 266 | $gameSystem.clearSRPGBattleMode(); 267 | $gameSystem.clearSrpgActorCommandWindowNeedRefresh(); 268 | $gameSystem.clearSrpgActorCommandStatusWindowNeedRefresh(); 269 | $gameTemp.clearMoveTable(); 270 | $gameTemp.clearTargetEvent(); 271 | $gameParty.clearSrpgBattleActors(); 272 | $gameTroop.clearSrpgBattleEnemys(); 273 | if ($gameSystem.isBattlePhase() === 'actor_phase' || $gameSystem.isBattlePhase() === 'auto_actor_phase') { 274 | this.eventUnitEvent(); 275 | } 276 | this.eventAfterAction(); 277 | 278 | //srpg_moveAfterAction Fix 279 | if (battler.SrpgRemainingMove && battler.srpgTurnEnd() && !battler.isSrpgAfterActionMove() && 280 | battler.SrpgRemainingMove() && !$gameTemp.isTurnEndFlag() && 281 | $gameSystem.isBattlePhase() !== 'auto_actor_phase'){ 282 | return; 283 | } 284 | 285 | if (battler.srpgTurnEnd()){ 286 | battler.resetDistToAction(); 287 | $gameSystem.updateActionSequence(); 288 | $gameSystem.updateActionCount(); 289 | $gameSystem.srpgNextBattlerAction(); 290 | } 291 | }; 292 | 293 | /**predict action sequence and store, refresh */ 294 | Game_System.prototype.updateActionSequence = function() { 295 | var aliveBattlers = $gameMap.aliveBattlers() 296 | var battlerWaitTimes = aliveBattlers.map(function(battler){return battler.waitTime()}); 297 | 298 | this.updateActionSequenceWithDashRule(aliveBattlers, battlerWaitTimes); 299 | //console.log(aliveBattlers[0].name()) 300 | if ($gameSystem.isSRPGMode() && SceneManager._scene._turnIndicatorWindow){ 301 | SceneManager._scene._turnIndicatorWindow.refresh(); 302 | } 303 | }; 304 | 305 | /**predict action sequence of next 15 actions based on 100 meter dash rule.*/ 306 | Game_System.prototype.updateActionSequenceWithDashRule = function(aliveBattlers, battlerWaitTimes){ 307 | var actionSequence = [] 308 | while (actionSequence.length < 15){ 309 | var nextIndex = 0 310 | for (var i = 0; i < aliveBattlers.length; i++){ 311 | if (battlerWaitTimes[i] < battlerWaitTimes[nextIndex]){ 312 | nextIndex = i 313 | } 314 | } 315 | actionSequence.push(aliveBattlers[nextIndex]); 316 | battlerWaitTimes[nextIndex] += aliveBattlers[nextIndex].waitTimePerAction(); 317 | } 318 | this.setActionSequence(actionSequence); 319 | var nextBattler = this.nextBattler(); 320 | var time = nextBattler.waitTime(); 321 | aliveBattlers.forEach(function(battler){battler.updateDistToAction(time)}) 322 | }; 323 | 324 | /**update action count and trigger turn end if meets requirenment*/ 325 | Game_System.prototype.updateActionCount = function() { 326 | this._actionCount += 1; 327 | if (this._actionCount >= $gameMap.aliveBattlers().length){ 328 | this.srpgTurnEnd(); 329 | } 330 | } 331 | 332 | /**turn end, update states, buffs, turn, action count, and trigger event.*/ 333 | Game_System.prototype.srpgTurnEnd = function() { 334 | $gameMap.aliveBattlers().forEach(function(battler){ 335 | battler.onTurnEnd(); 336 | }) 337 | $gameMap.events().forEach(function(event) { 338 | if (event.isType() === 'turnEnd') { 339 | if (event.pageIndex() >= 0) event.start(); 340 | $gameTemp.pushSrpgEventList(event); 341 | } 342 | }); 343 | //srpg_Summon fix 344 | if (this.updateEnemySummonedEvents){ 345 | this.updateEnemySummonedEvents(); 346 | this.updateActorSummonedEvents(); 347 | } 348 | this._actionCount = 0; 349 | this.srpgTurnPlus(); 350 | }; 351 | 352 | /**end srpg, clear up data*/ 353 | var _Game_System_endSRPG = Game_System.prototype.endSRPG 354 | Game_System.prototype.endSRPG = function() { 355 | if ($gameSystem.isSRPGMode() && SceneManager._scene._turnIndicatorWindow){ 356 | SceneManager._scene._turnIndicatorWindow.hide(); 357 | } 358 | $gameSystem.setActionSequence([]); 359 | _Game_System_endSRPG.call(this); 360 | }; 361 | 362 | /**activeate next battler and deactivate all the other battlers*/ 363 | Game_System.prototype.setBattlerFlags = function() { 364 | $gameMap.aliveBattlers().forEach(function(battler) { 365 | battler.setSrpgTurnEnd(true); 366 | }) 367 | 368 | this.nextBattler().setSrpgTurnEnd(false); 369 | this.nextBattler().SRPGActionTimesSet(); 370 | } 371 | 372 | // ========================= 373 | // Turn indicator Window 374 | // ========================= 375 | var _SRPG_SceneMap_createAllWindows = Scene_Map.prototype.createAllWindows; 376 | Scene_Map.prototype.createAllWindows = function() { 377 | this.createTurnIndicatorWindow(); 378 | _SRPG_SceneMap_createAllWindows.call(this); 379 | }; 380 | 381 | Scene_Map.prototype.createTurnIndicatorWindow = function() { 382 | this._turnIndicatorWindow = new Window_TurnIndicator(); 383 | this.addWindow(this._turnIndicatorWindow); 384 | }; 385 | 386 | window.Window_TurnIndicator = function() { 387 | this.initialize.apply(this, arguments); 388 | } 389 | 390 | Window_TurnIndicator.prototype = Object.create(Window_Base.prototype); 391 | Window_TurnIndicator.prototype.constructor = Window_TurnIndicator; 392 | 393 | 394 | /** @TODO: 1. Set window width, height, x and y position. 395 | * 2. Code what to draw in Window_TurnIndicator.prototype.refresh*/ 396 | 397 | /**@param x: x position of the window(top left) 398 | * @param y: y position of the window(top left)*/ 399 | Window_TurnIndicator.prototype.initialize = function(x, y) { 400 | var width = this.windowWidth(); 401 | var height = this.windowHeight(); 402 | x = x || 0; 403 | y = y || (Graphics.boxHeight - height)/2; 404 | Window_Base.prototype.initialize.call(this, x, y, width, height); 405 | this.setBackgroundType(2); 406 | this._actionSequence = []; 407 | this._faceFrame = ImageManager.loadSystem(_faceFrame); 408 | this._faceBack = ImageManager.loadSystem(_faceBack); 409 | this.resetCount(); 410 | this.refresh(); 411 | }; 412 | 413 | Window_TurnIndicator.prototype.resetCount = function() { 414 | this._count = 30; 415 | }; 416 | 417 | Window_TurnIndicator.prototype.disableCount = function() { 418 | this._count = Number.POSITIVE_INFINITY; 419 | }; 420 | 421 | Window_TurnIndicator.prototype.faceSize = function() { 422 | return _faceSize; 423 | }; 424 | 425 | Window_TurnIndicator.prototype.faceNumber = function() { 426 | return _faceNumber; 427 | }; 428 | 429 | Window_TurnIndicator.prototype.facePadding = function() { 430 | return _facePadding; 431 | }; 432 | 433 | Window_TurnIndicator.prototype.windowWidth = function() { 434 | return 250; 435 | }; 436 | 437 | Window_TurnIndicator.prototype.windowHeight = function() { 438 | var contetHeight = this.faceNumber() * (this.faceSize() + this.facePadding()); 439 | return Math.min(contetHeight + 2 * this.standardPadding(), 440 | Graphics.boxHeight - (Graphics.boxHeight - 2 * this.standardPadding())%(this.faceSize() + this.facePadding())); 441 | }; 442 | 443 | Window_TurnIndicator.prototype.refresh = function() { 444 | var fp = this.facePadding(); 445 | var fw = Window_Base._faceWidth; 446 | var fh = Window_Base._faceHeight 447 | this.contents.clear(); 448 | this.resetCount(); 449 | this._actionSequence = $gameSystem.actionSequence(); 450 | for (var i = 0; i < Math.min(this._actionSequence.length, this.faceNumber()); i++){ 451 | var battler = this._actionSequence[i] 452 | 453 | if (battler.isActor()){ 454 | this.drawActorFace(battler, 0, fp/2 + (this.faceSize() + fp)*i, fw, fh); 455 | } else { 456 | this.drawEnemyFace(battler, 0, fp/2 + (this.faceSize() + fp)*i, fw, fh); 457 | } 458 | //this.drawCharacter(event.characterName(), event.characterIndex(), 18, this.lineHeight() * (i+1)); 459 | // this.drawActorName(this._actionSequence[i], 48, this.lineHeight() * i); 460 | } 461 | }; 462 | 463 | /** update again after certain frame in case image is not loaded*/ 464 | Window_TurnIndicator.prototype.update = function() { 465 | Window_Base.prototype.update.call(this); 466 | if (this._actionSequence){ 467 | this._count -= 1; 468 | if (this._count%6 === 0){ 469 | this.refresh(); 470 | } 471 | if (this._count == 0){ 472 | this.disableCount(); 473 | } 474 | } 475 | }; 476 | 477 | Window_TurnIndicator.prototype.drawFace = function(faceName, faceIndex, x, y, width, height) { 478 | width = width || Window_Base._faceWidth; 479 | height = height || Window_Base._faceHeight; 480 | var bitmap = ImageManager.loadFace(faceName); 481 | var pw = Window_Base._faceWidth; 482 | var ph = Window_Base._faceHeight; 483 | var sw = Math.min(width, pw); 484 | var sh = Math.min(height, ph); 485 | var dx = Math.floor(x + Math.max(width - pw, 0) / 2); 486 | var dy = Math.floor(y + Math.max(height - ph, 0) / 2); 487 | var sx = faceIndex % 4 * pw + (pw - sw) / 2; 488 | var sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2; 489 | this.contents.blt(this._faceBack, 0, 0, this._faceBack.width, this._faceBack.height, dx, dy, this.faceSize(), this.faceSize()); 490 | this.contents.blt(bitmap, sx, sy, sw, sh, dx, dy, this.faceSize(), this.faceSize()); 491 | this.contents.blt(this._faceFrame, 0, 0, this._faceFrame.width, this._faceFrame.height, dx, dy, this.faceSize(), this.faceSize()); 492 | }; 493 | 494 | /**It's basically the same as Window_Base.prototype.drawCharacter. Only difference is var ph = ... 495 | * Some chararcters won't show up. The bug is somewhere else as the save/load menu also won't display some characters.*/ 496 | // Window_TurnIndicator.prototype.drawCharacter = function(characterName, characterIndex, x, y) { 497 | // var bitmap = ImageManager.loadCharacter(characterName); 498 | // var big = ImageManager.isBigCharacter(characterName); 499 | // var pw = bitmap.width / (big ? 3 : 12); 500 | // var ph = bitmap.height / (big ? 4 : 8) * 7/10; 501 | // var n = characterIndex; 502 | // var sx = (n % 4 * 3 + 1) * pw; 503 | // var sy = (Math.floor(n / 4) * 4) * ph; 504 | // var that = this; 505 | // var nf = function () { 506 | // that.contents.blt(bitmap, sx, sy, pw, ph, x - pw / 2, y - ph); 507 | // }; 508 | // bitmap.addLoadListener(nf); 509 | // //this.contents.blt(bitmap, sx, sy, pw, ph, x - pw / 2, y - ph); 510 | // }; 511 | 512 | /** @TODO: This is guidance on some other thing you might want to fix: 513 | * 1. To remove turn end sprite from enemies, check this function in SRPG_Core: 514 | * Sprite_Character.prototype.updateCharacterFrame. 515 | * 516 | * 2. Test compatibility with skill note tag in SRPG_Core. 517 | * If anything breaks try to fix by editing Scene_Map.prototype.srpgAfterAction in this plugin*/ 518 | 519 | })(); 520 | -------------------------------------------------------------------------------- /SRPG_ActorAISkillControl.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | // SRPG_ActorAISkillControl.js 3 | //----------------------------------------------------------------------------- 4 | // free to use and edit 5 | //============================================================================= 6 | /*: 7 | * @plugindesc SRPG_AIControl provides target selection method with a given skill, but actor's skill is picked randomly.This plugin gives you control on actor skill selection. 8 | * @author Shoukang 9 | * 10 | * @help 11 | * 12 | * RMMV allows you to set enemy skill priority and skill conditions, which also work in SRPG mode. 13 | * However, there are no such choices for actor units. Actor AI will randomly select a skill from the available 14 | * skill list. This plugin allows you to set skill priority and conditions for Actors in SRPG mode. 15 | * The difference of priority between a skill and the highest priority skill will affect the possibility of using 16 | * a skill. if difference >= 3, 0 possibility. if difference = 1, 1/3 possibility, if difference = 2, 17 | * 2/3 possibility(compared to the highest priority skill, it's the same as the enemy skill's rating). 18 | * 19 | * skill notetags: 20 | * x is the priority(rating) of the skill. If don't write this a skill's priority is 5. This number can be negative or positive. 21 | * Only use this skill when it meets condition. If don't write this a skill always meets condition. 22 | * code The code will be put in if (...) brackets. 23 | * 24 | * You can use these values in a formula 25 | * s[n] value of switch n 26 | * v[n] value of variable n 27 | * a user of the skill 28 | * for example, the following code means only use this skill when user's hp is not full. 29 | * 30 | * a.hp < a.mhp 31 | * 32 | *========================================================================================================================== 33 | * v 1.00 first release! 34 | * Future plan: check actor notetages and class notetags. 35 | * Enable target condition check in formula.(This is hard though, because this stage is before move, target can be anyone in range) 36 | * ========================================================================================================================= 37 | * Compatibility 38 | * Anywhere below SRPG_Core 39 | */ 40 | (function () { 41 | var parameters = PluginManager.parameters('SRPG_ActorAISkillControl'); 42 | 43 | Game_Action.prototype.AIpriority = function() { 44 | return Number(this.item().meta.AIpriority) || 5; 45 | }; 46 | 47 | Game_Action.prototype.AISkillCondition = function() { 48 | var notedata = this.item().note.split(/[\r\n]+/); 49 | var flag = false; 50 | var code = ""; 51 | for (var i = 0; i < notedata.length; i++){ 52 | if (notedata[i].match(/<\/AISkillCondition>/i)) return code; 53 | if (flag) code = code + "\n" + notedata[i]; 54 | if (notedata[i].match(//i)) flag = true; 55 | } 56 | return false; 57 | }; 58 | 59 | var shoukang_Game_Actor_makeAutoBattleActions = Game_Actor.prototype.makeAutoBattleActions; 60 | Game_Actor.prototype.makeAutoBattleActions = function() { 61 | if ($gameSystem.isSRPGMode() == true) { 62 | for (var i = 0; i < this.numActions(); i++) { 63 | var a = this; 64 | var topPriority = - 100; 65 | var list = this.makeActionList().filter(function(item){ 66 | if (item.item().meta.AISkillCondition){ 67 | var s = $gameSwitches._data; 68 | var v = $gameVariables._data; 69 | if (eval(item.AISkillCondition()) === false){ 70 | return false; 71 | } 72 | } 73 | topPriority = Math.max(topPriority, item.AIpriority()); 74 | return true; 75 | }); 76 | var finallist = list.filter(function(item){ 77 | return topPriority - item.AIpriority() < 3; 78 | }); 79 | this.setAction(i, this.selectAction(finallist, topPriority - 3)); 80 | } 81 | this.setActionState('waiting'); 82 | } else { 83 | return shoukang_Game_Actor_makeAutoBattleActions.call(this); 84 | } 85 | }; 86 | 87 | Game_Actor.prototype.selectAction = function(actionList, ratingZero) { 88 | var sum = actionList.reduce(function(r, item) { 89 | return r + item.AIpriority() - ratingZero; 90 | }, 0); 91 | 92 | if (sum > 0) { 93 | var value = Math.randomInt(sum); 94 | for (var i = 0; i < actionList.length; i++) { 95 | var action = actionList[i]; 96 | value -= action.AIpriority() - ratingZero; 97 | if (value < 0) { 98 | return action; 99 | } 100 | } 101 | } else { 102 | return null;//this will report error with pathfinding plugin! 103 | } 104 | }; 105 | })(); 106 | -------------------------------------------------------------------------------- /SRPG_AgiAttackControl.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | //SRPG_AgiAttackControl.js 3 | // v 1.03 better compatibility for getAgiAttackTime function. 4 | //============================================================================= 5 | /*: 6 | * @plugindesc More control over the Agiattack rule, support AoE agi Attack, v1.01 change and add notetags 7 | * @author Shoukang 8 | * 9 | * @param agi attack formula 10 | * @desc The equation to determine agi attack times 11 | * @default dif >= 4 ? 1 : 0; 12 | * 13 | * @param agi attack max time 14 | * @desc the maximum agi attack time 15 | * @type number 16 | * @default 2 17 | * 18 | * @param agi attack no cost 19 | * @desc agi attack won't cost any tp or mp 20 | * @type boolean 21 | * @default false 22 | * 23 | * @param default agi attack 24 | * @desc If not specified, battler can do agi attack. 25 | * @type boolean 26 | * @default true 27 | * 28 | * @param default agi reception 29 | * @desc If not specified, battler can receive agi attack 30 | * @type boolean 31 | * @default true 32 | * 33 | * @help 34 | * =================================================================================================== 35 | * Compatibility: 36 | * Map battle need SRPG_AoEAnimation(updated on 8/27/21), and place this plugin below it. 37 | * Scene battle should work regradless. 38 | * this plugin will make agiAttackplus parameter in core useless. 39 | * =================================================================================================== 40 | * 41 | * =================================================================================================== 42 | * New state / equip / actor / enemy / class note tags: 43 | * this battler can do Agi Attack 44 | * this battler can receive Agi Attack(if its enemy can do agi attack) 45 | * priority is state > equip > actor/enemy > class 46 | * =================================================================================================== 47 | * The following values can be used for agi attack formula: 48 | * a :fast unit in the battle 49 | * b :slow unit in the battle 50 | * dif :a.agi - b.agi 51 | * a simple guidance to understand the default formular meaning: 52 | * dif >= 4 ? 1 : 0 53 | * is dif >= 4 ? if yes do 1 agiAttack, if no do 0 agiAttack. 54 | * you can even make something like dif >= 4 ? (dif >= 8 ? 2:1) : 0; 55 | * therefore it will further check (dif >= 8 ? 2:1) if dif >= 4. 56 | * You can also use (dif/b.agi) * 2, dif > Math.randomInt(100) ? 1:0, etc. 57 | * if result is a float number like 3.1415... only the integer part will be taken into account. 58 | * =================================================================================================== 59 | * v 1.03 better compatibility for getAgiAttackTime function. 60 | * v 1.02 fix a bug for negative agi Attack time. 61 | * v 1.01 change and add note tags, the note tags in previous version won't work now, use the new one instead! 62 | * v 1.00 first release 63 | */ 64 | (function () { 65 | 'use strict' 66 | //================================================================================================= 67 | //Plugin Parameters 68 | //================================================================================================= 69 | var parameters = PluginManager.parameters('SRPG_AgiAttackControl'); 70 | var _formula = parameters['agi attack formula'] || 'dif >= 4 ? 1 : 0'; 71 | var _max = Number(parameters['agi attack max time'] || 2); 72 | var _noCost = !!eval(parameters['agi attack no cost']); 73 | var _defaultAgiAttack = !!eval(parameters['default agi attack']); 74 | var _defaultAgiReception = !!eval(parameters['default agi reception']); 75 | 76 | //map battle logic 77 | Scene_Map.prototype.srpgAgiAttackPlus = function(agiUser, target, targetEvents){ 78 | var agiTime = agiUser.getAgiAttackTime(target); 79 | if (agiTime <= 0) return; 80 | var agiAction = _noCost ? agiUser.action(0).createNoCostAction() : agiUser.action(0); 81 | for (var i = 0; i < agiTime; i++){ 82 | if (agiUser == $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]){ 83 | this.addAoESkillToAgiList(agiAction, agiUser, targetEvents); 84 | } else { 85 | this.addSkillToAgiList(agiAction, agiUser, target); 86 | } 87 | } 88 | } 89 | 90 | Game_Battler.prototype.getAgiAttackTime = function(target){ 91 | if (this.agi <= target.agi) return 0; 92 | if (!this.hasAgiAttackAction()) return 0; 93 | var dif = this.agi - target.agi; 94 | var a = this; 95 | var b = target; 96 | if (a.canAgiAttack() && b.canAgiReception()) { 97 | var count = Math.floor(eval(_formula)); 98 | return Math.max(Math.min(count, _max), 0); 99 | } else return 0; 100 | } 101 | 102 | Game_Actor.prototype.canAgiAttack = function() { 103 | //priority: states > equips > actor > class 104 | var items = this.states().concat(this.equips()) 105 | items = items.concat([this.actor(), this.currentClass()]) 106 | return this.checkAgi(items, 'agiAttack'); 107 | }; 108 | 109 | Game_Actor.prototype.canAgiReception = function() { 110 | var items = this.states().concat(this.equips()) 111 | items = items.concat([this.actor(), this.currentClass()]) 112 | return this.checkAgi(items, 'agiReception'); 113 | }; 114 | 115 | Game_Enemy.prototype.canAgiAttack = function() { 116 | var items = this.states().concat([this.enemy()]) 117 | return this.checkAgi(items, 'agiAttack') 118 | }; 119 | 120 | Game_Enemy.prototype.canAgiReception = function() { 121 | var items = this.states().concat([this.enemy()]) 122 | return this.checkAgi(items, 'agiReception'); 123 | }; 124 | 125 | Game_Battler.prototype.checkAgi = function (items, symbol){ 126 | for (var i = 0; i < items.length; i++){ 127 | if (items[i] && items[i].meta[symbol] !== undefined) { 128 | return eval(items[i].meta[symbol]); 129 | } 130 | } 131 | if (symbol === 'agiAttack') return _defaultAgiAttack; 132 | if (symbol === 'agiReception') return _defaultAgiReception; 133 | } 134 | 135 | var _BattleManager_makeActionOrders = BattleManager.makeActionOrders; 136 | BattleManager.makeActionOrders = function() { 137 | if ($gameSystem.isSRPGMode()){ 138 | var battlers = $gameParty.members().concat($gameTroop.members()); 139 | var agiBattlers = []; 140 | battlers.forEach(function(battler) {battler.makeSpeed();}); 141 | //active event timing is 0, targets timing is 1, so actor will stay at [0] 142 | battlers.sort(function(a, b) {return a.srpgActionTiming() - b.srpgActionTiming();}); 143 | var user = battlers[0]; 144 | for (var i = 1; i < battlers.length; i++){ 145 | var target = battlers[i]; 146 | var firstBattler = user.agi >= target.agi ? user : target; 147 | var secondBattler = user.agi >= target.agi ? target : user; 148 | var agiTime = firstBattler.getAgiAttackTime(secondBattler); 149 | if (agiTime > 0){ 150 | var agiAction = firstBattler.action(0); 151 | if (firstBattler == user && i == 1){ 152 | firstBattler.reserveSameAction(agiTime, agiBattlers); 153 | } else if (firstBattler == target) { 154 | firstBattler.reserveSameAction(agiTime, agiBattlers); 155 | } 156 | } 157 | } 158 | this._actionBattlers = battlers.concat(agiBattlers) 159 | } else _BattleManager_makeActionOrders.call(this); 160 | } 161 | 162 | Game_Battler.prototype.reserveSameAction = function(num, agiBattlers) { 163 | this._reserveAction = []; 164 | var action = _noCost ? this._actions[0].createNoCostAction() : this._actions[0]; 165 | for (var i = 0; i < num; i++){ 166 | this._reserveAction.push(action); 167 | agiBattlers.push(this); 168 | } 169 | }; 170 | 171 | Game_Battler.prototype.addSameAction = function() { 172 | if (!this.currentAction() && this._reserveAction && this._reserveAction.length > 0) { 173 | this._actions.push(this._reserveAction.pop()); 174 | var targets = this._actions[0].makeTargets(); 175 | if (targets.length == 0) this._actions = []; 176 | } 177 | }; 178 | 179 | var _SRPG_BattleManager_endTurn = BattleManager.endTurn; 180 | BattleManager.endTurn = function() { 181 | if ($gameSystem.isSRPGMode() == true) this.clearRemainingActions(); 182 | _SRPG_BattleManager_endTurn.call(this); 183 | }; 184 | 185 | BattleManager.clearRemainingActions = function() { 186 | for (var i = 0; i < this._actionBattlers.length; i++){ 187 | this._actionBattlers[i].clearReserveAction(); 188 | } 189 | this._actionBattlers = []; 190 | }; 191 | 192 | Game_Battler.prototype.clearReserveAction = function(){ 193 | this._reserveAction = []; 194 | } 195 | 196 | Game_Battler.prototype.hasAgiAttackAction = function(){ 197 | return this.currentAction() && this.currentAction().canAgiAttack(); 198 | } 199 | 200 | Game_Action.prototype.canAgiAttack = function(){ 201 | return this.item() && this.isForOpponent() && !this.item().meta.doubleAction; 202 | } 203 | 204 | Game_Action.prototype.createNoCostAction = function(){ 205 | var action = this.createAoERepeatedAction(); 206 | action.setHideAnimation(undefined); 207 | return action; 208 | } 209 | 210 | })(); 211 | -------------------------------------------------------------------------------- /SRPG_AuraSkill.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | // SRPG_AuraSkill.js 3 | //----------------------------------------------------------------------------- 4 | // Free to use and edit version 1.06 fix bug for aura range 0. Fix bug for not removing states properly 5 | //============================================================================= 6 | /*: 7 | * @plugindesc This plugin allows you to create Aura skills for SRPG battle. Place it below all SRPG plugins for best compatibility. 8 | * @author Shoukang 9 | * 10 | * @param max range 11 | * @desc This is the max range for Aura detection, shape is square. This range should equal to your largest Aura range. 12 | * @type number 13 | * @min 1 14 | * @default 3 15 | * 16 | * @param default range 17 | * @desc If not specified this is the default range of an Aura. 18 | * @type number 19 | * @default 2 20 | * 21 | * @param default target 22 | * @desc Input "friend", "foe" or "all". 23 | * @type string 24 | * @default friend 25 | * 26 | * @param default shape 27 | * @desc If not specified this is the default shape of an Aura, refer to SRPG_AOE. 28 | * @type string 29 | * @default circle 30 | * 31 | * @param Aura color 32 | * @desc Set the color of Aura tile 33 | * https://www.w3schools.com/cssref/css_colors.asp 34 | * @type string 35 | * @default green 36 | * 37 | * @param show Aura color 38 | * @desc always show the color of Aura tiles 39 | * @type boolean 40 | * 41 | * @help 42 | * This plugin provides several note tags for you to create Aura skills. 43 | * An aura skill will add a state automatically to valid units in Aura range. 44 | * Passive Aura skills can be created by skill notetags. It will assign the (sub)state to valid units within the Aura range. 45 | * Active aura skills can be created by state notetags. You can actively use a skill to gain an "Aura state", as long as this Aura state 46 | * exist it will assign a (sub)state to the valid units within the Aura range. (Credits to Boomy) 47 | * This also allows you to activate aura effects in other ways(add this aura state by script calls, or whatever else) 48 | * Now Events with can also have passive Aura. 49 | * ========================================================================================================================= 50 | * skill/event/state note tags: 51 | * this is the (sub)state this skill/event/state will assign (to valid units), replace x with (sub)state id. 52 | * This is the units that will be affected, xxx can be "friend" "foe" or "all". For unitevent/object, friend is actor and foe is enemy.(no need to add quote) 53 | * The range of Aura, similar to AoE range. 54 | * The shape of Aura, replace xxx with shapes defined in SRPR_AoE (Anisotropic shapes not supported) 55 | * The minumum range of Aura, creats a hole. Default is 0. 56 | * The color of this Aura skill. https://www.w3schools.com/cssref/css_colors.asp 57 | * If have this notetag, show this aura's range on movetable. 58 | * You may also want to use state note tag (see below). 59 | * 60 | * state note tag: 61 | * With this notetag a state will be removed once a unit is out of the Aura. Give this notetag to the (sub)state. 62 | * If you want the Aura to be effective after a unit leaves the Aura range don't use this tag. 63 | * 64 | * event note tag: 65 | * On which event page is the aura active. If don't write the aura is always active (unless it's erased).The first page is 0, 2nd page is 1, etc. 66 | * 67 | * Aura states of related units will be refreshed everytime you open the SRPGstatuswindow, 68 | * prediction window, menu window. It will also refresh when show movetable, before battle, after action, battle start and turn end. 69 | * You can also assign Aura skills to enemies. 70 | * You may want to use some other plugins like ALOE_ItemSkillSortPriority to put a passive aura skill to the end of 71 | * your skill list. 72 | * ========================================================================================================================== 73 | * version 1.06 fix bug for aura range 0. Fix bug for not removing states properly 74 | * version 1.05 support aura for unitevents and objects! 75 | * version 1.04 show aura range on movetable! 76 | * version 1.03 add state note tags for active aura skills. Fix issues of states without 77 | * version 1.02 refresh status when turn end. 78 | * version 1.01 refresh status when open main menu. fix some bugs. 79 | * version 1.00 first release! 80 | * =========================================================================================================================== 81 | * Compatibility: 82 | * This plugin needs SPPG_AoE to work. Place this plugin below SRPG_ShowAoERange, SRPG_BattleUI if you are using them. 83 | * =========================================================================================================================== 84 | */ 85 | (function () { 86 | var parameters = PluginManager.parameters('SRPG_AuraSkill'); 87 | var _maxRange = parameters['max range'] || 3; 88 | var _defaultRange = parameters['default range'] || 2; 89 | var _defaultTarget = parameters['default target'] || "friend"; 90 | var _defaultShape = parameters['default shape'] || "circle"; 91 | var _defaultColor = parameters['Aura color'] || "green"; 92 | var _showColor = !!eval(parameters['show Aura color']); 93 | 94 | //refresh aura at the following conditions. 95 | 96 | var shoukang_SrpgStatus_refresh = Window_SrpgStatus.prototype.refresh; 97 | Window_SrpgStatus.prototype.refresh = function() { 98 | this.contents.clear(); 99 | if (!this._battler) return; 100 | $gameTemp.refreshAura($gameTemp.activeEvent());//refresh aura when open srpgstatus window 101 | if ($gameTemp.targetEvent()) $gameTemp.refreshAura($gameTemp.targetEvent()); 102 | shoukang_SrpgStatus_refresh.call(this); 103 | }; 104 | 105 | var shoukang_Game_System_srpgMakeMoveTable = Game_System.prototype.srpgMakeMoveTable; 106 | Game_System.prototype.srpgMakeMoveTable = function(event) { 107 | $gameTemp.refreshAura(event); 108 | shoukang_Game_System_srpgMakeMoveTable.call(this, event); 109 | if (!$gameMap.isEventRunning() && $gameSystem.isBattlePhase() === 'actor_phase') $gameTemp.makeAuraList(event);//show aura color 110 | } 111 | 112 | var shoukang_Scene_Map_eventAfterAction = Scene_Map.prototype.eventAfterAction; 113 | Scene_Map.prototype.eventAfterAction = function() { 114 | if ($gameTemp.areaTargets().length === 0) $gameTemp.refreshAura($gameTemp.activeEvent()); 115 | shoukang_Scene_Map_eventAfterAction.call(this); 116 | }; 117 | 118 | var shoukang_Game_System_runBattleStartEvent = Game_System.prototype.runBattleStartEvent; 119 | Game_System.prototype.runBattleStartEvent = function() { 120 | $gameMap.events().forEach(function(event) { 121 | if (event.isErased()) return; 122 | var unit = $gameSystem.EventToUnit(event.eventId()); 123 | if (unit && (unit[0] === 'actor' || unit[0] === 'enemy')) $gameTemp.refreshAura(event); 124 | }); 125 | shoukang_Game_System_runBattleStartEvent.call(this); 126 | }; 127 | 128 | var shoukang_Scene_Map_eventBeforeBattle = Scene_Map.prototype.eventBeforeBattle; 129 | Scene_Map.prototype.eventBeforeBattle = function() { 130 | if ($gameTemp.shouldPayCost()){//this is used to avoid refreshing repeatedly when using AoE skills. 131 | $gameTemp.refreshAura($gameTemp.activeEvent()); 132 | if ($gameTemp.targetEvent()) $gameTemp.refreshAura($gameTemp.targetEvent());//refresh aura before battle 133 | if ($gameTemp.areaTargets().length > 0){ 134 | $gameTemp.areaTargets().forEach(function(target){ 135 | $gameTemp.refreshAura(target.event); 136 | }); 137 | } 138 | } 139 | shoukang_Scene_Map_eventBeforeBattle.call(this); 140 | }; 141 | 142 | var shoukang_Game_System_srpgTurnEnd = Game_System.prototype.srpgTurnEnd; 143 | Game_System.prototype.srpgTurnEnd = function() {//shoukang turn end 144 | $gameMap.events().forEach(function(event) { 145 | if (event.isErased()) return; 146 | var unit = $gameSystem.EventToUnit(event.eventId()); 147 | if (unit && (unit[0] === 'actor' || unit[0] === 'enemy')) $gameTemp.refreshAura(event); 148 | }); 149 | shoukang_Game_System_srpgTurnEnd.call(this); 150 | }; 151 | 152 | var shoukang_Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow; 153 | Scene_Menu.prototype.createCommandWindow = function() { 154 | shoukang_Scene_Menu_createCommandWindow.call(this); 155 | if ($gameSystem.isSRPGMode() == true) { 156 | $gameMap.events().forEach(function (event){ 157 | if (event.isErased()) return; 158 | var unit = $gameSystem.EventToUnit(event.eventId()); 159 | if (unit && unit[0] === 'actor') $gameTemp.refreshAura(event); 160 | }); 161 | } 162 | }; 163 | 164 | Game_System.prototype.setSrpgActorCommandWindowNeedRefresh = function(battlerArray) { 165 | this._SrpgActorCommandWindowRefreshFlag = [true, battlerArray]; 166 | $gameTemp.updateAuraList(); 167 | }; 168 | 169 | //Aura functions start here 170 | 171 | Game_Battler.prototype.clearAura = function() { 172 | var statelist = this.states(); 173 | for (i = statelist.length - 1; i >= 0; i--){ 174 | if (statelist[i].meta.SRPGAura) { 175 | this.eraseState(statelist[i].id)//v1.06 update 176 | } 177 | } 178 | this.refresh(); 179 | }; 180 | 181 | Game_Temp.prototype.refreshAura = function(userevent) { 182 | var user = $gameSystem.EventToUnit(userevent.eventId())[1]; 183 | user.clearAura(); 184 | var x = userevent.posX(); 185 | var y = userevent.posY(); 186 | $gameMap.events().forEach(function (event) {//check all events 187 | var dx = x - event.posX(); 188 | var dy = y - event.posY(); 189 | if (event.isErased() || Math.abs(dx) > _maxRange || Math.abs(dy) > _maxRange) return;//if beyond maxrange return, just to save time. 190 | var unit = $gameSystem.EventToUnit(event.eventId()); 191 | if (unit && (unit[0] === 'actor' || unit[0] === 'enemy')){ 192 | unit[1].skills().forEach( function(item){//check all skills 193 | if ($gameTemp.isAuraStateValid(item, userevent.isType(), unit[0], dx, dy)) user.addState(Number(item.meta.SRPGAuraState)); 194 | }); 195 | unit[1].states().forEach(function(item){//check all states 196 | if ($gameTemp.isAuraStateValid(item, userevent.isType(), unit[0], dx, dy)) user.addState(Number(item.meta.SRPGAuraState)); 197 | }); 198 | } else if (event.isType() === 'unitEvent' || event.isType() === 'object'){ 199 | var item = event.event() 200 | if (item.meta.SRPGAuraPage && Number(item.meta.SRPGAuraPage) != event.pageIndex()) return; 201 | if ($gameTemp.isAuraStateValid(item, userevent.isType(), 'actor', dx, dy)) user.addState(Number(item.meta.SRPGAuraState)); 202 | } 203 | }); 204 | }; 205 | 206 | Game_Temp.prototype.isAuraStateValid = function(item, usertype, ownertype, dx, dy) { 207 | if (item.meta.SRPGAuraState){ 208 | var type = item.meta.SRPGAuraTarget || _defaultTarget; 209 | var range = Number(item.meta.SRPGAuraRange || _defaultRange); 210 | var shape = item.meta.SRPGAuraShape || _defaultShape; 211 | var minrange = Number(item.meta.SRPGAuraMinRange) || 0; 212 | if (!$gameMap.inArea(dx, dy, range, minrange, shape, 0)) return false; 213 | if (type === 'friend' && ownertype == usertype) return true; 214 | if (type === 'foe' && ownertype != usertype) return true; 215 | if (type === 'all') return true; 216 | } 217 | return false; 218 | }; 219 | 220 | // visualize Aura on movetable 221 | 222 | Game_Temp.prototype.makeAuraList = function(userevent) { 223 | var unit = $gameSystem.EventToUnit(userevent.eventId()); 224 | var orix = userevent.posX() 225 | var oriy = userevent.posY() 226 | var route = userevent._srpgForceRoute;//this is used to refresh Aura when opening SrpgActorCommand; 227 | for (var i = 0; i < route.length; i++){ 228 | orix = $gameMap.roundXWithDirection(orix, route[i]); 229 | oriy = $gameMap.roundYWithDirection(oriy, route[i]); 230 | } 231 | unit[1].skills().forEach( function(item){//check all skills 232 | if (item.meta.SRPGAuraState && (_showColor === true || item.meta.SRPGShowAura)){ 233 | $gameTemp.pushAuratoMoveList(item, orix, oriy); 234 | } 235 | }); 236 | unit[1].states().forEach(function(item){//check all states 237 | if (item.meta.SRPGAuraState && (_showColor === true || item.meta.SRPGShowAura)){ 238 | $gameTemp.pushAuratoMoveList(item, orix, oriy); 239 | } 240 | }); 241 | }; 242 | 243 | Game_Temp.prototype.pushAuratoMoveList = function(item, orix, oriy) { 244 | var range = Number(item.meta.SRPGAuraRange) || _defaultRange; 245 | var shape = item.meta.SRPGAuraShape || _defaultShape; 246 | var minrange = Number(item.meta.SRPGAuraMinRange) || 0; 247 | var color = item.meta.SRPGAuraColor || _defaultColor; 248 | var limx = $gameMap.width() - orix + range; 249 | var limy = $gameMap.height() - oriy + range; 250 | for (var x = Math.max(0, range -orix); x < 1+range*2 && x < limx; x++) { 251 | for (var y = Math.max(0, range -oriy); y < 1+range*2 && y < limy; y++) { 252 | if ($gameMap.inArea(x-range, y-range, range, minrange, shape,0)) { 253 | $gameTemp.pushMoveList([orix + x -range, oriy + y - range, ['Aura', color]]); 254 | } 255 | } 256 | } 257 | }; 258 | 259 | Game_Temp.prototype.updateAuraList = function() { 260 | for (var i = this._MoveList.length - 1; i >= 0; i--){ 261 | if (this._MoveList[i][2][0] === "Aura") { 262 | this._MoveList.splice(i, 1); 263 | } 264 | } 265 | $gameTemp.setResetMoveList(true); 266 | this.makeAuraList($gameTemp.activeEvent()); 267 | }; 268 | 269 | var shoukang_setThisMoveTile = Sprite_SrpgMoveTile.prototype.setThisMoveTile; 270 | Sprite_SrpgMoveTile.prototype.setThisMoveTile = function(x, y, attackFlag) { 271 | shoukang_setThisMoveTile.call(this, x, y, attackFlag); 272 | if (attackFlag[0] === "Aura") { 273 | this.aura = true; 274 | this.bitmap.fillAll(attackFlag[1]); 275 | } 276 | }; 277 | 278 | var shoukang_Sprite_SrpgMoveTile_initialize = Sprite_SrpgMoveTile.prototype.initialize; 279 | Sprite_SrpgMoveTile.prototype.initialize = function() { 280 | shoukang_Sprite_SrpgMoveTile_initialize.call(this); 281 | this.aura = false; 282 | }; 283 | 284 | var shoukang_Sprite_SrpgMoveTile_clearThisMoveTile = Sprite_SrpgMoveTile.prototype.clearThisMoveTile; 285 | Sprite_SrpgMoveTile.prototype.clearThisMoveTile = function() { 286 | shoukang_Sprite_SrpgMoveTile_clearThisMoveTile.call(this); 287 | this.aura = false; 288 | } 289 | 290 | Sprite_SrpgMoveTile.prototype.updateAnimation = function() { 291 | this._frameCount++; 292 | this._frameCount %= 90; 293 | if (!this.aura) this.opacity = 210 - Math.abs(this._frameCount - 45) * 2; 294 | else this.opacity = Math.abs(this._frameCount - 45) * 5 - 90; 295 | }; 296 | 297 | if (!Game_Enemy.prototype.skills) { 298 | Game_Enemy.prototype.skills = function() { 299 | var skills = [] 300 | for (var i = 0; i < this.enemy().actions.length; ++i) { 301 | var skill = $dataSkills[this.enemy().actions[i].skillId]; 302 | if (skill) skills.push(skill); 303 | } 304 | return skills; 305 | } 306 | }; 307 | })(); 308 | -------------------------------------------------------------------------------- /SRPG_BattleResultAutoClose.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | //SRPG_BattleResultAutoClose.js 3 | // Simple plugin to allows User to control exp for each skill. 4 | //============================================================================= 5 | /*: 6 | * @plugindesc Simple plugin to close battle result window automatically in enemy phase. 7 | * @author NatePlays, Shoukang 8 | * 9 | * @param wait count 10 | * @desc The frame count it take to auto close the result window 11 | * @type number 12 | * @default 45 13 | * 14 | * @param actor phase auto close 15 | * @desc result window will auto close in actor phase 16 | * @type boolean 17 | * @default false 18 | * 19 | * @help 20 | * =================================================================================================== 21 | * Compatibility: 22 | * Place below Core plugin 23 | * =================================================================================================== 24 | * v 1.00 First Release 25 | */ 26 | (function () { 27 | var parameters = PluginManager.parameters('SRPG_BattleResultAutoClose'); 28 | var _delayBattleEnd = Number(parameters['wait count'] || 45); 29 | var _actorPhaseClose = !!eval(parameters['actor phase auto close'] || false); 30 | 31 | var _WindowBattleResult_Update = Window_SrpgBattleResult.prototype.update; 32 | Window_SrpgBattleResult.prototype.update = function() { 33 | _WindowBattleResult_Update.call(this); 34 | this.updateWait(); 35 | this.updateAutoClose(); 36 | }; 37 | 38 | Window_SrpgBattleResult.prototype.updateWait = function() { 39 | if (this.isOpen() && !this.isChangeExp()){ 40 | this._waitCount--; 41 | } 42 | }; 43 | 44 | Window_SrpgBattleResult.prototype.updateAutoClose = function() { 45 | if (this.isOpen() && this._waitCount <= 0 && ($gameSystem.isBattlePhase() !== 'actor_phase' || _actorPhaseClose)) { 46 | $gameSystem.setSubBattlePhase('after_battle'); 47 | if (!$gameSystem.useMapBattle()) BattleManager.endBattle(3); 48 | this._waitCount = _delayBattleEnd; 49 | this.close(); 50 | } 51 | }; 52 | 53 | var _Window_SrpgBattleResult_setRewards = Window_SrpgBattleResult.prototype.setRewards 54 | Window_SrpgBattleResult.prototype.setRewards = function(rewards) { 55 | _Window_SrpgBattleResult_setRewards.call(this, rewards) 56 | this._waitCount = _delayBattleEnd; 57 | }; 58 | 59 | })(); 60 | -------------------------------------------------------------------------------- /SRPG_BattleUI.js: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // SRPG_BattleUI.js 3 | // Copyright (c) 2020 SRPG Team. All rights reserved. 4 | // Released under the MIT license. 5 | // http://opensource.org/licenses/mit-license.php 6 | //============================================================================= 7 | 8 | /*: 9 | * @plugindesc SRPG Battle UI adjustment, edited by Shoukang to support battlePrepare plugin compatibility 10 | * @author SRPG Team 11 | * 12 | * @help 13 | * My (RyanBram) simple plugin for adjusting RPG Maker MV UI 14 | * to make it more unique for SRPG Battle 15 | * 16 | */ 17 | 18 | 19 | (function () { 20 | 'use strict'; 21 | 22 | 23 | const switchId = 1; 24 | 25 | const _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow; 26 | Scene_Menu.prototype.createCommandWindow = function() { 27 | _Scene_Menu_createCommandWindow.call(this); 28 | if ($gameSwitches.value(switchId) && $gameSystem.isBattlePhase() !== 'battle_prepare') { 29 | this._commandWindow.x = (Graphics.boxWidth - this._commandWindow.width)/2; 30 | this._commandWindow.y = (Graphics.boxHeight - this._commandWindow.height)/2; // 150 31 | } 32 | }; 33 | 34 | const _Scene_Menu_createStatusWindow = Scene_Menu.prototype.createStatusWindow; 35 | Scene_Menu.prototype.createStatusWindow = function() { 36 | _Scene_Menu_createStatusWindow.call(this); 37 | if ($gameSwitches.value(switchId) && $gameSystem.isBattlePhase() !== 'battle_prepare') { 38 | this._statusWindow.x = (Graphics.boxWidth - this._statusWindow.width)/2; 39 | this._statusWindow.hide(); 40 | this._goldWindow.hide(); 41 | } 42 | }; 43 | 44 | const _Scene_Menu_commandPersonal = Scene_Menu.prototype.commandPersonal; 45 | Scene_Menu.prototype.commandPersonal = function () { 46 | _Scene_Menu_commandPersonal.call(this); 47 | this.showStatusAndHideCommand(); 48 | }; 49 | 50 | const _Scene_Menu_commandFormation = Scene_Menu.prototype.commandFormation; 51 | Scene_Menu.prototype.commandFormation = function () { 52 | _Scene_Menu_commandFormation.call(this); 53 | this.showStatusAndHideCommand(); 54 | }; 55 | 56 | // ============================================================================== 57 | // REMOVE MENU COMMAND ---------------------------------------------------------- 58 | // ============================================================================== 59 | 60 | const _Window_MenuCommand_addMainCommands = Window_MenuCommand.prototype.addMainCommands; 61 | Window_MenuCommand.prototype.addMainCommands = function() { 62 | if ($gameSwitches.value(switchId)) { 63 | this.addCommand("Units", 'status', this.areMainCommandsEnabled()); 64 | } else { 65 | _Window_MenuCommand_addMainCommands.call(this); 66 | } 67 | }; 68 | 69 | const _Window_MenuCommand_addFormationCommand = Window_MenuCommand.prototype.addFormationCommand; 70 | Window_MenuCommand.prototype.addFormationCommand = function() { 71 | if (!$gameSwitches.value(switchId)) { 72 | _Window_MenuCommand_addFormationCommand.call(this); 73 | } 74 | }; 75 | 76 | // REMOVE MENU COMMAND ---------------------------------------------------------- 77 | 78 | /* 79 | // ============================================================================== 80 | // REMOVE MENU COMMAND ---------------------------------------------------------- 81 | // ============================================================================== 82 | Window_MenuCommand.prototype.addMainCommands = function() { 83 | var enabled = this.areMainCommandsEnabled(); 84 | if (this.needsCommand('item') && !$gameSwitches.value(switchId)) { 85 | this.addCommand(TextManager.item, 'item', enabled); 86 | } 87 | if (this.needsCommand('skill') && !$gameSwitches.value(switchId)) { 88 | this.addCommand(TextManager.skill, 'skill', enabled); 89 | } 90 | if (this.needsCommand('equip') && !$gameSwitches.value(switchId)) { 91 | this.addCommand(TextManager.equip, 'equip', enabled); 92 | } 93 | if (this.needsCommand('status') && !$gameSwitches.value(switchId)) { 94 | this.addCommand(TextManager.status, 'status', enabled); 95 | } else { 96 | this.addCommand("Units", 'status', enabled); 97 | } 98 | }; 99 | 100 | Window_MenuCommand.prototype.addFormationCommand = function() { 101 | var enabled = this.isFormationEnabled(); 102 | if (this.needsCommand('formation') && !$gameSwitches.value(switchId)) { 103 | this.addCommand(TextManager.formation, 'formation', enabled); 104 | } 105 | }; 106 | // REMOVE MENU COMMAND ---------------------------------------------------------- 107 | */ 108 | 109 | // ============================================================================== 110 | // CHANGE SRPG Movement Indicator ----------------------------------------------- 111 | // ============================================================================== 112 | Sprite_SrpgMoveTile.prototype.createBitmap = function() { 113 | var tileWidth = $gameMap.tileWidth(); 114 | var tileHeight = $gameMap.tileHeight(); 115 | this.bitmap = new Bitmap(tileWidth - 4, tileHeight - 4); 116 | this.anchor.x = 0.5; 117 | this.anchor.y = 0.5; 118 | this.blendMode = Graphics.BLEND_ADD; 119 | }; 120 | 121 | Sprite_SrpgMoveTile.prototype.updateAnimation = function() { 122 | this._frameCount++; 123 | this._frameCount %= 20; 124 | this.opacity = (60 - this._frameCount) * 3; 125 | }; 126 | // CHANGE SRPG Movement Indicator ----------------------------------------------- 127 | 128 | // ============================================================================== 129 | // CHANGE SRPG Battle Prediciton Width ------------------------------------------ 130 | // ============================================================================== 131 | 132 | Window_SrpgPrediction.prototype.windowWidth = function() { 133 | return 816; 134 | }; 135 | 136 | Window_SrpgStatus.prototype.windowWidth = function() { 137 | return 408; 138 | }; 139 | 140 | Scene_Map.prototype.createSrpgStatusWindow = function() { 141 | this._mapSrpgStatusWindow = new Window_SrpgStatus(0, 0); 142 | this._mapSrpgStatusWindow.x = Graphics.boxWidth - ((Graphics.boxWidth - 816) / 2) - this._mapSrpgStatusWindow.windowWidth(); 143 | this._mapSrpgStatusWindow.openness = 0; 144 | this.addWindow(this._mapSrpgStatusWindow); 145 | }; 146 | 147 | Scene_Map.prototype.createSrpgTargetWindow = function() { 148 | this._mapSrpgTargetWindow = new Window_SrpgStatus((Graphics.boxWidth-816)/2, 0); 149 | this._mapSrpgTargetWindow.openness = 0; 150 | this.addWindow(this._mapSrpgTargetWindow); 151 | }; 152 | 153 | Scene_Map.prototype.createSrpgPredictionWindow = function() { 154 | this._mapSrpgPredictionWindow = new Window_SrpgPrediction((Graphics.boxWidth-816)/2, 0); 155 | this._mapSrpgPredictionWindow.y = this._mapSrpgStatusWindow.windowHeight(); 156 | this._mapSrpgPredictionWindow.openness = 0; 157 | this.addWindow(this._mapSrpgPredictionWindow); 158 | }; 159 | // CHANGE SRPG Battle Prediciton Width ------------------------------------------ 160 | 161 | // ============================================================================== 162 | // Window Opacity --------------------------------------------------------------- 163 | // ============================================================================== 164 | // Window_Base.prototype.standardBackOpacity = function() { 165 | // return 255; 166 | // }; 167 | // Window Opacity --------------------------------------------------------------- 168 | 169 | 170 | const _Scene_Menu_onPersonalCancel = Scene_Menu.prototype.onPersonalCancel; 171 | Scene_Menu.prototype.onPersonalCancel = function () { 172 | _Scene_Menu_onPersonalCancel.call(this); 173 | this.showCommandAndHideStatus(); 174 | }; 175 | 176 | const _Scene_Menu_onFormationCancel = Scene_Menu.prototype.onFormationCancel; 177 | Scene_Menu.prototype.onFormationCancel = function () { 178 | _Scene_Menu_onFormationCancel.call(this); 179 | this.showCommandAndHideStatus(); 180 | }; 181 | 182 | Scene_Menu.prototype.showStatusAndHideCommand = function () { 183 | if ($gameSwitches.value(switchId) && $gameSystem.isBattlePhase() !== 'battle_prepare') { 184 | this._commandWindow.hide(); 185 | this._statusWindow.show(); 186 | } 187 | }; 188 | 189 | Scene_Menu.prototype.showCommandAndHideStatus = function () { 190 | if ($gameSwitches.value(switchId) && $gameSystem.isBattlePhase() !== 'battle_prepare') { 191 | this._commandWindow.show(); 192 | this._statusWindow.hide(); 193 | } 194 | }; 195 | })(); -------------------------------------------------------------------------------- /SRPG_ExpControl.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | //SRPG_ExpControl.js 3 | // Simple plugin to allows User to control exp for each skill. 4 | //============================================================================= 5 | /*: 6 | * @plugindesc Simple plugin to allows User to control exp for each skill. Only work in SRPG mode 7 | * @author Shoukang 8 | * 9 | * @help 10 | * This plugin provides no plugin parameters 11 | * =================================================================================================== 12 | * Compatibility: 13 | * Place it below SRPG_AoEAnimation if you use. 14 | * =================================================================================================== 15 | * Skill note tag: 16 | * set the exp to certain value, can also be a formula. 17 | * values you can use for the formula: 18 | * a the actor, same as damage formula 19 | * dif the exp difference from this level exp to next level exp. 20 | * =================================================================================================== 21 | * v 1.00 First Release 22 | */ 23 | (function () { 24 | //================================================================================================= 25 | //Plugin Parameters 26 | //================================================================================================= 27 | var parameters = PluginManager.parameters('SRPG_ExpControl'); 28 | 29 | var _useItem = Game_Battler.prototype.useItem; 30 | Game_Battler.prototype.useItem = function(item) { 31 | if ($gameSystem.isSRPGMode() && this.isActor() && DataManager.isSkill(item) && 32 | item.meta.srpgExp) { 33 | var a = this; 34 | var dif = this.nextLevelExp() - this.currentLevelExp(); 35 | $gameTroop.setSrpgExp(eval(item.meta.srpgExp)) 36 | } 37 | _useItem.call(this, item); 38 | }; 39 | 40 | var _SRPG_Game_Troop_expTotal = Game_Troop.prototype.expTotal; 41 | Game_Troop.prototype.expTotal = function() { 42 | if ($gameSystem.isSRPGMode() == true && this._srpgExp !== undefined) { 43 | //console.log(this._srpgExp) 44 | return Math.round(this._srpgExp); 45 | } else return _SRPG_Game_Troop_expTotal.call(this); 46 | }; 47 | 48 | Game_Troop.prototype.setSrpgExp = function(exp) { 49 | this._srpgExp = exp; 50 | }; 51 | 52 | Game_Troop.prototype.clearSrpgExp = function() { 53 | this._srpgExp = undefined; 54 | }; 55 | 56 | var _srpgAfterAction = Scene_Map.prototype.srpgAfterAction; 57 | Scene_Map.prototype.srpgAfterAction = function() { 58 | if (this.srpgBattleFinished()){ 59 | $gameTroop.clearSrpgExp(); 60 | } 61 | _srpgAfterAction.call(this); 62 | }; 63 | 64 | //check for whether AoE map battle is finished. Only useful when you have AoEAnimation plugin 65 | Scene_Map.prototype.srpgBattleFinished = function() { 66 | var livePartyMembers = $gameParty.battleMembers().filter(function(member) { 67 | return member.isAlive(); 68 | }); 69 | var activeType = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[0] 70 | return (!$gameTemp.areaTargets || $gameTemp.areaTargets().length <= 0) || 71 | (activeType == 'enemy' && $gameTroop.isAllDead()) || livePartyMembers.length <= 0; 72 | } 73 | 74 | })(); 75 | -------------------------------------------------------------------------------- /SRPG_ModifiedMoveTable.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | // SRPG_ModifiedMoveTable.js 3 | //----------------------------------------------------------------------------- 4 | //Free to use and edit v.1.01 add move cost notetag for Actor/enemy/class/equipments/states 5 | //============================================================================= 6 | /*: 7 | * @plugindesc This plugin provides control over movecost and modified the make move 8 | * table function to provide a fire-emblem like move rule. (see help for detail) 9 | * @author Shoukang 10 | * 11 | * @help 12 | * Units with srpgThroughTag >= terrainTag will consider the movecost of that terrain as 1. 13 | * Units that have special note tags can have a different move cost on a terrain. See notetags below. 14 | * Move rule in SRPG_RangeControl allows a unit to step on the next tile if its remaining 15 | * move point is bigger than 0, which means a unit with 3 (or even 1) move points 16 | * can step on a tile which costs 4 move points. Then the unit has no remaining 17 | * movepoints and will stop there. 18 | * This plugin changes the rule so that a unit can step on the next tile only when 19 | * its remaining move point is bigger than the move cost of that tile. 20 | * ================================================================================= 21 | * new actor/enemy/class/equipments/states notetags: 22 | * 23 | * replace X and Y with terrain tag and cost so that the terrainX will cost Y moves for the specific unit. 24 | * 25 | * priority: states > equipments > actor/enemy > class 26 | * if there are multiple states/equipments that conflicts the final cost will be the last 27 | * equipment/state that have this notetag. It's not designed for very complicated needs. 28 | * if srpgthroughtag >= terrain tag, these notetags will be ignored. 29 | * ================================================================================= 30 | * Please put this plugin below SRPG_RangeControl. 31 | * v.1.01 add move cost notetag for Actor/enemy/class/equipments/states 32 | */ 33 | 34 | (function () { 35 | 36 | //get a list that contain special move cost for each terrain. 37 | Game_Enemy.prototype.getSpecialMoveCosts = function(){ 38 | var costList = []; 39 | for (var terrain = 0; terrain < 8; terrain ++ ){ 40 | costList.push(undefined); 41 | if(this.enemy().meta["srpgTerrain"+terrain+"Cost"]){ 42 | costList[terrain] = Number(this.enemy().meta["srpgTerrain"+terrain+"Cost"]); 43 | } 44 | } 45 | return costList; 46 | } 47 | 48 | Game_Actor.prototype.getSpecialMoveCosts = function() { 49 | var costList = []; 50 | for (var terrain = 0; terrain < 8; terrain ++ ){ 51 | costList.push(undefined); 52 | if (this.currentClass().meta.MoveAfterAction){ 53 | costList[terrain] = Number(this.actor().meta["srpgTerrain"+terrain+"Cost"]); 54 | } 55 | 56 | if (this.actor().meta["srpgTerrain"+terrain+"Cost"]) { 57 | costList[terrain] = Number(this.actor().meta["srpgTerrain"+terrain+"Cost"]); 58 | } 59 | 60 | var items = this.equips().concat(this.states()); 61 | for (var i = 0; i < items.length; i++){ 62 | if (items[i] && items[i].meta["srpgTerrain"+terrain+"Cost"]){ 63 | costList[terrain] = Number(items[i].meta["srpgTerrain"+terrain+"Cost"]); 64 | }; 65 | } 66 | } 67 | return costList; 68 | }; 69 | 70 | var shoukang_Game_Map_srpgMoveCost = Game_Map.prototype.srpgMoveCost 71 | Game_Map.prototype.srpgMoveCost = function(x, y, tag, special){ 72 | if (tag && tag >= $gameMap.terrainTag(x, y)) return 1; 73 | var moveCost = shoukang_Game_Map_srpgMoveCost.call(this, x, y); 74 | if (special && special[$gameMap.terrainTag(x, y)] !== undefined){ 75 | moveCost = special[$gameMap.terrainTag(x, y)]; 76 | } 77 | return moveCost; 78 | } 79 | 80 | //add a check for special. 81 | Game_CharacterBase.prototype.srpgMoveCanPass = function(x, y, d, tag, special) { 82 | var x2 = $gameMap.roundXWithDirection(x, d); 83 | var y2 = $gameMap.roundYWithDirection(y, d); 84 | if (!$gameMap.isValid(x2, y2)) { 85 | return false; 86 | } 87 | if (this.isSrpgCollidedWithEvents(x2, y2)) { 88 | return false; 89 | } 90 | if (this.isThrough()) { 91 | return true; 92 | } 93 | 94 | if (special && special[$gameMap.terrainTag(x2, y2)]){ 95 | return true; 96 | } 97 | 98 | if (special && special[$gameMap.terrainTag(x, y)] && $gameMap.isPassable(x2, y2, this.reverseDir(d))){ 99 | return true 100 | } 101 | 102 | if (($gameMap.terrainTag(x2, y2) > 0 && $gameMap.terrainTag(x2, y2) <= tag) || 103 | ($gameMap.terrainTag(x, y) > 0 && $gameMap.terrainTag(x, y) <= tag && 104 | $gameMap.isPassable(x2, y2, this.reverseDir(d)))) { 105 | return true; 106 | } 107 | if (!this.isMapPassable(x, y, d)) { 108 | return false; 109 | } 110 | return true; 111 | }; 112 | 113 | Game_CharacterBase.prototype.makeMoveTable = function(x, y, move, unused, tag) { 114 | var edges = []; 115 | var user = $gameSystem.EventToUnit(this.eventId())[1]; 116 | var specialMoveCost = user.getSpecialMoveCosts(); 117 | //console.log(specialMoveCost) 118 | if (move > 0) edges = [[x, y, move, [0]]]; 119 | $gameTemp.setMoveTable(x, y, move, [0]); 120 | $gameTemp.pushMoveList([x, y, false]); 121 | $gameMap.makeSrpgZoCTable(this.isType() == 'actor' ? 'enemy' : 'actor', this.throughZoC()); 122 | 123 | while (edges.length > 0) { 124 | var cell = edges.shift(); 125 | for (var d = 2; d < 10; d += 2) { 126 | if (!this.srpgMoveCanPass(cell[0], cell[1], d, tag, specialMoveCost)) continue;//shoukang edit: add a check for special move cost 127 | var dx = $gameMap.roundXWithDirection(cell[0], d); 128 | var dy = $gameMap.roundYWithDirection(cell[1], d); 129 | var movecost = $gameMap.srpgMoveCost(dx, dy, tag, specialMoveCost); 130 | if ($gameTemp.MoveTable(dx, dy)[0] >= 0 || (cell[2] - movecost) < 0) continue; //shoukang edit: if move < cost skip 131 | 132 | var dmove = cell[2] - movecost; 133 | var route = cell[3].concat(d); 134 | $gameTemp.setMoveTable(dx, dy, dmove, route); 135 | $gameTemp.pushMoveList([dx, dy, false]); 136 | if (dmove > 0 && !$gameMap._zocTable[dx+','+dy]) { 137 | edges.push([dx, dy, dmove, route]); 138 | edges.sort(function (a, b) {return b[2] - a[2]}); 139 | } 140 | } 141 | } 142 | } 143 | 144 | /* Game_CharacterBase.prototype.makeMoveTable = function(x, y, move, unused, tag) { 145 | var performance = window.performance; 146 | var t0 = performance.now(); 147 | var edges = []; 148 | var user = $gameSystem.EventToUnit(this.eventId())[1]; 149 | var specialMoveCost = user.getSpecialMoveCosts(); 150 | var compareFunc = function(a, b){return a[2] > b[2]}; 151 | if (move > 0) edges = [[x, y, move, [0]]]; 152 | $gameTemp.setMoveTable(x, y, move, [0]); 153 | $gameTemp.pushMoveList([x, y, false]); 154 | $gameMap.makeSrpgZoCTable(this.isType() == 'actor' ? 'enemy' : 'actor', this.throughZoC()); 155 | 156 | while (edges.length > 0) { 157 | var cell = edges.heappop(compareFunc); 158 | for (var d = 2; d < 10; d += 2) { 159 | if (!this.srpgMoveCanPass(cell[0], cell[1], d, tag, specialMoveCost)) continue;//shoukang edit: add a check for special move cost 160 | var dx = $gameMap.roundXWithDirection(cell[0], d); 161 | var dy = $gameMap.roundYWithDirection(cell[1], d); 162 | var movecost = $gameMap.srpgMoveCost(dx, dy, tag, specialMoveCost); 163 | if ($gameTemp.MoveTable(dx, dy)[0] >= 0 || (cell[2] - movecost) < 0) continue; //shoukang edit: if move < cost skip 164 | 165 | var dmove = cell[2] - movecost; 166 | var route = cell[3].concat(d); 167 | $gameTemp.setMoveTable(dx, dy, dmove, route); 168 | $gameTemp.pushMoveList([dx, dy, false]); 169 | if (dmove > 0 && !$gameMap._zocTable[dx+','+dy]) { 170 | edges.heappush([dx, dy, dmove, route], compareFunc); 171 | } 172 | } 173 | } 174 | var t1 = performance.now(); 175 | console.log((t1 - t0) + " milliseconds.") 176 | } 177 | 178 | Array.prototype.heappush = function(element, func = function(x,y){return x > y}){ 179 | this.push(element); 180 | var idc = this.length - 1; 181 | var idp = Math.floor((idc - 1)/2); 182 | while (idp >= 0 && func(this[idc], this[idp])) { 183 | //console.log(idc, Math.floor((idc - 1)/2)); 184 | [this[idc], this[idp]] = [this[idp], this[idc]]; 185 | idc = idp; 186 | idp = Math.floor((idc - 1)/2); 187 | } 188 | //console.log(this); 189 | } 190 | 191 | Array.prototype.heappop = function(func = function(x,y){return x > y}){ 192 | var ans = this[0] 193 | this[0] = this[this.length - 1] 194 | this.pop(); 195 | var idp = 0; 196 | var idc1 = idp * 2 + 1; 197 | //var idc2 = idc1 + 1; 198 | while (idc1 < this.length) { 199 | if (idc1 + 1 < this.length && func(this[idc1 + 1], this[idc1])){ 200 | idc1 += 1; 201 | } 202 | if (func(this[idc1], this[idp])){ 203 | [this[idc1], this[idp]] = [this[idp], this[idc1]]; 204 | idp = idc1; 205 | idc1 = idp * 2 + 1; 206 | } else break; 207 | } 208 | //console.log(this, ans); 209 | return ans 210 | }*/ 211 | })(); 212 | -------------------------------------------------------------------------------- /SRPG_MoveAfterAction.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | // SRPG_MoveAfterAction.js 3 | //----------------------------------------------------------------------------- 4 | // Free to use and edit version 1.04 fix bug for after action move when actor is defeated. 5 | //============================================================================= 6 | /*: 7 | * @plugindesc 8 | * Allow units to move if they have remaining move points after action. 9 | * @author Shoukang 10 | * 11 | * @param auto select actor 12 | * @desc if the actor can do move after action, auto select the actor 13 | * @type boolean 14 | * @default true 15 | * 16 | * @help 17 | * actor/class/weapon/armor/state note tag: 18 | * with this note tag the actor can move again when it has remaining move. 19 | * Enemy units and auto battle actors can not move after action, because they don't know how to use it. 20 | * ========================================================================================================================== 21 | * version 1.04 fix bug for after action move when actor is defeated. 22 | * version 1.03 fix bug for not clearing movetile after action 23 | * version 1.02 fix bug for auto battle, can auto select actor if the actor can do move after action 24 | * version 1.01 enable state notetags 25 | * version 1.00 first release! 26 | * =========================================================================================================================== 27 | * Compatibility: 28 | * Place this plugin below the other SRPG plugins. 29 | * =========================================================================================================================== 30 | */ 31 | 32 | (function() { 33 | var params = PluginManager.parameters('SRPG_MoveAfterAction'); 34 | var _autoSelect = !!eval(params['auto select actor']); 35 | 36 | var coreParameters = PluginManager.parameters('SRPG_core'); 37 | var _srpgAutoBattleStateId = Number(coreParameters['srpgAutoBattleStateId'] || 14); 38 | var shoukang_Game_BattlerBase_initMembers = Game_BattlerBase.prototype.initMembers; 39 | Game_BattlerBase.prototype.initMembers = function() { 40 | shoukang_Game_BattlerBase_initMembers.call(this); 41 | this._SrpgRemainingMove = 0; 42 | this._isSrpgAfterActionMove = false; 43 | }; 44 | 45 | Game_BattlerBase.prototype.isSrpgAfterActionMove = function() { 46 | if (this.SRPGActionTimes() <= 1) return this._isSrpgAfterActionMove;//in case someone use add action time skills 47 | return false; 48 | }; 49 | 50 | Game_BattlerBase.prototype.setSrpgAfterActionMove = function(val) { 51 | this._isSrpgAfterActionMove = val; 52 | }; 53 | 54 | Game_BattlerBase.prototype.SrpgRemainingMove = function() { 55 | return this._SrpgRemainingMove; 56 | }; 57 | 58 | Game_BattlerBase.prototype.setSrpgRemainingMove = function(val) { 59 | this._SrpgRemainingMove = val; 60 | }; 61 | //store remaining move after move route force 62 | var shoukang_Game_Event_srpgMoveRouteForce = Game_Event.prototype.srpgMoveRouteForce; 63 | Game_Event.prototype.srpgMoveRouteForce = function(array) { 64 | var battlerArray = $gameSystem.EventToUnit(this.eventId()); 65 | if (!battlerArray[1].isAutoBattle() && battlerArray[1].canMoveAfterAction() && !battlerArray[1].isSrpgAfterActionMove()){ 66 | var x = this.posX(); 67 | var y = this.posY(); 68 | for (var i = 0; i < array.length; i++){ 69 | x = $gameMap.roundXWithDirection(x, array[i]); 70 | y = $gameMap.roundYWithDirection(y, array[i]); 71 | } 72 | battlerArray[1].setSrpgRemainingMove($gameTemp.MoveTable(x, y)[0]);// 73 | } 74 | shoukang_Game_Event_srpgMoveRouteForce.call(this, array); 75 | }; 76 | //check actor, class and equipments. 77 | Game_Actor.prototype.canMoveAfterAction = function(type) { 78 | if (this.srpgTurnEnd() || this.isDead()) return false; 79 | if (_srpgAutoBattleStateId && this.isStateAffected(_srpgAutoBattleStateId)) return false 80 | if (this.actor().meta.MoveAfterAction) return true; 81 | if (this.currentClass().meta.MoveAfterAction) return true; 82 | var equipments = this.equips(); 83 | for (var i = 0; i < equipments.length; i++){ 84 | if (equipments[i] && equipments[i].meta.MoveAfterAction) return true; 85 | } 86 | var states = this.states(); 87 | for (var i = 0; i < states.length; i++){ 88 | if (states[i] && states[i].meta.MoveAfterAction) return true; 89 | } 90 | return false; 91 | }; 92 | 93 | Game_Enemy.prototype.canMoveAfterAction = function(type) { 94 | // if (this.enemy().meta.MoveAfterAction) return true; 95 | return false; 96 | }; 97 | // if actor has remaining move and can do after move action, let the actor do after move action. 98 | var shoukang_Scene_Map_srpgAfterAction = Scene_Map.prototype.srpgAfterAction; 99 | Scene_Map.prototype.srpgAfterAction = function() { 100 | var currentEvent = $gameTemp.activeEvent(); 101 | var currentBattler = $gameSystem.EventToUnit(currentEvent.eventId())[1]; 102 | var oriX = $gameTemp.activeEvent().posX(); 103 | var oriY = $gameTemp.activeEvent().posY(); 104 | shoukang_Scene_Map_srpgAfterAction.call(this); 105 | if (currentBattler.isAlive() && currentBattler.srpgTurnEnd() && !currentBattler.isSrpgAfterActionMove() && 106 | currentBattler.SrpgRemainingMove() && !$gameTemp.isTurnEndFlag() && 107 | $gameSystem.isBattlePhase() !== 'auto_actor_phase'){ 108 | currentBattler.setSrpgAfterActionMove(true); 109 | currentBattler.setSrpgTurnEnd(false); 110 | $gameTemp.setAutoMoveDestinationValid(true); 111 | $gameTemp.setAutoMoveDestination(oriX, oriY); 112 | if (_autoSelect){ 113 | $gameMap._flagInvokeActionStart = false; 114 | $gameTemp.setActiveEvent(currentEvent); 115 | $gameSystem.srpgMakeMoveTable(currentEvent); 116 | var battlerArray = $gameSystem.EventToUnit(currentEvent.eventId()); 117 | $gameParty.pushSrpgBattleActors(battlerArray[1]); 118 | $gameTemp.reserveOriginalPos($gameTemp.activeEvent().posX(), $gameTemp.activeEvent().posY()); 119 | $gameSystem.setSrpgActorCommandStatusWindowNeedRefresh(battlerArray); 120 | $gameTemp.setResetMoveList(true); 121 | $gameSystem.setSubBattlePhase('actor_move'); 122 | } 123 | } else if ($gameTemp.isTurnEndFlag()) currentBattler.setSrpgRemainingMove(0); 124 | }; 125 | 126 | var shoukang_Scene_Menu_commandAutoBattle = Scene_Menu.prototype.commandAutoBattle 127 | Scene_Menu.prototype.commandAutoBattle = function() { 128 | shoukang_Scene_Menu_commandAutoBattle.call(this) 129 | $gameMap.events().forEach(function(event) { 130 | var battlerArray = $gameSystem.EventToUnit(event._eventId); 131 | if (battlerArray && battlerArray[0] === 'actor' && battlerArray[1].isSrpgAfterActionMove()) { 132 | battlerArray[1].setSrpgTurnEnd(true); 133 | battlerArray[1].setSrpgAfterActionMove(false) 134 | battlerArray[1].setSrpgRemainingMove(0) 135 | } 136 | }); 137 | }; 138 | 139 | var shoukang_Scene_Map_isSrpgActorTurnEnd = Scene_Map.prototype.isSrpgActorTurnEnd; 140 | Scene_Map.prototype.isSrpgActorTurnEnd = function() {//the true/false here is confusing......true is not turn end, false is turn end 141 | var result = $gameMap.events().some(function(event) { 142 | var battlerArray = $gameSystem.EventToUnit(event._eventId); 143 | if (battlerArray && battlerArray[0] === 'actor' && !event.isErased() && !battlerArray[1].isRestricted()) { 144 | if (battlerArray[1].SrpgRemainingMove() && battlerArray[1].isSrpgAfterActionMove()) return true; 145 | } 146 | }); 147 | if (result === true) return true; 148 | return shoukang_Scene_Map_isSrpgActorTurnEnd.call(this); 149 | }; 150 | 151 | var shoukang_Game_System_clearData = Game_System.prototype.clearData; 152 | Game_System.prototype.clearData = function() { 153 | $gameTemp.clearMoveTable(); 154 | $gameTemp.setResetMoveList(true); 155 | shoukang_Game_System_clearData.call(this); 156 | }; 157 | 158 | //reset values on turn end. 159 | var shoukang_Game_Battler_onTurnEnd = Game_Battler.prototype.onTurnEnd; 160 | Game_Battler.prototype.onTurnEnd = function() { 161 | if ($gameSystem.isSRPGMode() == true) { 162 | this.setSrpgRemainingMove(0); 163 | this.setSrpgAfterActionMove(false); 164 | } 165 | shoukang_Game_Battler_onTurnEnd.call(this); 166 | }; 167 | //only show wait command when after action move. 168 | var shoukang_Window_ActorCommand_makeCommandList = Window_ActorCommand.prototype.makeCommandList; 169 | Window_ActorCommand.prototype.makeCommandList = function() { 170 | if ($gameSystem.isSRPGMode() == true && this._actor && this._actor.isSrpgAfterActionMove()) { 171 | this.addWaitCommand(); 172 | } else { 173 | shoukang_Window_ActorCommand_makeCommandList.call(this); 174 | } 175 | }; 176 | //only enable move again when waiting on unit event. 177 | var shoukang_Scene_Map_commandWait = Scene_Map.prototype.commandWait 178 | Scene_Map.prototype.commandWait = function() { 179 | var battler = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]; 180 | var flag = $gameMap.eventsXy($gameTemp.activeEvent().posX(), $gameTemp.activeEvent().posY()).some(function(event) { 181 | if (event.isType() === 'unitEvent' && event.pageIndex() >= 0) return true; 182 | }); 183 | if (!flag || battler.isSrpgAfterActionMove()){ 184 | battler.setSrpgRemainingMove(0); 185 | battler.setSrpgAfterActionMove(false); 186 | } 187 | shoukang_Scene_Map_commandWait.call(this); 188 | }; 189 | //replace move with remaining move when after action move. 190 | var shoukang_Game_CharacterBase_makeMoveTable = Game_CharacterBase.prototype.makeMoveTable; 191 | Game_CharacterBase.prototype.makeMoveTable = function(x, y, move, unused, tag) { 192 | var battler = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]; 193 | if (battler.isSrpgAfterActionMove()) move = battler.SrpgRemainingMove(); 194 | shoukang_Game_CharacterBase_makeMoveTable.call(this, x, y, move, unused, tag); 195 | } 196 | //don't show range table for after action move. 197 | var shoukang_Game_CharacterBase_makeRangeTable = Game_CharacterBase.prototype.makeRangeTable; 198 | Game_CharacterBase.prototype.makeRangeTable = function(x, y, range, unused, oriX, oriY, skill) { 199 | if ($gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].isSrpgAfterActionMove()) return; 200 | shoukang_Game_CharacterBase_makeRangeTable.call(this, x, y, range, unused, oriX, oriY, skill); 201 | }; 202 | 203 | if (Game_CharacterBase.prototype.makeAoETable){ 204 | var shoukang_Game_CharacterBase_makeAoETable = Game_CharacterBase.prototype.makeAoETable; 205 | Game_CharacterBase.prototype.makeAoETable = function(x, y, range, unused, skill, areaRange, areaminRange, shape, user) { 206 | if ($gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].isSrpgAfterActionMove()) return; 207 | shoukang_Game_CharacterBase_makeAoETable.call(this, x, y, range, unused, skill, areaRange, areaminRange, shape, user) 208 | }; 209 | }; 210 | 211 | })(); 212 | -------------------------------------------------------------------------------- /SRPG_RemainingMove.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | // SRPG_RemainingMove.js 3 | //----------------------------------------------------------------------------- 4 | // Free to use and edit version 1.00 5 | //============================================================================= 6 | /*: 7 | * @plugindesc 8 | * Allow units to move with remaining move point and set additional move with actor/class/enemy note tag. 9 | * @author Shoukang 10 | * 11 | * @help 12 | * 13 | * New actor/class/enemy note tag: 14 | * With this note tag the actor can move again when it has remaining move, you can use a formula 15 | * as the damage formula to determine additional action time. 16 | * For example: a.level/10 (decimal will be ignored) 17 | * ====================================================================================================================== 18 | * Compatibility: 19 | * Not compatible with SRPG_MoveAfterAction. 20 | * place it somewhere below SRPG_RangeControl, SRPG_ModifiedMoveTable and SRPG_TerrainEffect(basically every plugin that overwrites Game_CharacterBase.prototype.makeMoveTable); 21 | */ 22 | 23 | (function() { 24 | 25 | Game_Temp.prototype.setUsedMovePoint = function(val){ 26 | this._ump = val; 27 | }; 28 | 29 | Game_Temp.prototype.usedMovePoint = function(){ 30 | return this._ump || 0; 31 | }; 32 | 33 | Object.defineProperty(Game_BattlerBase.prototype, 'ump', { 34 | get: function() { return this._ump || 0}, 35 | set:function(val) { this._ump = val }, 36 | configurable: true 37 | }); 38 | 39 | var _Game_Battler_SRPGActionTimesSet = Game_Battler.prototype.SRPGActionTimesSet; 40 | Game_Battler.prototype.SRPGActionTimesSet = function() { 41 | _Game_Battler_SRPGActionTimesSet.call(this); 42 | var formula = '0'; 43 | var a = this; 44 | if (this.isActor()){ 45 | if (this.actor().meta.addActionTimes){ 46 | formula = this.actor().meta.addActionTimes; 47 | } else if (this.currentClass().meta.addActionTimes){ 48 | formula = this.currentClass().meta.addActionTimes; 49 | } 50 | } else if (this.isEnemy() && this.enemy().meta.addActionTimes){ 51 | formula = this.enemy().meta.addActionTimes; 52 | } 53 | this._SRPGActionTimes += Math.floor(eval(formula)); 54 | }; 55 | 56 | var _Game_Battler_onTurnEnd = Game_Battler.prototype.onTurnEnd; 57 | Game_Battler.prototype.onTurnEnd = function() { 58 | this.ump = 0; 59 | _Game_Battler_onTurnEnd.call(this); 60 | }; 61 | 62 | var _Game_Event_srpgMoveRouteForce = Game_Event.prototype.srpgMoveRouteForce; 63 | Game_Event.prototype.srpgMoveRouteForce = function(array) { 64 | var battlerArray = $gameSystem.EventToUnit(this.eventId()); 65 | var x = this.posX(); 66 | var y = this.posY(); 67 | var originalMove = $gameTemp.MoveTable(x, y)[0]; 68 | // get the end position by route 69 | for (var i = 0; i < array.length; i++){ 70 | x = $gameMap.roundXWithDirection(x, array[i]); 71 | y = $gameMap.roundYWithDirection(y, array[i]); 72 | } 73 | $gameTemp.setUsedMovePoint(originalMove - $gameTemp.MoveTable(x, y)[0]); //store the battler's ump into temporay memory 74 | _Game_Event_srpgMoveRouteForce.call(this, array); 75 | }; 76 | 77 | var _Game_CharacterBase_makeMoveTable = Game_CharacterBase.prototype.makeMoveTable; 78 | Game_CharacterBase.prototype.makeMoveTable = function(x, y, move, unused, tag) { 79 | var battler = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]; 80 | move = Math.max(battler.srpgMove() - battler.ump, 0); 81 | _Game_CharacterBase_makeMoveTable.call(this, x, y, move, unused, tag); 82 | } 83 | 84 | var _Scene_Map_srpgAfterAction = Scene_Map.prototype.srpgAfterAction; 85 | Scene_Map.prototype.srpgAfterAction = function(){ 86 | var currentEvent = $gameTemp.activeEvent(); 87 | var battler = $gameSystem.EventToUnit(currentEvent.eventId())[1]; 88 | battler.ump = battler.ump + $gameTemp.usedMovePoint(); 89 | $gameTemp.setUsedMovePoint(0); 90 | _Scene_Map_srpgAfterAction.call(this); 91 | }; 92 | 93 | var _Scene_Map_commandWait = Scene_Map.prototype.commandWait 94 | Scene_Map.prototype.commandWait = function() { 95 | var battler = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]; 96 | battler.useSRPGActionTimes(999); 97 | _Scene_Map_commandWait.call(this); 98 | }; 99 | 100 | })(); 101 | -------------------------------------------------------------------------------- /SRPG_Rescue.js: -------------------------------------------------------------------------------- 1 | //==================================================================================================================== 2 | // SRPG_Rescue.js 3 | //-------------------------------------------------------------------------------------------------------------------- 4 | // free to use and edit v1.01 Fix bug for unable to drop actor at where they were rescued. 5 | //==================================================================================================================== 6 | /*: 7 | * @plugindesc Add Advanced interaction for SRPG battle. 8 | * @author Shoukang 9 | * 10 | * @param text rescue 11 | * @desc default text for Rescue interaction. 12 | * @default Rescue 13 | * 14 | * @param text drop 15 | * @desc default text for drop interaction. 16 | * @default Drop 17 | * 18 | * @param rescue state id 19 | * @type number 20 | * @desc stateeffect of rescue, set 0 to disable. Don't set remove conditions to the state effect. 21 | * @default 0 22 | * 23 | * @param rescue requirenment formula 24 | * @desc default requirenment for rescue interaction. 25 | * @default a.agi - b.agi >= 4 26 | * 27 | * @param rescue sprite 28 | * @type file 29 | * @dir img/characters/ 30 | * @desc default sprite to indicate that a unit have rescued battler 31 | * @default $Rescue 32 | * 33 | * @help 34 | * Allow battlers to rescue/drop actors. 35 | * If the carrier dies, the rescued unit will drop regardless of the tile passibility. 36 | * Need a rescue sprite. Get a sample here: https://github.com/ShoukangHong/Shoukang_SRPG_plugin/blob/main/Demos/%24Rescue.png 37 | * Place the image in img/characters/ 38 | * ========================================================================================================================== 39 | * actor/class note tag: 40 | * give a carrier meta property to the actor/actor class. 41 | * You can check for this property in the rescue requirenment formula, for example: 42 | * (a.actor().meta.carrier || a.currentClass().meta.carrier) && a.agi - b.agi >= 4 43 | * The '(a.actor().meta.carrier || a.currentClass().meta.carrier)' part check for the meta data. 44 | * ========================================================================================================================== 45 | * v1.01 Fix bug for unable to drop actor at where they were rescued. 46 | * v1.00 first release! 47 | * ========================================================================================================================= 48 | * Compatibility: 49 | * This plugin requires SRPG_BattlePrepare and SRPG_AdvancedInteraction(updated 3/1/2022), and place it below them. 50 | */ 51 | 52 | (function () { 53 | 'use strict'; 54 | var parameters = PluginManager.parameters('SRPG_Rescue'); 55 | var _textRescue = parameters['text rescue'] || 'Rescue'; 56 | var _textDrop = parameters['text drop'] || 'Drop'; 57 | var _rescueFormula = parameters['rescue requirenment formula'] || 'a.agi - b.agi >= 4'; 58 | var _rescueState = Number(parameters['rescue state id']) || 0; 59 | var _rescueSprite = parameters['rescue sprite'] || '$Rescue'; 60 | 61 | var _Window_ActorCommand_addActorInteractionCommand = Window_ActorCommand.prototype.addActorInteractionCommand 62 | Window_ActorCommand.prototype.addActorInteractionCommand = function(events) { 63 | _Window_ActorCommand_addActorInteractionCommand.call(this, events); 64 | for (var i = 0; i < events.length; i++){ 65 | if(events[i].canInteract('rescue')){ 66 | this.addCommand(_textRescue, 'rescue', true); 67 | return; 68 | } 69 | } 70 | if ($gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].rescuedBattler()){ 71 | this.addCommand(_textDrop, 'drop', true); 72 | } 73 | }; 74 | 75 | var _Window_ActorCommand_highlightSymbolList = Window_ActorCommand.prototype.highlightSymbolList 76 | Window_ActorCommand.prototype.highlightSymbolList = function(){ 77 | return _Window_ActorCommand_highlightSymbolList.call(this).concat(['rescue', 'drop']) 78 | } 79 | 80 | var _Scene_Map_createSrpgActorCommandWindow = Scene_Map.prototype.createSrpgActorCommandWindow; 81 | Scene_Map.prototype.createSrpgActorCommandWindow = function(){ 82 | _Scene_Map_createSrpgActorCommandWindow.call(this); 83 | this._mapSrpgActorCommandWindow.setHandler('rescue', this.commandRescue.bind(this)); 84 | this._mapSrpgActorCommandWindow.setHandler('drop', this.commandDrop.bind(this)); 85 | }; 86 | 87 | Scene_Map.prototype.commandRescue = function() { 88 | $gameSystem.setSrpgInteractionType('rescue'); 89 | $gameSystem.setBattlePhase('actor_phase'); 90 | $gameSystem.setSubBattlePhase('actor_Interaction'); 91 | $gameTemp.clearMoveTable(); 92 | $gameTemp.makeInteractionTable($gameTemp.activeEvent()); 93 | $gameSystem.clearSrpgActorCommandWindowNeedRefresh(); 94 | var interactionEvents = $gameMap.surroundingInteractionEvents($gameTemp.activeEvent(), $gameSystem.srpgInteractionType(), $gameSystem.srpgInteractionName()); 95 | $gameTemp.setAutoMoveDestinationValid(true); 96 | $gameTemp.setAutoMoveDestination(interactionEvents[0].posX(), interactionEvents[0].posY()) 97 | }; 98 | 99 | Scene_Map.prototype.commandDrop = function() { 100 | var actor = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1] 101 | $gameTemp.setTargetEvent(actor.rescuedBattler().event()); 102 | $gameSystem.setSrpgInteractionType('drop'); 103 | $gameSystem.setBattlePhase('actor_phase'); 104 | $gameSystem.setSubBattlePhase('actor_Interaction'); 105 | $gameTemp.clearMoveTable(); 106 | $gameSystem.clearSrpgActorCommandWindowNeedRefresh(); 107 | $gameTemp.makeInteractionTable($gameTemp.activeEvent()); 108 | } 109 | 110 | var _SRPG_Game_Player_startInteractionEvent = Game_Player.prototype.startInteractionEvent 111 | Game_Player.prototype.startInteractionEvent = function(x, y, triggers, normal) { 112 | if ($gameSystem.srpgInteractionType() === 'drop'){ 113 | if ($gameMap.positionIsOpen(x, y)){ 114 | $gameTemp.targetEvent().appear()//appear so that srpgMoveCanPass can work properly 115 | $gameTemp.activeEvent().turnTowardPlayer() 116 | var targetArray = $gameSystem.EventToUnit($gameTemp.targetEvent().eventId()) 117 | var tag = targetArray ? targetArray[1].srpgThroughTag() : 0; 118 | if ($gameTemp.targetEvent().pos(x, y) || 119 | $gameTemp.targetEvent().srpgMoveCanPass($gamePlayer.posX(), 120 | $gamePlayer.posY(), 5, tag)){ 121 | $gameSystem.setSubBattlePhase('start_Interaction'); 122 | } else { 123 | SoundManager.playBuzzer(); 124 | } 125 | $gameTemp.targetEvent().erase() 126 | } else { 127 | SoundManager.playBuzzer(); 128 | } 129 | } else _SRPG_Game_Player_startInteractionEvent.call(this, x, y, triggers, normal) 130 | } 131 | 132 | var _Scene_Map_triggerInteraction = Scene_Map.prototype.triggerInteraction 133 | Scene_Map.prototype.triggerInteraction = function(){ 134 | var type = $gameSystem.srpgInteractionType(); 135 | if (type == 'rescue'){ 136 | this.startRescue(); 137 | } else if (type === 'drop'){ 138 | this.startDrop($gameTemp.activeEvent(), $gameTemp.targetEvent(), $gamePlayer.posX(), $gamePlayer.posY()); 139 | } else { 140 | _Scene_Map_triggerInteraction.call(this) 141 | } 142 | } 143 | 144 | 145 | Scene_Map.prototype.startRescue = function(){ 146 | var event = $gameTemp.targetEvent(); 147 | event.turnTowardCharacter($gameTemp.activeEvent()); 148 | $gameTemp.activeEvent().turnTowardCharacter(event); 149 | var a = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1] 150 | var b = $gameSystem.EventToUnit($gameTemp.targetEvent().eventId())[1] 151 | a.setRescuedBattler(b) 152 | $gameTemp.targetEvent().erase() 153 | $gameSystem.clearSrpgInteractionType(); 154 | $gameSystem.clearSrpgInteractionName(); 155 | $gameSystem.clearSrpgActorCommandStatusWindowNeedRefresh(); 156 | } 157 | 158 | Scene_Map.prototype.startDrop = function(userEvent, targetEvent, x, y){ 159 | var actor = $gameSystem.EventToUnit(userEvent.eventId())[1] 160 | targetEvent.setPosition(x, y); 161 | targetEvent.appear() 162 | actor.setRescuedBattler(false) 163 | targetEvent.turnTowardCharacter(userEvent); 164 | userEvent.turnTowardCharacter(targetEvent); 165 | $gameSystem.clearSrpgInteractionType(); 166 | targetEvent.refreshImage(); 167 | this._spriteset._characterSprites.forEach(function(sprite) { 168 | if (sprite._character === targetEvent) { 169 | sprite.show() 170 | } 171 | }); 172 | } 173 | 174 | var _Game_Event_canInteract = Game_Event.prototype.canInteract 175 | Game_Event.prototype.canInteract = function(type, name){ 176 | if (type == 'rescue'){ 177 | if (!this.isErased() && this.isType() == 'actor'){ 178 | var battlerArray = $gameSystem.EventToUnit(this.eventId()) 179 | if (battlerArray && battlerArray[1] && battlerArray[1].isAlive()){ 180 | return $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1].canRescue(battlerArray[1]) 181 | } 182 | } 183 | } else return _Game_Event_canInteract.call(this, type, name) 184 | } 185 | 186 | //deal with turn end and end srpg 187 | var shoukang_Scene_Map_isSrpgActorTurnEnd = Scene_Map.prototype.isSrpgActorTurnEnd; 188 | Scene_Map.prototype.isSrpgActorTurnEnd = function() {//the true/false here is confusing......true is not turn end, false is turn end 189 | if (!shoukang_Scene_Map_isSrpgActorTurnEnd.call(this)) return false; 190 | return $gameMap.events().some(function(event) { 191 | var battlerArray = $gameSystem.EventToUnit(event.eventId()); 192 | if (battlerArray && battlerArray[0] === 'actor' && !event.isErased() && !battlerArray[1].isRestricted()) { 193 | return battlerArray[1].canInput(); 194 | } 195 | }); 196 | }; 197 | 198 | var _Scene_Map_srpgAfterAction = Scene_Map.prototype.srpgAfterAction; 199 | Scene_Map.prototype.srpgAfterAction = function() { 200 | _Scene_Map_srpgAfterAction.call(this) 201 | $gameMap.events().forEach(function (event) { 202 | if (event.isErased() && event.isType() == 'actor'){ 203 | var battlerArray = $gameSystem.EventToUnit(event.eventId()) 204 | if (battlerArray && battlerArray[1] && battlerArray[1].isDead() && battlerArray[1].rescuedBattler()){ 205 | this.startDrop(event, battlerArray[1].rescuedBattler().event(), event.posX(), event.posY()) 206 | } 207 | } 208 | }, this); 209 | }; 210 | 211 | var _Game_System_endSRPG = Game_System.prototype.endSRPG 212 | Game_System.prototype.endSRPG = function() { 213 | $gameMap.events().forEach(function(event) { 214 | var battlerArray = $gameSystem.EventToUnit(event.eventId()); 215 | if (battlerArray && (battlerArray[0] === 'actor')) { 216 | battlerArray[1].setRescuedBattler(false) 217 | } 218 | }); 219 | _Game_System_endSRPG.call(this); 220 | }; 221 | 222 | //deal with sprites 223 | var _SRPG_Sprite_Character_setCharacterBitmap = Sprite_Character.prototype.setCharacterBitmap; 224 | Sprite_Character.prototype.setCharacterBitmap = function() { 225 | _SRPG_Sprite_Character_setCharacterBitmap.call(this); 226 | this._rescueBitmap = ImageManager.loadCharacter(_rescueSprite); 227 | }; 228 | 229 | var _SRPG_Sprite_Character_updateCharacterFrame = Sprite_Character.prototype.updateCharacterFrame; 230 | Sprite_Character.prototype.updateCharacterFrame = function() { 231 | _SRPG_Sprite_Character_updateCharacterFrame.call(this); 232 | if ($gameSystem.isSRPGMode() == true && this._character.isEvent() == true && !this._character.isErased()) { 233 | var battlerArray = $gameSystem.EventToUnit(this._character.eventId()); 234 | if (battlerArray && battlerArray[1] && battlerArray[1].rescuedBattler() && battlerArray[1].isAlive()) { 235 | if (this.previousPatternX === this.characterPatternX()) return 236 | var pw = this._rescueBitmap.width/3; 237 | var ph = this._rescueBitmap.height; 238 | var sx = this.characterPatternX() * pw; 239 | var sy = 0; 240 | this.createRescueSprite(); 241 | this._rescueSprite.bitmap = this._rescueBitmap; 242 | if (this.characterPatternX() === 0) { 243 | this._rescueSprite.visible = !this._rescueSprite.visible; 244 | } 245 | this._rescueSprite.setFrame(sx, sy, pw, ph); 246 | this.previousPatternX = this.characterPatternX() 247 | } else if (this._rescueSprite) { 248 | this.removeChild(this._rescueSprite); 249 | this._rescueSprite = null; 250 | } 251 | } else if (this._rescueSprite) { 252 | this.removeChild(this._rescueSprite); 253 | this._rescueSprite = null; 254 | } 255 | }; 256 | 257 | Sprite_Character.prototype.createRescueSprite = function() { 258 | if (!this._rescueSprite) { 259 | this._rescueSprite = new Sprite(); 260 | this._rescueSprite.anchor.x = 0.5; 261 | this._rescueSprite.anchor.y = 1; 262 | this.addChild(this._rescueSprite); 263 | } 264 | }; 265 | 266 | //Game BattlerBase 267 | Game_BattlerBase.prototype.canRescue = function(b){ 268 | var a = this 269 | if (!a.rescuedBattler() && !b.rescuedBattler() && a.isActor() && b.isActor()){ 270 | return eval(_rescueFormula) 271 | } 272 | } 273 | 274 | Game_BattlerBase.prototype.rescuedBattler = function(){ 275 | return this._rescuedBattler 276 | } 277 | 278 | Game_BattlerBase.prototype.setRescuedBattler = function(b){ 279 | this._rescuedBattler = b 280 | if (!_rescueState) return 281 | if (!b){ 282 | this.removeState(_rescueState) 283 | } else{ 284 | this.addState(_rescueState) 285 | } 286 | } 287 | 288 | })(); 289 | -------------------------------------------------------------------------------- /SRPG_ShowAoERange.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | // SRPG_ShowAoERange.js 3 | //----------------------------------------------------------------------------- 4 | //Free to use and edit v.1.06 Faster make range table performance. 5 | //============================================================================= 6 | /*: 7 | * @plugindesc The original attack range only shows the enemy/actor's default skill range. 8 | * This plugin will show attack AND AoE Range of all available skills in actor turn. 9 | * @author Shoukang 10 | * 11 | * @param AoE Color 12 | * @desc Set the color of AoE tile 13 | 14 | * https://www.w3schools.com/cssref/css_colors.asp 15 | * @type string 16 | * @default MediumVioletRed 17 | * 18 | * @param show actor AoE 19 | * @desc Also show actor's AoE. If actor has tooooo much 20 | * skills it might look ugly and have lag spikes. 21 | * @type boolean 22 | * @default false 23 | * 24 | * @help 25 | * The original attack range only shows the enemy/actor's default skill range, which doesn't provide 26 | * enough information for players to avoid AoEs and other skills. 27 | * This plugin will show attack and AoE Range of all available skills in actor's turn. 28 | * Tiles within attack range will be colored red, tiles not within attack range but within AoE range 29 | * will be colored differently. 30 | * ==================================================================================================== 31 | * v.1.06 Faster make range table performance.(The v1.03 complexity analysis is wrong) 32 | * v.1.05 Fix bug for attack skill id, fix a bug for range 0 AoE show range. 33 | * v.1.04 Fix bug for range 0 skills 34 | * v.1.03 Improved algorithm, no it's much faster! 35 | * Complexity change from O(m^2 * r^2 * a^2 * 4^3) to O((m + r)^2 * a^2 * 4^2) ! 36 | * v 1.02 add range of default srpg attack skill. Support loop map. 37 | * v 1.01 now it will check skill stype, seal, etc. 38 | * v 1.00 first release! 39 | * ==================================================================================================== 40 | * Compatibility: 41 | * Please put this plugin below SRPG_RangeControl. 42 | */ 43 | (function () { 44 | var parameters = PluginManager.parameters('SRPG_ShowAoERange'); 45 | var _AoEColor = parameters['AoE Color'] || "MediumVioletRed"; 46 | var _showActorAoE = !!eval(parameters['show actor AoE']) || false; 47 | var _noDirectionShape = { 48 | circle : true, 49 | square : true, 50 | cross : true, 51 | plus : true, 52 | star : true, 53 | checker : true 54 | } 55 | //In actor phase, show range and AoE range of all skills 56 | var _shoukangSrpgMakeMoveTable = Game_System.prototype.srpgMakeMoveTable; 57 | Game_System.prototype.srpgMakeMoveTable = function(event) { 58 | if (!$gameMap.isEventRunning() && ($gameSystem.isBattlePhase() === 'actor_phase' && 59 | $gameSystem.isSubBattlePhase() === 'normal' || $gameSystem.isBattlePhase() === 'battle_prepare')){ 60 | var user = $gameSystem.EventToUnit(event.eventId())[1]; 61 | $gameTemp.makeSearchedAoETable(); 62 | $gameTemp.clearMoveTable(); 63 | event.makeMoveTable(event.posX(), event.posY(), user.srpgMove(), null, user.srpgThroughTag()); 64 | user.skills().forEach(function(item){//all skills 65 | if (item.id === 1){ 66 | item = $dataSkills[user.attackSkillId()]; 67 | } 68 | if (!user.srpgCanShowRange(item)) return;//if not useable don't show 69 | var range = user.srpgSkillRange(item); 70 | var areaRange = Number(item.meta.srpgAreaRange) || 0; 71 | var minRange = Number(item.meta.srpgAreaMinRange) || 0; 72 | var shape = item.meta.srpgAreaType || 'circle'; 73 | var canDrawAoE = event.canDrawAoE(areaRange); 74 | 75 | $gameTemp.moveList().some(function(pos) {//all reachable tiles 76 | var x = pos[0]; 77 | var y = pos[1]; 78 | if (!$gameMap.isOccupied(x, y)) { 79 | if (canDrawAoE) event.makeAoETable(x, y, range, null, item, areaRange, minRange, shape, user);//if skill is AoE use this function 80 | else event.makeRangeTable(x, y, range, null, x, y, item); 81 | } 82 | return item.meta.notUseAfterMove // if cannot move before attacking,return after processed the origin. 83 | }); 84 | }); 85 | $gameTemp.convertRangeList($gameMap.width(), $gameMap.height()); 86 | $gameTemp.pushRangeListToMoveList(); 87 | } else{ 88 | _shoukangSrpgMakeMoveTable.call(this, event); 89 | } 90 | }; 91 | 92 | Game_CharacterBase.prototype.makeRangeTable = function(x, y, range, unused, oriX, oriY, skill) { 93 | var user = $gameSystem.EventToUnit(this.eventId())[1]; 94 | if (!skill || !user) return; 95 | var minRange = user.srpgSkillMinRange(skill); 96 | var edges = []; 97 | var searched = []; 98 | for (var i = 0; i < $dataMap.width; i++) { 99 | searched[i] = []; 100 | } 101 | if (range > 0) edges = [[x, y, range, [0], []]]; 102 | if (minRange <= 0 && $gameTemp.RangeTable(x, y)[0] < 0) { 103 | if ($gameTemp.MoveTable(x, y)[0] < 0) $gameTemp.pushRangeList([x, y, true]); 104 | $gameTemp.setRangeTable(x, y, range, [0]); 105 | $gameTemp.addRangeMoveTable(x, y, x, y); 106 | } 107 | $gameMap.makeSrpgLoSTable(this); 108 | 109 | for (var i = 0; i < edges.length; i++) { 110 | var cell = edges[i]; 111 | var drange = cell[2] - 1; 112 | if (searched[cell[0]][cell[1]]) continue; 113 | searched[cell[0]][cell[1]] = true; 114 | for (var d = 2; d < 10; d += 2) { 115 | if (cell[4][d] == 1) continue; 116 | if (!this.srpgRangeCanPass(cell[0], cell[1], d)) continue; 117 | var dx = $gameMap.roundXWithDirection(cell[0], d); 118 | var dy = $gameMap.roundYWithDirection(cell[1], d); 119 | var route = cell[3].concat(d); 120 | var forward = cell[4].slice(0); 121 | forward[10-d] = 1; 122 | if (drange > 0) edges.push([dx, dy, drange, route, forward]); 123 | 124 | if ($gameMap.distTo(x, y, dx, dy) >= minRange && this.srpgRangeExtention(dx, dy, x, y, skill, range)) { 125 | if ($gameTemp.RangeTable(dx, dy)[0] < 0) { 126 | $gameTemp.setRangeTable(dx, dy, drange, route); 127 | if ($gameTemp.MoveTable(dx, dy)[0] < 0) $gameTemp.pushRangeList([dx, dy, true]); 128 | } 129 | $gameTemp.addRangeMoveTable(dx, dy, x, y); 130 | } 131 | } 132 | } 133 | }; 134 | 135 | //for each tile in attack range, make AoE Table 136 | Game_CharacterBase.prototype.makeAoETable = function(x, y, range, unused, skill, areaRange, areaminRange, shape, user) { 137 | if (!skill || !user) return; 138 | var minRange = user.srpgSkillMinRange(skill); 139 | var width = $gameMap.width(); 140 | var height = $gameMap.height(); 141 | var edges = [[x, y, range, [0], []]]; 142 | var searched = []; 143 | for (var i = 0; i < $dataMap.width; i++) { 144 | searched[i] = []; 145 | } 146 | if (minRange <= 0 && $gameTemp.RangeTable(x, y)[0] < 0) { 147 | if ($gameTemp.MoveTable(x, y)[0] < 0) $gameTemp.pushRangeList([x, y, true]); 148 | $gameTemp.setRangeTable(x, y, range, [0]); 149 | } 150 | if (range == 0) return $gameTemp.setAoETable(x, y, areaRange, areaminRange, shape, d, skill, range, [0]); 151 | $gameMap.makeSrpgLoSTable(this); 152 | for (var i = 0; i < edges.length; i++) { 153 | var cell = edges[i]; 154 | var drange = cell[2] - 1; 155 | if (searched[cell[0]][cell[1]]) continue; 156 | searched[cell[0]][cell[1]] = true; 157 | for (var d = 2; d < 10; d += 2) { 158 | if (cell[4][d] === 1) continue; 159 | if (!this.srpgRangeCanPass(cell[0], cell[1], d)) continue; 160 | var dx = $gameMap.roundXWithDirection(cell[0], d); 161 | var dy = $gameMap.roundYWithDirection(cell[1], d); 162 | var route = cell[3].concat(d); 163 | var forward = cell[4].slice(0); 164 | forward[10-d] = 1; 165 | if (drange > 0) edges.push([dx, dy, drange, route, forward]); 166 | if ($gameMap.distTo(x, y, dx, dy) >= minRange && this.srpgRangeExtention(dx, dy, x, y, skill, range)) { 167 | $gameTemp.setAoETable(dx, dy, areaRange, areaminRange, shape, d, skill, drange, route); 168 | } 169 | } 170 | } 171 | }; 172 | 173 | //if AoE is in area set attack flag as 'AoE' (AoE) 174 | Game_Temp.prototype.setAoETable = function(dx, dy, aMax, aMin, shape, d, skill, drange, route) { 175 | if (this.isAoESearched(dx, dy, skill, d, shape)) return; 176 | $gameTemp.setAoESearched(dx, dy, skill, d, shape); 177 | if (this.RangeTable(dx, dy)[0] < 0 || this.RangeTable(dx, dy)[1] === 'AoE') { 178 | this.setRangeTable(dx, dy, drange, route); 179 | if (this.MoveTable(dx, dy)[0] < 0) { 180 | this.pushRangeList([dx, dy, true]); 181 | } 182 | } 183 | 184 | var width = $gameMap.width(); 185 | var height = $gameMap.height(); 186 | var rlim = 1 + aMax * 2; 187 | for (var m = 0; m < rlim; ++m) { 188 | for (var n =0; n < rlim; ++n) { 189 | var aoex = $gameMap.roundX(dx + m - aMax); 190 | var aoey = $gameMap.roundY(dy + n - aMax); 191 | if ($gameMap.isValid(aoex, aoey) && this.RangeTable(aoex, aoey)[0] < 0 && 192 | $gameMap.inArea(m-aMax, n-aMax, aMax, aMin, shape, d)) { 193 | this.setRangeTable(aoex, aoey, - 1, 'AoE'); 194 | } 195 | } 196 | } 197 | }; 198 | 199 | Game_Temp.prototype.makeSearchedAoETable = function(){ 200 | this._searchedAoETable = []; 201 | for (var i = 0; i < $dataMap.width; i++) { 202 | var vartical = []; 203 | for (var j = 0; j < $dataMap.height; j++) { 204 | vartical[j] = [-1,-1,-1,-1]; 205 | } 206 | this._searchedAoETable[i] = vartical; 207 | } 208 | //console.log(this._searchedAoETable) 209 | } 210 | 211 | Game_Temp.prototype.isAoESearched = function(dx, dy, skill, d, shape) { 212 | return this._searchedAoETable[dx][dy][d/2 - 1] === skill.id; 213 | }; 214 | 215 | Game_Temp.prototype.setAoESearched = function(dx, dy, skill, d, shape) { 216 | var id = skill.id 217 | if (_noDirectionShape[shape]){ 218 | this._searchedAoETable[dx][dy] = [id, id, id, id]; 219 | } else { 220 | this._searchedAoETable[dx][dy][d/2 - 1] = id; 221 | } 222 | }; 223 | 224 | //make AoE range list according to Rangetable 225 | Game_Temp.prototype.convertRangeList = function(width, height){ 226 | for (var i = 0; i < width; ++i){ 227 | for (var j = 0; j < height; ++j){ 228 | if (this.RangeTable(i, j)[1] === 'AoE') this.pushRangeList([i, j, 'AoE']); 229 | } 230 | } 231 | }; 232 | 233 | Game_Actor.prototype.srpgCanShowRange = function(skill){ 234 | //console.log(skill.id == this.attackSkillId(), this.addedSkillTypes().includes(skill.stypeId), skill.stypeId !== 0, Game_BattlerBase.prototype.srpgCanShowRange.call(this, skill)) 235 | if (skill.id == this.attackSkillId() || (this.addedSkillTypes().includes(skill.stypeId) && skill.stypeId !== 0)){ 236 | return Game_BattlerBase.prototype.srpgCanShowRange.call(this, skill); 237 | } else return false; 238 | }; 239 | 240 | Game_BattlerBase.prototype.srpgCanShowRange = function(skill){ 241 | return (this.isSkillWtypeOk(skill) && this.canPaySkillCost(skill) && 242 | !this.isSkillSealed(skill.id) && !this.isSkillTypeSealed(skill.stypeId)); 243 | }; 244 | 245 | Game_Event.prototype.canDrawAoE = function(areaRange){ 246 | return areaRange > 0 && (_showActorAoE === true || this.isType() == 'enemy') 247 | }; 248 | 249 | //fill AoE tiles with color 250 | Sprite_SrpgMoveTile.prototype.setThisMoveTile = function(x, y, attackFlag) { 251 | this._frameCount = 0; 252 | this._posX = x; 253 | this._posY = y; 254 | if (attackFlag === true) this.bitmap.fillAll('red'); 255 | else if (attackFlag === false) this.bitmap.fillAll('blue'); 256 | else if (attackFlag === 'AoE') this.bitmap.fillAll(_AoEColor); 257 | }; 258 | 259 | if (!Game_Enemy.prototype.skills) { 260 | Game_Enemy.prototype.skills = function() { 261 | var skills = [] 262 | for (var i = 0; i < this.enemy().actions.length; ++i) { 263 | var skill = $dataSkills[this.enemy().actions[i].skillId]; 264 | if (skill) skills.push(skill); 265 | } 266 | return skills; 267 | } 268 | }; 269 | 270 | Game_Map.prototype.isOccupied = function(x, y){ 271 | return $gameMap.events().some(function(otherEvent) { 272 | return otherEvent.pos(x, y) && otherEvent.eventId() !== $gameTemp.activeEvent().eventId() && !otherEvent.isThrough() && 273 | !otherEvent.isErased() && (['enemy', 'actor', 'playerEvent'].contains(otherEvent.isType())); 274 | }); 275 | }; 276 | 277 | })(); 278 | -------------------------------------------------------------------------------- /SRPG_Summon.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | //SRPG_Summon.js 3 | //============================================================================= 4 | /*: 5 | * @plugindesc Allow you to summon/enemy/objects during SRPG battle. v 1.06 Fix a bug for equip window not showing the right actor. 6 | * @author Shoukang 7 | * 8 | * @param Summon Map Id 9 | * @desc the map Id for summon events 10 | * @type number 11 | * @default 1 12 | * 13 | * @param summon appear Animation Id 14 | * @desc appear animation for wrap skill, input 0 to disable 15 | * @default 52 16 | * 17 | * @param summon disappear Animation Id 18 | * @desc disappear animation for wrap skill, input 0 to disable 19 | * @default 52 20 | * 21 | * @help 22 | * 23 | * This plugin allow you to summon events which are copy of events from the summon map (the map with Summon Map Id). 24 | * You need to place all the type of events you want to summon in the summon map. 25 | * Summon units on unpassable tiles will be ignored. 26 | * 27 | * Although summoning battlers just need an empty event to refer to, this mechanism could be very helpful for summoning 28 | * objects. You can even use this plugin to summon objects out of an SRPG battle!(summoned events will not be memorized) 29 | * 30 | * You don't need any place holder event to summon. A new event will be created, which have the event id = 31 | * $gameMap.nextEventId() (this is before the summon, after summon the length will of course increase by 1). 32 | * 33 | * By calling a common event in your skill effect, you can summon multiple same actors/enemies/objects, set their level, 34 | * their life span, etc. Please read the script calls for more information. 35 | * 36 | * =================================================================================================== 37 | * Compatibility: 38 | * Need Dr.Q's SRPG_PositionEffect plugin to use the note tag so that you can target an empty cell. 39 | * Need SRPG_AoE in my bug fix patch if you use AoE summon. It fixed a bug for aoe cellTarget. 40 | * However the enemy still won't know how to cast skill without a target. 41 | * =================================================================================================== 42 | * script calls: 43 | * 44 | * this.summon(type, summonId, battlerId, level, turn, x, y); 45 | * type: can be 'actor', 'enemy', or 'object', or other valid types. 46 | * summonId: the id of the event that you are going to copy from the Summon Map. 47 | * battlerId: the id of actor/enemy. 48 | * level: the level of summoned actor, default is initial level of actor. 49 | * turn: the life span of this event. After this number of turns the event will disappear. default is infinite. 50 | * x: x position, default is $gamePlayer.posX(); 51 | * y: y position, default is $gamePlayer.posY(); 52 | * 53 | * If you want to use the default vaule of a parameter, or a parameter is not needed for your summon and 54 | * you are not sure what to put, simply use undefined (do not add '') as a place holder. 55 | * 56 | * For example, this.summon('actor', 1, 2, undefined, undefined, 5, 6); will summon actor 2 at postion (5, 6), 57 | * the event is a copy of event id 1 in the summon map. 58 | * You can use var a = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1] to store the active battler as a 59 | * variable a. Then you can use a.mat, a.level and other formulars to determine summoned batter level and summon turns. 60 | * For example this.summon('actor', 1, 2, a.level, a.mat/10) 61 | * 62 | * this.AoESummon(type, summonId, battlerId, level, turn); 63 | * Same, use this for an AoE summon skill to summon multiple units. 64 | * 65 | * $gameParty.existingMemberNumber(); 66 | * gives the number of alive party members, which doesn't take summoned actors into consideration. 67 | * Can be used to check game end condition. 68 | * =================================================================================================== 69 | * v 1.06 Fix a bug for equip window not showing the right actor. 70 | * v 1.05 Fix a bug for sprite overlay. 71 | * v 1.04 Fix a bug for wrong action subject. 72 | * v 1.03 fix a bug where summoned battlers disappear after save & load. 73 | * v 1.02 can summon events above or below a battler.(for the use of summon magic circles)!However it's not allowed to summon multiply magic circles on the same tile. 74 | * v 1.01 add aoe summon, fix bugs, enable more summon event types. 75 | * v 1.00 First Release 76 | */ 77 | 78 | (function () { 79 | //================================================================================================= 80 | //Plugin Parameters 81 | //================================================================================================= 82 | var parameters = PluginManager.parameters('SRPG_Summon'); 83 | var _SummonMapId = Number(parameters['Summon Map Id']) || 1; 84 | var _appearAnimation = Number(parameters['summon appear Animation Id']) || 0; 85 | var _disappearAnimation = Number(parameters['summon disappear Animation Id']) || 0; 86 | 87 | var coreParameters = PluginManager.parameters('SRPG_core'); 88 | var _existActorVarID = Number(coreParameters['existActorVarID'] || 1); 89 | var _existEnemyVarID = Number(coreParameters['existEnemyVarID'] || 2); 90 | 91 | //$dataSummon is the global variable that stores the summon Map data. 92 | DataManager.loadSummonData = function(mapId) { 93 | if (mapId > 0) { 94 | var filename = 'Map%1.json'.format(mapId.padZero(3)); 95 | this._mapLoader = ResourceHandler.createLoader('data/' + filename, this.loadDataFile.bind(this, '$dataSummon', filename)); 96 | this.loadDataFile('$dataSummon', filename); 97 | } else { 98 | this.makeEmptyMap(); 99 | } 100 | }; 101 | 102 | var _DataManager_onLoad = DataManager.onLoad 103 | DataManager.onLoad = function(object) { 104 | _DataManager_onLoad.call(this, object); 105 | if (object === $dataSummon) { 106 | this.extractMetadata(object); 107 | for (var i = 0; i < object.events.length; i++) { 108 | var data = object.events[i]; 109 | if (data && data.note !== undefined) { 110 | this.extractMetadata(data); 111 | } 112 | } 113 | } 114 | }; 115 | 116 | //load the summon data while loading this plugin. 117 | DataManager.loadSummonData(_SummonMapId); 118 | 119 | Game_Interpreter.prototype.AoESummon = function(type, summonId, battlerId, level, turn){ 120 | var aoe = $gameTemp._activeAoE; 121 | var rlim = 1 + aoe.size * 2; 122 | for (var m = 0; m < rlim; ++m) { 123 | for (var n =0; n < rlim; ++n) { 124 | var x = $gameMap.roundX($gamePlayer.posX() + m - aoe.size); 125 | var y = $gameMap.roundY($gamePlayer.posY() + n - aoe.size); 126 | if ($gameMap.isValid(x, y) && $gameMap.inArea(m-aoe.size, n-aoe.size, aoe.size, aoe.minSize, aoe.shape, aoe.dir)) { 127 | this.summon(type, summonId, battlerId, level, turn, x, y); 128 | } 129 | } 130 | } 131 | } 132 | 133 | //script call 134 | Game_Interpreter.prototype.summon = function(type, summonId, battlerId, level, turn, x, y){ 135 | if (x === undefined) x = $gamePlayer.posX(); 136 | if (y === undefined) y = $gamePlayer.posY(); 137 | if (!turn) turn = 10000;//Number.POSITIVE_INFINITY; 138 | if (!$gameMap.canSummon(type, summonId, battlerId,x,y)) return; 139 | if ($gameTemp.activeEvent() && $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())){ 140 | $gameTemp.activeEvent().turnTowardCharacter($gamePlayer); 141 | var summoner = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]; 142 | } else { 143 | var summoner = null; 144 | } 145 | var eventId = $gameMap.nextEventId(); 146 | var summonEvent = new Game_SummonEvent($gameMap.mapId(), eventId, summonId, summoner, turn, x, y); 147 | $gameMap.addEvent(summonEvent); 148 | if (type == 'actor'){ 149 | this.addSummonActor(eventId, battlerId, level); 150 | } else if (type == 'enemy'){ 151 | this.addSummonEnemy(eventId, battlerId); 152 | } else summonEvent.setType(type); 153 | 154 | if (SceneManager._scene instanceof Scene_Map){ 155 | var sprite = new Sprite_Character(summonEvent) 156 | SceneManager._scene._spriteset._characterSprites.push(sprite) 157 | SceneManager._scene._spriteset._tilemap.addChild(sprite) 158 | } 159 | summonEvent.requestAnimation(_appearAnimation); 160 | } 161 | 162 | Game_Interpreter.prototype.addSummonActor = function(eventId, actorId, level) { 163 | var actor_unit = new Game_Actor(actorId); 164 | var event = $gameMap.event(eventId); 165 | actor_unit.setSummoner(event.summoner()); 166 | if (level){ 167 | actor_unit.changeLevel(level, false); 168 | actor_unit.recoverAll(); 169 | } 170 | actor_unit.initTp(); //TPを初期化 171 | var bitmap = ImageManager.loadFace(actor_unit.faceName()); //顔グラフィックをプリロードする 172 | $gameSystem.setEventToUnit(event.eventId(), 'actor', actor_unit); 173 | event.setType('actor'); 174 | actor_unit.setBattleMode('normal'); 175 | $gameMap.setEventImages(); 176 | $gameSystem.pushSrpgAllActors(event.eventId());//add or not? 177 | var oldValue = $gameVariables.value(_existActorVarID); 178 | $gameVariables.setValue(_existActorVarID, oldValue + 1); 179 | return actor_unit; 180 | }; 181 | 182 | Game_Interpreter.prototype.addSummonEnemy = function(eventId, enemyId) { 183 | var enemy_unit = new Game_Enemy(enemyId, 0, 0); 184 | var event = $gameMap.event(eventId); 185 | enemy_unit.setSummoner(event.summoner()); 186 | enemy_unit.initTp(); //TPを初期化 187 | var faceName = enemy_unit.enemy().meta.faceName; //顔グラフィックをプリロードする 188 | if (faceName) { 189 | var bitmap = ImageManager.loadFace(faceName); 190 | } else if ($gameSystem.isSideView()) { 191 | var bitmap = ImageManager.loadSvEnemy(enemy_unit.battlerName(), enemy_unit.battlerHue()); 192 | } else { 193 | var bitmap = ImageManager.loadEnemy(enemy_unit.battlerName(), enemy_unit.battlerHue()); 194 | } 195 | $gameSystem.setEventToUnit(event.eventId(), 'enemy', enemy_unit); 196 | event.setType('enemy'); 197 | enemy_unit.setBattleMode('normal'); 198 | $gameMap.setEventImages(); 199 | var oldValue = $gameVariables.value(_existEnemyVarID); 200 | $gameVariables.setValue(_existEnemyVarID, oldValue + 1); 201 | return true; 202 | }; 203 | 204 | //summon validity 205 | Game_Map.prototype.canSummon = function(type, summonId, battlerId, x, y) { 206 | if (!$gameMap.isValid(x,y)) return; 207 | if (type == 'actor' || type == 'enemy') { 208 | if (!$gameMap.positionIsOpen(x, y)) return; 209 | //var battler = (type == 'actor' ? $gameActors.actor(battlerId) : new Game_Enemy(battlerId, 0, 0)); 210 | //if ($gameMap.terrainTag(x, y) <= battler.srpgThroughTag()) return true; 211 | return $gameMap.fourDirectionPassable(x, y); 212 | } 213 | var priority = $dataSummon.events[summonId].pages[0].priorityType; 214 | return $gameMap.eventsXyNt(x, y).every(function(event) { 215 | return event._priorityType != priority; 216 | }); 217 | }; 218 | 219 | Game_Map.prototype.fourDirectionPassable = function(x, y) { 220 | for (var d = 2; d < 10; d+=2){ 221 | if (!this.isPassable(x, y, d)) return false; 222 | } 223 | return true; 224 | }; 225 | 226 | Game_System.prototype.EventToUnit = function(event_id) { 227 | var battlerArray = this._EventToUnit[event_id]; 228 | if (!battlerArray) return; 229 | if ((typeof battlerArray[1]) === 'number') { 230 | var actor = $gameActors.actor(battlerArray[1]); 231 | return [battlerArray[0], actor] 232 | } else { 233 | return battlerArray; 234 | } 235 | }; 236 | 237 | Game_System.prototype.updateEnemySummonedEvents = function(){ 238 | $gameMap.events().forEach(function(event) { 239 | if (event instanceof Game_SummonEvent && !event.isErased()) { 240 | if (event.summoner() && event.summoner().isEnemy()) event.updateTurns(); 241 | } 242 | }); 243 | } 244 | 245 | Game_System.prototype.updateActorSummonedEvents = function(){ 246 | $gameMap.events().forEach(function(event) { 247 | if (event instanceof Game_SummonEvent && !event.isErased()) { 248 | if (event.summoner() && event.summoner().isActor()) event.updateTurns(); 249 | } 250 | }); 251 | } 252 | 253 | var _Game_System_srpgStartActorTurn = Game_System.prototype.srpgStartActorTurn; 254 | Game_System.prototype.srpgStartActorTurn = function(){ 255 | _Game_System_srpgStartActorTurn.call(this); 256 | this.updateActorSummonedEvents(); 257 | } 258 | 259 | var _Game_System_srpgStartEnemyTurn = Game_System.prototype.srpgStartEnemyTurn; 260 | Game_System.prototype.srpgStartEnemyTurn = function(){ 261 | _Game_System_srpgStartEnemyTurn.call(this); 262 | this.updateEnemySummonedEvents(); 263 | } 264 | 265 | Game_System.prototype.refreshSrpgAllActors = function() { 266 | for (i = this._srpgAllActors.length-1; i >= 0; i--){ 267 | var actor = $gameSystem.EventToUnit(this._srpgAllActors[i])[1]; 268 | if (actor.isDead() && actor.isSummonedBattler()){ 269 | this._srpgAllActors.splice(i, 1); 270 | } 271 | } 272 | }; 273 | 274 | var _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow; 275 | Scene_Menu.prototype.createCommandWindow = function() { 276 | if ($gameSystem.isSRPGMode() == true && $gameSystem.isBattlePhase() !== 'battle_prepare') { 277 | $gameSystem.refreshSrpgAllActors(); 278 | } 279 | _Scene_Menu_createCommandWindow.call(this); 280 | }; 281 | 282 | Game_Party.prototype.existingMemberNumber = function() { 283 | var existingMembers = this.allmembers().filter(function(member) { 284 | return member.isAlive() && !member.isSummonedBattler(); 285 | }); 286 | return existingMembers.length 287 | } 288 | 289 | var _Game_Party_menuActor = Game_Party.prototype.menuActor 290 | Game_Party.prototype.menuActor = function() { 291 | if ($gameSystem.isSRPGMode() && this._menuActor){ 292 | if (!this.members().contains(this._menuActor)) { 293 | this._menuActor = this.members()[0]; 294 | } 295 | return this._menuActor; 296 | } else return _Game_Party_menuActor.call(this); 297 | }; 298 | 299 | var _Game_Party_setMenuActor = Game_Party.prototype.setMenuActor 300 | Game_Party.prototype.setMenuActor = function(actor) { 301 | _Game_Party_setMenuActor.call(this, actor); 302 | if ($gameSystem.isSRPGMode()) this._menuActor = actor; 303 | }; 304 | 305 | Game_Map.prototype.addEvent = function(event){ 306 | this._events.push(event) 307 | } 308 | 309 | Game_Map.prototype.nextEventId = function(){ 310 | return this._events.length; 311 | } 312 | 313 | Game_Battler.prototype.summoner = function(){ 314 | return this._summoner; 315 | } 316 | 317 | Game_Battler.prototype.isSummonedBattler = function(){ 318 | return this._summoner !== undefined; 319 | } 320 | 321 | Game_Battler.prototype.setSummoner = function(battler){ 322 | this._summoner = battler; 323 | } 324 | 325 | var _Game_Actor_event = Game_Actor.prototype.event 326 | Game_Actor.prototype.event = function() { 327 | if (this.isSummonedBattler()){ 328 | return Game_BattlerBase.prototype.event.call(this); 329 | } else return _Game_Actor_event.call(this); 330 | }; 331 | 332 | //the original set subject and subject makes no sense. 333 | var _Game_Action_setSubject = Game_Action.prototype.setSubject; 334 | Game_Action.prototype.setSubject = function(subject) { 335 | _Game_Action_setSubject.call(this, subject); 336 | this._subject = subject; 337 | }; 338 | 339 | var _Game_Action_subject = Game_Action.prototype.subject; 340 | Game_Action.prototype.subject = function() { 341 | return this._subject; 342 | }; 343 | 344 | Game_SummonEvent = function() { 345 | this.initialize.apply(this, arguments); 346 | } 347 | 348 | Game_SummonEvent.prototype = Object.create(Game_Event.prototype); 349 | Game_SummonEvent.prototype.constructor = Game_SummonEvent; 350 | 351 | Game_SummonEvent.prototype.initialize = function(mapId, eventId, summonEventId, summoner, turn, x, y) { 352 | Game_Character.prototype.initialize.call(this); 353 | this._mapId = mapId; 354 | this._eventId = eventId; 355 | this._summonEventId = summonEventId; 356 | this._summoner = summoner; 357 | this._turns = turn; 358 | this.locate(x, y); 359 | this.refresh(); 360 | }; 361 | 362 | Game_SummonEvent.prototype.event = function() { 363 | return $dataSummon.events[this._summonEventId]; 364 | }; 365 | 366 | Game_SummonEvent.prototype.summoner = function() { 367 | return this._summoner; 368 | }; 369 | 370 | Game_SummonEvent.prototype.updateTurns = function() { 371 | if (this._turns < 10000) this._turns -=1; 372 | if (this._turns <= 0){ 373 | var battleArray = $gameSystem.EventToUnit(this.eventId()) 374 | if (battleArray && battleArray[1] && battleArray[1].isAlive()){ 375 | battleArray[1].addState(battleArray[1].deathStateId()) 376 | if (battleArray[1].isActor()) { 377 | var oldValue = $gameVariables.value(_existActorVarID); 378 | $gameVariables.setValue(_existActorVarID, oldValue - 1); 379 | } else { 380 | var oldValue = $gameVariables.value(_existEnemyVarID); 381 | $gameVariables.setValue(_existEnemyVarID, oldValue - 1); 382 | } 383 | } 384 | this.requestAnimation(_disappearAnimation); 385 | this.erase(); 386 | } 387 | }; 388 | 389 | })(); 390 | -------------------------------------------------------------------------------- /SRPG_TerrainEffectWindow.js: -------------------------------------------------------------------------------- 1 | //==================================================================================================================== 2 | // SRPG_TerrainEffectWindow.js 3 | //-------------------------------------------------------------------------------------------------------------------- 4 | // free to use and edit V1.00 First Release 5 | //==================================================================================================================== 6 | /*: 7 | * @plugindesc Add a terrain effect information window on the scene. 8 | * @author Shoukang 9 | * 10 | * @param width for each effect 11 | * @desc the width it takes to display each effect 12 | * @type number 13 | * @default 147 14 | * 15 | * @param max effects 16 | * @desc maximum effects that can be displayed, relates to the width of terrain effect window 17 | * @type number 18 | * @default 4 19 | * 20 | * @param min effects 21 | * @desc minimum effects that will be displayed, relates to the width of terrain effect window 22 | * @type number 23 | * @default 2 24 | * 25 | * @param text no effect 26 | * @desc when effects < minimun effects, fill the blank with this 27 | * @type string 28 | * @default -- 29 | * 30 | * @param buff color 31 | * @desc color index for a buff terrain effect 32 | * @type number 33 | * @default 29 34 | * 35 | * @param debuff color 36 | * @desc color index for a debuff terrain effect 37 | * @type number 38 | * @default 18 39 | * 40 | * @help 41 | * 42 | * This plugin allows you to visualize the terrain effect from SRPG_TerrainEffect. 43 | * ========================================================================================================================== 44 | * Compatibility: 45 | * Need SRPG_TerrainEffect. 46 | * put below SRPG_TerrainEffect and SRPG_AoE. 47 | * ========================================================================================================================= 48 | * v1.00 first release! 49 | */ 50 | (function(){ 51 | var params = PluginManager.parameters('SRPG_TerrainEffectWindow'); 52 | var _widthEach = Number(params['width for each effect'] || 147); 53 | var _max = Number(params['max effects'] || 2); 54 | var _min = Number(params['min effects'] || 0); 55 | var _noEffect = params['text no effect'] || '--'; 56 | var _buffColor = Number(params['buff color'] || 29); 57 | var _debuffColor = Number(params['debuff color'] || 18); 58 | 59 | var parameters = PluginManager.parameters('SRPG_TerrainEffect'); 60 | var paramModList = []; 61 | var xparamModList = []; 62 | var sparamModList = []; 63 | for (var tagId = 0; tagId < 8; tagId++) { 64 | paramModList[tagId] = []; 65 | xparamModList[tagId] = []; 66 | sparamModList[tagId] = []; 67 | paramModList[tagId][0] = 0; 68 | paramModList[tagId][1] = 0; 69 | paramModList[tagId][2] = Number(parameters['Tag_' + tagId + '_Mod:ATK'] || 0); 70 | paramModList[tagId][3] = Number(parameters['Tag_' + tagId + '_Mod:DEF'] || 0); 71 | paramModList[tagId][4] = Number(parameters['Tag_' + tagId + '_Mod:MAT'] || 0); 72 | paramModList[tagId][5] = Number(parameters['Tag_' + tagId + '_Mod:MDF'] || 0); 73 | paramModList[tagId][6] = Number(parameters['Tag_' + tagId + '_Mod:AGI'] || 0); 74 | paramModList[tagId][7] = Number(parameters['Tag_' + tagId + '_Mod:LUK'] || 0); 75 | xparamModList[tagId][0] = Number(parameters['Tag_' + tagId + '_Mod:HIT'] || 0.0); 76 | xparamModList[tagId][1] = Number(parameters['Tag_' + tagId + '_Mod:EVA'] || 0.0); 77 | xparamModList[tagId][2] = Number(parameters['Tag_' + tagId + '_Mod:CRI'] || 0.0); 78 | xparamModList[tagId][3] = Number(parameters['Tag_' + tagId + '_Mod:CEV'] || 0.0); 79 | xparamModList[tagId][4] = Number(parameters['Tag_' + tagId + '_Mod:MEV'] || 0.0); 80 | xparamModList[tagId][5] = Number(parameters['Tag_' + tagId + '_Mod:MRF'] || 0.0); 81 | xparamModList[tagId][6] = Number(parameters['Tag_' + tagId + '_Mod:CNT'] || 0.0); 82 | xparamModList[tagId][7] = Number(parameters['Tag_' + tagId + '_Mod:HRG'] || 0.0); 83 | xparamModList[tagId][8] = Number(parameters['Tag_' + tagId + '_Mod:MRG'] || 0.0); 84 | xparamModList[tagId][9] = Number(parameters['Tag_' + tagId + '_Mod:TRG'] || 0.0); 85 | sparamModList[tagId][0] = Number(parameters['Tag_' + tagId + '_Mod:TGR'] || 1.0); 86 | sparamModList[tagId][1] = Number(parameters['Tag_' + tagId + '_Mod:GRD'] || 1.0); 87 | sparamModList[tagId][2] = Number(parameters['Tag_' + tagId + '_Mod:REC'] || 1.0); 88 | sparamModList[tagId][3] = Number(parameters['Tag_' + tagId + '_Mod:PHA'] || 1.0); 89 | sparamModList[tagId][4] = Number(parameters['Tag_' + tagId + '_Mod:MCR'] || 1.0); 90 | sparamModList[tagId][5] = Number(parameters['Tag_' + tagId + '_Mod:TCR'] || 1.0); 91 | sparamModList[tagId][6] = Number(parameters['Tag_' + tagId + '_Mod:PDR'] || 1.0); 92 | sparamModList[tagId][7] = Number(parameters['Tag_' + tagId + '_Mod:MDR'] || 1.0); 93 | sparamModList[tagId][8] = Number(parameters['Tag_' + tagId + '_Mod:FDR'] || 1.0); 94 | sparamModList[tagId][9] = Number(parameters['Tag_' + tagId + '_Mod:EXR'] || 1.0); 95 | } 96 | var paramWordList = ['MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', 'LUK']; 97 | var xparamWordList = ['HIT', 'EVA', 'CRI', 'CEV', 'MEV', 'MRF', 'CNT', 'HRG', 'MRG', 'TRG']; 98 | var sparamWordList = ['TGR', 'GRD', 'REC', 'PHA', 'MCR', 'TCR', 'PDR', 'MDR', 'FDR', 'EXR']; 99 | 100 | var _SRPG_SceneMap_createAllWindows = Scene_Map.prototype.createAllWindows; 101 | Scene_Map.prototype.createAllWindows = function() { 102 | this.createSrpgTerrainEffectWindow(); 103 | _SRPG_SceneMap_createAllWindows.call(this); 104 | }; 105 | 106 | Scene_Map.prototype.createSrpgTerrainEffectWindow = function() { 107 | this._mapSrpgTerrainEffectWindow = new Window_SrpgTerrainEffect(0, 0); 108 | this._mapSrpgTerrainEffectWindow.x = Graphics.boxWidth - this._mapSrpgTerrainEffectWindow.windowWidth(); 109 | this._mapSrpgTerrainEffectWindow.y = 0; 110 | this._mapSrpgTerrainEffectWindow.openness = 0; 111 | this.addWindow(this._mapSrpgTerrainEffectWindow); 112 | }; 113 | 114 | window.Window_SrpgTerrainEffect = function() { 115 | this.initialize.apply(this, arguments); 116 | } 117 | 118 | Window_SrpgTerrainEffect.prototype = Object.create(Window_Base.prototype); 119 | Window_SrpgTerrainEffect.prototype.constructor = Window_SrpgTerrainEffect; 120 | 121 | Window_SrpgTerrainEffect.prototype.initialize = function(x, y) { 122 | this._effectCount = 0; 123 | var width = this.windowWidth(); 124 | var height = this.windowHeight(); 125 | Window_Base.prototype.initialize.call(this, x, y, width, height); 126 | this.refresh(); 127 | }; 128 | 129 | Window_SrpgTerrainEffect.prototype.windowWidth = function() { 130 | //if (this._effectCount == 0) return 0; 131 | return _widthEach; 132 | }; 133 | 134 | Window_SrpgTerrainEffect.prototype.windowHeight = function() { 135 | return this.fittingHeight(Math.min(Math.max(_min, this._effectCount), _max)); 136 | }; 137 | 138 | // Window_SrpgTerrainEffect.prototype.loadWindowskin = function() { 139 | // this._windowskinName = _skin; 140 | // this.windowskin = ImageManager.loadSystem(this._windowskinName); 141 | // }; 142 | 143 | Window_SrpgTerrainEffect.prototype.refresh = function() { 144 | var tagId = $gameMap.terrainTag($gamePlayer.posX(), $gamePlayer.posY()); 145 | this._effectCount = 0; 146 | var hasUnit = $gameTemp.activeEvent() && $gameSystem.EventToUnit($gameTemp.activeEvent().eventId()); 147 | var unitData = undefined; 148 | if (hasUnit) { 149 | var unit = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]; 150 | if (unit.isActor()) unitData = unit.currentClass(); 151 | if (unit.isEnemy()) unitData = unit.enemy(); 152 | } 153 | if (this._tagId !== tagId || this._unitData !== unitData){ 154 | this._tagId = tagId; 155 | this._unitData = unitData; 156 | this.contents.clear(); 157 | this.updatePlacement(); 158 | this.drawContents(); 159 | } 160 | }; 161 | 162 | Window_SrpgTerrainEffect.prototype.drawContents = function() { 163 | this._textCount = 0; 164 | if (this._effectCount !== 0){ 165 | this.drawParamValue(paramModList, paramWordList); 166 | this.drawParamValue(xparamModList, xparamWordList); 167 | this.drawParamValue(sparamModList, sparamWordList); 168 | } 169 | this.resetTextColor(); 170 | for (var i = this._textCount; i < _min; i++){ 171 | this.drawText(_noEffect, 0, i * this.lineHeight(), _widthEach - 2 * this.standardPadding(), 'center'); 172 | } 173 | }; 174 | 175 | Window_SrpgTerrainEffect.prototype.updatePlacement = function() { 176 | this.countEffects(); 177 | this.height = this.windowHeight(); 178 | this.contents.resize(this.width - 2 * this.standardPadding(), this.height - 2 * this.standardPadding()); 179 | }; 180 | 181 | Window_SrpgTerrainEffect.prototype.countEffects = function(){ 182 | this._effectCount = 0; 183 | this.countParamValue(paramModList, paramWordList); 184 | this.countParamValue(xparamModList, xparamWordList); 185 | this.countParamValue(sparamModList, sparamWordList); 186 | } 187 | 188 | Window_SrpgTerrainEffect.prototype.countParamValue = function(paramList, paramWordList){ 189 | for (var i = 0; i < paramWordList.length; i++){ 190 | if (this.getParamValue(paramList, paramWordList, i) != 0) this._effectCount += 1; 191 | } 192 | } 193 | 194 | Window_SrpgTerrainEffect.prototype.getParamValue = function(paramList, paramWordList, i) { 195 | var value = paramList[this._tagId][i]; 196 | if (this._unitData){ 197 | var paramPlus = Number(this._unitData.meta['srpgTE_Tag' + this._tagId + 'Mod' + paramWordList[i]] || 0); 198 | if (paramList == sparamModList && paramPlus == 0) paramPlus = 1; 199 | if (paramList === sparamModList) { 200 | value *= paramPlus; 201 | } else value += paramPlus; 202 | } 203 | if (paramList === sparamModList) value -= 1; 204 | return value; 205 | } 206 | 207 | Window_SrpgTerrainEffect.prototype.drawParamValue = function(paramList, paramWordList) { 208 | for (var i = 0; i < paramWordList.length; i++){ 209 | var value = this.getParamValue(paramList, paramWordList, i); 210 | if (value !== 0){ 211 | var pd = this.textPadding(); 212 | var wd = _widthEach - 2 * this.standardPadding(); 213 | var sign = value > 0 ? '+' : ''; 214 | var color = value > 0 ? _buffColor : _debuffColor; 215 | if (paramList === paramModList){ 216 | var info = sign + value; 217 | } else{ 218 | var info = sign + Math.round(100 * value) + '%'; 219 | } 220 | this.changeTextColor(this.systemColor()); 221 | this.drawText(paramWordList[i], pd, this._textCount * this.lineHeight(), wd / 2 - pd, 'left') 222 | this.changeTextColor(this.textColor(color)); 223 | this.drawText(info, wd / 2, this._textCount * this.lineHeight(), wd / 2 - pd, 'right'); 224 | this._textCount += 1; 225 | } 226 | } 227 | }; 228 | 229 | Game_System.prototype.setSrpgTerrainEffectWindowNeedRefresh = function() { 230 | this._SrpgTerrainEffectWindowRefreshFlag = true; 231 | }; 232 | 233 | // ステータスウィンドウのリフレッシュフラグをクリアする 234 | Game_System.prototype.clearSrpgTerrainEffectWindowNeedRefresh = function() { 235 | this._SrpgTerrainEffectWindowRefreshFlag = false; 236 | }; 237 | 238 | Game_System.prototype.srpgTerrainEffectWindowNeedRefresh = function() { 239 | return this._SrpgTerrainEffectWindowRefreshFlag; 240 | }; 241 | 242 | var _SRPG_Game_Player_startMapEvent = Game_Player.prototype.startMapEvent; 243 | Game_Player.prototype.startMapEvent = function(x, y, triggers, normal) { 244 | _SRPG_Game_Player_startMapEvent.call(this, x, y, triggers, normal); 245 | if ($gameSystem.isSRPGMode()) $gameSystem.setSrpgTerrainEffectWindowNeedRefresh(); 246 | } 247 | 248 | var _Game_System_setSubBattlePhase = Game_System.prototype.setSubBattlePhase 249 | Game_System.prototype.setSubBattlePhase = function(phase) { 250 | _Game_System_setSubBattlePhase.call(this, phase) 251 | if (phase == 'normal' || phase == 'status_window') this.setSrpgTerrainEffectWindowNeedRefresh(); 252 | }; 253 | 254 | var _SRPG_SceneMap_update = Scene_Map.prototype.update; 255 | Scene_Map.prototype.update = function() { 256 | _SRPG_SceneMap_update.call(this); 257 | if ($gameSystem.isSRPGMode()) { 258 | var tileWindow = this._mapSrpgTerrainEffectWindow; 259 | if ($gameSystem.isBattlePhase() !== 'actor_phase' || $gameMap.isEventRunning() || 260 | ['invoke_action', 'battle_window'].contains($gameSystem.isSubBattlePhase())){ 261 | tileWindow.close(); 262 | return; 263 | //tileWindow.y = Graphics.boxHeight - tileWindow.windowHeight(); 264 | } 265 | if ($gameSystem.srpgTerrainEffectWindowNeedRefresh()){ 266 | tileWindow.refresh(); 267 | $gameSystem.clearSrpgTerrainEffectWindowNeedRefresh(); 268 | } 269 | if (tileWindow.isClosed()){ 270 | tileWindow.open(); 271 | } 272 | } 273 | 274 | if (!$gameSystem.srpgTerrainEffectWindowNeedRefresh() && !$gameSystem.isSRPGMode()){ 275 | this._mapSrpgTerrainEffectWindow.close(); 276 | $gameSystem.setSrpgTerrainEffectWindowNeedRefresh(); 277 | } 278 | } 279 | 280 | })(); 281 | -------------------------------------------------------------------------------- /oldVersions/SRPG_AgiAttackControl v 1.01.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | //SRPG_AgiAttackControl.js 3 | //change the file name to SRPG_AgiAttackControl.js for this plugin to work 4 | //============================================================================= 5 | /*: 6 | * @plugindesc More control over the Agiattack rule, support AoE agi Attack 7 | * @author Shoukang 8 | * 9 | * @param agi attack formula 10 | * @desc The equation to determine agi attack times 11 | * @default dif >= 4 ? 1 : 0; 12 | * 13 | * @param agi attack max time 14 | * @desc the maximum agi attack time 15 | * @type number 16 | * @default 2 17 | * 18 | * @param agi attack no cost 19 | * @desc agi attack won't cost any tp or mp 20 | * @type boolean 21 | * @default false 22 | * 23 | * @help 24 | * =================================================================================================== 25 | * Compatibility: 26 | * Map battle need SRPG_AoEAnimation(updated on 8/27/21), and place this plugin below it. 27 | * Scene battle should work regradless. 28 | * this plugin will make agiAttackplus parameter in core useless. 29 | * =================================================================================================== 30 | * 31 | * =================================================================================================== 32 | * New actor / enemy tags: 33 | * this battler can't do Agi Attack 34 | * this battler won't receive Agi Attack 35 | * =================================================================================================== 36 | * The following values can be used for agi attack formula: 37 | * a :fast unit in the battle 38 | * b :slow unit in the battle 39 | * dif :a.agi - b.agi 40 | * a simple guidance to understand the default formular meaning: 41 | * dif >= 4 ? 1 : 0 42 | * is dif >= 4 ? if yes do 1 agiAttack, if no do 0 agiAttack. 43 | * you can even make something like dif >= 4 ? (dif >= 8 ? 2:1) : 0; 44 | * therefore it will further check (dif >= 8 ? 2:1) if dif >= 4. 45 | * You can also use (dif/b.agi) * 2, dif > Math.randomInt(100) ? 1:0, etc. 46 | * if result is a float number like 3.1415... only the integer part will be taken into account. 47 | * =================================================================================================== 48 | * v 1.00 first release 49 | */ 50 | (function () { 51 | 'use strict' 52 | //================================================================================================= 53 | //Plugin Parameters 54 | //================================================================================================= 55 | var parameters = PluginManager.parameters('SRPG_AgiAttackControl'); 56 | var _formula = parameters['agi attack formula'] || 'dif >= 4 ? 1 : 0'; 57 | var _max = Number(parameters['agi attack max time'] || 2); 58 | var _noCost = !!eval(parameters['agi attack no cost']); 59 | 60 | //map battle logic 61 | Scene_Map.prototype.srpgAgiAttackPlus = function(agiUser, target, targetEvents){ 62 | if (agiUser.agi <= target.agi) return; 63 | if (!agiUser.canAgiAttack()) return; 64 | var agiTime = agiUser.getAgiAttackTime(target); 65 | var agiAction = _noCost ? agiUser.action(0).createNoCostAction() : agiUser.action(0); 66 | for (var i = 0; i < agiTime; i++){ 67 | if (agiUser == $gameSystem.EventToUnit($gameTemp.activeEvent().eventId())[1]){ 68 | this.addAoESkillToAgiList(agiAction, agiUser, targetEvents); 69 | } else { 70 | this.addSkillToAgiList(agiAction, agiUser, target); 71 | console.log(agiAction) 72 | } 73 | } 74 | } 75 | 76 | Game_Battler.prototype.getAgiAttackTime = function(target){ 77 | var dif = this.agi - target.agi; 78 | var a = this; 79 | var b = target; 80 | var ma = a.isActor() ? a.actor().meta : a.enemy().meta; 81 | var mb = b.isActor() ? b.actor().meta : b.enemy().meta; 82 | if (ma.noAgiAttack) return 0; 83 | if (mb.noAgiCounter) return 0; 84 | var count = Math.floor(eval(_formula)); 85 | return Math.min(count, _max); 86 | } 87 | 88 | var _BattleManager_makeActionOrders = BattleManager.makeActionOrders; 89 | BattleManager.makeActionOrders = function() { 90 | if ($gameSystem.isSRPGMode()){ 91 | var battlers = $gameParty.members().concat($gameTroop.members()); 92 | var agiBattlers = []; 93 | battlers.forEach(function(battler) {battler.makeSpeed();}); 94 | //active event timing is 0, targets timing is 1, so actor will stay at [0] 95 | battlers.sort(function(a, b) {return a.srpgActionTiming() - b.srpgActionTiming();}); 96 | var user = battlers[0]; 97 | for (var i = 1; i < battlers.length; i++){ 98 | var target = battlers[i]; 99 | var firstBattler = user.agi >= target.agi ? user : target; 100 | var secondBattler = user.agi >= target.agi ? target : user; 101 | if (firstBattler.canAgiAttack()) { 102 | var agiTime = firstBattler.getAgiAttackTime(secondBattler); 103 | var agiAction = firstBattler.action(0); 104 | if (firstBattler == user && i == 1 && agiTime > 0){ 105 | firstBattler.reserveSameAction(agiTime, agiBattlers); 106 | } else if (firstBattler == target && agiTime > 0) { 107 | firstBattler.reserveSameAction(agiTime, agiBattlers); 108 | } 109 | } 110 | } 111 | this._actionBattlers = battlers.concat(agiBattlers) 112 | } else _BattleManager_makeActionOrders.call(this); 113 | } 114 | 115 | Game_Battler.prototype.reserveSameAction = function(num, agiBattlers) { 116 | this._reserveAction = []; 117 | var action = _noCost ? this._actions[0].createNoCostAction() : this._actions[0]; 118 | for (var i = 0; i < num; i++){ 119 | this._reserveAction.push(action); 120 | agiBattlers.push(this); 121 | } 122 | }; 123 | 124 | Game_Battler.prototype.addSameAction = function() { 125 | if (!this.currentAction() && this._reserveAction && this._reserveAction.length > 0) { 126 | this._actions.push(this._reserveAction.pop()); 127 | var targets = this._actions[0].makeTargets(); 128 | if (targets.length == 0) this._actions = []; 129 | } 130 | }; 131 | 132 | var _SRPG_BattleManager_endTurn = BattleManager.endTurn; 133 | BattleManager.endTurn = function() { 134 | if ($gameSystem.isSRPGMode() == true) this.clearRemainingActions(); 135 | _SRPG_BattleManager_endTurn.call(this); 136 | }; 137 | 138 | BattleManager.clearRemainingActions = function() { 139 | for (var i = 0; i < this._actionBattlers.length; i++){ 140 | this._actionBattlers[i].clearReserveAction(); 141 | } 142 | this._actionBattlers = []; 143 | }; 144 | 145 | Game_Battler.prototype.clearReserveAction = function(){ 146 | this._reserveAction = []; 147 | } 148 | 149 | Game_Battler.prototype.canAgiAttack = function(){ 150 | return this.currentAction() && this.currentAction().canAgiAttack(); 151 | } 152 | 153 | Game_Action.prototype.canAgiAttack = function(){ 154 | return this.isForOpponent() && this.item() && !this.item().meta.doubleAction; 155 | } 156 | 157 | Game_Action.prototype.createNoCostAction = function(){ 158 | var action = this.createAoERepeatedAction(); 159 | action.setHideAnimation(undefined); 160 | return action; 161 | } 162 | 163 | })(); 164 | -------------------------------------------------------------------------------- /oldVersions/SRPG_BattlePrepare_v1.01.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | // SRPG_BattlePrepare.js 3 | //----------------------------------------------------------------------------- 4 | // free to use and edit Important: replace the file name with SRPG_BattlePrepareto use 5 | //============================================================================= 6 | /*: 7 | * @plugindesc Add battle Prepare phase at the beginning of SRPG battle. 8 | * @author Shoukang 9 | * 10 | * @param disable remove 11 | * @desc disable remove actor command 12 | * @type boolean 13 | * @default false 14 | * 15 | * @param textPrepareEvent 16 | * @desc Name of Prepare Event. Used in SRPG menu window. 17 | * @default Prepare 18 | * 19 | * @param textFinishPrepare 20 | * @desc Name of Finish Prepare. Used in SRPG menu window. 21 | * @default Ready 22 | * 23 | * @param textExchange 24 | * @desc Name of Exchange position. Used in SRPG menu window. 25 | * @default Exchange 26 | * 27 | * @param textRemove 28 | * @desc Name of Remove actor. Used in SRPG menu window. 29 | * @default Remove 30 | * 31 | * @help 32 | * 33 | * This plugin allows you to prepare before battle. You can change equipment, see enemy's status, remove or add actors, 34 | * and switch actor positions in battle Prepare phase. 35 | * Only events with are moveable. AutoBattle units are also not moveable. 36 | * The new flow is: battleStart---Prepare---actorturn---....... 37 | * ======================================================================================================================== 38 | * event note: 39 | * # start this event when Prepare is finished. 40 | * # start this event when you trigger prepare command in main menu. You can use this event to open shop or do other things you want. 41 | *========================================================================================================================== 42 | * PluginCommand 43 | * DisableSRPGPrepare Disable battle Prepare 44 | * EnableSRPGPrepare Enable battle Prepare 45 | *========================================================================================================================== 46 | * v1.01 fixed some small bugs and changed the parameter description. 47 | * v 1.00 first release! 48 | * ========================================================================================================================= 49 | * Compatibility: 50 | * This plugin made some big changes to SRPG_Core, put it above all the SRPG plugins except SRPG_Core! 51 | */ 52 | (function () { 53 | var parameters = PluginManager.parameters('SRPG_BattlePrepare'); 54 | var _disableRemove = !!eval(parameters['disable remove']); 55 | var _textPrepareEvent = parameters['textPrepareEvent']|| 'Prepare'; 56 | var _textFinishPrepare = parameters['textFinishPrepare']|| 'Ready'; 57 | var _textExchange = parameters['textExchange']|| 'Exchange'; 58 | var _textRemove = parameters['textRemove']|| 'Remove'; 59 | 60 | //paramerters from core plugin 61 | var coreParameters = PluginManager.parameters('SRPG_core'); 62 | var _srpgBattleSwitchID = Number(coreParameters['srpgBattleSwitchID'] || 1); 63 | var _srpgBestSearchRouteSize = Number(coreParameters['srpgBestSearchRouteSize'] || 20); 64 | var _textSrpgTurnEnd = coreParameters['textSrpgTurnEnd'] || 'ターン終了'; 65 | var _textSrpgAutoBattle = coreParameters['textSrpgAutoBattle'] || 'オート戦闘'; 66 | var _turnVarID = Number(coreParameters['turnVarID'] || 3); 67 | var _existActorVarID = Number(coreParameters['existActorVarID'] || 1); 68 | var _srpgAutoBattleStateId = Number(coreParameters['srpgAutoBattleStateId'] || 14); 69 | 70 | //add battle_prepare phase, prepare_command subphase and exchange_position subphase. 71 | var _SRPG_Game_Player_startMapEvent = Game_Player.prototype.startMapEvent 72 | Game_Player.prototype.startMapEvent = function(x, y, triggers, normal) { 73 | if ($gameSystem.isSRPGMode() == true && !$gameMap.isEventRunning() && $gameSystem.isBattlePhase() === 'battle_prepare'){ 74 | if ($gameSystem.isSubBattlePhase() === 'normal' && triggers[0] === 0) { 75 | $gameMap.eventsXy(x, y).forEach(function(event) { 76 | if (event.isType() === 'actor' && Number(event.event().meta.id) === 0 && !event.isErased()) { 77 | var battlerArray = $gameSystem.EventToUnit(event.eventId()); 78 | if (!battlerArray[1].isAutoBattle()){ 79 | SoundManager.playOk(); 80 | $gameTemp.setActiveEvent(event); 81 | $gameSystem.setSrpgPrepareWindowNeedRefresh(battlerArray); 82 | $gameSystem.setSubBattlePhase('prepare_command'); 83 | } else SoundManager.playBuzzer(); 84 | return; 85 | } else if (event.isType() === 'enemy') { 86 | SoundManager.playOk(); 87 | $gameTemp.setResetMoveList(true); 88 | $gameTemp.setActiveEvent(event); 89 | $gameSystem.srpgMakeMoveTable(event); 90 | var battlerArray = $gameSystem.EventToUnit(event.eventId()); 91 | $gameSystem.setSrpgStatusWindowNeedRefresh(battlerArray); 92 | $gameSystem.setSubBattlePhase('status_window'); 93 | return; 94 | } else if (event.isType() === 'playerEvent') { 95 | if (event.pageIndex() >= 0) event.start(); 96 | return; 97 | } else if (event.event().meta.type === 'actor' && event.isErased() && $gameParty.remainingActorList().length > 0){ //if there's remaining actor add actor. 98 | SoundManager.playOk(); 99 | var actorId = $gameParty.remainingActorList()[0]; 100 | var oldValue = $gameVariables.value(_existActorVarID); 101 | $gameVariables.setValue(_existActorVarID, oldValue + 1); 102 | event.appear(); 103 | $gameMap.changeActor(event.eventId(), actorId); 104 | } else SoundManager.playBuzzer(); 105 | }); 106 | } else if ($gameSystem.isSubBattlePhase() === 'exchange_position' && triggers[0] === 0){ 107 | $gameMap.eventsXy(x, y).forEach(function(event) { 108 | if (event.event().meta.type === 'actor') { 109 | if (Number(event.event().meta.id) === 0 && event.eventId() !== $gameTemp.activeEvent().eventId()) { 110 | var battlerArray = $gameSystem.EventToUnit(event.eventId()); 111 | if (battlerArray && battlerArray[1] && battlerArray[1].isAutoBattle()){ 112 | SoundManager.playBuzzer(); 113 | } else{ 114 | SoundManager.playOk(); 115 | $gameTemp.clearMoveTable(); 116 | $gameTemp.activeEvent().swap(event); //exchange event position; 117 | $gameTemp.clearActiveEvent(); 118 | $gameSystem.setSubBattlePhase('normal'); 119 | $gameTemp.setResetMoveList(true); 120 | $gameSystem.srpgMakePrepareTable(); 121 | } 122 | return; 123 | } else SoundManager.playBuzzer(); 124 | } 125 | }); 126 | } 127 | } else _SRPG_Game_Player_startMapEvent.call(this, x, y, triggers, normal) 128 | }; 129 | //don't move the player when prepare command is open 130 | var _SRPG_Game_Player_canMove = Game_Player.prototype.canMove; 131 | Game_Player.prototype.canMove = function() { 132 | if ($gameSystem.isSRPGMode() == true && $gameSystem.isSubBattlePhase() === 'prepare_command') { 133 | return false; 134 | } else return _SRPG_Game_Player_canMove.call(this); 135 | }; 136 | 137 | //drag the origingal updatecallmenu method here so I can rewrite, I can't find any better way. 138 | Scene_Map.prototype.updateCallMenu = function() { 139 | if (this.isMenuEnabled()) { 140 | if (this.isMenuCalled()) { 141 | this.menuCalling = true; 142 | } 143 | if (this.menuCalling && !$gamePlayer.isMoving()) { 144 | this.callMenu(); 145 | } 146 | } else { 147 | this.menuCalling = false; 148 | } 149 | }; 150 | 151 | //This part is too complicated, I copy and add my conditions 152 | var _SRPG_SceneMap_updateCallMenu = Scene_Map.prototype.updateCallMenu; 153 | Scene_Map.prototype.updateCallMenu = function() { 154 | if ($gameSystem.isSRPGMode() && $gameSystem.isSubBattlePhase() === 'invoke_action') { 155 | this.menuCalling = false; 156 | return; 157 | } 158 | if ($gameSystem.isSRPGMode() == true) { 159 | if ($gameSystem.srpgWaitMoving() == true || 160 | $gameTemp.isAutoMoveDestinationValid() == true || 161 | $gameSystem.isSubBattlePhase() === 'status_window' || 162 | $gameSystem.isSubBattlePhase() === 'actor_command_window' || 163 | $gameSystem.isSubBattlePhase() === 'battle_window' || 164 | $gameSystem.isSubBattlePhase() === 'prepare_command' ||//shoukang add new condition: $gameSystem.isSubBattlePhase() === 'prepare_command' 165 | ($gameSystem.isBattlePhase() != 'actor_phase' && 166 | $gameSystem.isBattlePhase() != 'battle_prepare')) {//shoukang add new condition: $gameSystem.isBattlePhase() != 'battle_prepare' 167 | this.menuCalling = false; 168 | return; 169 | } 170 | if ($gameSystem.isSubBattlePhase() === 'actor_move') { 171 | if (Input.isTriggered('cancel') || TouchInput.isCancelled()) { 172 | SoundManager.playCancel(); 173 | $gameSystem.setSubBattlePhase('normal'); 174 | $gameSystem.clearSrpgActorCommandStatusWindowNeedRefresh(); 175 | $gameParty.clearSrpgBattleActors(); 176 | $gameTemp.clearActiveEvent(); 177 | $gameTemp.clearMoveTable(); 178 | } 179 | } else if ($gameSystem.isSubBattlePhase() === 'actor_target') { 180 | if (Input.isTriggered('cancel') || TouchInput.isCancelled()) { 181 | SoundManager.playCancel(); 182 | var event = $gameTemp.activeEvent(); 183 | var battlerArray = $gameSystem.EventToUnit(event.eventId()); 184 | $gameTemp.clearMoveTable(); 185 | $gameTemp.initialMoveTable($gameTemp.originalPos()[0], $gameTemp.originalPos()[1], battlerArray[1].srpgMove()); 186 | event.makeMoveTable($gameTemp.originalPos()[0], $gameTemp.originalPos()[1], battlerArray[1].srpgMove(), [0], battlerArray[1].srpgThroughTag()); 187 | var list = $gameTemp.moveList(); 188 | for (var i = 0; i < list.length; i++) { 189 | var pos = list[i]; 190 | var flag = $gameSystem.areTheyNoUnits(pos[0], pos[1], ''); 191 | if (flag == true && _srpgBestSearchRouteSize > 0) event.makeRangeTable(pos[0], pos[1], battlerArray[1].srpgWeaponRange(), [0], pos[0], pos[1], $dataSkills[battlerArray[1].attackSkillId()]); 192 | } 193 | $gameTemp.pushRangeListToMoveList(); 194 | $gameTemp.setResetMoveList(true); 195 | $gameSystem.setSrpgActorCommandWindowNeedRefresh(battlerArray); 196 | $gameSystem.setSubBattlePhase('actor_command_window'); 197 | } 198 | } else if ($gameSystem.isSubBattlePhase() === 'exchange_position'){ //shoukang add exchange position condition 199 | if (Input.isTriggered('cancel') || TouchInput.isCancelled()) { 200 | SoundManager.playCancel(); 201 | $gameSystem.clearSrpgPrepareWindowNeedRefresh(); 202 | $gameSystem.setSubBattlePhase('normal'); 203 | $gameTemp._MoveList = []; 204 | $gameTemp.setResetMoveList(true); 205 | $gameTemp.clearActiveEvent(); 206 | $gameTemp.clearMoveTable(); 207 | $gameSystem.srpgMakePrepareTable(); 208 | } 209 | } 210 | else { 211 | _SRPG_SceneMap_updateCallMenu.call(this); 212 | } 213 | } else { 214 | _SRPG_SceneMap_updateCallMenu.call(this); 215 | } 216 | }; 217 | 218 | //update prepare command window 219 | var _SRPG_MB_SceneMap_update = Scene_Map.prototype.update; 220 | Scene_Map.prototype.update = function() { 221 | _SRPG_MB_SceneMap_update.call(this); 222 | if ($gameSystem.isSRPGMode() && $gameSystem.isBattlePhase() === 'battle_prepare') { 223 | if ($gameTemp.moveList().length === 0) $gameSystem.srpgMakePrepareTable(); 224 | var flag = $gameSystem.srpgPrepareWindowNeedRefresh(); 225 | if (flag && flag[0]) { 226 | if (!this._mapSrpgPrepareWindow.isOpen() && !this._mapSrpgPrepareWindow.isOpening()) { 227 | this._mapSrpgPrepareWindow.setup(flag[1][1]); 228 | } 229 | } else { 230 | if (this._mapSrpgPrepareWindow.isOpen() && !this._mapSrpgPrepareWindow.isClosing()) { 231 | this._mapSrpgPrepareWindow.close(); 232 | } 233 | } 234 | } 235 | }; 236 | //Rewrite startSRPG to run srpgStartBattlePrepare instead of actor turn when SRPG battle start 237 | Game_System.prototype.startSRPG = function() { 238 | this._SRPGMode = true; 239 | $gameSwitches.setValue(_srpgBattleSwitchID, true); 240 | this._isBattlePhase = 'initialize'; 241 | this._isSubBattlePhase = 'initialize'; 242 | $gamePlayer.refresh(); 243 | $gameTemp.clearActiveEvent(); 244 | this.clearData(); //データの初期化 245 | this.setAllEventType(); //イベントタイプの設定 246 | this.setSrpgActors(); //アクターデータの作成 247 | this.setSrpgEnemys(); //エネミーデータの作成 248 | $gameMap.setEventImages(); // ユニットデータに合わせてイベントのグラフィックを変更する 249 | this.runBattleStartEvent(); // ゲーム開始時の自動イベントを実行する 250 | $gameVariables.setValue(_turnVarID, 1); //ターン数を初期化する 251 | $gameSystem.resetSearchedItemList(); //探索済み座標を初期化する 252 | this.clearSrpgPrepareWindowNeedRefresh();//shoukang initialize 253 | if (this.isPrepareEnabled()) this.srpgStartBattlePrepare();//shoukang start Prepare if enabled 254 | else this.srpgStartActorTurn();//アクターターンを開始する 255 | }; 256 | 257 | Game_System.prototype.srpgStartBattlePrepare = function() { 258 | $gameSystem.srpgMakePrepareTable();//make prepare table 259 | this.setBattlePhase('battle_prepare'); 260 | this.setSubBattlePhase('normal'); 261 | }; 262 | //====================================================================================== 263 | //Change and add commands in main menu 264 | //====================================================================================== 265 | var _SRPG_SceneMenu_createCommandWindow = Scene_Menu.prototype.createCommandWindow; 266 | Scene_Menu.prototype.createCommandWindow = function() { 267 | _SRPG_SceneMenu_createCommandWindow.call(this); 268 | if ($gameSystem.isSRPGMode() == true) { 269 | this._commandWindow.setHandler('finish prepare',this.commandFinishPrepare.bind(this)); 270 | this._commandWindow.setHandler('prepare',this.commandPrepareEvent.bind(this)); 271 | } 272 | }; 273 | 274 | var _SRPG_Window_MenuCommand_makeCommandList = Window_MenuCommand.prototype.makeCommandList; 275 | Window_MenuCommand.prototype.makeCommandList = function() { 276 | if ($gameSystem.isSRPGMode() == true && $gameSystem.isBattlePhase() == 'battle_prepare') { 277 | this.addFinishPrepareCommand(); 278 | this.addPrepareEventCommand(); 279 | if (this.needsCommand('equip')) this.addCommand(TextManager.equip, 'equip', true); 280 | } 281 | _SRPG_Window_MenuCommand_makeCommandList.call(this); 282 | }; 283 | //add command 284 | Window_MenuCommand.prototype.addFinishPrepareCommand = function() { 285 | this.addCommand(_textFinishPrepare, 'finish prepare', true); 286 | }; 287 | 288 | Window_MenuCommand.prototype.addPrepareEventCommand = function() { 289 | var menuWindow = this; 290 | $gameMap.events().some(function(event) { 291 | if (event.isType() === 'prepare') menuWindow.addCommand(_textPrepareEvent, 'prepare', true); 292 | }); 293 | }; 294 | //rewrite these functions to hide these commands in prepare phase 295 | Window_MenuCommand.prototype.addTurnEndCommand = function() { 296 | if ($gameSystem.isBattlePhase() != 'battle_prepare') this.addCommand(_textSrpgTurnEnd, 'turnEnd', true); 297 | }; 298 | 299 | Window_MenuCommand.prototype.addAutoBattleCommand = function() { 300 | if ($gameSystem.isBattlePhase() != 'battle_prepare') this.addCommand(_textSrpgAutoBattle, 'autoBattle', true); 301 | }; 302 | //command effect 303 | Scene_Menu.prototype.commandFinishPrepare = function() { 304 | $gameSystem.clearSrpgAllActors(); 305 | $gameMap.events().forEach(function(event) { 306 | if (event.isType() === 'afterPrepare') { 307 | if (event.pageIndex() >= 0) event.start(); 308 | $gameTemp.pushSrpgEventList(event); 309 | } 310 | if (event.isType() === 'actor' && !event.isErased()) { 311 | var actor = $gameSystem.EventToUnit(event.eventId()); 312 | if (actor[1]) $gameSystem.pushSrpgAllActors(event.eventId()); //refresh SrpgAllActors list 313 | } else if (event.isType() === 'actor' && event.isErased()) event.setType(''); 314 | }); 315 | $gameTemp.clearMoveTable(); 316 | $gameSystem.setBattlePhase('actor_phase'); 317 | $gameSystem.srpgStartActorTurn(); 318 | SceneManager.pop(); 319 | }; 320 | 321 | Scene_Menu.prototype.commandPrepareEvent = function() { 322 | $gameMap.events().forEach(function(event) { 323 | if (event.isType() === 'prepare') { 324 | if (event.pageIndex() >= 0) event.start(); 325 | $gameTemp.pushSrpgEventList(event); 326 | } 327 | }); 328 | SceneManager.pop(); 329 | }; 330 | 331 | //show all party members in prepare phase 332 | var _SRPG_Game_Party_members = Game_Party.prototype.members; 333 | Game_Party.prototype.members = function() { 334 | if ($gameSystem.isSRPGMode() == true && $gameSystem.isBattlePhase() === 'battle_prepare') { 335 | return this._actors.map(function(id) { 336 | return $gameActors.actor(id); 337 | }); 338 | } else return _SRPG_Game_Party_members.call(this); 339 | }; 340 | //===================================================================================================================== 341 | //Actor prepare window 342 | //===================================================================================================================== 343 | var _SRPG_SceneMap_createAllWindows = Scene_Map.prototype.createAllWindows; 344 | Scene_Map.prototype.createAllWindows = function() { 345 | _SRPG_SceneMap_createAllWindows.call(this); 346 | this.createPrepareWindow(); 347 | }; 348 | 349 | Scene_Map.prototype.createPrepareWindow = function() { 350 | this._mapSrpgPrepareWindow = new Window_ActorCommand(); 351 | this._mapSrpgPrepareWindow.x = Math.max(Graphics.boxWidth / 2 - this._mapSrpgPrepareWindow.windowWidth(), 0); 352 | this._mapSrpgPrepareWindow.y = Math.max(Graphics.boxHeight / 2 - this._mapSrpgPrepareWindow.windowHeight(), 0); 353 | this._mapSrpgPrepareWindow.setHandler('partymember', this.commandPartyMember.bind(this)); 354 | this._mapSrpgPrepareWindow.setHandler('exchange', this.commandExchange.bind(this)); 355 | this._mapSrpgPrepareWindow.setHandler('remove', this.commandRemove.bind(this)); 356 | this._mapSrpgPrepareWindow.setHandler('cancel', this.cancelPrepareCommand.bind(this)); 357 | this.addWindow(this._mapSrpgPrepareWindow); 358 | }; 359 | //battle Prepare phase add these commands 360 | var _SRPG_Window_ActorCommand_makeCommandList = Window_ActorCommand.prototype.makeCommandList; 361 | Window_ActorCommand.prototype.makeCommandList = function() { 362 | if ($gameSystem.isSRPGMode() == true && $gameSystem.isBattlePhase() === 'battle_prepare') { 363 | if (this._actor) { 364 | this.addPartyMemberCommand(); 365 | this.addExchangeCommand(); 366 | this.addRemoveCommand(); 367 | } 368 | } else _SRPG_Window_ActorCommand_makeCommandList.call(this); 369 | }; 370 | //add command 371 | //add this command for each remaining actor, should open a new window to list remaining actors, but my coding skill is limited so I make this instead. 372 | Window_ActorCommand.prototype.addPartyMemberCommand = function() { 373 | var remainingactorlist = $gameParty.remainingActorList(); 374 | for (var i = 0; i < remainingactorlist.length; i++){ 375 | this.addCommand($gameActors.actor(remainingactorlist[i]).name(), 'partymember', true); 376 | } 377 | }; 378 | 379 | Window_ActorCommand.prototype.addExchangeCommand = function() { 380 | this.addCommand(_textExchange, 'exchange', true); 381 | }; 382 | 383 | Window_ActorCommand.prototype.addRemoveCommand = function() { 384 | if (_disableRemove) return; 385 | if ($gameVariables.value(_existActorVarID) > 1) this.addCommand(_textRemove, 'remove', true); 386 | else this.addCommand(_textRemove, 'remove', false); 387 | }; 388 | 389 | Window_ActorCommand.prototype.addCancelPrepareCommand = function() { 390 | this.addCommand('cancel', 'cancel', true); 391 | }; 392 | //command effect 393 | Scene_Map.prototype.commandPartyMember = function() { 394 | var remainingactorlist = $gameParty.remainingActorList(); 395 | var i = this._mapSrpgPrepareWindow._index;//shoukang I think there is better ways to do this but I don't know what can I get except index. 396 | $gameMap.changeActor($gameTemp.activeEvent().eventId(), remainingactorlist[i]); 397 | $gameTemp.clearActiveEvent(); 398 | $gameSystem.clearSrpgPrepareWindowNeedRefresh(); 399 | $gameSystem.setSubBattlePhase('normal'); 400 | }; 401 | 402 | Scene_Map.prototype.commandExchange = function() { 403 | $gameTemp.pushMoveList([$gameTemp.activeEvent().posX(), $gameTemp.activeEvent().posY(), true]); 404 | $gameTemp.setResetMoveList(true); 405 | $gameSystem.setSubBattlePhase('exchange_position'); 406 | $gameSystem.clearSrpgPrepareWindowNeedRefresh(); 407 | }; 408 | 409 | Scene_Map.prototype.commandRemove = function() { 410 | var oldValue = $gameVariables.value(_existActorVarID); 411 | var id = $gameTemp.activeEvent().eventId(); 412 | $gameVariables.setValue(_existActorVarID, oldValue - 1); 413 | $gameTemp.clearActiveEvent(); 414 | $gameMap.event(id).erase(); 415 | $gameSystem._EventToUnit[id] = null; 416 | $gameMap.event(id).setType(''); 417 | $gameSystem.clearSrpgPrepareWindowNeedRefresh(); 418 | $gameSystem.setSubBattlePhase('normal'); 419 | }; 420 | 421 | Scene_Map.prototype.cancelPrepareCommand = function() { 422 | $gameSystem.setSubBattlePhase('normal'); 423 | $gameTemp.clearActiveEvent(); 424 | $gameSystem.clearSrpgPrepareWindowNeedRefresh(); 425 | }; 426 | 427 | //add prepare command window refresh flag 428 | var _SRPG_Game_System_initialize = Game_System.prototype.initialize; 429 | Game_System.prototype.initialize = function() { 430 | _SRPG_Game_System_initialize.call(this); 431 | this._SrpgPrepareWindowRefreshFlag = [false, null]; 432 | this._enablePrepare = true; 433 | }; 434 | 435 | Game_System.prototype.srpgPrepareWindowNeedRefresh = function() { 436 | return this._SrpgPrepareWindowRefreshFlag; 437 | }; 438 | 439 | Game_System.prototype.setSrpgPrepareWindowNeedRefresh = function(battlerArray) { 440 | this._SrpgPrepareWindowRefreshFlag = [true, battlerArray]; 441 | }; 442 | 443 | Game_System.prototype.clearSrpgPrepareWindowNeedRefresh = function() { 444 | this._SrpgPrepareWindowRefreshFlag = [false, null]; 445 | }; 446 | 447 | //================================================================================================= 448 | //plugin command 449 | //================================================================================================= 450 | var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; 451 | Game_Interpreter.prototype.pluginCommand = function(command, args) { 452 | _Game_Interpreter_pluginCommand.call(this, command, args); 453 | if (command === 'EnableSRPGPrepare') $gameSystem.setSRPGPrepare(true); 454 | if (command === 'DisableSRPGPrepare') $gameSystem.setSRPGPrepare(false); 455 | }; 456 | 457 | Game_System.prototype.isPrepareEnabled = function() { 458 | if (this._enablePrepare === undefined) this._enablePrepare = true; 459 | return this._enablePrepare; 460 | }; 461 | 462 | Game_System.prototype.setSRPGPrepare = function(value) { 463 | this._enablePrepare = value; 464 | }; 465 | 466 | 467 | //================================================================================================= 468 | //used new functions 469 | //================================================================================================= 470 | //make the table of operatable actor tiles. 471 | Game_System.prototype.srpgMakePrepareTable = function() { 472 | $gameMap.events().forEach(function(event) { 473 | if (event.event().meta.type === 'actor' && Number(event.event().meta.id) === 0){ 474 | var battlerArray = $gameSystem.EventToUnit(event.eventId()); 475 | if (battlerArray && battlerArray[1] && battlerArray[1].isAutoBattle()) return; 476 | $gameTemp.pushMoveList([event.posX(), event.posY(), false]); 477 | } 478 | }); 479 | }; 480 | //get remaining actors in party 481 | Game_Party.prototype.remainingActorList = function(){ 482 | var actorlist = []; 483 | $gameMap.events().forEach(function(event) { 484 | if (event.isType() === 'actor' && !event.isErased()) { 485 | var actor = $gameSystem.EventToUnit(event.eventId()) 486 | if (actor[1]) actorlist.push(actor[1]._actorId); 487 | } 488 | }); 489 | var list = []; 490 | for (var i = 0; i < this._actors.length; i++){ 491 | if (!actorlist.includes(this._actors[i])) list.push(this._actors[i]); 492 | } 493 | return list.sort(); 494 | } 495 | //change actor, similar to add actor 496 | Game_Map.prototype.changeActor = function(eventId, actorId) { 497 | var actor_unit = $gameActors.actor(actorId); 498 | var event = this.event(eventId); 499 | if (actor_unit && event) { 500 | actor_unit.initTp(); 501 | var bitmap = ImageManager.loadFace(actor_unit.faceName()); 502 | $gameSystem.setEventToUnit(event.eventId(), 'actor', actor_unit.actorId()); 503 | event.setType('actor'); 504 | var xy = event.makeAppearPoint(event, event.posX(), event.posY(), actor_unit.srpgThroughTag()); 505 | event.setPosition(xy[0], xy[1]); 506 | this.setEventImages(); 507 | } 508 | }; 509 | })(); 510 | -------------------------------------------------------------------------------- /oldVersions/SRPG_PathfindingChange.js: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | // SRPG_PathfindingChange.js 3 | //----------------------------------------------------------------------------- 4 | //This plugin changes the pathfinding method of SRPG_Pathfinding, with enhanced compatibility 5 | // to SRPG_Rangecontrol and better route search function. 6 | //============================================================================= 7 | /*: 8 | * @plugindesc This plugin provides an enhanced pathfinding method. Now you can have my moveMethod plugin so it's not needed. 9 | * 10 | * @author Shoukang 11 | * 12 | * @param search range 13 | * @desc How many move points pathfingding AI can consume before stop, set low to to avoid lag spikes. 14 | * @type number 15 | * @min 10 16 | * @default 30 17 | * 18 | * @param use this fallback 19 | * @desc Use fallback move in this plugin instead of the original pathfing plugin. 20 | * @type boolean 21 | * @default true 22 | * 23 | * @help 24 | * The original pathfinding plugin doesn't take terrain cost into consideration when searching for the 25 | * best path. So units will choose the most "straight" route rather than a curved route with a lower 26 | * total tile cost. 27 | * This plugin doesn't choose the path with the shortest total move cost but chooses the path with the 28 | * least turns. For example, if a unit has 4 move points, it takes 6 turns to reach y from x 29 | * [x, 4, 1, 4, 1, 4, 1, y]. However, if there's another route [x, 2, 2, 2, 2, 2, 2, 2, 2, 2, y], which 30 | * only takes 5 turns, the AI will choose the latter. despite the latter one has a higher totalmovecost. . 31 | * Nonetheless, while choosing the path it will not consider friend unit positions or attack range, so 32 | * the route is still not necessarily the fastest, but it should be good enough to use. 33 | * 34 | * This plugin is inspired by the make move table function in SRPG_RangeControl. Many parts are kept 35 | * same so it has high compatibility, but the move rule is based on SRPG_ModifiedMoveTable, so this 36 | * move table plugin is required. The only concern now is the Zoc table, which I'm not familiar with. 37 | * P.S., this plugin doesn't support looping maps(does anyone use looping maps for SRPG?). 38 | * 39 | * This plugin also provides a fallback choice, fallback will try its best to move near to the target. 40 | * If you disable it then the SRPG_pathfinding will do the fallback. 41 | * 42 | * Please put this plugin below SRPG_Pathfinding, and use my SRPG_ModifiedMoveTable. 43 | * 44 | */ 45 | (function () { 46 | var parameters = PluginManager.parameters('SRPG_PathfindingChange'); 47 | var maxMove = Number(parameters['search range']) || 30; 48 | var enableFallback = Boolean(parameters['use this fallback']) || true; 49 | 50 | 51 | Game_Map.prototype.convertRoute = function(arr) { 52 | arr.forEach( function(a, b){ 53 | switch (a) { 54 | case 2 : 55 | arr[b] = "Down"; 56 | break; 57 | case 4 : 58 | arr[b] = "Left"; 59 | break; 60 | case 6 : 61 | arr[b] = "Right"; 62 | break; 63 | case 8 : 64 | arr[b] = "Up"; 65 | break; 66 | } 67 | }); 68 | }; 69 | 70 | //overwrite the pathTo function 71 | Game_Map.prototype.pathTo = function(x, y, x2, y2, tag) { 72 | var event = $gameTemp.activeEvent(); 73 | var move = $gameSystem.EventToUnit(event.eventId())[1].srpgMove(); 74 | var edges = []; 75 | var movetable = []; 76 | var route = []; 77 | var fallback = []; 78 | var distance = Math.abs(x2-x) + Math.abs(y2-y); 79 | var mindist = distance; 80 | for (var i=0; i<$gameMap.width(); i++){//creat a 2D array for the map 81 | movetable[i] = []; 82 | } 83 | if (move > 0 && distance > 1) { 84 | edges = [[x, y, maxMove, []]]; 85 | } else return []; 86 | movetable[x][y] = (maxMove, []);//store remaining move and route in movettable 87 | $gameMap.makeSrpgZoCTable(event.isType() == 'actor' ? 'enemy' : 'actor', event.throughZoC());// Shoukang: I'm not sure about zoc table because I'm not using it 88 | while (edges.length > 0) { 89 | var cell = edges.shift(); 90 | for (var d = 2; d < 10; d += 2) { 91 | if (!event.srpgMoveCanPass(cell[0], cell[1], d, tag)) continue; 92 | var dx = $gameMap.roundXWithDirection(cell[0], d); 93 | var dy = $gameMap.roundYWithDirection(cell[1], d); 94 | var movecost = 1; 95 | if(tag < $gameMap.terrainTag(dx, dy)){ 96 | movecost = $gameMap.srpgMoveCost(dx, dy); 97 | } 98 | if (movetable[dx][dy] || (cell[2] - movecost) < 0) continue; //shoukang edit: if move < cost skip 99 | var dmove = Math.max(cell[2] - movecost, 0); 100 | var rmove = move - (maxMove - cell[2])%move;//calculate remaining move in one turn 101 | if (movecost > rmove){// take move turns into consideration 102 | dmove = dmove - rmove; 103 | } 104 | route = cell[3].concat(d); 105 | movetable[dx][dy] = (dmove, route); 106 | distance = Math.abs(x2-dx) + Math.abs(y2-dy); 107 | if (distance <= 1){//reaches target, stop search 108 | $gameMap.convertRoute(route); 109 | route.push(0);//I added this just for the pathDifference in optimization part of SRPG_pathfinding. 110 | return route; 111 | } 112 | if (enableFallback && distance < mindist) {//store fallback route if enabled. 113 | mindist = distance; 114 | fallback = route; 115 | } 116 | if (dmove > 0 && !$gameMap._zocTable[dx+','+dy] ) { 117 | edges.push([dx, dy, dmove, route]); 118 | edges.sort(function (a, b) {//always do the next loop with highest dmove to ensure shortest path. 119 | return b[2] - a[2]; 120 | }); 121 | } 122 | } 123 | } 124 | $gameMap.convertRoute(fallback);//if no path find within maxMove, return fallback 125 | return fallback; 126 | }; 127 | })(); 128 | -------------------------------------------------------------------------------- /oldVersions/SRPG_StatusWindow.js: -------------------------------------------------------------------------------- 1 | //==================================================================================================================== 2 | // SRPG_StatusWindow.js 3 | //-------------------------------------------------------------------------------------------------------------------- 4 | // free to use and edit V1.00 First Release 5 | //==================================================================================================================== 6 | /*: 7 | * @plugindesc This plugin allows you to show multiple status pages in SRPG battle and open status window from actor command window 8 | * @author Shoukang 9 | * 10 | * @param enable actor status command 11 | * @type boolean 12 | * @default false 13 | * 14 | * @param window width 15 | * @desc the width of status window 16 | * @type number 17 | * @default 408 18 | * 19 | * @param windowHeight 20 | * @desc Number of text lines the window can have. 21 | * @type number 22 | * @default 10 23 | * 24 | * @param number of pages 25 | * @desc Number of pages the status window have 26 | * @type number 27 | * @default 3 28 | * 29 | * @help 30 | * 31 | * This plugin allows you to show multiple status pages in SRPG battle. 32 | * Click Ok will go to next page, click cancel will close the window. 33 | * You need to code yourself to show the contents. 34 | * I left the TODO notes and examples for you to DIY your status window. Just serch for 'TODO', 35 | * and play around with the code. Drawing text is easy to learn.(but hard to master). 36 | * If you scroll to the bottom I also copy and paste some functions used (such as 'drawBasicInfoActor') 37 | * so you know what they are doing. 38 | * The example code as well as the code copied from core plugin have many 'magic numbers'... Which is not a good 39 | * coding example. It's usually better to replace the numbers with variables. For example number 6 is actually this.textPadding(), 40 | * values such as 192... should derive from calculations like _width/2 - this.standardpadding() + this.textPadding(); 41 | * This will make your code more maintainable, especially when you want to change the window width and other parameters someday. 42 | * ========================================================================================================================== 43 | * Compatibility: 44 | * Place it below SRPG_UX_Window and SRPG_BattleUI 45 | * ========================================================================================================================= 46 | * v1.00 first release! 47 | */ 48 | 49 | (function(){ 50 | var params = PluginManager.parameters('SRPG_StatusWindow'); 51 | var _enableStatus = !!eval(params['enable actor status command']); 52 | var _width = Number(params['window width'] || 408); 53 | var _height = Number(params['windowHeight'] || 10); 54 | var _pages = Number(params['number of pages'] || 3); 55 | 56 | var _Window_SrpgStatus_initialize = Window_SrpgStatus.prototype.initialize 57 | Window_SrpgStatus.prototype.initialize = function(x, y) { 58 | _Window_SrpgStatus_initialize.call(this, x, y); 59 | this._page = 0; 60 | this.refresh(); 61 | }; 62 | 63 | var _SRPG_Game_Player_triggerAction = Game_Player.prototype.triggerAction; 64 | Game_Player.prototype.triggerAction = function() { 65 | if ($gameSystem.isSRPGMode() && $gameSystem.isSubBattlePhase() === 'status_window') { 66 | if (Input.isTriggered('ok') || TouchInput.isTriggered()) { 67 | $gameSystem.setSrpgStatusWindowNextPage(); 68 | return true; 69 | } 70 | } 71 | return _SRPG_Game_Player_triggerAction.call(this); 72 | } 73 | 74 | Game_System.prototype.setSrpgStatusWindowNextPage = function(){ 75 | this._SrpgStatusWindowPageNext = true; 76 | } 77 | 78 | Game_System.prototype.clearSrpgStatusWindowNextPage = function(){ 79 | this._SrpgStatusWindowPageNext = false; 80 | } 81 | 82 | Game_System.prototype.srpgStatusWindowNextPage = function(){ 83 | return this._SrpgStatusWindowPageNext; 84 | } 85 | 86 | Game_System.prototype.setActorCommandStatus = function(){ 87 | this._isActorCommandStatus = true; 88 | } 89 | 90 | Game_System.prototype.clearActorCommandStatus = function(){ 91 | this._isActorCommandStatus = false; 92 | } 93 | 94 | Game_System.prototype.isActorCommandStatus = function(){ 95 | return this._isActorCommandStatus; 96 | } 97 | 98 | var _SRPG_SceneMap_update = Scene_Map.prototype.update; 99 | Scene_Map.prototype.update = function() { 100 | _SRPG_SceneMap_update.call(this); 101 | if ($gameSystem.isSRPGMode()) { 102 | if ($gameSystem.srpgStatusWindowNextPage()){ 103 | SoundManager.playOk(); 104 | this._mapSrpgStatusWindow.nextPage(); 105 | $gameSystem.clearSrpgStatusWindowNextPage(); 106 | } 107 | } 108 | } 109 | 110 | var _updateCallMenu = Scene_Map.prototype.updateCallMenu; 111 | Scene_Map.prototype.updateCallMenu = function() { 112 | if ($gameSystem.isSRPGMode() && !$gameSystem.srpgWaitMoving()) { 113 | if ($gameSystem.isSubBattlePhase() === 'status_window' && this.isMenuCalled()) { 114 | $gameSystem.clearSrpgStatusWindowNeedRefresh(); 115 | SoundManager.playCancel(); 116 | if ($gameSystem.isActorCommandStatus()){ 117 | $gameSystem.setSubBattlePhase('actor_command_window'); 118 | $gameSystem.clearSrpgStatusWindowNeedRefresh(); 119 | this._mapSrpgActorCommandWindow.activate(); 120 | } else { 121 | $gameTemp.clearActiveEvent(); 122 | $gameSystem.setSubBattlePhase('normal'); 123 | $gameTemp.clearMoveTable(); 124 | } 125 | return; 126 | } 127 | } 128 | _updateCallMenu.call(this); 129 | }; 130 | 131 | //change the window priority 132 | var _SRPG_SceneMap_createAllWindows = Scene_Map.prototype.createAllWindows; 133 | Scene_Map.prototype.createAllWindows = function() { 134 | _SRPG_SceneMap_createAllWindows.call(this); 135 | this._windowLayer.removeChild(this._mapSrpgStatusWindow); 136 | this.createSrpgStatusWindow(); 137 | }; 138 | 139 | var _Scene_Map_createSrpgActorCommandWindow = Scene_Map.prototype.createSrpgActorCommandWindow; 140 | Scene_Map.prototype.createSrpgActorCommandWindow = function(){ 141 | _Scene_Map_createSrpgActorCommandWindow.call(this); 142 | this._mapSrpgActorCommandWindow.setHandler('status', this.commandStatus.bind(this)); 143 | }; 144 | 145 | Scene_Map.prototype.commandStatus = function() { 146 | var battlerArray = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId()); 147 | SoundManager.playOk(); 148 | $gameTemp.setResetMoveList(true); 149 | $gameSystem.setActorCommandStatus(); 150 | $gameSystem.setSrpgStatusWindowNeedRefresh(battlerArray); 151 | $gameSystem.setSubBattlePhase('status_window'); 152 | }; 153 | 154 | var _Scene_Map_selectPreviousActorCommand = Scene_Map.prototype.selectPreviousActorCommand 155 | Scene_Map.prototype.selectPreviousActorCommand = function() { 156 | if ($gameSystem.isActorCommandStatus()) { 157 | $gameSystem.clearActorCommandStatus(); 158 | this._mapSrpgActorCommandWindow.activate(); 159 | } else _Scene_Map_selectPreviousActorCommand.call(this); 160 | } 161 | 162 | 163 | Window_ActorCommand.prototype.addSrpgStatusCommand = function() { 164 | if (_enableStatus) this.addCommand(TextManager.status, 'status'); 165 | } 166 | 167 | //a bad idea to add the status command here... 168 | var _Window_ActorCommand_addWaitCommand = Window_ActorCommand.prototype.addWaitCommand 169 | Window_ActorCommand.prototype.addWaitCommand = function() { 170 | this.addSrpgStatusCommand(); 171 | _Window_ActorCommand_addWaitCommand.call(this); 172 | }; 173 | 174 | var _Window_SrpgStatus_clearBattler = Window_SrpgStatus.prototype.clearBattler 175 | Window_SrpgStatus.prototype.clearBattler = function() { 176 | this._page = 0; 177 | _Window_SrpgStatus_clearBattler.call(this); 178 | }; 179 | 180 | Window_SrpgStatus.prototype.windowWidth = function() { 181 | return _width; 182 | }; 183 | 184 | Window_SrpgStatus.prototype.windowHeight = function() { 185 | return this.fittingHeight(_height); 186 | }; 187 | 188 | Window_SrpgStatus.prototype.nextPage = function() { 189 | this._page = (this._page + 1) % _pages; 190 | this.refresh(); 191 | }; 192 | 193 | Window_SrpgStatus.prototype.drawContentsActor = function() { 194 | var lineHeight = this.lineHeight(); 195 | if (this._page == 0){ 196 | //TODO: this part is for page 0 197 | this.drawActorName(this._battler, 6, lineHeight * 0); 198 | this.drawActorClass(this._battler, 192, lineHeight * 0); 199 | this.drawActorFace(this._battler, 6, lineHeight * 1); 200 | this.drawBasicInfoActor(176, lineHeight * 1); 201 | this.drawActorSrpgEqiup(this._battler, 6, lineHeight * 5); 202 | this.drawParameters(6, lineHeight * 6); 203 | this.drawSrpgParameters(6, lineHeight * 9); 204 | } else if (this._page == 1){ 205 | //TODO: this part is for page 1, the code here is just an example 206 | this.drawActorFace(this._battler, 6, lineHeight * 1); 207 | this.drawBasicInfoActor(176, lineHeight * 1); 208 | this.drawText('actor page 1', 6, lineHeight * 0); 209 | //an example to draw element rate 210 | this.changeTextColor(this.systemColor()); 211 | this.drawText('fire', 6, lineHeight * 5, 120); 212 | this.drawText('ice', 6, lineHeight * 6, 120); 213 | this.resetTextColor(); 214 | this.drawText(this._battler.elementRate(2) * 100 + '%', 6 + 120, lineHeight * 5, 48, 'right'); 215 | this.drawText(this._battler.elementRate(3) * 100 + '%', 6 + 120, lineHeight * 6, 48, 'right'); 216 | } else if (this._page == 2){ 217 | //TODO: this part is for page 2, the code here is just an example 218 | this.drawText('actor page 2', 6, lineHeight * 0) 219 | 220 | //an example to draw equipments 221 | var equips = this._battler.equips(); 222 | var count = equips.length; 223 | for (var i = 0; i < count; i++) { 224 | this.drawItemName(equips[i], 6, lineHeight * 1 + this.lineHeight() * i); 225 | } 226 | } 227 | //Feel free to add/remove pages. 228 | }; 229 | 230 | Window_SrpgStatus.prototype.drawContentsEnemy = function() { 231 | var lineHeight = this.lineHeight(); 232 | if (this._page == 0){ 233 | //TODO: this part is for page 0 234 | this.drawActorName(this._battler, 6, lineHeight * 0); 235 | this.drawEnemyClass(this._battler, 192, lineHeight * 0); 236 | this.drawEnemyFace(this._battler, 6, lineHeight * 1); 237 | this.drawBasicInfoEnemy(176, lineHeight * 1); 238 | this.drawEnemySrpgEqiup(this._battler, 6, lineHeight * 5); 239 | this.drawParameters(6, lineHeight * 6); 240 | this.drawSrpgParameters(6, lineHeight * 9); 241 | } else if (this._page == 1){ 242 | //TODO: this part is content for page 1, the code here is just an example 243 | this.drawEnemyFace(this._battler, 6, lineHeight * 1); 244 | this.drawBasicInfoEnemy(176, lineHeight * 1); 245 | this.drawText('enemy page 1', 6, lineHeight * 0); 246 | 247 | //an example to draw element rate 248 | this.changeTextColor(this.systemColor()); 249 | this.drawText('fire', 6, lineHeight * 5, 120); 250 | this.drawText('ice', 6, lineHeight * 6, 120); 251 | this.resetTextColor(); 252 | this.drawText(this._battler.elementRate(2) * 100 + '%', 6 + 120, lineHeight * 5, 48, 'right'); 253 | this.drawText(this._battler.elementRate(3) * 100 + '%', 6 + 120, lineHeight * 6, 48, 'right'); 254 | } else if (this._page == 2){ 255 | //TODO: this part is content for page 2 256 | this.drawText('enemy page 2', 6, lineHeight * 0) 257 | } 258 | //Feel free to add/remove pages. 259 | }; 260 | 261 | /* copied from SRPG_Core for reference, you can uncomment it and edit here to change whatever. 262 | //parameters from core. 263 | var parameters = PluginManager.parameters('SRPG_core'); 264 | var _enemyDefaultClass = parameters['enemyDefaultClass'] || 'エネミー'; 265 | var _textSrpgEquip = parameters['textSrpgEquip'] || '装備'; 266 | var _textSrpgMove = parameters['textSrpgMove'] || '移動力'; 267 | var _textSrpgRange = parameters['textSrpgRange'] || '射程'; 268 | var _textSrpgWait = parameters['textSrpgWait'] || '待機'; 269 | var _textSrpgTurnEnd = parameters['textSrpgTurnEnd'] || 'ターン終了'; 270 | var _textSrpgAutoBattle = parameters['textSrpgAutoBattle'] || 'オート戦闘'; 271 | var _srpgBattleQuickLaunch = parameters['srpgBattleQuickLaunch'] || 'true'; 272 | var _srpgActorCommandEquip = parameters['srpgActorCommandEquip'] || 'true'; 273 | var _srpgBattleEndAllHeal = parameters['srpgBattleEndAllHeal'] || 'true'; 274 | 275 | Window_SrpgStatus.prototype.refresh = function() { 276 | this.contents.clear(); 277 | if (!this._battler) { 278 | return; 279 | } 280 | if (this._type === 'actor') { 281 | this.drawContentsActor(); 282 | } else if (this._type === 'enemy') { 283 | this.drawContentsEnemy(); 284 | } 285 | }; 286 | 287 | Window_SrpgStatus.prototype.drawBasicInfoActor = function(x, y) { 288 | var lineHeight = this.lineHeight(); 289 | this.drawSrpgExpRate(this._battler, x, y + lineHeight * 0); 290 | this.drawActorLevel(this._battler, x, y + lineHeight * 0); 291 | this.drawActorIcons(this._battler, x, y + lineHeight * 1); 292 | this.drawActorHp(this._battler, x, y + lineHeight * 2); 293 | if ($dataSystem.optDisplayTp) { 294 | this.drawActorMp(this._battler, x, y + lineHeight * 3, 90); 295 | this.drawActorTp(this._battler, x + 96, y + lineHeight * 3, 90); 296 | } else { 297 | this.drawActorMp(this._battler, x, y + lineHeight * 3); 298 | } 299 | }; 300 | 301 | Window_SrpgStatus.prototype.drawBasicInfoEnemy = function(x, y) { 302 | var lineHeight = this.lineHeight(); 303 | this.drawEnemyLevel(this._battler, x, y + lineHeight * 0); 304 | this.drawActorIcons(this._battler, x, y + lineHeight * 1); 305 | this.drawActorHp(this._battler, x, y + lineHeight * 2); 306 | if ($dataSystem.optDisplayTp) { 307 | this.drawActorMp(this._battler, x, y + lineHeight * 3, 90); 308 | this.drawActorTp(this._battler, x + 96, y + lineHeight * 3, 90); 309 | } else { 310 | this.drawActorMp(this._battler, x, y + lineHeight * 3); 311 | } 312 | }; 313 | 314 | Window_SrpgStatus.prototype.drawParameters = function(x, y) { 315 | var lineHeight = this.lineHeight(); 316 | for (var i = 0; i < 6; i++) { 317 | var paramId = i + 2; 318 | var x2 = x + 188 * (i % 2); 319 | var y2 = y + lineHeight * Math.floor(i / 2); 320 | this.changeTextColor(this.systemColor()); 321 | this.drawText(TextManager.param(paramId), x2, y2, 120); 322 | this.resetTextColor(); 323 | this.drawText(this._battler.param(paramId), x2 + 120, y2, 48, 'right'); 324 | } 325 | }; 326 | 327 | Window_SrpgStatus.prototype.drawSrpgParameters = function(x, y) { 328 | var lineHeight = this.lineHeight(); 329 | this.changeTextColor(this.systemColor()); 330 | this.drawText(_textSrpgMove, x, y, 120); 331 | this.resetTextColor(); 332 | this.drawText(this._battler.srpgMove(), x + 120, y, 48, 'right'); 333 | this.changeTextColor(this.systemColor()); 334 | this.drawText(_textSrpgRange, x + 188, y, 120); 335 | this.resetTextColor(); 336 | var text = ''; 337 | if (this._battler.srpgWeaponMinRange() > 0) { 338 | text += this._battler.srpgWeaponMinRange() + '-'; 339 | } 340 | text += this._battler.srpgWeaponRange(); 341 | this.drawText(text, x + 188 + 72, y, 96, 'right'); 342 | }; 343 | */ 344 | 345 | })(); 346 | --------------------------------------------------------------------------------