|
//=============================================================================
// bcsj.js
//=============================================================================
/*:
* @plugindesc 保存相应物品
* @author wangwang
*
* @param i_id
* @desc 储存物品数据的变量
* @default 101
* @param w_id
* @desc 储存武器数据的变量
* @default 102
*@param a_id
* @desc 储存防具数据的变量
* @default 103
*/
(function() {
var parameters = PluginManager.parameters('bcsj');
var i_id = Number(parameters['i_id'] || 101);
var w_id = Number(parameters['w_id'] || 102);
var a_id = Number(parameters['a_id'] || 103);
var cc = [i_id,w_id,a_id]
//设置物品武器装备
set_i = function(id,xm,val){
if ($dataItems[id]){
return Set_itembase(id,0,xm,val)
}
return false
}
set_w = function(id,xm,val){
if ($dataItems[id]){
return Set_itembase(id,1,xm,val)
}
return false
}
set_a = function(id,xm,val){
if ($dataItems[id]){
return Set_itembase(id,2,xm,val)
}
return false
}
Set_itembase = function(id,type,xm,val){
var cc_id = cc[type];
if (!$gameVariables[cc_id]){$gameVariables[cc_id]=new Object()}
if ($gameVariables[cc_id][id]){
if(xm){$gameVariables[cc_id][id][xm] = val};
}else {
$gameVariables[cc_id][id]=new Object()
if(xm){$gameVariables[cc_id][id][xm] = val};
}
return true
}
//获得物品武器装备
get_i = function(id){
return Get_itembase(id,0)
}
get_w = function(id){
return Get_itembase(id,1)
}
get_a = function(id){
return Get_itembase(id,2)
}
//获取物品武器装备
Get_itembase = function(id,type){
var itemobject = Get_Itembasedata(id,type)
var cc_id = cc[type];
if (itemobject && $gameVariables[cc_id] && $gameVariables[cc_id][id]){
for( xm in $gameVariables[cc_id][id]) {
itemobject[xm] = $gameVariables[cc_id][id][xm]
}
}
return itemobject
}
//获取物品武器装备基础数据
Get_Itembasedata = function(i_id,type){
switch (type) {
case 0 : //物品
var wp = Get_jichu_i(i_id)
for( xm in $dataItems[i_id]) {
if (xm =='damage'){
for (nr in $dataItems[i_id][xm]){
wp['damage'][nr] = $dataItems[i_id][xm][nr]
}
}else if (xm == 'effects'){
for (nr1 in $dataItems[i_id][xm]){
wp[xm][nr1] = {code:0 , dataId: 0, value1:0,value2: 0 }
for (nr2 in $dataItems[i_id][xm][nr1]){
wp[xm][nr1][nr2] = $dataItems[i_id][xm][nr1][nr2]
}
}
}else {wp[xm] = $dataItems[i_id][xm]}
}
return wp
case 1 : //武器
var wq = Get_jichu_w(i_id)
for( xm in $dataWeapons[i_id]) {
if (xm == 'params'){
for (nr in $dataWeapons[i_id][xm]){
wq[xm][nr] = $dataWeapons[i_id][xm][nr]
}
}else if(xm == 'traits'){
for (nr1 in $dataWeapons[i_id][xm]){
wq[xm][nr1] ={code:0,dataId:0,value:0}
for(nr2 in $dataWeapons[i_id][xm][nr1]){
wq[xm][nr1][nr2]=$dataWeapons[i_id][xm][nr1][nr2]
}
}
}else {wq[xm]= $dataWeapons[i_id][xm]}
}
return wq
case 2 : //防具
var fj = Get_jichu_a(i_id)
for( xm in $dataArmors[i_id]) {
if (xm == 'params'){
for (nr in $dataArmors[i_id][xm]){
fj[xm][nr] = $dataArmors[i_id][xm][nr]
}
}else if(xm == 'traits'){
for (nr1 in $dataArmors[i_id][xm]){
fj[xm][nr1] ={code: 0,dataId:0,value:0}
for(nr2 in $dataArmors[i_id][xm][nr1]){
fj[xm][nr1][nr2]=$dataArmors[i_id][xm][nr1][nr2]
}
}
}else {fj[xm] = $dataArmors[i_id][xm]}
}
return fj
}
}
//获取物品空白副本
Get_jichu_i =function (i_id) {
var wp ;
if ($dataItems[i_id]){
wp = {
animationId: 0,consumable: true,description: '',hitType: 0,iconIndex: 0,id: 0,itypeId: 1,name: '',note: '',occasion: 0,price: 0,repeats: 1,scope: 0,speed: 0,successRate: 100,tpGain: 0
};
wp.meta = new Object();
wp.effects =[];
wp.damage = {critical:false,elementId: 0 , formula:'0' ,type: 0 ,variance: 20 }
}
return wp
}
//获取武器空白副本
Get_jichu_w = function (i_id) {
var wq ;
if ($dataWeapons[i_id]){
wq= {
animationId: 0,description: "",etypeId: 1,iconIndex: 0,id: 0,name: "",price: 0,wtypeId: 0
};
wq.meta = new Object();
wq.params =[0,0,0,0,0,0,0,0];
wq.traits =[];
}
return wq
}
//获取防具空白副本
Get_jichu_a = function (i_id) {
var fj ;
if ($dataArmors[i_id]){
fj= {
atypeId: 0,description: "",etypeId: 2,iconIndex: 0,id: 0,name: "",note: "",price: 0
};
fj.meta = new Object();
fj.params =[0,0,0,0,0,0,0,0];
fj.traits =[];
}
return fj
}
Game_Item.prototype.object = function() {
if (this.isSkill()) {
return $dataSkills[this._itemId];
} else if (this.isItem()) {
return get_i(this._itemId);
} else if (this.isWeapon()) {
return get_w(this._itemId);
} else if (this.isArmor()) {
return get_a(this._itemId);;
} else {
return null;
}
}
Game_Enemy.prototype.itemObject = function(kind, dataId) {
if (kind === 1) {
return get_i(dataId);
} else if (kind === 2) {
return get_w(dataId);
} else if (kind === 3) {
return get_a(dataId);
} else {
return null;
}
};
Game_Party.prototype.items = function() {
var list = [];
for (var id in this._items) {
list.push(get_i(id));
}
return list;
};
Game_Party.prototype.weapons = function() {
var list = [];
for (var id in this._weapons) {
list.push(get_w(id));
}
return list;
};
Game_Party.prototype.armors = function() {
var list = [];
for (var id in this._armors) {
list.push(get_a(id));
}
return list;
};
Window_ShopBuy.prototype.makeItemList = function() {
this._data = [];
this._price = [];
this._shopGoods.forEach(function(goods) {
var item = null;
switch (goods[0]) {
case 0:
item = get_i(goods[1]);
break;
case 1:
item = get_w(goods[1]);
break;
case 2:
item = get_a(goods[1]);
break;
}
if (item) {
this._data.push(item);
this._price.push(goods[2] === 0 ? item.price : goods[3]);
}
}, this);
};
})();
/*
//武器
//防具与武器 大致相同改成set_a 就好.. (wtypeId) 那里 不同
set_w(1,'name','巨剑') //名称
set_w(1,'description','这是巨剑的介绍')
set_w(1,'animationId', 5)//动画id
set_w(1,'wtypeId', 0)//武器类型 防具类型 atypeId 0开始
set_w(1,'etypeId', 1)//装备类型 武器默认1 防具 2 开始
set_w(1,'iconIndex ', 97)//图标id
set_w(1,'price', 100)//价格
set_w(1,'note', "注释")//注释
//参数是一个数组
//设置参数变更 (完全变更)
set_w(1,'params', [
100, //hp
200, //mp
300, //攻击
400, //防御
500, //m攻击
600, //m防御
700, //敏捷
800 //运气
])
//设置参数(部分)
canshu = get_w(1)['params']
canshu[1] = 100
set_w(1,'params', canshu)
//设置特性方法 特性是一个数组 ,包含的是对象
texing = get_w(1)['traits'] //获得特性数组
texing[0] //第一个特性
//如果设置第一个特性
//结合数据库
texing[0].code = 11
//元素率11,减益率12,状态率14,状态拒绝15
//参数 21,额外参数22,特殊参数23
//攻击元素31 ,状态32,速度33,次数34
//添加技能类型41,封存技能类型42,添加技能43,封存技能44
//装备武器类型51,装备防具类型52,锁定装备53,封存装备54,装备槽类型55
//动作次数61,特殊标记62,崩塌效益63,队伍能力64
//选项
texing[0].dataId = 0
// 以下为开始值
//元素率1,减益率0,状态率1,状态拒绝1
//参数 0 额外参数0,特殊参数0
//攻击元素1 ,状态1,速度0,次数0
//添加技能类型1,封存技能类型1,添加技能1,封存技能1
//动作次数0,特殊标记0,崩塌效益0,队伍能力0
//数值
texing[0].value = 1 // 比例 ,数值 ,或 默认1
//添加一个特性对象
tx = {
code: 11,dataId:0,value:1
}
texing[texing.length]= tx
//设置特性
set_w(1,'traits', texing)
//物品
set_i(1,'animationId','41')//动画id
set_i(1,'consumable', true ) // //可消耗?
set_i(1,'hitType', 0 ) //打击类型 0开始
set_i(1,'description', "介绍" )
set_i(1,'iconIndex', 176) //图标id
set_i(1,'id', 1) //id
set_i(1,'itypeId', 1) //物品种类 1开始
set_i(1,'name', "药水") //名称
set_i(1,'note',"注释" )//注释
set_i(1,'scope', 0 )//范围 0开始
set_i(1,'speed', 0 )//速度
set_i(1,'repeats',1 ) //重复
set_i(1,'successRate',100 ) //成功率
set_i(1,'tpGain',0 )//tp获得
set_i(1,'occasion', 0) //场合 0开始
set_i(1,'price', 50) //价格
//设置伤害 伤害是一个对象.
shanghai = get_i(1)['damage'] //获得伤害
//要改哪个就设置哪个
shanghai.critical = false //是否暴击
shanghai.elementId = 0 //元素 -1开始
shanghai.formula ="0" //公式
shanghai.type = 0 //类型 0开始
shanghai.variance= 20 //变化
set_i(1,'damage', shanghai )
//创建新的伤害
sh = {critical:false, //是否暴击
elementId: 0 , //元素 -1开始
formula:"0" , //公式
type: 0 , //类型 0开始
variance: 20 , //变化
}
set_i(1,'damage', sh )
//设置效果 效果是一个数组
xiaoguo = get_w(1)['effects'] //获取效果数组
//设置一个效果
xiaoguo[0]//第一个效果
xiaoguo[0].code = 11
//恢复hp 11 mp 12 ,tp 13
//增加状态 21 消除状态 22
//31 添加增益效果 32 添加减益效果 33 删除增益效果 34 删除减益
//41 特殊效果 42 增长 43学习技能 44公共事件
xiaoguo[0].dataId= 0
//恢复hp mp tp 默认0
//增加状态 消除状态 0开始
// 添加增益效果 添加减益效果 删除增益效果 删除减益 0开始
// (特殊效果 默认 0) (增长 0 开始 )(学习技能种类 1开始 ) (公共事件 1 开始)
xiaoguo[0].value1= 0
//hp 比例 mp 比例 .tp 值
//增加状态 消除状态 比例
//(添加增益效果 场景段) ( 添加减益效果 场景段 ) (删除增益效果 删除减益值 默认为 1)
// (特殊效果 默认 1)(增长 值 ) ( 学习技能 公共事件默认 1 )
xiaoguo[0].value2= 0
//hp 值 mp 值
//之于的都默认 0
//添加一个效果
xg ={code: 21 , dataId: 0 , value1: 0.5 , value2: 0 }
xiaoguo[xiaoguo.length] = xg
set_i(1,'effects',xiaoguo)
*/
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-5-10 11:34
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.