class Interpreter
# 用于在事件脚本中调用的初始化方法
def init_plugin_CaiShuZi
# 生成答案字符串的蠢方法
a0 = rand(10).to_s
a1 = rand(10).to_s
until a1 != a0
a1 = rand(10).to_s
end
a2 = rand(10).to_s
until a2 != a1 && a2 != a0
a2 = rand(10).to_s
end
a3 = rand(10).to_s
until a3 != a2 && a3 != a1 && a3 != a0
a3 = rand(10).to_s
end
# 答案字符串
$_CaiShuZi_string = a0 + a1 + a2 + a3
# 猜对
$_CaiShuZi_judge = false
# 历史记录
$_CaiShuZi_history = []
end
class Game_Party
# 插件 Task 设置
alias _CaiShuZi_set_mapwindow_task set_mapwindow_task
def set_mapwindow_task
# 保留之前的 task 设置
_CaiShuZi_set_mapwindow_task
# 新的内容只有插件开启的时候会添加
if $plugin_CaiShuZi_enable
# 具体的 Task 设置
if $_CaiShuZi_history.size < 8
name = "猜数字:开始@Quitmenu-Switchon[1]"
text = "回合数: #{$_CaiShuZi_history.size}\n"
$_CaiShuZi_history.each do |t|
text = text + t + "\n"
end
else
name = "猜数字:开始@Quitmenu"
text = "回合数已达 8 次,无法继续猜!"
end
@tasks_info.push Game_Task.new(name,text)
name = "猜数字:退出@Quitmenu-Switchon[2]"
text = "直接退出游戏,不获取任何奖励"
@tasks_info.push Game_Task.new(name,text)
if $_CaiShuZi_judge
name = "猜数字:领奖@Quitmenu-Switchon[3]"
text = "回合数: #{$_CaiShuZi_history.size}\n奖励是:回复剂 x#{10-$_CaiShuZi_history.size}"
@tasks_info.push Game_Task.new(name,text)
end
end
end
end