赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2415 |
最后登录 | 2023-10-3 |
在线时间 | 24 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 95
- 在线时间
- 24 小时
- 注册时间
- 2007-6-16
- 帖子
- 160
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
制作过程中出问题了,来请教各位大侠!
1、平时或菜单中可以使用的补血技能,对目标使用后演奏不能使用的SE,SP不减,血数值不变,但是退出使用后,血实际上已经被加上了,而且如果一直按使用技能,表面上看起来没使用,实际上不断的被免费(不扣SP)使用,而且可以超过当前等级的MAXHP,达到N万。
请问这是因为什么引起的?我把Game_Battle 3发上来大家帮忙看看。
#==============================================================================
# ■ Game_Battler (分割定义 3)
#------------------------------------------------------------------------------
# 处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
# 超级类来使用。
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 可以使用特技的判定
# skill_id : 特技 ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
#############角色技能###################
if $game_party.item_number(130) < 5 and skill_id == 120
return false
end
if skill_id == 116 or skill_id == 118 or skill_id == 119 or skill_id == 121 or skill_id == 644 or skill_id == 125 or skill_id == 126 or skill_id == 127 and $game_party.item_number(130) < 1
return false
end
if skill_id == 168 or skill_id == 143 or skill_id == 142 or skill_id == 141 or skill_id == 117 or skill_id == 325 or skill_id == 326 or skill_id == 327 and $game_party.item_number(130) < 1
return false
end
if skill_id == 94 or skill_id == 99 or skill_id == 100 or skill_id == 101 and $game_party.item_number(130) < 1
return false
end
if skill_id == 148 or skill_id == 149 or skill_id == 150 or skill_id == 169 and $game_party.item_number(130) < 2
return false
end
if self.hp > self.maxhp/5 or self.state?(72) and skill_id==87
return false
end
if self.hp > self.maxhp/5 or self.state?(72) and skill_id==235
return false
end
#if not self.state?(52) and skill_id==235
#return false
#end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==290
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==291
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==318
return false
end
if self.hp > self.maxhp/5 or self.state?(72) and skill_id==257 #那个258是指技能ID,改成需要的数字。
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==88 #那个258是指技能ID,改成需要的数字。
return false
end
if self.hp > self.maxhp/5 or self.state?(72) and skill_id==89 #那个258是指技能ID,改成需要的数字。
return false
end
if self.hp > self.maxhp/5 or self.state?(72) and skill_id==90 #那个258是指技能ID,改成需要的数字。
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==91 #那个258是指技能ID,改成需要的数字。
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==92 #那个258是指技能ID,改成需要的数字。
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==93 #那个258是指技能ID,改成需要的数字。
return false
end
if self.hp > self.maxhp/5 or self.state?(72) and skill_id==258 #那个258是指技能ID,改成需要的数字。
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==39 #漫天过海L1
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==40 #漫天过海L2
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==42 #漫天过海L2
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==59 #漫天过海L2
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==266 #那个266是指技能ID,改成需要的数字。
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==36 #连续斩1
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==38 #连续斩2
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==41 #连续斩2
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==43#连续斩2
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==37#移形换影
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==632#移形换影
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==633#移形换影
return false
end
if self.hp > self.maxhp/5 or self.fennu < 50 or self.state?(72) and skill_id==634#移形换影
return false
end
if self.hp > self.maxhp/5 or self.state?(72) and skill_id==281#灭绝2
return false
end
if self.hp > self.maxhp/5 or self.state?(72) and skill_id==282#灭绝3
return false
end
if self.hp > self.maxhp/5 or self.state?(72) and skill_id==271#灭绝4
return false
end
if self.hp <= self.maxhp/2 and skill_id==145 #横扫千军or self.state?(12) or self.state?(2)
return false
end
if self.hp <= self.maxhp/2 and skill_id==146 #横扫千军or self.state?(12) or self.state?(2)
return false
end
if self.hp <= self.maxhp/2 and skill_id==97 #横扫千军or self.state?(12) or self.state?(2)
return false
end
if self.hp <= self.maxhp/2 and skill_id==98 #横扫千军or self.state?(12) or self.state?(2)
return false
end
if self.hp < self.maxhp/1.3 and skill_id==124#连劈1 or self.state?(12) or self.state?(2)
return false
end
if self.hp < self.maxhp/1.3 and skill_id==128#连劈3 or self.state?(12) or self.state?(2)
return false
end
if self.hp < self.maxhp/1.3 and skill_id==113#连劈4 or self.state?(12) or self.state?(2)
return false
end
if self.hp < self.maxhp/1.3 and skill_id==144#连劈2 or self.state?(12) or self.state?(2)
return false
end
if self.fennu < 5 and skill_id ==250 #神圣之光1
return false
end
if self.fennu < 5 and skill_id ==279 #神圣之光2
return false
end
if self.fennu < 10 and skill_id ==3 #星光
return false
end
if self.fennu < 5 and skill_id ==4 #席雨火
return false
end
if self.fennu < 50 and skill_id ==134 #贼证
return false
end
if self.fennu < 10 and skill_id ==262 #三花聚顶
return false
end
if self.fennu < 20 and skill_id ==99 #魔盾
return false
end
if self.fennu < 20 and skill_id ==100 #魔盾
return false
end
if self.fennu < 20 and skill_id ==101 #魔盾
return false
end
if self.fennu < 15 and skill_id ==256 #回魂
return false
end
if self.fennu < 80 and skill_id ==255 #圣灵
return false
end
if self.fennu < 50 and skill_id ==122 #神佑
return false
end
if self.fennu < 5 and skill_id ==260 #光之箭2
return false
end
if self.fennu < 15 and skill_id ==259
return false
end
if self.fennu < 15 and skill_id ==307
return false
end
if self.fennu < 15 and skill_id ==308
return false
end
#################召唤兽#####################
if self.fennu < 50 and skill_id ==153 #斩铁
return false
end
if self.fennu < 30 and skill_id ==154 #地狱火
return false
end
if self.fennu < 30 and skill_id ==155 #冰女
return false
end
if self.fennu < 30 and skill_id ==156
return false
end
if self.fennu < 50 and skill_id ==157
return false
end
if self.fennu < 50 and skill_id ==158
return false
end
if self.fennu < 50 and skill_id ==159
return false
end
if self.fennu < 40 and skill_id ==161
return false
end
##################SP特技##################
if self.fennu < 275 and skill_id ==8
return false
end
if self.fennu < 50 and skill_id ==20
return false
end
if self.fennu < 750 and skill_id ==9
return false
end
if self.fennu < 450 and skill_id ==10
return false
end
if self.fennu < 950 and skill_id ==11
return false
end
if self.fennu < 150 and skill_id ==12
return false
end
if self.fennu < 750 and skill_id ==13
return false
end
if self.fennu < 150 and skill_id ==14
return false
end
if self.fennu < 750 and skill_id ==15
return false
end
if self.fennu < 110 and skill_id ==16
return false
end
if self.fennu < 450 and skill_id ==17
return false
end
if self.fennu < 110 and skill_id ==18
return false
end
if self.fennu < 450 and skill_id ==19
return false
end
if self.fennu < 50 and skill_id ==267
return false
end
if self.fennu < 50 and skill_id ==268
return false
end
if self.fennu < 50 and skill_id ==269
return false
end
if self.fennu < 50 and skill_id ==270
return false
end
if self.fennu < 50 and skill_id ==132
return false
end
if self.fennu < 50 and skill_id ==135
return false
end
if self.fennu < 50 and skill_id ==626
return false
end
if self.fennu < 5 and skill_id ==273
return false
end
if self.fennu < 5 and skill_id ==275
return false
end
if self.fennu < 5 and skill_id ==276
return false
end
if self.fennu < 5 and skill_id ==278
return false
end
################################################
# 战斗不能的情况下不能使用
if dead?
return false
end
# 限制为"不能使用魔法"的情况下
#if self.restriction == 1
# 魔法禁锢, 纯魔法特技不能使用
if self.state?(5) and $data_skills[skill_id].atk_f == 0 and self.restriction == 1 and $data_skills[skill_id].agi_f != 1
return false
end
# 特技禁锢, 非魔法特技不能使用
if self.state?(12) and $data_skills[skill_id].atk_f != 0 and self.restriction == 1 and $data_skills[skill_id].agi_f != 1
return false
end
# 虚脱, HP在一半以下时不能使用特技
if self.state?(10) and self.hp < self.maxhp / 2 and self.restriction == 1 and $data_skills[skill_id].agi_f != 1
return false
end
# 遗忘, 学会的技能有一定的概率不能使用
if self.state?(11) and self.restriction == 1 and $data_skills[skill_id].agi_f != 1
return rand(100) < 50 ? true : false
end
# 诅咒, 任何消耗SP的技能都不能使用
if self.state?(2) and $data_skills[skill_id].sp_cost != 0 and self.restriction == 1
return false
end
#end
# SP 不足的情况下不能使用
if $data_skills[skill_id].sp_cost > self.sp
return false
end
# 获取可以使用的时机
occasion = $data_skills[skill_id].occasion
# 战斗中的情况下
if $game_temp.in_battle
# [平时] 或者是 [战斗中] 可以使用
return (occasion == 0 or occasion == 1)
# 不是战斗中的情况下
else
# [平时] 或者是 [菜单中] 可以使用
return (occasion == 0 or occasion == 2)
end
end
end
#--------------------------------------------------------------------------
# ● 应用通常攻击效果
# attacker : 攻击者 (battler)
#--------------------------------------------------------------------------
def attack_effect(attacker)
# 清除会心一击标志
self.critical = false
# 第一命中判定
if attacker.is_a?(Game_Actor)
hit_result = (rand(100) < 80 + attacker.agi/20 + attacker.str/20)
else
hit_result = (rand(100) > self.agi/5)
# 命中的情况下
end
if hit_result == true
# 计算基本伤害
#########################普通攻击伤害计算式改###########################
atk = [attacker.atk-self.pdef, 0].max
if attacker.is_a?(Game_Actor)
self.damage = atk* (10+$game_variables[251])/10#+ attacker.str/10
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
else
self.damage = atk / (1 + $game_variables[253]/10)
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
end
# 伤害符号正确的情况下
if self.damage > 0
#self.damage +=rand(20)
self.fennu += (1 + rand(10))
# 会心一击修正
if attacker.is_a?(Game_Actor)
if rand(100) < 4+$game_variables[253]
self.damage *= 2
self.critical = true
else
if rand(100) < 4
self.damage *= 2
self.critical = true
self.fennu += (1 + rand(10))
end
end
end
# 防御修正
if self.guarding?
self.damage /= 2
self.fennu += 1
end
end
# 分散
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# 第二命中判定
eva = 8 * self.agi / attacker.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
#end
end
# 命中的情况下
if hit_result == true
# 状态冲击解除
remove_states_shock
# HP 的伤害计算
if not self.state?(95) and not self.state?(94) and not self.state?(93) and not self.state?(91)
self.hp -= self.damage
end
if self.state?(95)
if self.sp >= self.damage*2
self.sp -= self.damage*2
else
self.damage -= self.sp/2
self.sp = 0
self.remove_state(95)
self.hp -= self.damage
end
#else
#self.hp -= self.damage
end
if self.state?(94)
if self.sp >= self.damage
self.sp -= self.damage
else
self.damage -= self.sp
self.sp = 0
self.remove_state(94)
self.hp -= self.damage
end
end
if self.state?(93)
if self.sp >= self.damage/2
self.sp -= self.damage/2
else
self.damage -= self.sp*2
self.sp = 0
self.remove_state(93)
self.hp -= self.damage
end
end
if self.state?(91)
if self.sp >= self.damage/3
self.sp -= self.damage/3
else
self.damage -= self.sp*3
self.sp = 0
self.remove_state(91)
self.hp -= self.damage
end
end
#############################吸血#####################
if self.state?(190) and $game_actors[7].weapon_id == 130 and not $game_actors[7].state?(1)
$game_actors[7].hp += self.damage
self.remove_state(190)
end
#############################吸血完######################
# effective |= self.hp != last_hp
# effective |= self.sp != last_sp
if self.hp < 0
self.hp = 0
end
# 状态变化
@state_changed = false
states_plus(attacker.plus_state_set)
states_minus(attacker.minus_state_set)
#end
#################丢瓶神功######################
if self.damage>0 and self.state?(21) and self.damage < self.hp and not self.state?(95) and $game_party.item_number(62)>0
$game_party.gain_item(62,-1)
self.animation_id = 15
self.hp += 150
elsif self.damage>0 and self.state?(21) and self.damage < self.hp and not self.state?(95) and $game_party.item_number(62)==0 and $game_party.item_number(63)>0
$game_party.gain_item(63,-1)
self.animation_id = 16
self.hp+=450
end
###########################丢瓶神功完###########
# Miss 的情况下
else
# 伤害设置为 "Miss"
self.damage = "Miss"
#self.fennu -= rand(5)
# 清除会心一击标志
self.critical = false
end
# 过程结束
return true
end
#--------------------------------------------------------------------------
# ● 应用特技效果
# user : 特技的使用者 (battler)
# skill : 特技
#--------------------------------------------------------------------------
def skill_effect(user, skill)
# 清除会心一击标志
self.critical = false
# 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
# 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
####################火神挂坠火系伤害调整#################
if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==122
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==133
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==266
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==267
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==268
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==270
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(1) and user.armor4_id ==269
self.damage *= 1.5
self.damage = self.damage.round
end
#################七星耳环冰系伤害调整##########################
if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==121
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==261
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==262
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==263
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==264
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==265
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(2) and user.armor4_id ==132
self.damage *= 1.5
self.damage = self.damage.round
end
#######################九天仙铃雷系伤害调整#########################
if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==123
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==134
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==271
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==272
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==273
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==274
self.damage *= 1.5
self.damage = self.damage.round
end
if user.is_a?(Game_Actor) and skill.element_set.include?(3) and user.armor4_id ==275
self.damage *= 1.5
self.damage = self.damage.round
end
############################装备影响魔法威力改完###########################
# 过程结束
return false
end
# 清除有效标志
effective = false
# 公共事件 ID 是有效的情况下,设置为有效标志
effective |= skill.common_event_id > 0
# 第一命中判定
################必中#########333
if user.state?(49)
hit = 101
hit_result = (rand(100) < hit)
else
##########################
hit = skill.hit
if skill.atk_f > 0 and not user.state?(49)
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
end
# 不确定的特技的情况下设置为有效标志
effective |= hit < 100
# 命中的情况下
if hit_result == true
# 计算威力
power = skill.power
#if user.is_a?(Game_Actor)
if skill.atk_f > 50
power += user.atk
#power += user.str * 5
power -= self.pdef * skill.pdef_f / 100
power -= self.mdef * skill.mdef_f / 100
power -= self.dex * skill.dex_f / 100
power = [power, 0].max
end
if skill.int_f > 50 #and power > 0
power += user.int*5
power -= self.mdef * skill.mdef_f / 100
power -= self.pdef * skill.pdef_f / 100
power -= self.dex * skill.dex_f / 100
power = [power, 0].max
end
if skill.dex_f > 50 and power > 0
power += user.dex*5
power -= self.dex * skill.dex_f / 100
power -= self.mdef * skill.mdef_f / 100
power -= self.pdef * skill.pdef_f / 100
end
if skill.dex_f > 50 and power < 0
power -= user.dex*5
end
self.damage = power
# 属性修正
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
# 伤害符号正确的情况下
if self.damage > 0
if user.is_a?(Game_Actor)
self.damage = power* (10+$game_variables[251])/10
else
self.damage = power / (1 + $game_variables[254]/10)
self.fennu += (1 + rand(10))
end
# 修正会心一击
if user.is_a?(Game_Actor) #and rand(100) < 4+$game_variables[254]/10
if rand(100) < 4+$game_variables[254]/10
self.damage *= 2
self.critical = true
end
else
if rand(100) < 4
self.damage *= 2
self.critical = true
self.fennu += (1 + rand(10))
end
end
else
if user.is_a?(Game_Actor)
if rand(101) < $game_variables[252]
self.damage = power*2
self.critical = true
end
end
self.hp -= self.damage
#if self.guarding?
#self.fennu -= 1
#end
end
# 分散
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# 第二命中判定
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# 不确定的特技的情况下设置为有效标志
effective |= hit < 100
end
# 命中的情况下
if hit_result == true
# 威力 0 以外的物理攻击的情况下
if skill.power != 0 and skill.atk_f > 0
# 状态冲击解除
remove_states_shock
# 设置有效标志
effective = true
end
#################丢瓶神功######################
if self.damage>0 and self.state?(21) and self.damage < self.hp and not self.state?(95) and not self.state?(104) and $game_party.item_number(62)>0
$game_party.gain_item(62,-1)
self.animation_id = 15
self.hp += 150
elsif self.damage>0 and self.state?(21) and self.damage < self.hp and not self.state?(95) and not self.state?(104) and $game_party.item_number(62)==0 and $game_party.item_number(63)>0
$game_party.gain_item(63,-1)
self.animation_id = 16
self.hp+=450
end
###########################丢瓶神功完###########
# 状态变化###############冰封改#################
@state_changed = false
if not self.state?(104)#如果不是冰封状态
effective |= states_plus(skill.plus_state_set)#附加状态正常
end
effective |= states_minus(skill.minus_state_set)#不附加任何状态
# 如果没有解除冰封
if self.state?(104)
self.damage = 0 #特技伤害值为0
end
####################冰封改完##################
# HP 的伤害减法运算#########################
if self.damage < 0 and self.state?(41)
self.damage = -0
last_hp = self.hp
self.hp -= 0
else
last_hp = self.hp
########################魔力护盾##################
if self.damage > 0
if not self.state?(95) and not self.state?(94) and not self.state?(93) and not self.state?(91)
self.hp -= self.damage
end
if self.state?(95)
if self.sp >= self.damage*2
self.sp -= self.damage*2
else
self.damage -= self.sp/2
self.hp -= self.damage
self.remove_state(95)
self.sp = 0
effective |= self.hp != last_hp
end
#else
#self.hp -= self.damage
#effective |= self.hp != last_hp
end
end
if self.state?(94)
if self.sp >= self.damage
self.sp -= self.damage
else
self.damage -= self.sp
self.sp = 0
self.remove_state(94)
self.hp -= self.damage
end
end
if self.state?(93)
if self.sp >= self.damage/2
self.sp -= self.damage/2
else
self.damage -= self.sp*2
self.sp = 0
self.remove_state(93)
self.hp -= self.damage
end
end
if self.state?(91)
if self.sp >= self.damage/3
self.sp -= self.damage/3
else
self.damage -= self.sp*3
self.sp = 0
self.remove_state(91)
self.hp -= self.damage
end
end
#if self.state?(95) and self.damage > 0
#if $game_actors[5].sp > self.damage/4
#$game_actors[5].sp -= self.damage/4
#$game_variables[100] += self.damage/4
#else
#self.sp = 0
# $game_actors[2].remove_state(95)
# $game_actors[3].remove_state(95)
# $game_actors[4].remove_state(95)
#$game_actors[5].remove_state(95)
#$game_actors[6].remove_state(95)
#$game_actors[7].remove_state(95)
#$game_actors[8].remove_state(95)
#$game_actors[9].remove_state(95)
#$game_variables[100] = 0
#end
# if $game_variables[100] >= 250
#$game_actors[2].remove_state(95)
#$game_actors[3].remove_state(95)
#$game_actors[4].remove_state(95)
#$game_actors[5].remove_state(95)
#$game_actors[6].remove_state(95)
#$game_actors[7].remove_state(95)
#$game_actors[8].remove_state(95)
#$game_actors[9].remove_state(95)
#$game_variables[100] = 0
#end
#else
# self.hp -= self.damage
#end
#end
##########血黄必死招##########
if self.hp <= self.maxhp/5 and self.state?(100)
self.damage = 9999
self.hp -= self.damage
effective |= self.hp != last_hp
end
# effective |= self.hp != last_hp
# effective |= self.sp != last_sp
if self.hp < 0
self.hp = 0
end
end
#################3##
# 威力为 0 的场合
if skill.power == 0
# 伤害设置为空的字串
#self.damage = 1+rand(9)
# 状态没有变化的情况下
unless @state_changed
# 伤害设置为空
#self.damage = "防御"
end
end
# Miss 的情况下
else
# 伤害设置为 "Miss"
self.damage = "Miss"
#self.fennu -= rand(5)
end
#end
# 不在战斗中的情况下
unless $game_temp.in_battle
# 伤害设置为 nil
self.damage = nil
end
# 过程结束
return effective
end
#--------------------------------------------------------------------------
# ● 应用物品效果
# item : 物品
#--------------------------------------------------------------------------
def item_effect(item)
# 清除会心一击标志
self.critical = false
# 物品的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
# 或者物品的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
((item.scope == 5 or item.scope == 6) and self.hp >= 1)
# 过程结束
return false
end
# 清除有效标志
effective = false
# 公共事件 ID 是有效的情况下,设置为有效标志
effective |= item.common_event_id > 0
# 命中判定
hit_result = (rand(100) < item.hit)
# 不确定的特技的情况下设置为有效标志
effective |= item.hit < 100
# 命中的情况
if hit_result == true
# 计算回复量
recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp+item.recover_hp*$game_variables[252]/100
recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp+item.recover_sp*$game_variables[252]/100
if recover_hp < 0
recover_hp += self.pdef * item.pdef_f / 20
recover_hp += self.mdef * item.mdef_f / 20
recover_hp = [recover_hp, 0].min
end
# 属性修正
recover_hp *= elements_correct(item.element_set)
recover_hp /= 100
recover_sp *= elements_correct(item.element_set)
recover_sp /= 100
# 分散
if item.variance > 0 and recover_hp.abs > 0
amp = [recover_hp.abs * item.variance / 100, 1].max
recover_hp += rand(amp+1) + rand(amp+1) - amp
end
if item.variance > 0 and recover_sp.abs > 0
amp = [recover_sp.abs * item.variance / 100, 1].max
recover_sp += rand(amp+1) + rand(amp+1) - amp
end
# 回复量符号为负的情况下
#if recover_hp < 0
# 防御修正
# if self.guarding?
# recover_hp /= 2
#end
#end
# HP 回复量符号的反转、设置伤害值
self.damage = -recover_hp
# HP 以及 SP 的回复
##########################禁疗############################
if self.damage < 0 and self.state?(41)# and not self.state?(1)
self.damage = -0
last_hp = self.hp
self.hp -= 0
last_hp = self.hp
last_sp = self.sp
else
self.hp += recover_hp
self.sp += recover_sp
#########
if recover_sp != 0 #如果补SP的量不等于0
self.damage = -recover_sp #伤害=SP恢复量的倒数
if self.hp > self.maxhp
self.hp = self.maxhp
end
if self.sp > self.maxsp
self.sp = self.maxsp
end
end#################
effective |= self.hp != last_hp
effective |= self.sp != last_sp
# 状态变化
@state_changed = false
effective |= states_plus(item.plus_state_set)
effective |= states_minus(item.minus_state_set)
end
# 能力上升值有效的情况下
if item.parameter_type > 0 and item.parameter_points != 0
# 能力值的分支
case item.parameter_type
when 1 # MaxHP
@maxhp_plus += item.parameter_points
when 2 # MaxSP
@maxsp_plus += item.parameter_points
when 3 # 力量
@str_plus += item.parameter_points
when 4 # 灵巧
@dex_plus += item.parameter_points
when 5 # 速度
@agi_plus += item.parameter_points
when 6 # 魔力
@int_plus += item.parameter_points
end
# 设置有效标志
effective = true
end
# HP 回复率与回复量为 0 的情况下
if item.recover_hp_rate == 0 and item.recover_hp == 0 and item.recover_sp_rate == 0 and item.recover_sp == 0
# 设置伤害为空的字符串
self.damage = ""
# SP 回复率与回复量为 0、能力上升值无效的情况下
if item.recover_sp_rate == 0 and item.recover_sp == 0 and
(item.parameter_type == 0 or item.parameter_points == 0)
# 状态没有变化的情况下
unless @state_changed
# 伤害设置为 "Miss"
#self.damage = " "
end
end
end
# Miss 的情况下
else
# 伤害设置为 "Miss"
self.damage = "Miss"
end
# 不在战斗中的情况下
unless $game_temp.in_battle
# 伤害设置为 nil
self.damage = nil
end
# 过程结束
return effective
end
#--------------------------------------------------------------------------
# ● 应用连续伤害效果
#--------------------------------------------------------------------------
def slip_damage_effect
# 设置伤害
######炎灼##################################
if self.state?(102)
if self.hp >= 10000
self.damage = [self.damage,1000].max
else
self.damage = self.maxhp/10 + self.maxsp/10
end
end
######敌毒
if self.state?(3)
if self.hp >= 2000
self.damage = [self.damage,200].max
else
self.damage = self.hp / 10
end
end###########
# 分散
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# HP/MP 的伤害减法运算
#if self.state?(3) and @active_battler.is_a?(Game_Actor) and @active_battler.armor4_id ==89
#self.hp += self.damage
#else
if self.state?(3) and self.state?(53)
self.hp += self.damage
else
if self.state?(3) and not self.state?(53)
if not self.state?(95) and not self.state?(94) and not self.state?(93) and not self.state?(91)
self.hp -= self.damage
self.sp -= self.maxsp/10
end
if self.state?(95)
if self.sp >= self.damage*2
self.sp -= self.damage*2
else
self.damage -= self.sp/2
self.sp = 0
self.remove_state(95)
self.hp -= self.damage
end
#else
#self.hp -= self.damage
end
if self.state?(94)
if self.sp >= self.damage
self.sp -= self.damage
else
self.damage -= self.sp
self.sp = 0
self.remove_state(94)
self.hp -= self.damage
end
end
if self.state?(93)
if self.sp >= self.damage/2
self.sp -= self.damage/2
else
self.damage -= self.sp*2
self.sp = 0
self.remove_state(93)
self.hp -= self.damage
end
end
if self.state?(91)
if self.sp >= self.damage/3
self.sp -= self.damage/3
else
self.damage -= self.sp*3
self.sp = 0
self.remove_state(91)
self.hp -= self.damage
end
end
end
self.fennu += 3
end
if self.state?(102)
if self.hp >= 10000
self.damage = [self.damage,1000].max
end
if not self.state?(95) and not self.state?(94) and not self.state?(93) and not self.state?(91)
self.hp -= self.damage
end
if self.state?(95)
if self.sp >= self.damage*2
self.sp -= self.damage*2
else
self.damage -= self.sp/2
self.sp = 0
self.remove_state(95)
self.hp -= self.damage
end
end
if self.state?(94)
if self.sp >= self.damage
self.sp -= self.damage
else
self.damage -= self.sp
self.sp = 0
self.remove_state(94)
self.hp -= self.damage
end
end
if self.state?(93)
if self.sp >= self.damage/2
self.sp -= self.damage/2
else
self.damage -= self.sp*2
self.sp = 0
self.remove_state(93)
self.hp -= self.damage
end
end
if self.state?(91)
if self.sp >= self.damage/3
self.sp -= self.damage/3
else
self.damage -= self.sp*3
self.sp = 0
self.remove_state(91)
self.hp -= self.damage
end
end
self.fennu += 3
end
return true
end
#--------------------------------------------------------------------------
# ● 属性修正计算
# element_set : 属性
#--------------------------------------------------------------------------
def elements_correct(element_set)
# 無属性的情况
if element_set == []
# 返回 100
return 100
end
# 在被赋予的属性中返回最弱的
# ※过程 element_rate 是、本类以及继承的 Game_Actor
# 和 Game_Enemy 类的定义
weakest = -100
for i in element_set
weakest = [weakest, self.element_rate(i)].max
end
return weakest
end
2、我用了仓库脚本,里面添加了“仓库容积”限制,变量102号就是仓库能存入物品的数量,但是按照我的设置,第1个存入的物品到达上限时就无法存入另外的物品。并且始终只能读取第一个存入物品的数值,比如第一个存了3,上限是6,就算仓库里没有第二个物品,那么第二个物品1次也只能存3个(因为读取的是第一个物品的数量)。
脚本如下,请各位大侠帮忙出出主意。
PS:我不是伸手党,实在是解决不了了,困扰了个把星期,哎!只好麻烦大家。。。我会努力学习的^_^
#==============================================================================
# 本脚本来自www.66rpg.com,转载和使用请保留此信息
#==============================================================================
#
# 调用:$scene = Scene_Shop_Va.new(1)
#
#==============================================================================
# ■ Scene_Shop
#------------------------------------------------------------------------------
# 处理商店画面的类。
#==============================================================================
class Game_System
attr_accessor :goods
alias vaule_shop_66RPG_initialize initialize
def initialize
vaule_shop_66RPG_initialize
@goods = []
###########################################################################
# 初期的时候的商店物品,编号顺序:种类,ID,可卖数量
@goods[1] = [[-1,-1,-1]]
###########################################################################
end
def shop_change(shop,kind,id,delnumber)
dl = delnumber
for dt in $game_system.goods[shop]
if (dt[0]==kind) and (dt[1]==id)
dt[2] -= dl
dt[2] = [dt[2],$game_variables[102]].min
if dt[2] == 0
$game_system.goods[shop].delete(dt)
end
return
end
end
$game_system.goods[shop].push([kind,id,-delnumber])
end
end
class Scene_Shop_Va
def initialize(shop_number)
# 当前商店编号
@shop_now = shop_number
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 生成帮助窗口
@help_window = Window_Help.new
# 生成指令窗口
@command_window = Window_ShopCommand_Va.new
# 生成金钱窗口
@gold_window = Window_Gold.new
@gold_window.x = 480
@gold_window.y = 64
# 生成时间窗口
@dummy_window = Window_Base.new(0, 128, 640, 352)
# 生成购买窗口
@buy_window = Window_ShopBuy_Va.new($game_system.goods[@shop_now])
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
# 生成卖出窗口
@sell_window = Window_ShopSell_Va.new
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
# 生成数量输入窗口
@number_window = Window_ShopNumber_Va.new
@number_window.active = false
@number_window.visible = false
# 生成状态窗口
@status_window = Window_ShopStatus_Va.new
@status_window.visible = false
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@command_window.dispose
@gold_window.dispose
@dummy_window.dispose
@buy_window.dispose
@sell_window.dispose
@number_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@buy_window.update
@sell_window.update
@number_window.update
@status_window.update
# 指令窗口激活的情况下: 调用 update_command
if @command_window.active
update_command
return
end
# 购买窗口激活的情况下: 调用 update_buy
if @buy_window.active
update_buy
return
end
# 卖出窗口激活的情况下: 调用 update_sell
if @sell_window.active
update_sell
return
end
# 个数输入窗口激活的情况下: 调用 update_number
if @number_window.active
update_number
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (指令窗口激活的情况下)
#--------------------------------------------------------------------------
def update_command
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口光标位置分支
case @command_window.index
when 0 # 购买
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 窗口状态转向购买模式
@command_window.active = false
@dummy_window.visible = false
@buy_window.active = true
@buy_window.visible = true
@buy_window.refresh
@status_window.visible = true
when 1 # 卖出
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 窗口状态转向卖出模式
@command_window.active = false
@dummy_window.visible = false
@sell_window.active = true
@sell_window.visible = true
@sell_window.refresh
when 2 # 取消
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到地图画面
$scene = Scene_Map.new
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (购买窗口激活的情况下)
#--------------------------------------------------------------------------
def update_buy
# 设置状态窗口的物品
@status_window.item = @buy_window.item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 窗口状态转向初期模式
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
# 删除帮助文本
@help_window.set_text("")
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品
@item = @buy_window.item
# 物品无效的情况下、或者价格在所持金以上的情况下
if @item == nil #or @buy_window.item_number == $game_variables[102]#@item.number > $game_variables[101]# or @item.price > $game_party.gold
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 获取物品所持数
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
# 如果已经拥有了 99 个情况下
if number >= $game_variables[101]
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 计算可以最多购买的数量
#max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [[max, $game_variables[101] - number].min,@buy_window.item_number].min
# 窗口状态转向数值输入模式
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
#--------------------------------------------------------------------------
# ● 画面更新 (卖出窗口激活的情况下)
#--------------------------------------------------------------------------
def update_sell
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 窗口状态转向初期模式
@command_window.active = true
@dummy_window.visible = true
@sell_window.active = false
@sell_window.visible = false
@status_window.item = nil
# 删除帮助文本
@help_window.set_text("")
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
# 获取物品
#@sell_window.item_number
@item = @sell_window.item
#p @item_number.to_i
# 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
if @item == nil #or @buy_window.item_number == $game_variables[102]#or @buy_window.item_number.to_i >= $game_variables[102]# shop_goods.number >= $game_variables[102]#@buy_window.item_number == $game_variables[102]
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
#end
#
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 获取物品的所持数
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
# 最大卖出个数 = 物品的所持数
#max = [[max, $game_variables[102] - @buy_window.item_number].min,@buy_window.item_number].min
max = number#[number,$game_variables[102] - @buy_window.item_number.to_i].min#
#max = $game_variables[102] - shop_goods.number
# 窗口状态转向个数输入模式
@sell_window.active = false
@sell_window.visible = false
@number_window.set(@item, max, @item.price / 2)
@number_window.active = true
@number_window.visible = true
@status_window.visible = true
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (个数输入窗口激活的情况下)
#--------------------------------------------------------------------------
def update_number
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 设置个数输入窗口为不活动·非可视状态
@number_window.active = false
@number_window.visible = false
# 命令窗口光标位置分支
case @command_window.index
when 0 # 购买
# 窗口状态转向购买模式
@buy_window.active = true
@buy_window.visible = true
when 1 # 卖出
# 窗口状态转向卖出模式
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏商店 SE
$game_system.se_play($data_system.shop_se)
# 设置个数输入窗口为不活动·非可视状态
@number_window.active = false
@number_window.visible = false
# 命令窗口光标位置分支
case @command_window.index
when 0 # 购买
# 购买处理
temp = 0
case @item
when RPG::Item
$game_party.gain_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.gain_weapon(@item.id, @number_window.number)
temp = 1
when RPG::Armor
$game_party.gain_armor(@item.id, @number_window.number)
temp = 2
end
goods_del(temp,@item.id,@number_window.number)
# 刷新各窗口
@buy_window = Window_ShopBuy_Va.new($game_system.goods[@shop_now])
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
# 窗口状态转向购买模式
@buy_window.active = true
@buy_window.visible = true
when 1 # 卖出
# 卖出处理
#$game_party.lose_gold(@number_window.number)
temp = 0
case @item
when RPG::Item
$game_party.lose_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.lose_weapon(@item.id, @number_window.number)
temp = 1
when RPG::Armor
$game_party.lose_armor(@item.id, @number_window.number)
temp = 2
end
# 刷新各窗口
goods_del(temp,@item.id,-@number_window.number)
@buy_window = Window_ShopBuy_Va.new($game_system.goods[@shop_now])
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
# 窗口状态转向卖出模式
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
end
return
end
end
# 删除可出售商品内容
def goods_del(kind,id,delnumber)
dl = delnumber
for dt in $game_system.goods[@shop_now]
if (dt[0]==kind) and (dt[1]==id)
dt[2] -= dl
dt[2] = [dt[2],$game_variables[102]].min #$game_variables[102]
if dt[2] == 0
$game_system.goods[@shop_now].delete(dt)
end
return
end
end
$game_system.goods[@shop_now].push([kind,id,-delnumber])
end
end
#==============================================================================
# ■ Window_ShopBuy_Va
#------------------------------------------------------------------------------
# 商店画面、浏览显示可以购买的商品的窗口。
#==============================================================================
class Window_ShopBuy_Va < Window_Selectable
attr_accessor :shop_goods
#--------------------------------------------------------------------------
# ● 初始化对像
# shop_goods : 商品
#--------------------------------------------------------------------------
def initialize(shop_goods)
super(0, 128, 368, 352)
@shop_goods = shop_goods
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item_number
return @data_number[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
@data_number = []
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]]
when 2
item = $data_armors[goods_item[1]]
end
if (item != nil) and (goods_item[2] != 0)
@data.push(item)
@data_number.push(goods_item[2])
else
@data.delete(item)
end
end
# 如果项目数不是 0 就生成位图、描绘全部项目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘羡慕
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
# 获取物品所持数
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 220, y, 88, 32, "存有 ", 2)
self.contents.draw_text(x + 240, y, 88, 32, @data_number[index].to_s, 2)
# self.contents.draw_text(x + 180, y, 88, 32, item.price.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ■ Window_ShopCommand_Va
#------------------------------------------------------------------------------
# 商店画面、选择要做的事的窗口
#==============================================================================
class Window_ShopCommand_Va < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
@commands = ["取出物品", "存入物品", "离开仓库"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index * 160
self.contents.draw_text(x, 0, 128, 32, @commands[index])
end
end
#==============================================================================
# ■ Window_ShopSell_Va
#------------------------------------------------------------------------------
# 商店画面、浏览显示可以卖掉的商品的窗口。
#==============================================================================
class Window_ShopSell_Va < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 352)
@column_max = 2
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items)
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons)
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors)
end
end
# 如果项目数不是 0 就生成位图、描绘全部项目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目标号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ■ Window_ShopNumber_Va
#------------------------------------------------------------------------------
# 商店画面、输入买卖数量的窗口。
#==============================================================================
class Window_ShopNumber_Va < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 128, 368, 352)
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
@max = 1
@price = 0
@number = 1
end
#--------------------------------------------------------------------------
# ● 设置物品、最大个数、价格
#--------------------------------------------------------------------------
def set(item, max, price)
@item = item
@max = max
@price = price
@number = 1
refresh
end
#--------------------------------------------------------------------------
# ● 被输入的件数设置
#--------------------------------------------------------------------------
def number
return @number
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_item_name(@item, 4, 96)
self.contents.font.color = normal_color
self.contents.draw_text(272, 96, 32, 32, "×")
self.contents.draw_text(308, 96, 24, 32, @number.to_s, 2)
self.cursor_rect.set(304, 96, 32, 32)
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
if self.active
# 光标右 (+1)
if Input.repeat?(Input::RIGHT) and @number < @max
$game_system.se_play($data_system.cursor_se)
@number += 1
refresh
end
# 光标左 (-1)
if Input.repeat?(Input::LEFT) and @number > 1
$game_system.se_play($data_system.cursor_se)
@number -= 1
refresh
end
# 光标上 (+10)
if Input.repeat?(Input::UP) and @number < @max
$game_system.se_play($data_system.cursor_se)
@number = [@number + 10, @max].min
refresh
end
# 光标下 (-10)
if Input.repeat?(Input::DOWN) and @number > 1
$game_system.se_play($data_system.cursor_se)
@number = [@number - 10, 1].max
refresh
end
end
end
end
#==============================================================================
# ■ Window_ShopStatus_Va
#------------------------------------------------------------------------------
# 商店画面、显示物品所持数与角色装备的窗口。
#==============================================================================
class Window_ShopStatus_Va < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(368, 128, 272, 352)
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size = 18
self.contents.font.color = crisis_color
self.contents.draw_text(0, 20, 202, 32, "当前仓库等级:")
self.contents.draw_text(0, 20, 202, 32,$game_variables[377].to_s,2)
#self.contents.font.color = system_color
self.contents.draw_text(0, 40, 202, 32, "物品存储上限:")
self.contents.draw_text(0, 40, 202, 32, $game_variables[102].to_s,2)
#self.contents.draw_text(0, 60, 202, 32, "下一级S·EXP:")
#self.contents.draw_text(0, 60, 202, 32, "下一级S·EXP:")
self.contents.font.color = system_color
self.contents.draw_text(0, 80, 202, 32, "当前背包等级:")
self.contents.draw_text(0, 80, 202, 32, $game_variables[376].to_s,2)
#self.contents.font.color = system_color
self.contents.draw_text(0, 100, 202, 32, "物品携带上限:")
self.contents.draw_text(0, 100, 202, 32, $game_variables[101].to_s,2)
self.contents.font.color = knockout_color
self.contents.font.size = 20
self.contents.draw_text(0, 150, 202, 32, " 注 意 ")
#self.contents.font.color = system_color
self.contents.draw_text(0, 190, 202, 32, "要存的物品仓库是否已满?")
self.contents.draw_text(0, 210, 202, 32, "请勿在存入物品时超过")
self.contents.draw_text(0, 230, 202, 32, "最大上限,否则会被没收!")
end
#--------------------------------------------------------------------------
# ● 设置物品
# item : 新的物品
#--------------------------------------------------------------------------
def item=(item)
if @item != item
@item = item
refresh
end
end
end |
|