JAVASCRIPT 代码
[code]/**
* Created by Administrator on 2016/9/10.
*/
//==========================================================================================================
// RandomWeapon.js
//==========================================================================================================
/*:
* @plugindesc 随机获取一把武器.
* @author DYART
*
* @param price
* @desc 每次购买所需要的钱.
* @default 1000
* @help This plugin does not provide plugin commands. 这个插件没有提供插件命令。
* 使用方法: 在事件指令里输入: RandomWeapon get
*/
//这东西是定义一个对象,然后把插件里面的东西都藏在这对象里面,防止和别人起名字冲突了.
var RandomWeapon = window.RandomWeapon || {};
//外面调用的话,都要用RandomWeapon.来调用
//读取参数的对象
RandomWeapon.parameters = PluginManager.parameters('RandomWeapon');
//这是我们允许随机获得武器的id,id是根据dataWeapons.js里面的id属性确定的.
RandomWeapon.weaponsList = [1,2,3,4];
//每次随机的价格.从参数里面获得
RandomWeapon.price = parseInt (RandomWeapon.parameters['price'] || '1000') ;
RandomWeapon._Game_Interpreter_pluginCommand =Game_Interpreter. prototype.pluginCommand;
Game_Interpreter . prototype. pluginCommand = function(command, args ) {
RandomWeapon._Game_Interpreter.pluginCommand.call(this, command, args);
if(command === 'RandomWeapon'){
switch(args[0]){
case' get ': //命令 get
RandomWeapon.getWeapon();
break;
}
}
};
//这是获得武器的函数,在面向对象里面,我们叫它"方法".
RandomWeapon.getWeapon = function(){
if($gameParty.gold() |