查看: 2134|回复: 8

[有事请教] 怎么让部分敌人使用自带纸娃娃里的SV图跟玩家对战呢?

[复制链接]
梦石
0
星屑
282
在线时间
23 小时
注册时间
2022-3-11
回帖
24
发表于 2022-4-1 16:25:37 | 显示全部楼层 |阅读模式
悬赏30星屑未解决
如题,刚刚浅找了一下,好像只找到MV的没有看见MZ可用的。qaq

梦石
0
星屑
3081
在线时间
236 小时
注册时间
2021-4-22
回帖
203
发表于 2022-4-1 19:23:49 | 显示全部楼层
那就深深的找一下。实在不行咱就谷歌一下
http://www.yanfly.moe/wiki/Battle_Core_VisuStella_MZ
回复

使用道具 举报

梦石
0
星屑
282
在线时间
23 小时
注册时间
2022-3-11
回帖
24
 楼主| 发表于 2022-4-3 16:07:51 | 显示全部楼层
dabaxhei 发表于 2022-4-1 19:23
那就深深的找一下。实在不行咱就谷歌一下
http://www.yanfly.moe/wiki/Battle_Core_VisuStella_MZ ...

好哥哥,你关键词搜的什么。我搜SV只看见MV用的,敌人SV没有搜索结果。
回复

使用道具 举报

梦石
0
星屑
3081
在线时间
236 小时
注册时间
2021-4-22
回帖
203
发表于 2022-4-3 17:31:53 | 显示全部楼层
惊鸿酱 发表于 2022-4-3 16:07
好哥哥,你关键词搜的什么。我搜SV只看见MV用的,敌人SV没有搜索结果。 ...

https://plugin-mz.fungamemake.com/archives/2307
应该还有其它的 你在这个网站里搜SV就行 , 这个我是找到的 没用过 你自己试试吧
回复

使用道具 举报

梦石
0
星屑
282
在线时间
23 小时
注册时间
2022-3-11
回帖
24
 楼主| 发表于 2022-4-3 21:02:11 | 显示全部楼层
dabaxhei 发表于 2022-4-3 17:31
https://plugin-mz.fungamemake.com/archives/2307
应该还有其它的 你在这个网站里搜SV就行 , 这个我是 ...

请问,这个是需要科学上网的吗?因为里面有很多链接是没办法打开的,我找到了一个相关的帖子,但是里面的网址没办法打开。会显示连接不上网络。
https://plugin-mz.fungamemake.com/archives/2307
这个帖子。

点评

好像掛了  发表于 2022-4-4 20:34
回复

使用道具 举报

梦石
0
星屑
3081
在线时间
236 小时
注册时间
2021-4-22
回帖
203
发表于 2022-4-4 19:52:28 | 显示全部楼层
惊鸿酱 发表于 2022-4-3 21:02
请问,这个是需要科学上网的吗?因为里面有很多链接是没办法打开的,我找到了一个相关的帖子,但是里面的 ...

嗯 需要挂梯子
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2022-4-4 20:38:06 | 显示全部楼层
本帖最后由 tseyik 于 2022-4-4 20:40 编辑

https://dragonflare.blue/dcave/index.php?la=ja
需豋入
aaa.jpg
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2022-4-4 22:07:16 | 显示全部楼层
本帖最后由 tseyik 于 2022-4-4 22:13 编辑

Enemy Actor Version 1.0
VSMA​

https://forums.rpgmakerweb.com/i ... ctor-plugin.134649/
rpgmEA.png
[fold=MIT  ]
  1. //=============================================================================
  2. // RPG Maker MZ - Enemy Actor
  3. //=============================================================================

  4. /*
  5. MIT License

  6. Copyright (c) 2021 VSMA

  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:

  13. The above copyright notice and this permission notice shall be included in all
  14. copies or substantial portions of the Software.

  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. */

  23. /*:
  24. * @target MZ
  25. * @plugindesc enable enemies with sv_actor sprites.
  26. * @author VSMA
  27. *
  28. * @help
  29. *
  30. * First, make a new enemy as usual, his sprite is not important, it's will be replaced
  31. * by a sv_actor
  32. *
  33. * Then in the parameters of the plug-in:
  34. * - open the parameter enemy actors
  35. * - add a new element and fill in the parameters
  36. * - enemy: the is of enemy you made
  37. * - sv_actor: the sv_actor that will replace the enemy's sprite
  38. * - weapon : the id of a weapon. It's will be use only for the
  39. *
  40. * @param ENEMY_ACTORS
  41. * @text enemy actors
  42. * @type struct<Sound>[]
  43. *
  44. */

  45. /*~struct~Sound:
  46. * @param enemy
  47. * @type enemy
  48. *
  49. * @param sv_actor
  50. * @type file
  51. * @dir img/sv_actors/
  52. * @require 1
  53. *
  54. * @param weapon
  55. * @type weapon
  56. */



  57. (()=>{
  58.     const ENEMY_ACTORS = PluginManager.parameters("EnemyActor")["ENEMY_ACTORS"];
  59.     let enemyActorId = [];

  60.     function parseEnemyActors(){
  61.         let eaString = ENEMY_ACTORS;
  62.         eaString = eaString.slice(2, -2);
  63.         eaString = eaString.split("","");

  64.         for(let object of eaString){
  65.             object = object.split("\").join("");
  66.             let json = JSON.parse(object);
  67.             json.enemy = Number(json.enemy);
  68.             json.weapon = Number(json.weapon);
  69.             enemyActorId[json.enemy] = json;
  70.         }
  71.     }

  72.     parseEnemyActors();

  73.     class Game_EnemyActor extends Game_Battler{

  74.         constructor(){
  75.             super();
  76.             this.initialize(...arguments);
  77.         }
  78.    
  79.         isEnemyActor(){
  80.             return true;
  81.         }
  82.    
  83.         initialize = function(enemyActor, x, y) {
  84.             Game_Battler.prototype.initialize.call(this);
  85.             this.setup(enemyActor, x, y);
  86.         };
  87.    
  88.         initMembers(){
  89.             Game_Battler.prototype.initMembers.call(this);
  90.             this._enemyId = 0;
  91.             this._weapon = 0;
  92.             this._sv_actor = "";
  93.             this._letter = "";
  94.             this._plural = false;
  95.             this._screenX = 0;
  96.             this._screenY = 0;
  97.             
  98.         }
  99.    
  100.         setup(enemyActor, x, y){
  101.             this._enemyId = enemyActor.enemy;
  102.             this._weapon = enemyActor.weapon;
  103.             this._sv_actor = enemyActor.sv_actor;
  104.             this._screenX = x;
  105.             this._screenY = y;
  106.             this.recoverAll();
  107.         }
  108.    
  109.         isLetterEmpty() {
  110.             return this._letter === "";
  111.         }
  112.    
  113.         originalName() {
  114.             return this.enemy().name;
  115.         }
  116.    
  117.         enemy() {
  118.             return  $dataEnemies[this._enemyId];
  119.         }
  120.    
  121.         setLetter(letter) {
  122.             this._letter = letter;
  123.         }
  124.    
  125.         screenX() {
  126.             return this._screenX;
  127.         }
  128.         
  129.         screenY() {
  130.             return this._screenY;
  131.         }
  132.    
  133.         name() {
  134.             return this.originalName() + (this._plural ? this._letter : "");
  135.         }
  136.    
  137.         isSpriteVisible() {
  138.             return true;
  139.         }
  140.    
  141.         battlerName() {
  142.             return this.enemy().battlerName;
  143.         }
  144.    
  145.         battlerHue() {
  146.             return this.enemy().battlerHue;
  147.         }
  148.    
  149.         index() {
  150.             return $gameTroop.members().indexOf(this);
  151.         }
  152.         
  153.         isBattleMember() {
  154.             return this.index() >= 0;
  155.         }
  156.    
  157.         gold() {
  158.             return this.enemy().gold;
  159.         }
  160.    
  161.         exp() {
  162.             return this.enemy().exp;
  163.         };
  164.    
  165.         makeDropItems() {
  166.             const rate = this.dropItemRate();
  167.             return this.enemy().dropItems.reduce((r, di) => {
  168.                 if (di.kind > 0 && Math.random() * di.denominator < rate) {
  169.                     return r.concat(this.itemObject(di.kind, di.dataId));
  170.                 } else {
  171.                     return r;
  172.                 }
  173.             }, []);
  174.         };
  175.    
  176.         dropItemRate() {
  177.             return $gameParty.hasDropItemDouble() ? 2 : 1;
  178.         };
  179.         
  180.         friendsUnit() {
  181.             return $gameTroop;
  182.         }
  183.    
  184.         opponentsUnit() {
  185.             return $gameParty;
  186.         }
  187.    
  188.         enemyId() {
  189.             return this._enemyId;
  190.         }
  191.    
  192.         traitObjects() {
  193.             return Game_Battler.prototype.traitObjects.call(this).concat(this.enemy());
  194.         }
  195.    
  196.         paramBase(paramId) {
  197.             return this.enemy().params[paramId];
  198.         }
  199.    
  200.         itemObject(kind, dataId) {
  201.             if (kind === 1) {
  202.                 return $dataItems[dataId];
  203.             } else if (kind === 2) {
  204.                 return $dataWeapons[dataId];
  205.             } else if (kind === 3) {
  206.                 return $dataArmors[dataId];
  207.             } else {
  208.                 return null;
  209.             }
  210.         }
  211.    
  212.         transform(enemyId) {
  213.             const name = this.originalName();
  214.             this._enemyId = enemyId;
  215.             if (this.originalName() !== name) {
  216.                 this._letter = "";
  217.                 this._plural = false;
  218.             }
  219.             this.refresh();
  220.             if (this.numActions() > 0) {
  221.                 this.makeActions();
  222.             }
  223.         }
  224.    
  225.         meetsCondition(action) {
  226.             const param1 = action.conditionParam1;
  227.             const param2 = action.conditionParam2;
  228.             switch (action.conditionType) {
  229.                 case 1:
  230.                     return this.meetsTurnCondition(param1, param2);
  231.                 case 2:
  232.                     return this.meetsHpCondition(param1, param2);
  233.                 case 3:
  234.                     return this.meetsMpCondition(param1, param2);
  235.                 case 4:
  236.                     return this.meetsStateCondition(param1);
  237.                 case 5:
  238.                     return this.meetsPartyLevelCondition(param1);
  239.                 case 6:
  240.                     return this.meetsSwitchCondition(param1);
  241.                 default:
  242.                     return true;
  243.             }
  244.         }
  245.    
  246.         meetsTurnCondition(param1, param2) {
  247.             const n = this.turnCount();
  248.             if (param2 === 0) {
  249.                 return n === param1;
  250.             } else {
  251.                 return n > 0 && n >= param1 && n % param2 === param1 % param2;
  252.             }
  253.         };
  254.         
  255.         meetsHpCondition(param1, param2) {
  256.             return this.hpRate() >= param1 && this.hpRate() <= param2;
  257.         };
  258.         
  259.         meetsMpCondition(param1, param2) {
  260.             return this.mpRate() >= param1 && this.mpRate() <= param2;
  261.         };
  262.         
  263.         meetsStateCondition(param) {
  264.             return this.isStateAffected(param);
  265.         };
  266.         
  267.         meetsPartyLevelCondition(param) {
  268.             return $gameParty.highestLevel() >= param;
  269.         };
  270.         
  271.         meetsSwitchCondition(param) {
  272.             return $gameSwitches.value(param);
  273.         };
  274.         
  275.         isActionValid(action) {
  276.             return (
  277.                 this.meetsCondition(action) && this.canUse($dataSkills[action.skillId])
  278.             );
  279.         };
  280.         
  281.         selectAction(actionList, ratingZero) {
  282.             const sum = actionList.reduce((r, a) => r + a.rating - ratingZero, 0);
  283.             if (sum > 0) {
  284.                 let value = Math.randomInt(sum);
  285.                 for (const action of actionList) {
  286.                     value -= action.rating - ratingZero;
  287.                     if (value < 0) {
  288.                         return action;
  289.                     }
  290.                 }
  291.             } else {
  292.                 return null;
  293.             }
  294.         };
  295.         
  296.         selectAllActions(actionList) {
  297.             const ratingMax = Math.max(...actionList.map(a => a.rating));
  298.             const ratingZero = ratingMax - 3;
  299.             actionList = actionList.filter(a => a.rating > ratingZero);
  300.             for (let i = 0; i < this.numActions(); i++) {
  301.                 this.action(i).setEnemyAction(
  302.                     this.selectAction(actionList, ratingZero)
  303.                 );
  304.             }
  305.         };
  306.         
  307.         makeActions() {
  308.             Game_Battler.prototype.makeActions.call(this);
  309.             if (this.numActions() > 0) {
  310.                 const actionList = this.enemy().actions.filter(a =>
  311.                     this.isActionValid(a)
  312.                 );
  313.                 if (actionList.length > 0) {
  314.                     this.selectAllActions(actionList);
  315.                 }
  316.             }
  317.             this.setActionState("waiting");
  318.         };
  319.    
  320.    
  321.         /***************************************** */
  322.    
  323.         performActionStart(action) {
  324.             Game_Battler.prototype.performActionStart.call(this, action);
  325.             //this.requestEffect("whiten");
  326.         };
  327.         
  328.         performAction(action) {
  329.             Game_Battler.prototype.performAction.call(this, action);
  330.             if (action.isAttack()) {
  331.                 this.performAttack();
  332.             } else if (action.isGuard()) {
  333.                 this.requestMotion("guard");
  334.             } else if (action.isMagicSkill()) {
  335.                 this.requestMotion("spell");
  336.             } else if (action.isSkill()) {
  337.                 this.requestMotion("skill");
  338.             } else if (action.isItem()) {
  339.                 this.requestMotion("item");
  340.             }
  341.         }
  342.    
  343.         performAttack(){
  344.             
  345.             const weapons = this.weapons();
  346.             const wtypeId = weapons[0] ? weapons[0].wtypeId : 0;
  347.             const attackMotion = $dataSystem.attackMotions[wtypeId];
  348.             if (attackMotion) {
  349.                 if (attackMotion.type === 0) {
  350.                     this.requestMotion("thrust");
  351.                 } else if (attackMotion.type === 1) {
  352.                     this.requestMotion("swing");
  353.                 } else if (attackMotion.type === 2) {
  354.                     this.requestMotion("missile");
  355.                 }
  356.                 this.startWeaponAnimation(attackMotion.weaponImageId);
  357.             }
  358.         }
  359.    
  360.         weapons(){
  361.             return [$dataWeapons[this._weapon]];
  362.         }
  363.         
  364.         performActionEnd() {
  365.             Game_Battler.prototype.performActionEnd.call(this);
  366.         }
  367.    
  368.         performDamage() {
  369.             Game_Battler.prototype.performDamage.call(this);
  370.             SoundManager.playEnemyDamage();
  371.             this.requestMotion("damage");
  372.         }
  373.    
  374.         performCollapse() {
  375.             Game_Battler.prototype.performCollapse.call(this);
  376.             switch (this.collapseType()) {
  377.                 case 0:
  378.                     this.requestEffect("collapse");
  379.                     SoundManager.playEnemyCollapse();
  380.                     break;
  381.                 case 1:
  382.                     this.requestEffect("bossCollapse");
  383.                     SoundManager.playBossCollapse1();
  384.                     break;
  385.                 case 2:
  386.                     this.requestEffect("instantCollapse");
  387.                     break;
  388.             }
  389.         }
  390.    
  391.         setPlural(plural) {
  392.             this._plural = plural;
  393.         }

  394.         /*makeActionTimes() {
  395.             return 2;
  396.         }*/
  397.         
  398.         
  399.     }
  400.    
  401.     class Sprite_EnemyActor extends Sprite_Battler{
  402.    
  403.         static MOTIONS = {
  404.             walk: { index: 0, loop: true },
  405.             wait: { index: 1, loop: true },
  406.             chant: { index: 2, loop: true },
  407.             guard: { index: 3, loop: true },
  408.             damage: { index: 4, loop: false },
  409.             evade: { index: 5, loop: false },
  410.             thrust: { index: 6, loop: false },
  411.             swing: { index: 7, loop: false },
  412.             missile: { index: 8, loop: false },
  413.             skill: { index: 9, loop: false },
  414.             spell: { index: 10, loop: false },
  415.             item: { index: 11, loop: false },
  416.             escape: { index: 12, loop: true },
  417.             victory: { index: 13, loop: true },
  418.             dying: { index: 14, loop: true },
  419.             abnormal: { index: 15, loop: true },
  420.             sleep: { index: 16, loop: true },
  421.             dead: { index: 17, loop: true }
  422.         };
  423.    
  424.    
  425.         constructor(battler){
  426.             super(battler);
  427.    
  428.         }
  429.    
  430.         initMembers(){
  431.             Sprite_Battler.prototype.initMembers.call(this);
  432.             this._battlerName = "";
  433.             this._motion = null;
  434.             this._motionCount = 0;
  435.             this._pattern = 0;
  436.             this._battlerHue = 0;
  437.             this.createShadowSprite();
  438.             this.createWeaponSprite();
  439.             this.createMainSprite();
  440.             this.createStateSprite();
  441.             this.createStateIconSprite();
  442.         }

  443.         
  444.         createStateIconSprite(){
  445.             this._stateIconSprite = new Sprite_StateIcon();
  446.             this.addChild(this._stateIconSprite);
  447.         };
  448.    
  449.         mainSprite() {
  450.             return this._mainSprite;
  451.         }
  452.    
  453.         createShadowSprite() {
  454.             this._shadowSprite = new Sprite();
  455.             this._shadowSprite.bitmap = ImageManager.loadSystem("Shadow2");
  456.             this._shadowSprite.anchor.x = 0.5;
  457.             this._shadowSprite.anchor.y = 0.5;
  458.             this._shadowSprite.y = -2;
  459.             this.addChild(this._shadowSprite);
  460.         }
  461.    
  462.         update(){
  463.             Sprite_Battler.prototype.update.call(this);
  464.             this.updateShadow();
  465.             if (this._enemy) {
  466.                 this.updateMotion();
  467.                 this.updateVisibility();
  468.                 this.updateStateSprite();
  469.             }
  470.         }

  471.         updateStateSprite() {
  472.             this._stateIconSprite.y = -Math.round((this._mainSprite.bitmap.height/6 + 40) * 0.9);
  473.             if (this._stateIconSprite.y < 20 - this.y) {
  474.                 this._stateIconSprite.y = 20 - this.y;
  475.             }
  476.         }

  477.         updateVisibility() {
  478.             this._appeared = this._enemy.isAlive();
  479.             if (this._appeared) {
  480.                 this.opacity = 255;
  481.             }
  482.         };
  483.    
  484.         updateShadow() {
  485.             this._shadowSprite.visible = !!this._enemy;
  486.         }
  487.    
  488.         createWeaponSprite() {
  489.             this._weaponSprite = new Sprite_Weapon();
  490.             this.addChild(this._weaponSprite);
  491.         }
  492.    
  493.         createMainSprite() {
  494.             this._mainSprite = new Sprite();
  495.             this._mainSprite.anchor.x = 0.5;
  496.             this._mainSprite.anchor.y = 1;
  497.             this.addChild(this._mainSprite);
  498.         }
  499.    
  500.         createStateSprite() {
  501.             this._stateSprite = new Sprite_StateOverlay();
  502.             this.addChild(this._stateSprite);
  503.         }
  504.    
  505.         updateBitmap() {
  506.             Sprite_Battler.prototype.updateBitmap.call(this);
  507.             const name = this._enemy._sv_actor;
  508.             const hue = this._enemy.battlerHue();
  509.             if (this._battlerName !== name) {
  510.                 this._battlerName = name;
  511.                 let bitmap = ImageManager.loadSvActor(name);
  512.                 this.scale.x = -1;
  513.                 this._mainSprite.bitmap = bitmap
  514.                 this._battlerHue = hue;
  515.                 this.setHue(hue);
  516.                 this.initVisibility();
  517.             }
  518.         }

  519.         setHue(hue) {
  520.             Sprite.prototype.setHue.call(this, hue);

  521.             for (let i = 0; i < this.children.length; i++){
  522.                 if (i === 2) continue;
  523.                 const child = this.children[i];
  524.                 if (child.setHue){
  525.                     child.setHue(-hue);
  526.                 }
  527.             }
  528.         }
  529.    
  530.         setBattler(battler) {
  531.             Sprite_Battler.prototype.setBattler.call(this, battler);
  532.             this._enemy = battler;
  533.             this.setHome(battler.screenX(), battler.screenY());
  534.             this._stateIconSprite.setup(battler);
  535.         }
  536.    
  537.         updateMotion() {
  538.             this.setupMotion();
  539.             this.setupWeaponAnimation();
  540.             if (this._enemy.isMotionRefreshRequested()) {
  541.                 this.refreshMotion();
  542.                 this._enemy.clearMotion();
  543.             }
  544.             this.updateMotionCount();
  545.         }
  546.    
  547.         setupMotion() {
  548.             if (this._enemy.isMotionRequested()) {
  549.                 this.startMotion(this._enemy.motionType());
  550.                 this._enemy.clearMotion();
  551.             }
  552.         }
  553.    
  554.         setupWeaponAnimation() {
  555.             if (this._enemy.isWeaponAnimationRequested()) {
  556.                 this._weaponSprite.setup(this._enemy.weaponImageId());
  557.                 this._enemy.clearWeaponAnimation();
  558.             }
  559.         }
  560.    
  561.         updateMotionCount(){
  562.             
  563.             if (this._motion && ++this._motionCount >= this.motionSpeed()) {
  564.                 if (this._motion.loop) {
  565.                     this._pattern = (this._pattern + 1) % 4;
  566.                 } else if (this._pattern < 2) {
  567.                     this._pattern++;
  568.                     
  569.                 } else {
  570.                     this.refreshMotion();
  571.                 }
  572.                 this._motionCount = 0;
  573.             }
  574.         }
  575.    
  576.         refreshMotion() {
  577.             const actor = this._enemy;
  578.             if (actor) {
  579.                 const stateMotion = actor.stateMotionIndex();
  580.                 if (stateMotion === 3) {
  581.                     this.startMotion("dead");
  582.                 } else if (stateMotion === 2) {
  583.                     this.startMotion("sleep");
  584.                 } else if (actor.isChanting()) {
  585.                     this.startMotion("chant");
  586.                 } else if (actor.isGuard() || actor.isGuardWaiting()) {
  587.                     this.startMotion("guard");
  588.                 } else if (stateMotion === 1) {
  589.                     this.startMotion("abnormal");
  590.                 } else if (this.isMoving()) {
  591.                     this.startMotion("walk");
  592.                 } else if (actor.isDying()) {
  593.                     this.startMotion("dying");
  594.                 }  else {
  595.                     this.startMotion("wait");
  596.                 }
  597.             }
  598.         }
  599.    
  600.         startMotion(motionType) {
  601.             const newMotion = Sprite_Actor.MOTIONS[motionType];
  602.             if (this._motion !== newMotion) {
  603.                 this._motion = newMotion;
  604.                 this._motionCount = 0;
  605.                 this._pattern = 0;
  606.             }
  607.         }
  608.    
  609.         motionSpeed() {
  610.             return 12;
  611.         }
  612.    
  613.         updateFrame(){
  614.             Sprite_Battler.prototype.updateFrame.call(this);
  615.             const bitmap = this._mainSprite.bitmap;
  616.             if (bitmap) {
  617.                 const motionIndex = this._motion ? this._motion.index : 0;
  618.                 const pattern = this._pattern < 3 ? this._pattern : 1;
  619.                 const cw = bitmap.width / 9;
  620.                 const ch = bitmap.height / 6;
  621.                 const cx = Math.floor(motionIndex / 6) * 3 + pattern;
  622.                 const cy = motionIndex % 6;
  623.                 this._mainSprite.setFrame(cx * cw, cy * ch, cw, ch);
  624.                 this.setFrame(0, 0, cw, ch);
  625.             }
  626.         }
  627.    
  628.         updateTargetPosition() {
  629.             if (this.shouldStepForward()) {
  630.                 this.stepForward();
  631.             } else if (!this.inHomePosition()) {
  632.                 this.stepBack();
  633.             }
  634.         }
  635.    
  636.         shouldStepForward() {
  637.             return this._enemy.isActing();
  638.         }
  639.    
  640.         stepForward() {
  641.             this.startMove(48, 0, 12);
  642.         }
  643.    
  644.         stepBack = function() {
  645.             this.startMove(0, 0, 12);
  646.         }
  647.    
  648.         updateMain() {
  649.             Sprite_Battler.prototype.updateMain.call(this);
  650.             if (this._enemy.isSpriteVisible() && !this.isMoving()) {
  651.                 this.updateTargetPosition();
  652.             }
  653.         }
  654.    
  655.         setupWeaponAnimation = function() {
  656.             
  657.             if (this._enemy.isWeaponAnimationRequested()) {
  658.                 this._weaponSprite.setup(this._enemy.weaponImageId());
  659.                 this._enemy.clearWeaponAnimation();
  660.             }
  661.         }

  662.         initVisibility() {
  663.             this._appeared = this._enemy.isAlive();
  664.             if (!this._appeared) {
  665.                 this.opacity = 0;
  666.             }
  667.         };
  668.     }
  669.    

  670.     Game_BattlerBase.prototype.isEnemyActor = function(){
  671.         return false;
  672.     }

  673.     Game_Troop.prototype.requestMotionRefresh = function(){
  674.         for(const enemy in this.member){
  675.             if(enemy.isEnemyActor()){
  676.                 enemy.requestMotionRefresh();
  677.             }
  678.         }
  679.     }

  680.     Game_Troop.prototype.setup = function(troopId) {
  681.         this.clear();
  682.         this._troopId = troopId;
  683.         this._enemies = [];
  684.         for (const member of this.troop().members) {
  685.             if ($dataEnemies[member.enemyId]) {
  686.                 const enemyId = member.enemyId;
  687.                 const x = member.x;
  688.                 const y = member.y;

  689.                 if (!!enemyActorId[enemyId]){
  690.                     
  691.                     const enemy = new Game_EnemyActor(enemyActorId[enemyId], x, y);
  692.                     
  693.                     if (member.hidden) {
  694.                         enemy.hide();
  695.                     }
  696.                     this._enemies.push(enemy);
  697.                 }

  698.                 else{
  699.                     const enemy = new Game_Enemy(enemyId, x, y);
  700.                     if (member.hidden) {
  701.                         enemy.hide();
  702.                     }
  703.                     this._enemies.push(enemy);
  704.                 }

  705.                
  706.                
  707.             }
  708.         }
  709.         this.makeUniqueNames();
  710.     };

  711.     Game_Troop.prototype.requestMotionRefresh = function() {
  712.         for (const member of this.members()) {
  713.             member.requestMotionRefresh();
  714.         }
  715.     }

  716.     Spriteset_Battle.prototype.createEnemies = function() {
  717.         const enemies = $gameTroop.members();
  718.         const sprites = [];
  719.         for (const enemy of enemies) {

  720.             if(enemy.isEnemyActor()){
  721.                 sprites.push(new Sprite_EnemyActor(enemy));
  722.             }
  723.             else{
  724.                 sprites.push(new Sprite_Enemy(enemy));
  725.             }

  726.             
  727.         }
  728.         sprites.sort(this.compareEnemySprite.bind(this));
  729.         for (const sprite of sprites) {
  730.             this._battleField.addChild(sprite);
  731.         }
  732.         this._enemySprites = sprites;
  733.     }

  734.     const BattleManager_updateEventMain = BattleManager.updateEventMain;
  735.     BattleManager.updateEventMain = function() {
  736.         $gameTroop.requestMotionRefresh();
  737.         return BattleManager_updateEventMain.call(this);
  738.     };

  739.     const BattleManager_startTurn = BattleManager.startTurn;
  740.     BattleManager.startTurn = function() {
  741.         $gameTroop.requestMotionRefresh();
  742.         BattleManager_startTurn.call(this);
  743.     };
  744.    
  745.     const BattleManager_updateTurn = BattleManager.updateTurn;
  746.     BattleManager.updateTurn = function(timeActive) {
  747.         $gameTroop.requestMotionRefresh();
  748.         BattleManager_updateTurn.call(this, timeActive);
  749.     };


  750. })();
复制代码
[/fold]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部