赞 | 1 |
VIP | 0 |
好人卡 | 1 |
积分 | 1 |
经验 | 5781 |
最后登录 | 2021-9-12 |
在线时间 | 146 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 75
- 在线时间
- 146 小时
- 注册时间
- 2009-8-2
- 帖子
- 34
|
同感 物品得失提示
127521于2011-12-30 19:24补充以下内容:
和物品分类整合后的脚本
#==============================================================================
# ■ Task
#------------------------------------------------------------------------------
# 定义任务的类
#==============================================================================
# 注意!!!在对话后得到物品,请在对话后先用事件等待3帧,否则对话框来不及消失。
# 开关定义:
$不显示金钱窗口 = 41
$不显示物品窗口 = 42
$不显示武器窗口 = 43
$不显示防具窗口 = 44
# 以上开关,当打开的时候,获得物品将不会提示,比如默认打开41号开关,获得金钱不再提示
class Task
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :name #名称
attr_accessor :relate_ev #关联事件
attr_accessor :ev_map #事件所在地图
attr_accessor :main #是否为主线
attr_accessor :id #ID
attr_accessor :npc #任务发布NPC
attr_accessor :num_on #可以重复接受的次数
attr_accessor :for_ever #是否永远可以接受
attr_accessor :ne_g #需要的金钱
attr_accessor :ne_item #需要物品
attr_accessor :ne_key #需要开关
attr_accessor :ne_va #需要变量值
attr_accessor :ne_give #是否需要扣除
attr_accessor :re_v #奖励是否可见
attr_accessor :re_exp #奖励经验值
attr_accessor :re_ski #奖励技能
attr_accessor :re_ab #奖励能力值
attr_accessor :re_g #奖励金钱
attr_accessor :re_item #奖励物品
attr_accessor :re_va #奖励变量改变
attr_accessor :re_wea #奖励武器
attr_accessor :re_arm #奖励防具
attr_accessor :over #是否已经奖励
attr_accessor :goal_name #目标(目标地点、目标NPC)
attr_accessor :detail #介绍
attr_accessor :finish #是否完成
def initialize
@name = ""
@main = false
@relate_ev = 0
@id = 0
@npc = ""
@num_on = 1
@for_ever = false
@ne_key = []
@ne_g = 0
@ne_item = []
@ne_va = []
@re_v = true
@re_exp = 0
@re_ski = []
@re_g = 0
@re_item = []
@re_ab = []
@re_va = []
@re_wea = []
@re_arm = []
@over = false
@goal_name = ""
@detail = ""
@finish = false
end
end
#==============================================================================
# ■ Game_Task
#------------------------------------------------------------------------------
# 处理任务的类
# $game_task 。
#==============================================================================
class Game_Task
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
@tasks = []
@tasks[0] = Task.new
end
#--------------------------------------------------------------------------
# ● 获取变量
# variable_id : 变量 ID
#--------------------------------------------------------------------------
def [](task_id)
if task_id <= 1000 and @tasks[task_id] != nil
return @tasks[task_id]
else
return nil
end
end
#--------------------------------------------------------------------------
# ● 设置变量
# variable_id : 变量 ID
# value : 变量的值
#--------------------------------------------------------------------------
def []=(task_id, value)
if task_id <= 5000
@tasks[task_id] = value
end
end
def evn_re(event_id, map_id)
for i in [email][email protected][/email]
if @tasks[i].ev_map == map_id
if @tasks[i].relate_ev == event_id
return @tasks[i]
end
end
end
return @tasks[0]
end
# 增加任务(附带分离detail与npc)
def add_task(event_id , map_id)
task_new = $game_task[0].clone
task_new.id = @tasks.size
task_new.relate_ev = event_id
task_new.ev_map = map_id
@tasks << task_new
@tasks[0] = Task.new
return @tasks.size
end
# 完成任务
def finish(task_id)
@tasks[task_id].finish = true
end
def size
return @tasks.size
end
def judge(id) # 判断任务是否完成
if id == 0
loop do
id += 1
if judge(id)
return true
end
end
else
over = judge_g(id) && judge_item(id) && judge_key(id) && judge_va(id)
@tasks[id].finish = over
return over
end
end
# 判断金钱是否足够
def judge_g(id)
if $game_party.gold >= @tasks[id].ne_g
return true
end
return false
end
# 判断物品是否收集齐
# index = 0 表示返回整体,其他则返回各个物品情况的数组
def judge_item(id ,index = 0)
over = []
res = true
for i in 0...@tasks[id].ne_item.size
infor = @tasks[id].ne_item[i].split("%")
item_id = infor[0].to_i
num = infor[1].to_i
over << ($game_party.item_number(item_id) >= num)
res = res && ($game_party.item_number(item_id) >= num)
end
if index == 0
return res
else
return over
end
end
# 判断开关
def judge_key(id)
res = true
for i in 0...@tasks[id].ne_key.size
infor = @tasks[id].ne_key[i].split("%")
key_id = infor[0].to_i
num = (infor[1].to_i == 0)
res = res && ($game_switches[key_id] == num)
end
return res
end
# 判断变量
def judge_va(id)
res = true
for i in 0...@tasks[id].ne_va.size
infor = @tasks[id].ne_va[i].split("%")
va_id = infor[0].to_i
num = infor[1].to_i
res = res && ($game_variables[va_id] == num)
end
return res
end
# 更新任务情况
def update
for i in [email][email protected][/email]
@tasks[i].finish = judge(i)
end
for i in [email][email protected][/email]
if @tasks[i].num_on < 1
@tasks[i].over = true && (!@tasks[i].for_ever)
end
end
end
end
#==============================================================================
# ■ Scene_Task
#------------------------------------------------------------------------------
# 处理任务的类。
#==============================================================================
class Scene_Task
def main
# 生成任务列表、任务详细介绍列表
@detail_window = Window_TaskDetail.new
@list_window = Window_Task.new(@detail_window)
@list_window.help_window = @detail_window
# 执行过度
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换就中断循环
if $scene != self
break
end
end
# 装备过渡
Graphics.freeze
# 释放窗口
@list_window.dispose
@detail_window.dispose
end
def update
@list_window.update
$game_task.update
if @list_window.active
update_list
return
end
end
def update_list
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Map.new
return
end
end
end
#==============================================================================
# ■ Window_Task
#------------------------------------------------------------------------------
# 任务选择窗口。
#==============================================================================
class Window_Task < Window_Selectable
def initialize(detail_window,index = false)
@index = index
super(0, 0, 160, 480)
@detail_window = detail_window
@column_max = 1
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@task = []
for i in 1...$game_task.size
# if !$game_task[i].finish
@task.push($game_task[i])
# end
end
@item_max = @task.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_task(i)
end
end
end
def draw_task(i)
if @task[i].main
self.contents.font.color = Color.new(255,128,0,255)
self.contents.draw_text(4, i * 32, 152, 32, @task[i].name, 0)
else
self.contents.font.color = normal_color
self.contents.draw_text(4, i * 32, 152, 32, @task[i].name, 0)
end
end
def update_help
@detail_window.refresh(@task == nil ? nil : @task[self.index])
end
end
#==============================================================================
# ■ Window_TaskDetail
#------------------------------------------------------------------------------
# 任务详细介绍窗口。
#==============================================================================
class Window_TaskDetail < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(160, 0, 480, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 18
end
def up_color
return Color.new(0, 255,120, 255)
end
def down_color
return Color.new(255, 0,120, 255)
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh(task)
self.contents.clear
x = 0
y = 0
if task == nil
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 480, 32, "当前无任务", 0)
return
end
@task = task
self.contents.draw_text(x, y, 480, 20, @task.name, 0)
self.contents.draw_text(x, y, 412, 20, @task.npc, 2)
y += 20
detail_ad = @task.detail.split("\n")
for i in 0...detail_ad.size
self.contents.draw_text(x, y, 480, 20, detail_ad[i], 0)
y += 20
end
if @task.for_ever
self.contents.draw_text(x, y, 480, 20, "无限任务", 0)
y +=20
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 480, 20, "任务需要", 1)
y += 20
self.contents.font.color = normal_color
if @task.ne_item.size != 0
item_co = $game_task.judge_item(@task.id, 1)
for i in 0...item_co.size
some_item = @task.ne_item[i].split("%")
item_id = some_item[0].to_i
item_num = some_item[1]
item = $data_items[item_id]
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x + 120, y , bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 150, y, 480, 20, item.name, 0)
self.contents.font.color = item_co[i] ? up_color : down_color
self.contents.draw_text(x + 240, y, 480, 20, $game_party.item_number(item_id).to_s, 0)
self.contents.font.color = normal_color
self.contents.draw_text(x + 270, y, 480, 20, "/", 0)
self.contents.draw_text(x + 280, y, 480, 20, item_num, 0)
if some_item[2] == "1"
self.contents.draw_text(x + 330, y, 480, 20, "(无需消耗)", 0)
end
y += 20
end
end
if @task.ne_g != 0
self.contents.font.color = $game_task.judge_g(@task.id) ? up_color : down_color
self.contents.draw_text(x + 20, y, 120, 20, $game_party.gold.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 140, y, 480, 20, "/", 0)
self.contents.draw_text(x + 150, y, 480, 20, @task.ne_g.to_s + $data_system.words.gold, 0)
y += 20
end
self.contents.font.color = crisis_color
if @task.finish && (@task.num_on != 0)
self.contents.draw_text(x + 20, y, 120, 20, "可以完成", 2)
y += 20
elsif @task.over
self.contents.draw_text(x + 20, y, 120, 20, "已经完成", 2)
y += 20
end
self.contents.font.color = normal_color
if @task.re_v || @task.over
self.contents.font.color = system_color
self.contents.draw_text(x, y, 480, 20, "任务奖励:", 1)
y += 20
self.contents.font.color = normal_color
if @task.re_exp != 0
self.contents.draw_text(x + 4, y, 480, 20, "经验奖励:" + @task.re_exp.to_s, 1)
y += 20
end
if @task.re_ab.size != 0
self.contents.draw_text(x + 4, y, 480, 20, "能力值奖励:", 0)
y += 20
for i in [email][email protected]_ab.size[/email]
string = @task.re_ab[i].split("%")
case string[0].to_i
when 0 # MaxHP
ab_n = "MaxHP"
when 1 # MaxSP
ab_n = "MaxSP"
when 2 # 力量
ab_n = "力量"
when 3 # 灵巧
ab_n = "灵巧"
when 4 # 速度
ab_n = "速度"
when 5 # 魔力
ab_n = "魔力"
end
self.contents.draw_text(x + 10 + (i % 2) * 200 , y + i / 2 * 20, 240, 32, ab_n + string[1], 0)
end
y += (i / 2 + 1) * 20
end
if @task.re_g != 0
self.contents.draw_text(x + 140, y, 480, 20, @task.re_g.to_s + $data_system.words.gold, 0)
y += 20
end
if @task.re_item.size != 0
for i in [email][email protected]_item.size[/email]
some_item = @task.re_item[i].split("%")
item_id = some_item[0].to_i
item_num = some_item[1]
item = $data_items[item_id]
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x + 120, y , bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 150, y, 480, 20, item.name, 0)
self.contents.draw_text(x + 220, y, 480, 20, item_num, 0)
y += 20
end
end
if @task.re_wea.size != 0
for i in [email][email protected]_wea.size[/email]
some_item = @task.re_wea[i].split("%")
item_id = some_item[0].to_i
item_num = some_item[1]
item = $data_weapons[item_id]
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x + 120, y , bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 150, y, 480, 20, item.name, 0)
if item_num != "1"
self.contents.draw_text(x + 220, y, 480, 20, item_num, 0)
end
y += 20
end
end
if @task.re_arm.size != 0
for i in [email][email protected]_arm.size[/email]
some_item = @task.re_arm[i].split("%")
item_id = some_item[0].to_i
item_num = some_item[1]
item = $data_armors[item_id]
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x + 120, y , bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 150, y, 480, 20, item.name, 0)
if item_num != "1"
self.contents.draw_text(x + 220, y, 480, 20, item_num, 0)
end
y += 20
end
end
end
end
end
#==============================================================================
#修改Scene_Title
#==============================================================================
class Scene_Title
def command_new_game
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 停止 BGM
Audio.bgm_stop
# 重置测量游戏时间用的画面计数器
Graphics.frame_count = 0
# 生成各种游戏对像
$game_task = Game_Task.new
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# 设置初期同伴位置
$game_party.setup_starting_members
# 设置初期位置的地图
$game_map.setup($data_system.start_map_id)
# 主角向初期位置移动
$game_player.moveto($data_system.start_x, $data_system.start_y)
# 刷新主角
$game_player.refresh
# 执行地图设置的 BGM 与 BGS 的自动切换
$game_map.autoplay
# 刷新地图 (执行并行事件)
$game_map.update
# 切换地图画面
$scene = Scene_Map.new
end
end
#==============================================================================
#修改Interpreter
#==============================================================================
class Interpreter
def initialize(depth = 0, main = false)
@depth = depth
@main = main
@task_id
@task_type = false # 进入任务输入模式
@reward = false # 是否可以奖励
@skip = false # 忽略事件条
@re_ed = false # 事件是否已经奖励
@con_abl = true # 物品消耗标志
@log = "" # 记录多行文章
# 深度超过 100 级
if depth > 100
print("调用公用事件超过了限制。")
exit
end
# 清除注释器的内部状态
clear
end
#--------------------------------------------------------------------------
# ● 任务输入模式切换(task)
#--------------------------------------------------------------------------
def task_on
$game_task.update
if $game_task.evn_re(@event_id, @map_id).id != 0
@task_id = $game_task.evn_re(@event_id, @map_id).id
if $game_task.evn_re(@event_id, @map_id).finish
if $game_task.evn_re(@event_id, @map_id).over
@re_ed = true # 奖励已完成的情况
else
@reward = true # 开启奖励
end
else
@skip = true # 未完成时忽略事件
end
else
@task_type = true # 开启任务输入
end
return true
end
def task_off
if @task_type
@task_type = false
$game_task[0].npc = $game_map.events[@event_id].name
$game_task.add_task(@event_id, @map_id)
elsif @skip
@skip = false
elsif @reward
@reward = false
$game_task.evn_re(@event_id, @map_id).num_on -= 1
else
@re_ed = false
end
return true
end
def execute_command
# 到达执行内容列表末尾的情况下
if @index >= @list.size - 1
# 时间结束
command_end
# 继续
return true
end
if @re_ed && @list[@index].code != 355
return true
end
# 事件命令的功能可以参考 @parameters
@parameters = @list[@index].parameters
# 命令代码分支
case @list[@index].code
when 101 # 文章的显示
return command_101
when 102 # 显示选择项
return command_102
when 402 # [**] 的情况下
return command_402
when 403 # 取消的情况下
return command_403
when 103 # 处理数值输入
return command_103
when 104 # 更改文章选项
return command_104
when 105 # 处理按键输入
return command_105
when 106 # 等待
return command_106
when 111 # 条件分支
return command_111
when 411 # 这以外的情况
return command_411
when 112 # 循环
return command_112
when 413 # 重复上次
return command_413
when 113 # 中断循环
return command_113
when 115 # 中断时间处理
return command_115
when 116 # 暂时删除事件
return command_116
when 117 # 公共事件
return command_117
when 118 # 标签
return command_118
when 119 # 标签跳转
return command_119
when 121 # 操作开关
return command_121
when 122 # 操作变量
return command_122
when 123 # 操作独立开关
return command_123
when 124 # 操作计时器
return command_124
when 125 # 增减金钱
return command_125
when 126 # 增减物品
return command_126
when 127 # 增减武器
return command_127
when 128 # 增减防具
return command_128
when 129 # 替换角色
return command_129
when 131 # 更改窗口外关
return command_131
when 132 # 更改战斗 BGM
return command_132
when 133 # 更改战斗结束 BGS
return command_133
when 134 # 更改禁止保存
return command_134
when 135 # 更改禁止菜单
return command_135
when 136 # 更改禁止遇敌
return command_136
when 201 # 場所移動
return command_201
when 202 # 设置事件位置
return command_202
when 203 # 地图滚动
return command_203
when 204 # 更改地图设置
return command_204
when 205 # 更改雾的色调
return command_205
when 206 # 更改雾的不透明度
return command_206
when 207 # 显示动画
return command_207
when 208 # 更改透明状态
return command_208
when 209 # 设置移动路线
return command_209
when 210 # 移动结束后等待
return command_210
when 221 # 准备过渡
return command_221
when 222 # 执行过渡
return command_222
when 223 # 更改画面色调
return command_223
when 224 # 画面闪烁
return command_224
when 225 # 画面震动
return command_225
when 231 # 显示图片
return command_231
when 232 # 移动图片
return command_232
when 233 # 旋转图片
return command_233
when 234 # 更改色调
return command_234
when 235 # 删除图片
return command_235
when 236 # 设置天候
return command_236
when 241 # 演奏 BGM
return command_241
when 242 # BGM 的淡入淡出
return command_242
when 245 # 演奏 BGS
return command_245
when 246 # BGS 的淡入淡出
return command_246
when 247 # 记忆 BGM / BGS
return command_247
when 248 # 还原 BGM / BGS
return command_248
when 249 # 演奏 ME
return command_249
when 250 # 演奏 SE
return command_250
when 251 # 停止 SE
return command_251
when 301 # 战斗处理
return command_301
when 601 # 胜利的情况
return command_601
when 602 # 逃跑的情况
return command_602
when 603 # 失败的情况
return command_603
when 302 # 商店的处理
return command_302
when 303 # 名称输入的处理
return command_303
when 311 # 增减 HP
return command_311
when 312 # 增减 SP
return command_312
when 313 # 更改状态
return command_313
when 314 # 全回复
return command_314
when 315 # 增减 EXP
return command_315
when 316 # 増減 等级
return command_316
when 317 # 増減 能力值
return command_317
when 318 # 增减特技
return command_318
when 319 # 变更装备
return command_319
when 320 # 更改角色名字
return command_320
when 321 # 更改角色职业
return command_321
when 322 # 更改角色图形
return command_322
when 331 # 増減敌人的 HP
return command_331
when 332 # 増減敌人的 SP
return command_332
when 333 # 更改敌人的状态
return command_333
when 334 # 敌人出现
return command_334
when 335 # 敌人变身
return command_335
when 336 # 敌人全回复
return command_336
when 337 # 显示动画
return command_337
when 338 # 伤害处理
return command_338
when 339 # 强制行动
return command_339
when 340 # 战斗中断
return command_340
when 351 # 调用菜单画面
return command_351
when 352 # 调用存档画面
return command_352
when 353 # 游戏结束
return command_353
when 354 # 返回标题画面
return command_354
when 355 # 脚本
return command_355
else # 其它
return true
end
end
#--------------------------------------------------------------------------
# ● 显示文章(task)
#--------------------------------------------------------------------------
def command_101
# 另外的文章已经设置过 message_text 的情况下
if $game_temp.message_text != nil
# 结束
return false
end
# 设置信息结束后待机和返回调用标志
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }
# message_text 设置为 1 行
$game_temp.message_text = @list[@index].parameters[0] + "\n"
if @task_type
$game_task[0].name = $game_temp.message_text.clone
end
line_count = 1
# 循环
loop do
# 下一个事件指令为文章两行以上的情况
if @list[@index+1].code == 401
# message_text 添加到第 2 行以下
$game_temp.message_text += @list[@index+1].parameters[0] + "\n"
line_count += 1
# 事件指令不在文章两行以下的情况
else
# 下一个事件指令为显示选择项的情况下
if @list[@index+1].code == 102
# 如果选择项能收纳在画面里
if @list[@index+1].parameters[0].size <= 4 - line_count
# 推进索引
@index += 1
# 设置选择项
$game_temp.choice_start = line_count
setup_choices(@list[@index].parameters)
end
# 下一个事件指令为处理输入数值的情况下
elsif @list[@index+1].code == 103
# 如果数值输入窗口能收纳在画面里
if line_count < 4
# 推进索引
@index += 1
# 设置输入数值
$game_temp.num_input_start = line_count
$game_temp.num_input_variable_id = @list[@index].parameters[0]
$game_temp.num_input_digits_max = @list[@index].parameters[1]
end
end
if @task_type
all = $game_temp.message_text.split("\n")
all.delete_at(0)
$game_task[0].detail = all.join("\n")
$game_temp.message_text = "接受任务\n\\c[4]" + $game_task[0].name
elsif @skip
$game_temp.message_text = "\\n[1]:\n任务还没有完成\n看看还要做些什么吧"
elsif @reward
$game_temp.message_text = "完成任务\n\\c[4]" + $game_task[@task_id].name.clone
end
# 继续
return true
end
# 推进索引
@index += 1
end
end
#--------------------------------------------------------------------------
# ● 开关操作(task)
#--------------------------------------------------------------------------
def command_121
if @task_type
if @parameters[0] == @parameters[1]
$game_task[0].ne_key << @parameters[0].to_s + "%" + @parameters[2].to_s
end
return true
elsif @skip
return true
end
if @reward
return true
end
# 循环全部操作
for i in @parameters[0] .. @parameters[1]
# 更改开关
$game_switches[i] = (@parameters[2] == 0)
end
# 刷新地图
$game_map.need_refresh = true
# 继续
return true
end
#--------------------------------------------------------------------------
# ● 变量操作(task)
#--------------------------------------------------------------------------
def command_122
# 初始化值
value = 0
# 操作数的分支
case @parameters[3]
when 0 # 恒量
value = @parameters[4]
when 1 # 变量
value = $game_variables[@parameters[4]]
when 2 # 随机数
value = @parameters[4] + rand(@parameters[5] - @parameters[4] + 1)
when 3 # 物品
value = $game_party.item_number(@parameters[4])
when 4 # 角色
actor = $game_actors[@parameters[4]]
if actor != nil
case @parameters[5]
when 0 # 等级
value = actor.level
when 1 # EXP
value = actor.exp
when 2 # HP
value = actor.hp
when 3 # SP
value = actor.sp
when 4 # MaxHP
value = actor.maxhp
when 5 # MaxSP
value = actor.maxsp
when 6 # 力量
value = actor.str
when 7 # 灵巧
value = actor.dex
when 8 # 速度
value = actor.agi
when 9 # 魔力
value = actor.int
when 10 # 攻击力
value = actor.atk
when 11 # 物理防御
value = actor.pdef
when 12 # 魔法防御
value = actor.mdef
when 13 # 回避修正
value = actor.eva
end
end
when 5 # 敌人
enemy = $game_troop.enemies[@parameters[4]]
if enemy != nil
case @parameters[5]
when 0 # HP
value = enemy.hp
when 1 # SP
value = enemy.sp
when 2 # MaxHP
value = enemy.maxhp
when 3 # MaxSP
value = enemy.maxsp
when 4 # 力量
value = enemy.str
when 5 # 灵巧
value = enemy.dex
when 6 # 速度
value = enemy.agi
when 7 # 魔力
value = enemy.int
when 8 # 攻击力
value = enemy.atk
when 9 # 物理防御
value = enemy.pdef
when 10 # 魔法防御
value = enemy.mdef
when 11 # 回避修正
value = enemy.eva
end
end
when 6 # 角色
character = get_character(@parameters[4])
if character != nil
case @parameters[5]
when 0 # X 坐标
value = character.x
when 1 # Y 坐标
value = character.y
when 2 # 朝向
value = character.direction
when 3 # 画面 X 坐标
value = character.screen_x
when 4 # 画面 Y 坐标
value = character.screen_y
when 5 # 地形标记
value = character.terrain_tag
end
end
when 7 # 其它
case @parameters[4]
when 0 # 地图 ID
value = $game_map.map_id
when 1 # 同伴人数
value = $game_party.actors.size
when 2 # 金钱
value = $game_party.gold
when 3 # 步数
value = $game_party.steps
when 4 # 游戏时间
value = Graphics.frame_count / Graphics.frame_rate
when 5 # 计时器
value = $game_system.timer / Graphics.frame_rate
when 6 # 存档次数
value = $game_system.save_count
end
end
if @task_type
if @parameters[0] == @parameters[1] && (@parameters[2] <= 2)
if @parameters[2] != 1
$game_task[0].ne_va << @parameters[0].to_s + "%" + value.to_s + "%" + @parameters[2].to_s
else
$game_task[0].re_va << @parameters[0].to_s + "%" + value.to_s
end
end
return true
elsif @skip
return true
end
if @reward
if @parameters[2] > 2
return true
elsif @parameters[2] == 0
return true
end
end
# 循环全部操作
for i in @parameters[0] .. @parameters[1]
# 操作分支
case @parameters[2]
when 0 # 代入
$game_variables[i] = value
when 1 # 加法
$game_variables[i] += value
when 2 # 减法
$game_variables[i] -= value
when 3 # 乘法
$game_variables[i] *= value
when 4 # 除法
if value != 0
$game_variables[i] /= value
end
when 5 # 剩余
if value != 0
$game_variables[i] %= value
end
end
# 检查上限
if $game_variables[i] > 99999999
$game_variables[i] = 99999999
end
# 检查下限
if $game_variables[i] < -99999999
$game_variables[i] = -99999999
end
end
# 刷新地图
$game_map.need_refresh = true
# 继续
return true
end
#--------------------------------------------------------------------------
# ● 独立开关操作(task)
#--------------------------------------------------------------------------
def command_123
if @task_type
case @parameters[0]
when "A"
$game_task[0].main = (@parameters[1] == 0)
when "B"
$game_task[0].re_v = (@parameters[1] == 0)
when "C"
$game_task[0].for_ever = (@parameters[1] == 0)
when "D"
@con_abl = (@parameters[1] == 0)
else
end
return true
elsif @skip || @reward
return true
end
# 事件 ID 有效的情况下
if @event_id > 0
# 生成独立开关键
key = [$game_map.map_id, @event_id, @parameters[0]]
# 更改独立开关
$game_self_switches[key] = (@parameters[1] == 0)
end
# 刷新地图
$game_map.need_refresh = true
# 继续
return true
end
#--------------------------------------------------------------------------
# ● 增减金钱(task)
#--------------------------------------------------------------------------
def command_125
# 获取要操作的值
value = operate_value(@parameters[0], @parameters[1], @parameters[2])
if @task_type
if value == 0
return true
elsif value < 0
$game_task[0].ne_g = (0 - value)
else
$game_task[0].re_g = value
end
return true
elsif @skip
return true
end
if @reward
end
# 增减金钱
$game_party.gain_gold(value) ################################
if $game_switches[$不显示金钱窗口]==false
carol3_66RPG = Window_Base.new((640-160)/2,128,180,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得金钱:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去金钱:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG.contents.draw_text(0,32,240,32,value.abs.to_s)
carol3_66RPG.contents.draw_text(0,32,140,32, $data_system.words.gold,2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
# 继续
return true
end
#--------------------------------------------------------------------------
# ● 增减物品(task)
#--------------------------------------------------------------------------
def command_126
# 获取要操作的值
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
if @task_type
con_str = @con_abl ? "0" : "1"
if value == 0
return true
elsif value < 0
num = 0 - value
item_num = @parameters[0].to_s + "%" + num.to_s + "%" + con_str
$game_task[0].ne_item << item_num
else
item_num = @parameters[0].to_s + "%" + value.to_s + "%" + con_str
$game_task[0].re_item << item_num
end
return true
elsif @skip
return true
end
if @reward
if value < 0
for i in 0...$game_task.evn_re(@event_id, @map_id).ne_item.size
id = $game_task.evn_re(@event_id, @map_id).ne_item[i].split("%")[0].to_i
able = $game_task.evn_re(@event_id, @map_id).ne_item[i].split("%")[2].to_i
if @parameters[0] == id && (able == 1)
return
end
end
end
end
# 增减物品
$game_party.gain_item(@parameters[0], value) #######################
if $game_switches[$不显示物品窗口]==false
carol3_66RPG_item = $data_items[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得物品:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去物品:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
# 继续
return true
end
#--------------------------------------------------------------------------
# ● 增减武器(task)
#--------------------------------------------------------------------------
def command_127
# 获取要操作的值
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
if @task_type
if value <= 0
return true
else
wea_num = @parameters[0].to_s + "%" + value.to_s
$game_task[0].re_wea << wea_num
end
return true
elsif @skip
return true
end
if @reward
if value < 0
$game_party.gain_weapon(@parameters[0], value)
end
return true
end
# 增减武器
$game_party.gain_weapon(@parameters[0], value) ###################
if $game_switches[$不显示武器窗口]==false
carol3_66RPG_item = $data_weapons[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得武器:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去武器:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
# 继续
return true
end
#--------------------------------------------------------------------------
# ● 增减防具(task)
#--------------------------------------------------------------------------
def command_128
# 获取要操作的值
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
if @task_type
if value <= 0
return true
else
arm_num = @parameters[0].to_s + "%" + value.to_s
$game_task[0].re_arm << arm_num
end
return true
elsif @skip
return true
end
if @reward
if value < 0
$game_party.gain_armor(@parameters[0], value)
end
return true
end
# 增减防具
$game_party.gain_armor(@parameters[0], value) ######################
if $game_switches[$不显示防具窗口]==false
carol3_66RPG_item = $data_armors[@parameters[0]]
carol3_66RPG = Window_Base.new((640-300)/2,128,300,100)
carol3_66RPG.contents = Bitmap.new(carol3_66RPG.width - 32, carol3_66RPG.height - 32)
if value >= 0
carol3_66RPG.contents.draw_text(0,0,240,32,"获得防具:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"006-System06",80,100)
else
carol3_66RPG.contents.draw_text(0,0,240,32,"失去防具:")
#——声效,可以自己改
Audio.se_play("Audio/SE/"+"005-System05",80,100)
end
carol3_66RPG_bitmap = RPG::Cache.icon(carol3_66RPG_item.icon_name)
carol3_66RPG.contents.blt(0, 32, carol3_66RPG_bitmap, Rect.new(0, 0, 24, 24), 255)
carol3_66RPG.contents.draw_text(0 + 28, 32, 212, 32, carol3_66RPG_item.name, 0)
carol3_66RPG.contents.draw_text(0, 32, 268, 32, "×"+value.abs.to_s, 2)
carol3_66RPG.opacity = 160
for i in 0..30
Graphics.update
end
for i in 0..10
carol3_66RPG.opacity -= 30
carol3_66RPG.contents_opacity -= 30
Graphics.update
end
carol3_66RPG.dispose
end
return true
# 继续
return true
end
#--------------------------------------------------------------------------
# ● 增减 EXP(task)
#--------------------------------------------------------------------------
def command_315
# 获取操作值
value = operate_value(@parameters[1], @parameters[2], @parameters[3])
if @task_type
if value > 0
$game_task[0].re_exp = value
end
return true
elsif @skip
return true
end
if @reward
if value > 0
iterate_actor(0) do |actor|
# 更改角色 EXP
actor.exp += value
end
end
return true
end
# 处理重复
iterate_actor(@parameters[0]) do |actor|
# 更改角色 EXP
actor.exp += value
end
# 继续
return true
end
#--------------------------------------------------------------------------
# ● 增减能力值(task)
#--------------------------------------------------------------------------
def command_317
# 获取操作值
value = operate_value(@parameters[2], @parameters[3], @parameters[4])
# 获取角色
actor = $game_actors[@parameters[0]]
if @task_type
if value > 0
str = @parameters[1].to_s + "%" + value.to_s
$game_task[0].re_ab << str
end
return true
elsif @skip
return true
end
if @reward
if value <= 0
return true
end
iterate_actor(0) do |actor|
case @parameters[1]
when 0 # MaxHP
actor.maxhp += value
when 1 # MaxSP
actor.maxsp += value
when 2 # 力量
actor.str += value
when 3 # 灵巧
actor.dex += value
when 4 # 速度
actor.agi += value
when 5 # 魔力
actor.int += value
end
end
return true
end
# 继续
if actor != nil
case @parameters[1]
when 0 # MaxHP
actor.maxhp += value
when 1 # MaxSP
actor.maxsp += value
when 2 # 力量
actor.str += value
when 3 # 灵巧
actor.dex += value
when 4 # 速度
actor.agi += value
when 5 # 魔力
actor.int += value
end
end
return true
end
#--------------------------------------------------------------------------
# ● 增减特技(task)
#--------------------------------------------------------------------------
def command_318
# 获取角色
actor = $game_actors[@parameters[0]]
if @task_type
if @parameters[1] != 0
$game_task[0].re_ski << actor.id.to_s + "%" + @parameters[2].to_s
end
return true
elsif @skip
return true
end
if @reward
if @parameters[1] != 0
return true
end
end
# 增减特技
if actor != nil
if @parameters[1] == 0
actor.learn_skill(@parameters[2])
else
actor.forget_skill(@parameters[2])
end
end
# 继续
return true
end
end
#==============================================================================
#修改Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :trigger # 目标
attr_reader :list # 执行内容
attr_accessor :name
attr_reader :starting # 启动中标志
#--------------------------------------------------------------------------
# ● 初始化对像
# map_id : 地图 ID
# event : 事件 (RPG::Event)
#--------------------------------------------------------------------------
def initialize(map_id, event)
super()
@map_id = map_id
@event = event
@name = event.name
@id = @event.id
@erased = false
@starting = false
@through = true
# 初期位置的移动
moveto(@event.x, @event.y)
refresh
end
end
|
|