Project1

标题: 脚本定制第1轮 ♠ 已完结,新活动计划中 [打印本页]

作者: Sion    时间: 2013-10-16 22:49
标题: 脚本定制第1轮 ♠ 已完结,新活动计划中
本帖最后由 Sion 于 2014-3-16 00:56 编辑

      最近没什么灵感,所以就帮大家写写脚本。规则如下:

1,在此贴回复你需要的脚本,这是完全免费的。
2,你所定制的脚本是开源的,这意味着它是可以给其它任何人使用的。
3,所定制的脚本必须是基于默认VA系统的。不会接受一个诸如基于 XXX 系统的脚本功能增强的定制。
4,我会选择我感兴趣的脚本来完成,复杂的系统是没有时间来搞的,比如说你要定制一个45°角战斗系统,那是不可能的 :P。
5,如果你是是本区的的活跃用户,经常在本区帮助其他人,我会优先考虑你的请求 ;)

总而言之,就是回帖提出你想要的小脚本就可以。如果有问题,可以通过私信联系我。

目前累计完成脚本数:10    <Holy Shit!>
播放从A点到B点移动的动画  范例下载@迷糊的安安
蛋疼的根据血量和状态显示不同立绘  范例下载@113340
探测隐藏事件的雷达  范例下载 / 脚本BUG修正@喵呜喵5
面向注释有“调查”的事件时,画面右下角显示“调查”  脚本链接@只是逛逛
鼠标系统添加变化指针功能  脚本链接@机械守护者
鼠标系统添加直接点选敌人功能  脚本链接@muyumuyulnny
随机出售物品的商店(可指定商品范围,可设定折扣)  脚本链接@a000b1745  
碎片死亡效果  脚本链接@qq987042370  
换装脚本  脚本链接 @qq645260214  
地图小地图  脚本链接 @落月小天魔  

   

作者: salvareless    时间: 2013-10-17 11:22
本帖最后由 Sion 于 2013-10-17 12:17 编辑

好霸气的大神。正好我遇到个难题至今未解,前来求教~~~~~~
就像我的帖子:http://rpg.blue/thread-335835-1-1.html 之中说到的一样,我希望能够在金币窗口显示身上某些道具的数量(目前是两个)来作为增加的货币使用。就像魔兽世界的正义,勇气,征服点数那样的货币。
以此衍生,可以额外添加一个菜单选项和对应的菜单页面(暂时命名为货币页面),将包括金币在内的各种扩展货币都显示在里面。形成类似魔兽世界的货币页面一样的东西。
但是由于技术有限,目前只完成了我发的帖子里面的效果,读不出变量:$game_party.item_number(83)的值。
之所以要做成显示身上物品数这个效果是因为这样可以比较方便的设置掉落,以及使扩展货币的种类不受限制。同时我还是用了另一个物品分类脚本,通过修改使这些设置为扩展货币的物品不在包包中显示,也正是应为不在包包中显示所以也就需要另开显示他们的窗口,一开始想到的就是金币窗口了,于是拉长的金币窗口,做成了如图效果。

回来附上使用的物品种类扩充脚本。


RUBY 代码复制
  1. #==============================================================================
  2. #  功能:[RMVA]增加物品栏类别
  3. #  作者:ScottyFan
  4. #  版本:v1.0 2013.8.8
  5. #  使用说明:
  6. #         在数据库-物品(包括装备)-备注 里写入 @itype[位置编号]
  7. #         新的物品分类编号是从 1 开始。比如 @itype[1]或者@itype[2]
  8. #==============================================================================
  9. module SFS
  10.   CATEGORY = [   #格式["显示名称", :标识],  标识随便写,不重复即可
  11.     ["",     :default], #注意,不要更改此行
  12.     ["消耗", :potion],  #此处为编号1
  13.     ["货币", :money],   #此处是在背包中隐藏
  14.     ]
  15. end
  16.  
  17. class RPG::BaseItem
  18.   attr_reader   :category_id
  19.   def category_id
  20.     return if self.is_a?(RPG::Skill)
  21.     if @category_id.nil?
  22.       /@itype\[(.+?)\]/ =~ @note
  23.       @category_id = $1.to_i
  24.     end
  25.     @category_id
  26.   end
  27. end
  28.  
  29.  
  30. class Window_ItemCategory
  31.   #--------------------------------------------------------------------------
  32.   # ● 生成指令列表
  33.   #--------------------------------------------------------------------------
  34.   def make_command_list
  35. #    SFS::CATEGORY.each do |itype|
  36. #      next if itype[1] == :default
  37. #      add_command(itype[0],  itype[1])
  38. #    end
  39.     add_command("消耗",     :potion)
  40.     add_command("材料",     :item)
  41.     add_command(Vocab::weapon,   :weapon)
  42.     add_command(Vocab::armor,    :armor)
  43.     add_command(Vocab::key_item, :key_item)
  44.   end
  45. end
  46.  
  47.  
  48. class Window_ItemList
  49.   #--------------------------------------------------------------------------
  50.   # ● 查询列表中是否含有此物品
  51.   #--------------------------------------------------------------------------
  52.   def include?(item)
  53.     if item && item.category_id > 0 #如果是特殊类别
  54.       return @category == SFS::CATEGORY[item.category_id][1]
  55.     end
  56.     case @category   
  57.     when :item
  58.       item.is_a?(RPG::Item) && !item.key_item?
  59.     when :weapon
  60.       item.is_a?(RPG::Weapon)
  61.     when :armor
  62.       item.is_a?(RPG::Armor)
  63.     when :key_item
  64.       item.is_a?(RPG::Item) && item.key_item?
  65.     else
  66.       false
  67.     end
  68.   end
  69. end



作者: 迷糊的安安    时间: 2013-10-17 11:59
本帖最后由 迷糊的安安 于 2013-10-17 12:02 编辑

我来定制一个。

使用类似TargetAnim[EventID,X,Y,AnimID]的指令,来实现一个某个动画一边播放一边从某事件向地图上x,y的坐标移动的效果,移动的速度由动画帧数决定,从事件A到[x,y],动画恰好播放完。

用来实现“角色向地图上某地点射击”的效果。如果EventID=0,那么就代表起始点是玩家。

动画需要自动旋转角度。例如以←为标准动画。 那么该脚本的效果始终是达成『事件    →    [x,y]』。
作者: 喵呜喵5    时间: 2013-10-17 12:57
salvareless 发表于 2013-10-17 11:22
好霸气的大神。正好我遇到个难题至今未解,前来求教~~~~~~
就像我的帖子:http://rpg.blue/thre ...

窗口需要在哪些地方显示出来?打开菜单后金钱窗口上方?地图上右下角?还是……?
这个脚本感觉挺简单的我似乎都会写……
作者: salvareless    时间: 2013-10-17 22:03
salvareless 发表于 2013-10-17 11:22
好霸气的大神。正好我遇到个难题至今未解,前来求教~~~~~~
就像我的帖子:http://rpg.blue/thre ...

刚才看了喵呜喵5回复的我的帖子,原来我调用变量那句没写对,再结合你给的提示,我想我知道怎么去写那个页面了,3Q大神。
作者: 113340    时间: 2013-10-18 08:00
我想要一个类似装备更换立绘的脚本,

在游戏本身界面最右面会显示一个立绘,根据游戏血量或者状态变化成不同受伤的样子。

这个立绘在打开菜单和装备选项时也不关闭。

类似于MaiDenSnow Eve 的这种效果吧,附赠类似效果图。

_ss_00.png (487.28 KB, 下载次数: 22)

_ss_00.png

_ss_01.png (359.2 KB, 下载次数: 15)

_ss_01.png

_ss_02.png (484.5 KB, 下载次数: 18)

_ss_02.png

作者: 喵呜喵5    时间: 2013-10-18 19:52
我也来定制一个……并不急着要如果其他人还有定制的话可以先无视掉…………

我希望制作一个矿石雷达的效果,具体如下

呼叫脚本,嗯这个没问题……


对主角显示一个雷达的动画,嗯这个也没有问题


开始依次探测距离主角一步远、两步远…………N步远的位置有没有指定的事件(事件名包含特殊字符或者事件包含特殊注释)
如果有的话,依次更改该事件的行走图为指定行走图XX秒



雷达探索结束
作者: 令狐林    时间: 2013-10-19 12:22
我想要一个天赋系统,不仅仅能加成人物属性(增加具体数值或是按百分比),同时也能触发一些其他功能,如开启某些开关,增加变量的值,开启公共事件等。不知道是否可以
作者: 只是逛逛    时间: 2013-10-19 21:59
我要两个脚本!(众:贪心!)
修改脚本:
  1. class Scene_Battle
  2. alias battleback_map_main main
  3. def main
  4.    @battleback_sprite = Spriteset_Map.new
  5.    battleback_map_main
  6.    @battleback_sprite.dispose
  7. end
  8. end
复制代码
PS:这是把地图当作战斗背景图的脚本。
修改要求:可以对战斗背景图模糊化、更改色调


制作脚本:
我想要个调查脚本,当角色面向事件且事件的第一行注释里写着<调查 on>时,在画面右下角显示“调查”二字。
作者: longshili    时间: 2013-10-20 14:32
本帖最后由 longshili 于 2013-10-20 14:33 编辑

求个战队脚本代替原本的队列~~~队伍上限18~24人,分成3~4个战队(6人一个战队),自动默认第一战队出战,其余备战(战斗死亡能替换更好)
PS:1、配合横版SideView Ver100 和 Sion大的 MouseSystem v2.0a
      2、不开火车,无论怎么队列换位。①地图时领队永远是主角1。②战斗时无论主角1怎么站位,他死了队伍灭亡游戏结束。
      3、能帮忙优化美化——窗口人物信息栏等(人物全显示,无需翻页)感激不尽
      4、能帮忙优化美化——战斗脸图人物信息(6人)万分膜拜
找了好久,也自己尝试都没什么成果,能力有限求帮忙,送V也可以,谢谢各位大神
作者: 机械守护者    时间: 2013-10-22 19:23
本帖最后由 机械守护者 于 2013-10-22 19:26 编辑

S叔,现在还可以吗?》》
能给乃写的那个鼠标脚本加上鼠标滑过npc时更改鼠标样式吗?(好吧,很无耻的要求。但是俺尝试了好多方法都失败了。
谢谢S叔了喵


类似这货?
作者: lirn    时间: 2013-10-24 15:30
本帖最后由 Sion 于 2013-10-25 17:19 编辑

一直以来都觉得是,前排队员战斗,后排队员坐着什么都帮不上总觉得好像不太合清理。

我设想,能不能就是设定未上场的队员各种状态可以持续作用,比如各种BUFF,DEBUFF的回合照常计算,中毒HP也会照扣,同时每回合可以回复一定的HPMP




————————————— Edited by Sion ——————————————

修改 Scene_Battle 里的一段脚本
RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2.   # ● 回合结束
  3.   #--------------------------------------------------------------------------
  4.   def turn_end
  5.     all_battle_members.each do |battler| #获取敌我双方的全部参战角色
  6.       battler.on_turn_end
  7.       refresh_status
  8.       @log_window.display_auto_affected_status(battler)
  9.       @log_window.wait_and_clear
  10.     end
  11.     ($game_party.all_members - $game_party.battle_members).each {|actor| # 获取我方待机角色
  12.       actor.on_turn_end
  13.       actor.hp += 10 #可以自己定义恢复HP等
  14.       @log_window.display_auto_affected_status(battler)# 显示自动状态的效果影响 如果不需要显示待机角色,就不需要这一行跟下一行
  15.       @log_window.wait_and_clear
  16.     }
  17.     BattleManager.turn_end
  18.     process_event
  19.     start_party_command_selection
  20.   end


作者: fux2    时间: 2013-10-25 14:25
本帖最后由 Sion 于 2013-10-25 21:38 编辑

角色的移动改为像素,实际坐标不影响(按视觉坐标取整,即和未修改时一样)




————————————— Edited by Sion ——————————————

这是搞到一半的工程: Project3.rar (1.43 MB, 下载次数: 59)
作者: lirn    时间: 2013-10-26 10:41
令狐林 发表于 2013-10-19 12:22
我想要一个天赋系统,不仅仅能加成人物属性(增加具体数值或是按百分比),同时也能触发一些其他功能,如开 ...

我这个设想可以不,某天赋则相当于学了一个空的技能,或者以物品形式存在用来触发开关什么的。至于属性,可以附加一个死亡不解除状态的脚本或者通过公共事件增加或者减少。
作者: 熊喵酱    时间: 2013-10-28 07:30
本帖最后由 76213585 于 2013-10-27 16:32 编辑

恩...  大家都訂了我也來訂一個好了


功能:
在顯示文章時淡入一張圖片(一張黑色的圖片
而在結束時背景又會淡出此圖片
大概效果:
原本在地圖正常的效果:

原本的對話:

之後的對話:

然後附上我使用的黑底圖片: (減法混合)



先謝謝Sion叔了~
作者: 魔力的觉醒    时间: 2013-10-29 20:29
弱弱的说一局。其实一直想要一个有人物立绘的商店脚本,像vx那种,
作者: 魔力的觉醒    时间: 2013-10-30 00:41
魔力的觉醒 发表于 2013-10-29 20:29
弱弱的说一局。其实一直想要一个有人物立绘的商店脚本,像vx那种, ...

就是进入商店  右边出现一个人物立绘   左边是可以买商品!!!我记得VX有 忘记在哪了
作者: salvareless    时间: 2013-10-31 10:18
本帖最后由 Sion 于 2013-11-1 10:12 编辑

我错了,想我这种奇葩脚本,我就应该直接来这里求的,提问区的回答…………哎…………

说正经的,我想定制一个双持职业平砍时左右手分别计算伤害的脚本,诶·可能会和由于加载了横版战斗,也许可能还会和横版有冲突吧。
总之就是盗贼两手都有武器,而且一般情况下两手的武器肯定不同,所以为求完美希望有一个左右手分别计算伤害的脚本,让游戏更加合理。
如果有办法实现的话就好了~~~~~3Q


————————————— Edited by Sion ——————————————
RUBY 代码复制
  1. class Game_Actor
  2.   alias_method :param_plus_20131101, :param_plus
  3.   def param_plus(param_id)
  4.     param_id == 2 ? attack_plus(super) : param_plus_20131101(param_id)
  5.   end
  6.   def attack_plus(atk)
  7.     equips.each_with_index {|equip, i|
  8.       next unless equip;
  9.       atk += case i
  10.       when 1; equip.params[2].fdiv(2); #修改第二个装备位置的攻击力计算公式,目前是变成一半
  11.       else    equip.params[2]
  12.       end
  13.     }
  14.     return atk.round
  15.   end
  16. end

作者: wanghanqing    时间: 2013-11-1 08:07
Ace中有视频播放的功能,能不能让视频播放支持暂停,重放,定位播放等功能?
作者: salvareless    时间: 2013-11-1 11:23
salvareless 发表于 2013-10-31 10:18
我错了,想我这种奇葩脚本,我就应该直接来这里求的,提问区的回答…………哎…………

说正经的,我想定制 ...

这个= =应该是装备的时候副手的武器只计算一半的攻击力到总攻击力上的意思吧。

sion大神看来你确实误解了我的本意,也许是我表达不清吧= =。我的意思是,双持职业平砍的时候不是要砍两刀么。第一刀用“总攻击力-左手武器攻击力”计算(右手攻击),第一刀用“总攻击力-右手武器攻击力”计算(左手攻击)。相当于魔兽里的盗贼捅人的时候有时候用左手有时候用右手这种感觉~~~~

不过这个折合副手攻击力的脚本,倒是真没想到,先谢谢了,继续求教。
作者: salvareless    时间: 2013-11-1 12:00
本帖最后由 salvareless 于 2013-11-1 12:42 编辑

话说我突然有个想法,不知道能不能这么弄。

首先,在默认的普通攻击脚本那里添加一行判断,判断是不是双持职业(或者判断角色职业ID也行),如果是使用“攻击”的时候不发动1号技能,而是用另一个技能(例如100号技能)。
class Game_Action

  #--------------------------------------------------------------------------
  # ● 设置普通攻击
  #--------------------------------------------------------------------------
  def set_attack
    if 双持职业(或者职业ID)
      使用100号技能
    else
      set_skill(subject.attack_skill_id)
    end
    self
  end

end

然后100号技能的设置和1号技能一样,只不过技能公式那一栏空白。

然后在横版战斗里面定义一种新的技能施展类型。并将这种技能的其他地方设置成和普通攻击一样,只有伤害计算部分另外写成下面这样。


class SideView
  def skill_action
    case skill_id # スキルIDで指定
    when 1 # スキル1番は通常攻撃なので、上の武器アクションを実行します
      return weapon_action
      ………………
    when 100
      return "双持平砍"
    end
end


然后把下面这个定义加到横版设定的合适位置。

"计算左手武器伤害"        => [造成伤害=(总攻击力-右手武器攻击)*(1-(目标防御/目标防御+目标幸运*4+400)),]
"计算右手武器伤害"        => [造成伤害=(总攻击力-左手武器攻击)*(1-(目标防御/目标防御+目标幸运*4+400)),]

"双持平砍"        => ["敵前移動","コラプス禁止","個別開始","武器振りL","计算左手武器伤害","対象アニメ武器LWT","武器振りR","计算右手武器伤害","死亡確認","対象アニメ武器WT","個別終了","コラプス禁止解除","次の行動者へ","座標リセットカーブ" ]

不知道这种想法对不对,还有就是代码的完善。让我改代码还可以,让我自己写就= =捉襟见肘了。

发上来之后才想到,还可以这样。就是不知道能不能行得通。

还只判断是不是二刀,如果是,返回100号技能和101号技能,就是二刀的平砍相当于同时发动两个技能。不知道能不能这么做。
100号技能的伤害公式是(总攻击力-右手武器攻击)*(1-(目标防御/目标防御+目标幸运*4+400))
101号技能的伤害公式是(总攻击力-左手武器攻击)*(1-(目标防御/目标防御+目标幸运*4+400))

然后还是定义动画
    when 100
      return "双持平砍左"
    when 101
      return "双持平砍右"

然后定义
"双持平砍左"        => ["敵前移動","コラプス禁止","個別開始","武器振りL","计算伤害","対象アニメ武器LWT","死亡確認",]       #左手砍了不回原位,除非砍死了
"双持平砍右"        => ["武器振りR","计算伤害","死亡確認","対象アニメ武器WT","個別終了","コラプス禁止解除","次の行動者へ","座標リセットカーブ" ]       #右手砍了再回原位

这是一种神奇的想法,不知道现实不现实啊。

作者: salvareless    时间: 2013-11-2 00:19
诶= =我在另两张帖子里,在tan12345和喵呜喵5的帮助下捣鼓出来了…………………………
发上连接给有同样需要的人看吧。
http://rpg.blue/thread-337421-1-1.html
作者: 念来过倒猪    时间: 2013-11-2 13:36
va的远小近大脚本有木有
作者: 念来过倒猪    时间: 2013-11-2 15:09
大量NPC互相战斗的脚本,感觉做成骑马与砍杀就有可能了
作者: 念来过倒猪    时间: 2013-11-2 15:13
大量NPC互相战斗,做成骑马与砍杀哪种感觉
作者: 893299399    时间: 2013-11-3 20:37
定制一个技能设置成全体敌人的时候,动画改成XP那样的同时播放(动画里设置不是画面),敌人有两个以上死亡的时候改成同时闪烁,这个应该算小脚本吧......
作者: 893299399    时间: 2013-11-3 21:02
893299399 发表于 2013-11-3 20:37
定制一个技能设置成全体敌人的时候,动画改成XP那样的同时播放(动画里设置不是画面),敌人有两个以上死亡的 ...

XP的战斗中如果技能的目标是敌方全体,并且动画里位置不是画面,在战斗中用这个技能被击杀的多个敌人会同时播放这个动画,而va的是依次播放动画,怎么改成XP那样的。
死亡是全体攻击敌人,比如一次全体攻击死了三个,VA是从第一个敌人到第三个敌人同时播放死亡的那个闪烁效果,怎么改成像XP那样的被一次攻击击杀的三个敌人同时播放死亡的闪烁效果......这样明白了么...
作者: 野生の小A酱    时间: 2013-11-4 07:07
请问可以用脚本把游戏菜单调成这个样子吗?

未命名.JPG (33.85 KB, 下载次数: 15)

未命名.JPG

作者: AVENTZERO    时间: 2013-11-4 21:05
本帖最后由 AVENTZERO 于 2013-11-5 22:44 编辑

全屏显示文字(超过4行限制的脚本)
附带一个showtext方法在事件脚本中调用如   A\n A\n A\n A\n A\n A\n A\n   就能显示很多行的A 这种有办法能实现吗?








为什么它到后面就换不了行了!!?
作者: 893299399    时间: 2013-11-8 20:34
本帖最后由 Sion 于 2013-11-12 18:31 编辑
893299399 发表于 2013-11-3 21:02
XP的战斗中如果技能的目标是敌方全体,并且动画里位置不是画面,在战斗中用这个技能被击杀的多个敌人会同 ...


把受到伤害的信息给去掉只留下使用物品,技能,状态和攻击的信息能行么





————————————— Edited by Sion ——————————————
RUBY 代码复制
  1. class Scene_Battle
  2.   def show_normal_animation(targets, animation_id, mirror = false)
  3.     animation = $data_animations[animation_id]
  4.     if animation
  5.       targets.each do |target|
  6.         target.animation_id = animation_id
  7.         target.animation_mirror = mirror
  8.       end
  9.       abs_wait_short
  10.     end
  11.   end
  12. end
  13.  
  14. class Window_BattleLog
  15.   def display_added_states(target)
  16.     target.result.added_state_objects.each do |state|
  17.       state_msg = target.actor? ? state.message1 : state.message2
  18.       target.perform_collapse_effect if state.id == target.death_state_id
  19.       next if state_msg.empty?
  20.       replace_text(target.name + state_msg)
  21. #~       wait
  22. #~       wait_for_effect
  23.     end
  24.   end
  25.   def display_action_results(target, item)
  26.     if target.result.used
  27.       last_line_number = line_number
  28.       display_critical(target, item)
  29.       display_damage(target, item)
  30.       display_affected_status(target, item)
  31.       display_failure(target, item)
  32. #~       wait if line_number > last_line_number
  33.       back_to(last_line_number)
  34.     end
  35.   end
  36.   #
  37.   def display_miss(target, item)
  38.     if !item || item.physical?
  39.       fmt = target.actor? ? Vocab::ActorNoHit : Vocab::EnemyNoHit
  40.       Sound.play_miss
  41.     else
  42.       fmt = Vocab::ActionFailure
  43.     end
  44.      add_text(sprintf(fmt, target.name))
  45. #~     wait
  46.   end
  47.   #
  48.   def display_evasion(target, item)
  49.     if !item || item.physical?
  50.       fmt = Vocab::Evasion
  51.       Sound.play_evasion
  52.     else
  53.       fmt = Vocab::MagicEvasion
  54.       Sound.play_magic_evasion
  55.     end
  56.     add_text(sprintf(fmt, target.name))
  57. #~     wait
  58.   end
  59.   def display_hp_damage(target, item)
  60.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  61.     if target.result.hp_damage > 0 && target.result.hp_drain == 0
  62.       target.perform_damage_effect
  63.     end
  64.     Sound.play_recovery if target.result.hp_damage < 0
  65.     add_text(target.result.hp_damage_text)
  66. #~     wait
  67.   end
  68.   def display_mp_damage(target, item)
  69.     return if target.dead? || target.result.mp_damage == 0
  70.     Sound.play_recovery if target.result.mp_damage < 0
  71.     add_text(target.result.mp_damage_text)
  72. #~     wait
  73.   end
  74.   def display_tp_damage(target, item)
  75.     return if target.dead? || target.result.tp_damage == 0
  76.     Sound.play_recovery if target.result.tp_damage < 0
  77.     add_text(target.result.tp_damage_text)
  78. #~     wait
  79.   end
  80. end

作者: muyumuyulnny    时间: 2013-11-9 13:08
我也来求一个想要很久的功能,就是您写的鼠标脚本,是否可以在战斗时鼠标直接选中敌人,而不是用选项框来选择敌人。
作者: dongdongdjh    时间: 2013-11-12 16:52
求一个 武器随机攻击力的脚本,不是已有那种随机属性装备脚本,只是武器攻击力随机,没有什么前缀,比如获得2个手斧,1个攻击力是16,1个攻击力是17这样。
其实怎么说呐,与其说是求脚本,更想要一个写的思路,攻击力不同,武器名相同,默认同类装备是数量叠加的,如何区别开,我实在想不出怎办。
作者: lirn    时间: 2013-11-13 23:15
本帖最后由 Sion 于 2013-11-15 20:37 编辑

如何做类似会心一击等额外附加的伤害?

我的意思是这样。

游戏计算流程大概是===》判断是否命中会心一击等等=====》然后再计算伤害公式========》处理会心一击伤害。

也就是说,会心一击伤害是伤害计算完毕之后附加的。

按这个道理,理论上应该设置目标附加了其中一种状态时,可以有类似会心一击的机制,追加伤害或者减少定值伤害,比如固定减少100伤害,并且会有类似会心一击那样的文字说明。

感觉这样的脚本不是太难吧。


=====================补充了一下思路===================

在Game_Battler下可以找到。

value *= item_element_rate(user, item)
          value *= pdr if item.physical?
          value *= mdr if item.magical?
          value *= rec if item.damage.recover?
          value = apply_critical(value) if @result.critical
          value = apply_variance(value, item.damage.variance)
          value = apply_guard(value)

假如前面做一个apply_A

那么,我想改成下面这样应该行

value *= item_element_rate(user, item)
          value *= pdr if item.physical?
          value *= mdr if item.magical?
          value *= rec if item.damage.recover?
          value = apply_critical(value) if @result.critical
          value = apply_variance(value, item.damage.variance)
          value = apply_guard(value)
          value -= apply_A#或者可以调整到防御之前

那么apply_A该怎么做?





————————————— Edited by Sion ——————————————
范例 Project3.rar (1.43 MB, 下载次数: 59)
作者: dongdongdjh    时间: 2013-11-14 10:49
dongdongdjh 发表于 2013-11-12 16:52
求一个 武器随机攻击力的脚本,不是已有那种随机属性装备脚本,只是武器攻击力随机,没有什么前缀,比如获 ...

学网络通信出身的表示能力不足,无法理解,跪求脚本,以作学习之用。
作者: dongdongdjh    时间: 2013-11-15 12:22
dongdongdjh 发表于 2013-11-14 10:49
学网络通信出身的表示能力不足,无法理解,跪求脚本,以作学习之用。

呵呵 算了 就是参考随机属性 装备强化和装备限制 这3个脚本 还没成功写出脚本才来这里求脚本比对看看自己的理解错在哪,早知道这样,也不花什么心思了。
作者: dongdongdjh    时间: 2013-11-15 12:47
dongdongdjh 发表于 2013-11-15 12:22
呵呵 算了 就是参考随机属性 装备强化和装备限制 这3个脚本 还没成功写出脚本才来这里求脚本比对看看自己 ...

并不需要这个脚本,改随机脚本把更新name删去,让护甲部分失效就能达到这个效果,只是想知道该怎么写这个脚本,看来va不需要新鲜血液,只要高手就可以了。
作者: lucifar5    时间: 2013-11-15 23:14
希望能有一个由玩家自行输入较多文字的脚本
文字内容可以只有英文

在MX和VX区都发现了类似的脚本
但运行均已失效 或链接已失效 所以来厚脸皮求助一下
作者: dongdongdjh    时间: 2013-11-16 10:12
dongdongdjh 发表于 2013-11-15 12:47
并不需要这个脚本,改随机脚本把更新name删去,让护甲部分失效就能达到这个效果,只是想知道该怎么写这个 ...

呵呵 你们贵人事多 不麻烦了,我说用 OSPF+BGP+组播把路由器R1和路由器R2之前链接起来,让一个不懂的人敲命令能敲出来么,再见。
作者: Sion    时间: 2013-11-16 10:56
本帖最后由 Sion 于 2013-11-16 11:09 编辑
dongdongdjh 发表于 2013-11-16 10:12
呵呵 你们贵人事多 不麻烦了,我说用 OSPF+BGP+组播把路由器R1和路由器R2之前链接起来,让一个不懂的人敲 ...


你:求一个 武器随机攻击力的脚本,不是已有那种随机属性装备脚本,只是武器攻击力随机,没有什么前缀,比如获得2个手斧,1个攻击力是16,1个攻击力是17这样。
其实怎么说呐,与其说是求脚本,更想要一个写的思路,攻击力不同,武器名相同,默认同类装备是数量叠加的,如何区别开,我实在想不出怎办。

(我当时是这样想的:感觉你已经开始写脚本了,并且问题的关键是不知道怎么把装备一个一个区分开,那么)
我:用数组来存储获得的物品就可以了,每次获得一个新物品就创建一个该物品的实例压入数组。读取数据那些的就要自己慢慢改了。

你:学网络通信出身的表示能力不足,无法理解,跪求脚本,以作学习之用。

(我当时是这样想的:学什么关能力毛事?跪求脚本“学习”?)
我:搜索“装备强化”或者“随机装备”一类的脚本参考即可。

你:呵呵 算了 就是参考随机属性 装备强化和装备限制 这3个脚本 还没成功写出脚本才来这里求脚本比对看看自己的理解错在哪,早知道这样,也不花什么心思了。
(过半小时)
你:并不需要这个脚本,改随机脚本把更新name删去,让护甲部分失效就能达到这个效果,只是想知道该怎么写这个脚本,看来va不需要新鲜血液,只要高手就可以了。

(我当时是这样想的:我靠,我写的脚本,跟人家那些有什么区别?还好没写,不然一个“并不需要这个脚本”就把我秒了。又求思路,你到底要啥?这位仁兄你是来抬杠的吧?)
我:怎么写我一开始就告诉你了。

你:呵呵 你们贵人事多 不麻烦了,我说用 OSPF+BGP+组播把路由器R1和路由器R2之前链接起来,让一个不懂的人敲命令能敲出来么,再见。

我现在是这样想的:你抬杠的时候能不能把逻辑搞清楚(看你黄字)?你要写脚本,连数组和创建实例都不懂,要别人从头手把手去教?抱歉我真的事多,请去提问区开贴让大家帮忙解决。
作者: dongdongdjh    时间: 2013-11-16 13:57
Sion 发表于 2013-11-16 10:56
你:求一个 武器随机攻击力的脚本,不是已有那种随机属性装备脚本,只是武器攻击力随机,没有什么前缀, ...

最后次回复
我抬杠 呵呵 群里有人想要个这种效果的脚本,但是我们都是些水平不高的爱好者聚在一个群,没人会写脚本  所以想自己看看脚本是不是能自己尝试写,尽自己的力。
一开始我就参考3个脚本自己写,但是比较没接触过脚本,只学过简单的C语言,只能自己理解猜意思,一开始把已有脚本修改,但是没成功,所以,来论坛看看。
正好看到这帖子,所以想问问写的思路,有了回复后继续回去看脚本。
通过改随机属性的确做出了这个效果,但是这脚本是比较复杂的,如果只是要达到我要的那个脚本的效果,其实很多东西都是没必要可以删去的,那么我就想,如果只是纯粹这个效果该怎么写,实际需要哪些数组和实例,如果有个参考的,那么比较举一反三可以类推其他东西,这样也能方便学习。还有我写的是“能力不足,无法理解”不知道如何能理解成学习什么能力不足。
还有跪求脚本学习有问题?这和小时候看着参考答案学习解题思路有区别?只是作为群中的一员,有人需要脚本,便有人积极的帮忙,我本以为作为版主应该会很热心。
还有,是我打错了,我也不知道该怎么表达,这样效果的脚本改脚本可以达到,并不是做游戏需要用到这个脚本,如果只是要这个效果,那么改脚本就可以了,我只想求个会写脚本的人写出这个效果的最简脚本才学习参考他写脚本的思路,呵呵,既然你们忙,抱歉打扰了。
这是我在这个论坛第一次回复的帖子,也算是最后一个吧。

作者: 我在孤岛等你    时间: 2013-11-17 11:27
本帖最后由 Sion 于 2013-11-17 12:39 编辑

求一个定期下雨系统……
每过4分钟20%下雨,下雨时间随机,1-2分钟。(试过过用事件,但太麻烦了)
(为了优先,立马去帮人……)


————————————— Edited by Sion ——————————————

作者: a000b1745    时间: 2013-11-17 16:45
本帖最后由 a000b1745 于 2013-11-17 19:04 编辑

S大~
請問一下,我想訂製一個關於商店的腳本不知能否實現??

腳本需求是這樣的:

我設置一個商人,該商人的商品是從我選定的物品ID裡隨機挑N個出來賣。
舉例:我在腳本先設置兩組商品↓

-商品A組 = [ i01,i03,i05,w12,w15,w16,a01,a02,a03 ]
-商品B組 = [ i01~i10,a10~25 ]
(P.S 種類+ID. i01=道具1號. w12=武器12號. a03=裝備3號 )

在該商人備註腳本 "Shop=A,5"   那就是從商品A組隨機抽5個出來賣
假如在該商人備註腳本 "Shop=A,8"   從商品A組隨機抽8個出來賣
假如在該商人備註腳本 "Shop=B,12"  從商品B組隨機抽12個出來賣

煩請 S大幫幫忙看下能否實現 :)

----------------------------------------------

剛想到能否加入一個新功能??
在代碼後面加入出售的商品價錢調整 (玩家賣給商人商品價格不變)
備註腳本 "Shop=A,5,100" 原價
備註腳本 "Shop=A,5,50"半價出售
備註腳本 "Shop=A,5,80" 原價80%出售 這樣...
作者: a000b1745    时间: 2013-11-18 09:39
本帖最后由 a000b1745 于 2013-11-18 09:43 编辑
a000b1745 发表于 2013-11-17 16:45
S大~
請問一下,我想訂製一個關於商店的腳本不知能否實現??


抱歉打擾了...不知能不能加上一個變數的設定,
我來敘述一下實際用途好了。

"每天有個流浪商人會出現在旅館、身上會帶著各種奇妙的道具。"
上次請你訂製的隨機出貨腳本很好用,不過我當初沒想周到...
因為這樣玩家每次開啟都是隨機的,實際上一天固定隨機骰一次商品就行了。

舉例:
假如腳本商品組 :A => [ a01~a10 ],流浪商人的腳本寫 " random_shop(:A, 3) "
我的GAME裡面 變數20號=天數,
想請問能否當變數20號=X時,第一次骰出 "a03,a06a,a08"
在 X 不變的狀況下都是出現"a03,a06a,a08"這組商品,
當 變數20號=X+1 (或 X有改變) 、過了一天~流浪商人到處捕貨賣貨,random_shop(:A, 3)會自動重新骰一組新的組合、假設結果是 "a02,a05a,a10",那麼遊戲中當天流浪商人都是固定賣"a02,a05a,a10"這組商品。
到隔天 變數2 0= X+2 便會重新在骰新的商品出來~!

抱歉越搞越複雜了 ...{:2_276:}
作者: longshili    时间: 2013-11-18 19:58
本帖最后由 Sion 于 2013-11-18 22:58 编辑

求个VA横版SideView Ver100的脚本,效果如下:
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Battle Engine v1.18
  4. # -- Last Updated: 2012.01.24
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-BattleEngine"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.24 - Compatibility Update: Enemy Levels
  17. # 2012.01.18 - Bug Fixed: Help Window clears text upon selecting nil items.
  18. # 2012.01.11 - Added <one animation> tag for multi-hit skills to play an
  19. #              animation only once.
  20. #            - Reduced lag from battle system constantly recreating bitmaps.
  21. # 2012.01.10 - Compatibility Update: Battle System FTB
  22. # 2012.01.09 - Anticrash methods implemented.
  23. #            - Damage Popups are now separate for damage formulas and recovery.
  24. # 2012.01.05 - Bug fixed: Game no longer crashes with escape skills/items.
  25. # 2012.01.02 - Compatibility Update: Target Manager
  26. #            - Added Option: AUTO_FAST
  27. #            - Random hits now show animations individually.
  28. # 2011.12.30 - Compatibility Update: Enemy Levels
  29. #            - Added Option to center the actors in the HUD.
  30. # 2011.12.27 - Bug fixed: TP Damage skills and items no longer crash game.
  31. #            - Default battle system bug fixes are now included from YEA's Ace
  32. #              Core Engine.
  33. #            - Groundwork is also made to support future battle system types.
  34. #            - Multi-hit actions no longer linger when a target dies during the
  35. #              middle of one of the hits.
  36. #            - Compatibility Update: Lunatic Objects v1.02
  37. # 2011.12.26 - Bug fixed: Multi-hit popups occured even after an enemy's dead.
  38. # 2011.12.22 - Bug fixed: Elemental Resistance popup didn't show.
  39. # 2011.12.20 - Bug fixed: Death state popups against immortal states.
  40. #            - Bug fixed: During State popup fix.
  41. #            - Added HIDE_POPUP_SWITCH.
  42. # 2011.12.17 - Compatibiilty Update: Cast Animations
  43. # 2011.12.15 - Compatibility Update: Battle Command List
  44. # 2011.12.14 - Compatibility Update: Lunatic Objects
  45. # 2011.12.13 - Compatibility Update: Command Party
  46. # 2011.12.12 - Bug fixed: Turn stalling if no inputable members.
  47. # 2011.12.10 - Compatibility update for Automatic Party HUD.
  48. #            - Popup graphical bug fixed.
  49. #            - Bug fixed: Didn't wait for boss dead animations.
  50. #            - Bug fixed: Surprise attacks that froze the game.
  51. #            - Bug fixed: Popups didn't show for straight recovery effects.
  52. # 2011.12.08 - Finished Script.
  53. # 2011.12.04 - Started Script.
  54. #
  55. #==============================================================================
  56. # ▼ Introduction
  57. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  58. # Ace Battle Engine works as a foundation for future battle engine add-ons. It
  59. # allows for easier management of the battle engine without adding too many
  60. # features, allowing users to customize what they want as they see fit. While
  61. # the Ace Battle Engine isn't an entirely new engine, it gives users control
  62. # that RPG Maker VX Ace didn't originally give them.
  63. #
  64. # Furthermore, this script provides some new features. They are as follows:
  65. #
  66. # -----------------------------------------------------------------------------
  67. # Animation Fixes
  68. # -----------------------------------------------------------------------------
  69. # Though the Yanfly Engine Ace - Ace Core Engine script contains these fixes,
  70. # these fixes are included in this script as well to ensure it's working for
  71. # the battle script in the event someone chooses not to work with the Ace Core
  72. # Engine script. The animation fixes prevent excessive animation overlaying
  73. # (and making the screen look really ugly) and prevents animation clashing
  74. # between two dual wielding normal attack animations.
  75. #
  76. # -----------------------------------------------------------------------------
  77. # Enemy Animations
  78. # -----------------------------------------------------------------------------
  79. # Enemies now show battle animations when they deliver attacks and skills
  80. # against the player's party. Before in RPG Maker VX Ace, it was nothing more
  81. # than just sound effects and the screen shaking. Now, animations play where
  82. # the status window is and relative to the position of each party member.
  83. #
  84. # -----------------------------------------------------------------------------
  85. # Left/Right Command Selection
  86. # -----------------------------------------------------------------------------
  87. # While choosing actions, the player can press Left or Right to move freely
  88. # between (alive) actors to change their skills. Players no longer have to
  89. # cancel all the way back to change one person's skill and reselect everything.
  90. # On that note, there is now the option that when a battle starts or at the
  91. # end of a turn, players will start immediately at command selection rather
  92. # than needing to select "Fight" in the Party Command Window.
  93. #
  94. # -----------------------------------------------------------------------------
  95. # Popups
  96. # -----------------------------------------------------------------------------
  97. # Dealing damage, inflicting states, adding buffs, landing critical hits,
  98. # striking weaknesses, missing attacks, you name it, there's probably a popup
  99. # for it. Popups deliver information to the player in a quick or orderly
  100. # fashion without requiring the player to read lines of text.
  101. #
  102. # -----------------------------------------------------------------------------
  103. # Targeting Window
  104. # -----------------------------------------------------------------------------
  105. # When targeting enemies, the window is no longer displayed. Instead, the
  106. # targeted enemies are highlighted and their names are shown at the top of the
  107. # screen in a help window. Another thing that's changed is when skills that
  108. # target multiple targets are selected, there is a confirmation step that the
  109. # player must take before continuing. In this confirmation step, all of the
  110. # multiple targets are selected and in the help window would display the scope
  111. # of the skill (such as "All Foes" or "Random Foes"). RPG Maker VX Ace skipped
  112. # this step by default.
  113. #
  114. # -----------------------------------------------------------------------------
  115. # Toggling On and Off Special Effects and Text
  116. # -----------------------------------------------------------------------------
  117. # Not everybody likes having the screen shake or the enemies blink when they
  118. # take damage. These effects can now be toggled on and off. Certain text can
  119. # also be toggled on and off from appearing. A lot of the displayed text has
  120. # been rendered redundant through the use of popups.
  121. #
  122. # -----------------------------------------------------------------------------
  123. # Visual Battle Status Window
  124. # -----------------------------------------------------------------------------
  125. # Rather than just having rows of names with HP and MP bars next to them, the
  126. # Battle Status Window now displays actors' faces and their gauges aligned at
  127. # the bottom. More status effects can be shown in addition to showing more
  128. # members on screen at once. The Battle Status Window is also optimized to
  129. # refresh less (thus, removing potential lag from the system).
  130. #
  131. # -----------------------------------------------------------------------------
  132. # Window Position Changes
  133. # -----------------------------------------------------------------------------
  134. # Windows such as the Skill Window and Item Window have been rearranged to
  135. # always provide the player a clear view of the battlefield rather than opening
  136. # up and covering everything. As such, the window positions are placed at the
  137. # bottom of the screen and are repositioned.
  138. #
  139. #==============================================================================
  140. # ▼ Instructions
  141. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  142. # To install this script, open up your script editor and copy/paste this script
  143. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  144. #
  145. # -----------------------------------------------------------------------------
  146. # Skill Notetags - These notetags go in the skills notebox in the database.
  147. # -----------------------------------------------------------------------------
  148. # <one animation>
  149. # Causes the action to display the action animation only once, even if it's a
  150. # multi-hit action. This is used primarily for non-all scope targeting.
  151. #
  152. # -----------------------------------------------------------------------------
  153. # Item Notetags - These notetags go in the items notebox in the database.
  154. # -----------------------------------------------------------------------------
  155. # <one animation>
  156. # Causes the action to display the action animation only once, even if it's a
  157. # multi-hit action. This is used primarily for non-all scope targeting.
  158. #
  159. # -----------------------------------------------------------------------------
  160. # Enemy Notetags - These notetags go in the enemy notebox in the database.
  161. # -----------------------------------------------------------------------------
  162. # <atk ani 1: x>
  163. # <atk ani 2: x>
  164. # Changes the normal attack animation of the particular enemy to animation x.
  165. # Attack animation 1 is the first one that plays. If there's a second animation
  166. # then the second one will play after in mirrored form.
  167. #
  168. # -----------------------------------------------------------------------------
  169. # State Notetags - These notetags go in the state notebox in the database.
  170. # -----------------------------------------------------------------------------
  171. # <popup add: string>
  172. # <popup rem: string>
  173. # <popup dur: string>
  174. # Status effects now create popups whenever they're inflicted. However, if you
  175. # don't like that a certain status effect uses a particular colour setting,
  176. # change "string" to one of the rulesets below to cause that popup to use a
  177. # different ruleset.
  178. #
  179. # <popup hide add>
  180. # <popup hide rem>
  181. # <popup hide dur>
  182. # Not everybody wants status effects to show popups when inflicted. When this
  183. # is the case, insert the respective tag to hide popups from appearing when the
  184. # state is added, removed, or during the stand-by phases.
  185. #
  186. # -----------------------------------------------------------------------------
  187. # Debug Tools - These tools only work during Test Play.
  188. # -----------------------------------------------------------------------------
  189. # - F5 Key -
  190. # Recovers all actors. Restores their HP and MP to max. Does not affect TP.
  191. # All states and buffs are removed whether they are positive or negative.
  192. #
  193. # - F6 Key -
  194. # Sets all actors to have 1 HP, 0 MP, and 0 TP. States are unaffected.
  195. #
  196. # - F7 Key -
  197. # Sets all actors to have max TP. Everything else is unaffected.
  198. #
  199. # - F8 Key -
  200. # Kills all enemies in battle. Ends the battle quickly.
  201. #
  202. #==============================================================================
  203. # ▼ Compatibility
  204. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  205. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  206. # it will run with RPG Maker VX without adjusting.
  207. #
  208. #==============================================================================
  209.  
  210. module YEA
  211.   module BATTLE
  212.  
  213.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  214.     # - General Battle Settings -
  215.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  216.     # These settings are adjusted for the overall battle system. These are
  217.     # various miscellaneous options to adjust. Each of the settings below will
  218.     # explain what they do. Change default enemy battle animations here, too.
  219.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  220.     BLINK_EFFECTS      = false  # Blink sprite when damaged?
  221.     FLASH_WHITE_EFFECT = true   # Flash enemy white when it starts an attack.
  222.     SCREEN_SHAKE       = false  # Shake screen in battle?
  223.     SKIP_PARTY_COMMAND = true   # Skips the Fight/Escape menu.
  224.     AUTO_FAST          = true   # Causes message windows to not wait.
  225.     ENEMY_ATK_ANI      = 36     # Sets default attack animation for enemies.
  226.  
  227.     # If this switch is ON, popups will be hidden. If OFF, the popups will be
  228.     # shown. If you do not wish to use this switch, set it to 0.
  229.     HIDE_POPUP_SWITCH  = 0
  230.  
  231.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  232.     # - Battle Status Window -
  233.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  234.     # This sets the default battle system your game will use. If your game
  235.     # doesn't have any other battle systems installed, it will use :dtb.
  236.     #
  237.     # Battle System        Requirement
  238.     #   :dtb               - Default Turn Battle. Default system.
  239.     #   :ftb               - YEA Battle System Add-On: Free Turn Battle
  240.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  241.     DEFAULT_BATTLE_SYSTEM = :dtb     # Default battle system set.
  242.  
  243.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  244.     # - Battle Status Window -
  245.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  246.     # Here, you can adjust the settings for the battle status window. The
  247.     # battle status window, by default, will show the actor's face, HP, MP, TP
  248.     # (if viable), and any inflicted status effects.
  249.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  250.     BATTLESTATUS_NAME_FONT_SIZE = 20    # Font size used for name.
  251.     BATTLESTATUS_TEXT_FONT_SIZE = 16    # Font size used for HP, MP, TP.
  252.     BATTLESTATUS_NO_ACTION_ICON = 185   # No action icon.
  253.     BATTLESTATUS_HPGAUGE_Y_PLUS = 11    # Y Location buffer used for HP gauge.
  254.     BATTLESTATUS_CENTER_FACES   = false # Center faces for the Battle Status.
  255.  
  256.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  257.     # - Help Window Text -
  258.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  259.     # When selecting a target to attack, this is the text that will be shown
  260.     # in place of a target's name for special cases. These special cases are
  261.     # for selections that were originally non-targetable battle scopes.
  262.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  263.     HELP_TEXT_ALL_FOES        = "All Foes"
  264.     HELP_TEXT_ONE_RANDOM_FOE  = "One Random Foe"
  265.     HELP_TEXT_MANY_RANDOM_FOE = "%d Random Foes"
  266.     HELP_TEXT_ALL_ALLIES      = "All Allies"
  267.     HELP_TEXT_ALL_DEAD_ALLIES = "All Dead Allies"
  268.     HELP_TEXT_ONE_RANDOM_ALLY = "One Random Ally"
  269.     HELP_TEXT_RANDOM_ALLIES   = "%d Random Allies"
  270.  
  271.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  272.     # - Popup Settings -
  273.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  274.     # These settings will adjust the popups that appear in battle. Popups
  275.     # deliver information to your player as battlers deal damage, inflict
  276.     # status effects, and more.
  277.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  278.     ENABLE_POPUPS  = true     # Set this to false if you wish to disable them.
  279.     FLASH_CRITICAL = true     # Sets critical hits to flash.
  280.  
  281.     # This hash adjusts the popup settings that will govern how popups appear.
  282.     # Adjust them accordingly.
  283.     POPUP_SETTINGS ={
  284.       :offset     => -24,         # Height offset of a popup.
  285.       :fade       => 12,          # Fade rate for each popup.
  286.       :full       => 60,          # Frames before a popup fades.
  287.       :hp_dmg     => "-%s ",      # SprintF for HP damage.
  288.       :hp_heal    => "+%s ",      # SprintF for HP healing.
  289.       :mp_dmg     => "-%s MP",    # SprintF for MP damage.
  290.       :mp_heal    => "+%s MP",    # SprintF for MP healing.
  291.       :tp_dmg     => "-%s TP",    # SprintF for MP damage.
  292.       :tp_heal    => "+%s TP",    # SprintF for MP healing.
  293.       :drained    => "DRAIN",     # Text display for draining HP/MP.
  294.       :critical   => "CRITICAL!", # Text display for critical hit.
  295.       :missed     => "MISS",      # Text display for missed attack.
  296.       :evaded     => "EVADE!",    # Text display for evaded attack.
  297.       :nulled     => "NULL",      # Text display for nulled attack.
  298.       :failed     => "FAILED",    # Text display for a failed attack.
  299.       :add_state  => "+%s",      # SprintF for added states.
  300.       :rem_state  => "-%s",      # SprintF for removed states.
  301.       :dur_state  => "%s",        # SprintF for during states.
  302.       :ele_rates  => true,        # This will display elemental affinities.
  303.       :ele_wait   => 20,          # This is how many frames will wait.
  304.       :weakpoint  => "WEAKPOINT", # Appears if foe is weak to element.
  305.       :resistant  => "RESIST",    # Appears if foe is resistant to element.
  306.       :immune     => "IMMUNE",    # Appears if foe is immune to element.
  307.       :absorbed   => "ABSORB",    # Appears if foe can absorb the element.
  308.       :add_buff   => "%s+",      # Appears when a positive buff is applied.
  309.       :add_debuff => "%s-",      # Appears when a negative buff is applied.
  310.     } # Do not remove this.
  311.  
  312.     # This is the default font used for the popups. Adjust them accordingly
  313.     # or even add new ones.
  314.     DEFAULT = ["VL Gothic", "Verdana", "Arial", "Courier"]
  315.  
  316.     # The following are the various rules that govern the individual popup
  317.     # types that will appear. Adjust them accordingly. Here is a list of what
  318.     # each category does.
  319.     #   Zoom1    The zoom the popup starts at. Values over 2.0 may cause lag.
  320.     #   Zoom2    The zoom the popup goes to. Values over 2.0 may cause lag.
  321.     #   Sz       The font size used for the popup text.
  322.     #   Bold     Applying bold for the popup text.
  323.     #   Italic   Applying italic for the popup text.
  324.     #   Red      The red value of the popup text.
  325.     #   Grn      The green value of the popup text.
  326.     #   Blu      The blue value of the popup text.
  327.     #   Font     The font used for the popup text.
  328.     POPUP_RULES ={
  329.       # Type     => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]
  330.       "DEFAULT"  => [   2.0,   1.0, 24, true,  false, 255, 255, 255, DEFAULT],
  331.       "CRITICAL" => [   2.0,   1.0, 24, true,  false, 255,  80,  80, DEFAULT],
  332.       "HP_DMG"   => [   2.0,   1.0, 36, true,  false, 255, 255, 255, DEFAULT],
  333.       "HP_HEAL"  => [   2.0,   1.0, 36, true,  false, 130, 250, 130, DEFAULT],
  334.       "MP_DMG"   => [   2.0,   1.0, 36, true,  false, 220, 180, 255, DEFAULT],
  335.       "MP_HEAL"  => [   2.0,   1.0, 36, true,  false, 160, 230, 255, DEFAULT],
  336.       "TP_DMG"   => [   2.0,   1.0, 36, true,  false, 242, 108,  78, DEFAULT],
  337.       "TP_HEAL"  => [   2.0,   1.0, 36, true,  false, 251, 175,  92, DEFAULT],
  338.       "ADDSTATE" => [   2.0,   1.0, 24, true,  false, 240, 100, 100, DEFAULT],
  339.       "REMSTATE" => [   2.0,   1.0, 24, true,  false, 125, 170, 225, DEFAULT],
  340.       "DURSTATE" => [   2.0,   1.0, 24, true,  false, 255, 240, 150, DEFAULT],
  341.       "DRAIN"    => [   2.0,   1.0, 36, true,  false, 250, 190, 255, DEFAULT],
  342.       "POSITIVE" => [   2.0,   1.0, 24, true,  false, 110, 210, 245, DEFAULT],
  343.       "NEGATIVE" => [   2.0,   1.0, 24, true,  false, 245, 155, 195, DEFAULT],
  344.       "WEAK_ELE" => [   0.5,   1.0, 24, true,  false, 240, 110,  80, DEFAULT],
  345.       "IMMU_ELE" => [   0.5,   1.0, 24, true,  false, 185, 235, 255, DEFAULT],
  346.       "REST_ELE" => [   0.5,   1.0, 24, true,  false, 145, 230, 180, DEFAULT],
  347.       "ABSB_ELE" => [   0.5,   1.0, 24, true,  false, 250, 190, 255, DEFAULT],
  348.       "BUFF"     => [   2.0,   1.0, 24, true,  false, 255, 240, 100, DEFAULT],
  349.       "DEBUFF"   => [   2.0,   1.0, 24, true,  false, 160, 130, 200, DEFAULT],
  350.     } # Do not remove this.
  351.  
  352.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  353.     # - Streamlined Messages -
  354.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  355.     # Want to remove some of those annoying messages that appear all the time?
  356.     # Now you can! Select which messages you want to enable or disable. Some of
  357.     # these messages will be rendered useless due to popups.
  358.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  359.     MSG_ENEMY_APPEARS  = false  # Message when enemy appears start of battle.
  360.     MSG_CURRENT_STATE  = false  # Show which states has affected battler.
  361.     MSG_CURRENT_ACTION = true   # Show the current action of the battler.
  362.     MSG_COUNTERATTACK  = true   # Show the message for a counterattack.
  363.     MSG_REFLECT_MAGIC  = true   # Show message for reflecting magic attacks.
  364.     MSG_SUBSTITUTE_HIT = true   # Show message for ally taking another's hit.
  365.     MSG_FAILURE_HIT    = false  # Show effect failed against target.
  366.     MSG_CRITICAL_HIT   = false  # Show attack was a critical hit.
  367.     MSG_HIT_MISSED     = false  # Show attack missed the target.
  368.     MSG_EVASION        = false  # Show attack was evaded by the target.
  369.     MSG_HP_DAMAGE      = false  # Show HP damage to target.
  370.     MSG_MP_DAMAGE      = false  # Show MP damage to target.
  371.     MSG_TP_DAMAGE      = false  # Show TP damage to target.
  372.     MSG_ADDED_STATES   = false  # Show target's added states.
  373.     MSG_REMOVED_STATES = false  # Show target's removed states.
  374.     MSG_CHANGED_BUFFS  = false  # Show target's changed buffs.
  375.  
  376.   end # BATTLE
  377. end # YEA
  378.  
  379. #==============================================================================
  380. # ▼ Editting anything past this point may potentially result in causing
  381. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  382. # halitosis so edit at your own risk.
  383. #==============================================================================
  384.  
  385. module YEA
  386.   module REGEXP
  387.   module ENEMY
  388.  
  389.     ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
  390.     ATK_ANI2 = /<(?:ATK_ANI_2|atk ani 2):[ ]*(\d+)>/i
  391.  
  392.   end # ENEMY
  393.   module USABLEITEM
  394.  
  395.     ONE_ANIMATION = /<(?:ONE_ANIMATION|one animation)>/i
  396.  
  397.   end # USABLEITEM
  398.   module STATE
  399.  
  400.     POPUP_ADD = /<(?:POPUP_ADD_RULE|popup add rule|popup add):[ ](.*)>/i
  401.     POPUP_REM = /<(?:POPUP_REM_RULE|popup rem rule|popup rem):[ ](.*)>/i
  402.     POPUP_DUR = /<(?:POPUP_DUR_RULE|popup dur rule|popup dur):[ ](.*)>/i
  403.  
  404.     HIDE_ADD  = /<(?:POPUP_HIDE_ADD|popup hide add|hide add)>/i
  405.     HIDE_REM  = /<(?:POPUP_HIDE_REM|popup hide rem|hide rem)>/i
  406.     HIDE_DUR  = /<(?:POPUP_HIDE_DUR|popup hide dur|hide dur)>/i
  407.  
  408.   end # STATE
  409.   end # REGEXP
  410. end # YEA
  411.  
  412. #==============================================================================
  413. # ■ Switch
  414. #==============================================================================
  415.  
  416. module Switch
  417.  
  418.   #--------------------------------------------------------------------------
  419.   # self.hide_popups
  420.   #--------------------------------------------------------------------------
  421.   def self.hide_popups
  422.     return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
  423.     return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
  424.   end
  425.  
  426. end # Switch
  427.  
  428. #==============================================================================
  429. # ■ Colour
  430. #==============================================================================
  431.  
  432. module Colour
  433.  
  434.   #--------------------------------------------------------------------------
  435.   # self.text_colour
  436.   #--------------------------------------------------------------------------
  437.   def self.text_colour(index)
  438.     windowskin = Cache.system("Window")
  439.     x = 64 + (index % 8) * 8
  440.     y = 96 + (index / 8) * 8
  441.     return windowskin.get_pixel(x, y)
  442.   end
  443.  
  444. end # Colour
  445.  
  446. #==============================================================================
  447. # ■ Icon
  448. #==============================================================================
  449.  
  450. module Icon
  451.  
  452.   #--------------------------------------------------------------------------
  453.   # self.no_action
  454.   #--------------------------------------------------------------------------
  455.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  456.  
  457. end # Icon
  458.  
  459. #==============================================================================
  460. # ■ Numeric
  461. #==============================================================================
  462.  
  463. class Numeric
  464.  
  465.   #--------------------------------------------------------------------------
  466.   # new method: group_digits
  467.   #--------------------------------------------------------------------------
  468.   unless $imported["YEA-CoreEngine"]
  469.   def group; return self.to_s; end
  470.   end # $imported["YEA-CoreEngine"]
  471.  
  472. end # Numeric
  473.  
  474. #==============================================================================
  475. # ■ DataManager
  476. #==============================================================================
  477.  
  478. module DataManager
  479.  
  480.   #--------------------------------------------------------------------------
  481.   # alias method: load_database
  482.   #--------------------------------------------------------------------------
  483.   class <<self; alias load_database_abe load_database; end
  484.   def self.load_database
  485.     load_database_abe
  486.     load_notetags_abe
  487.   end
  488.  
  489.   #--------------------------------------------------------------------------
  490.   # new method: load_notetags_abe
  491.   #--------------------------------------------------------------------------
  492.   def self.load_notetags_abe
  493.     groups = [$data_enemies, $data_states, $data_skills, $data_items]
  494.     for group in groups
  495.       for obj in group
  496.         next if obj.nil?
  497.         obj.load_notetags_abe
  498.       end
  499.     end
  500.   end
  501.  
  502. end # DataManager
  503.  
  504. #==============================================================================
  505. # ■ RPG::UsableItem
  506. #==============================================================================
  507.  
  508. class RPG::UsableItem < RPG::BaseItem
  509.  
  510.   #--------------------------------------------------------------------------
  511.   # public instance variables
  512.   #--------------------------------------------------------------------------
  513.   attr_accessor :one_animation
  514.  
  515.   #--------------------------------------------------------------------------
  516.   # common cache: load_notetags_abe
  517.   #--------------------------------------------------------------------------
  518.   def load_notetags_abe
  519.     @one_animation = false
  520.     #---
  521.     self.note.split(/[\r\n]+/).each { |line|
  522.       case line
  523.       #---
  524.       when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
  525.         @one_animation = true
  526.       end
  527.     } # self.note.split
  528.     #---
  529.   end
  530.  
  531. end # RPG::UsableItem
  532.  
  533. #==============================================================================
  534. # ■ RPG::Enemy
  535. #==============================================================================
  536.  
  537. class RPG::Enemy < RPG::BaseItem
  538.  
  539.   #--------------------------------------------------------------------------
  540.   # public instance variables
  541.   #--------------------------------------------------------------------------
  542.   attr_accessor :atk_animation_id1
  543.   attr_accessor :atk_animation_id2
  544.  
  545.   #--------------------------------------------------------------------------
  546.   # common cache: load_notetags_abe
  547.   #--------------------------------------------------------------------------
  548.   def load_notetags_abe
  549.     @atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
  550.     @atk_animation_id2 = 0
  551.     #---
  552.     self.note.split(/[\r\n]+/).each { |line|
  553.       case line
  554.       #---
  555.       when YEA::REGEXP::ENEMY::ATK_ANI1
  556.         @atk_animation_id1 = $1.to_i
  557.       when YEA::REGEXP::ENEMY::ATK_ANI2
  558.         @atk_animation_id2 = $1.to_i
  559.       end
  560.     } # self.note.split
  561.     #---
  562.   end
  563.  
  564. end # RPG::Enemy
  565.  
  566. #==============================================================================
  567. # ■ RPG::Enemy
  568. #==============================================================================
  569.  
  570. class RPG::State < RPG::BaseItem
  571.  
  572.   #--------------------------------------------------------------------------
  573.   # public instance variables
  574.   #--------------------------------------------------------------------------
  575.   attr_accessor :popup_rules
  576.  
  577.   #--------------------------------------------------------------------------
  578.   # common cache: load_notetags_abe
  579.   #--------------------------------------------------------------------------
  580.   def load_notetags_abe
  581.     @popup_rules = {
  582.       :add_state => "ADDSTATE",
  583.       :rem_state => "REMSTATE",
  584.       :dur_state => nil
  585.     } # Do not remove this.
  586.     #---
  587.     self.note.split(/[\r\n]+/).each { |line|
  588.       case line
  589.       #---
  590.       when YEA::REGEXP::STATE::POPUP_ADD
  591.         @popup_rules[:add_state] = $1.upcase.to_s
  592.       when YEA::REGEXP::STATE::POPUP_REM
  593.         @popup_rules[:rem_state] = $1.upcase.to_s
  594.       when YEA::REGEXP::STATE::POPUP_DUR
  595.         @popup_rules[:dur_state] = $1.upcase.to_s
  596.       when YEA::REGEXP::STATE::HIDE_ADD
  597.         @popup_rules[:add_state] = nil
  598.       when YEA::REGEXP::STATE::HIDE_REM
  599.         @popup_rules[:rem_state] = nil
  600.       when YEA::REGEXP::STATE::HIDE_DUR
  601.         @popup_rules[:dur_state] = nil
  602.       end
  603.     } # self.note.split
  604.     #---
  605.   end
  606.  
  607. end # RPG::State
  608.  
  609. #==============================================================================
  610. # ■ BattleManager
  611. #==============================================================================
  612.  
  613. module BattleManager
  614.  
  615.   #--------------------------------------------------------------------------
  616.   # overwrite method: self.battle_start
  617.   #--------------------------------------------------------------------------
  618.   def self.battle_start
  619.     $game_system.battle_count += 1
  620.     $game_party.on_battle_start
  621.     $game_troop.on_battle_start
  622.     return unless YEA::BATTLE::MSG_ENEMY_APPEARS
  623.     $game_troop.enemy_names.each do |name|
  624.       $game_message.add(sprintf(Vocab::Emerge, name))
  625.     end
  626.     if @preemptive
  627.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  628.     elsif @surprise
  629.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  630.     end
  631.     wait_for_message
  632.   end
  633.  
  634.   #--------------------------------------------------------------------------
  635.   # overwrite method: make_action_orders
  636.   #--------------------------------------------------------------------------
  637.   def self.make_action_orders
  638.     make_dtb_action_orders if btype?(:dtb)
  639.   end
  640.  
  641.   #--------------------------------------------------------------------------
  642.   # new method: make_dtb_action_orders
  643.   #--------------------------------------------------------------------------
  644.   def self.make_dtb_action_orders
  645.     @action_battlers = []
  646.     @action_battlers += $game_party.members unless @surprise
  647.     @action_battlers += $game_troop.members unless @preemptive
  648.     @action_battlers.each {|battler| battler.make_speed }
  649.     @action_battlers.sort! {|a,b| b.speed - a.speed }
  650.   end
  651.  
  652.   #--------------------------------------------------------------------------
  653.   # overwrite method: turn_start
  654.   #--------------------------------------------------------------------------
  655.   def self.turn_start
  656.     @phase = :turn
  657.     clear_actor
  658.     $game_troop.increase_turn
  659.     @performed_battlers = []
  660.     make_action_orders
  661.   end
  662.  
  663.   #--------------------------------------------------------------------------
  664.   # overwrite method: next_subject
  665.   #--------------------------------------------------------------------------
  666.   def self.next_subject
  667.     @performed_battlers = [] if @performed_battlers.nil?
  668.     loop do
  669.       @action_battlers -= @performed_battlers
  670.       battler = @action_battlers.shift
  671.       return nil unless battler
  672.       next unless battler.index && battler.alive?
  673.       @performed_battlers.push(battler)
  674.       return battler
  675.     end
  676.   end
  677.  
  678.   #--------------------------------------------------------------------------
  679.   # overwrite method: force_action
  680.   #--------------------------------------------------------------------------
  681.   def self.force_action(battler)
  682.     @action_forced = [] if @action_forced == nil
  683.     @action_forced.push(battler)
  684.     return unless Switch.forced_action_remove
  685.     @action_battlers.delete(battler)
  686.   end
  687.  
  688.   #--------------------------------------------------------------------------
  689.   # overwrite method: action_forced?
  690.   #--------------------------------------------------------------------------
  691.   def self.action_forced?
  692.     @action_forced != nil
  693.   end
  694.  
  695.   #--------------------------------------------------------------------------
  696.   # overwrite method: action_forced_battler
  697.   #--------------------------------------------------------------------------
  698.   def self.action_forced_battler
  699.     @action_forced.shift
  700.   end
  701.  
  702.   #--------------------------------------------------------------------------
  703.   # overwrite method: clear_action_force
  704.   #--------------------------------------------------------------------------
  705.   def self.clear_action_force
  706.     @action_forced = nil if @action_forced.empty?
  707.   end
  708.  
  709.   #--------------------------------------------------------------------------
  710.   # new method: self.init_battle_type
  711.   #--------------------------------------------------------------------------
  712.   def self.init_battle_type
  713.     set_btype($game_system.battle_system)
  714.   end
  715.  
  716.   #--------------------------------------------------------------------------
  717.   # new method: self.set_btype
  718.   #--------------------------------------------------------------------------
  719.   def self.set_btype(btype = :dtb)
  720.     @battle_type = btype
  721.   end
  722.  
  723.   #--------------------------------------------------------------------------
  724.   # new method: self.btype?
  725.   #--------------------------------------------------------------------------
  726.   def self.btype?(btype)
  727.     return @battle_type == btype
  728.   end
  729.  
  730. end # BattleManager
  731.  
  732. #==============================================================================
  733. # ■ Game_System
  734. #==============================================================================
  735.  
  736. class Game_System
  737.  
  738.   #--------------------------------------------------------------------------
  739.   # new method: battle_system
  740.   #--------------------------------------------------------------------------
  741.   def battle_system
  742.     if @battle_system.nil?
  743.       return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
  744.     else
  745.       return battle_system_corrected(@battle_system)
  746.     end
  747.   end
  748.  
  749.   #--------------------------------------------------------------------------
  750.   # new method: set_battle_system
  751.   #--------------------------------------------------------------------------
  752.   def set_battle_system(type)
  753.     case type
  754.     when :dtb; @battle_system = :dtb
  755.     when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  756.     else;      @battle_system = :dtb
  757.     end
  758.   end
  759.  
  760.   #--------------------------------------------------------------------------
  761.   # new method: battle_system_corrected
  762.   #--------------------------------------------------------------------------
  763.   def battle_system_corrected(type)
  764.     case type
  765.     when :dtb; return :dtb
  766.     when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
  767.     else;      return :dtb
  768.     end
  769.   end
  770.  
  771. end # Game_System
  772.  
  773. #==============================================================================
  774. # ■ Sprite_Base
  775. #==============================================================================
  776.  
  777. class Sprite_Base < Sprite
  778.  
  779.   #--------------------------------------------------------------------------
  780.   # new method: start_pseudo_animation
  781.   #--------------------------------------------------------------------------
  782.   unless $imported["YEA-CoreEngine"]
  783.   def start_pseudo_animation(animation, mirror = false)
  784.     dispose_animation
  785.     @animation = animation
  786.     return if @animation.nil?
  787.     @ani_mirror = mirror
  788.     set_animation_rate
  789.     @ani_duration = @animation.frame_max * @ani_rate + 1
  790.     @ani_sprites = []
  791.   end
  792.   end # $imported["YEA-CoreEngine"]
  793.  
  794. end # Sprite_Base
  795.  
  796. #==============================================================================
  797. # ■ Sprite_Battler
  798. #==============================================================================
  799.  
  800. class Sprite_Battler < Sprite_Base
  801.  
  802.   #--------------------------------------------------------------------------
  803.   # public instance variables
  804.   #--------------------------------------------------------------------------
  805.   attr_accessor :effect_type
  806.   attr_accessor :battler_visible
  807.   attr_accessor :popups
  808.  
  809.   #--------------------------------------------------------------------------
  810.   # alias method: initialize
  811.   #--------------------------------------------------------------------------
  812.   alias sprite_battler_initialize_abe initialize
  813.   def initialize(viewport, battler = nil)
  814.     sprite_battler_initialize_abe(viewport, battler)
  815.     @popups = []
  816.     @popup_flags = []
  817.   end
  818.  
  819.   #--------------------------------------------------------------------------
  820.   # alias method: update_bitmap
  821.   #--------------------------------------------------------------------------
  822.   alias sprite_battler_update_bitmap_abe update_bitmap
  823.   def update_bitmap
  824.     return if @battler.actor? && @battler.battler_name == ""
  825.     sprite_battler_update_bitmap_abe
  826.   end
  827.  
  828.   #--------------------------------------------------------------------------
  829.   # alias method: setup_new_animation
  830.   #--------------------------------------------------------------------------
  831.   unless $imported["YEA-CoreEngine"]
  832.   alias sprite_battler_setup_new_animation_abe setup_new_animation
  833.   def setup_new_animation
  834.     sprite_battler_setup_new_animation_abe
  835.     return if @battler.pseudo_ani_id <= 0
  836.     animation = $data_animations[@battler.pseudo_ani_id]
  837.     mirror = @battler.animation_mirror
  838.     start_pseudo_animation(animation, mirror)
  839.     @battler.pseudo_ani_id = 0
  840.   end
  841.   end # $imported["YEA-CoreEngine"]
  842.  
  843.   #--------------------------------------------------------------------------
  844.   # alias method: setup_new_effect
  845.   #--------------------------------------------------------------------------
  846.   alias sprite_battler_setup_new_effect_abe setup_new_effect
  847.   def setup_new_effect
  848.     sprite_battler_setup_new_effect_abe
  849.     setup_popups
  850.   end
  851.  
  852.   #--------------------------------------------------------------------------
  853.   # new method: setup_popups
  854.   #--------------------------------------------------------------------------
  855.   def setup_popups
  856.     return unless @battler.use_sprite?
  857.     @battler.popups = [] if @battler.popups.nil?
  858.     return if @battler.popups == []
  859.     array = @battler.popups.shift
  860.     create_new_popup(array[0], array[1], array[2])
  861.   end
  862.  
  863.   #--------------------------------------------------------------------------
  864.   # new method: create_new_popup
  865.   #--------------------------------------------------------------------------
  866.   def create_new_popup(value, rules, flags)
  867.     return if [url=home.php?mod=space&uid=133701]@battler[/url] == nil
  868.     return if flags & @popup_flags != []
  869.     array = YEA::BATTLE::POPUP_RULES[rules]
  870.     for popup in @popups
  871.       popup.y -= 24
  872.     end
  873.     return unless SceneManager.scene.is_a?(Scene_Battle)
  874.     return if SceneManager.scene.spriteset.nil?
  875.     view = SceneManager.scene.spriteset.viewportPopups
  876.     new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
  877.     @popups.push(new_popup)
  878.     @popup_flags.push("weakness") if flags.include?("weakness")
  879.     @popup_flags.push("resistant") if flags.include?("resistant")
  880.     @popup_flags.push("immune") if flags.include?("immune")
  881.     @popup_flags.push("absorbed") if flags.include?("absorbed")
  882.   end
  883.  
  884.   #--------------------------------------------------------------------------
  885.   # alias method: update_effect
  886.   #--------------------------------------------------------------------------
  887.   alias sprite_battler_update_effect_abe update_effect
  888.   def update_effect
  889.     sprite_battler_update_effect_abe
  890.     update_popups
  891.   end
  892.  
  893.   #--------------------------------------------------------------------------
  894.   # new method: update_popups
  895.   #--------------------------------------------------------------------------
  896.   def update_popups
  897.     for popup in @popups
  898.       popup.update
  899.       next unless popup.opacity <= 0
  900.       popup.bitmap.dispose
  901.       popup.dispose
  902.       @popups.delete(popup)
  903.       popup = nil
  904.     end
  905.     @popup_flags = [] if @popups == [] && @popup_flags != []
  906.     return unless SceneManager.scene_is?(Scene_Battle)
  907.     if @current_active_battler != SceneManager.scene.subject
  908.       @current_active_battler = SceneManager.scene.subject
  909.       @popup_flags = []
  910.     end
  911.   end
  912.  
  913. end # Sprite_Battler
  914.  
  915. #==============================================================================
  916. # ■ Sprite_Popup
  917. #==============================================================================
  918.  
  919. class Sprite_Popup < Sprite_Base
  920.  
  921.   #--------------------------------------------------------------------------
  922.   # public instance variables
  923.   #--------------------------------------------------------------------------
  924.   attr_accessor :flags
  925.  
  926.   #--------------------------------------------------------------------------
  927.   # initialize
  928.   #--------------------------------------------------------------------------
  929.   def initialize(viewport, battler, value, rules, flags)
  930.     super(viewport)
  931.     @value = value
  932.     @rules = rules
  933.     @rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
  934.     [url=home.php?mod=space&uid=274289]@fade[/url] = YEA::BATTLE::POPUP_SETTINGS[:fade]
  935.     @full = YEA::BATTLE::POPUP_SETTINGS[:full]
  936.     @flags = flags
  937.     [url=home.php?mod=space&uid=133701]@battler[/url] = battler
  938.     create_popup_bitmap
  939.   end
  940.  
  941.   #--------------------------------------------------------------------------
  942.   # create_popup_bitmap
  943.   #--------------------------------------------------------------------------
  944.   def create_popup_bitmap
  945.     rules_array = YEA::BATTLE::POPUP_RULES[@rules]
  946.     bw = Graphics.width
  947.     bw += 48 if @flags.include?("state")
  948.     bh = Font.default_size * 3
  949.     bitmap = Bitmap.new(bw, bh)
  950.     bitmap.font.name = rules_array[8]
  951.     size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
  952.     bitmap.font.size = size
  953.     bitmap.font.bold = rules_array[3]
  954.     bitmap.font.italic = rules_array[4]
  955.     if flags.include?("critical")
  956.       crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
  957.       bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
  958.     else
  959.       bitmap.font.out_color.set(0, 0, 0, 255)
  960.     end
  961.     dx = 0; dy = 0; dw = 0
  962.     dx += 24 if @flags.include?("state")
  963.     dw += 24 if @flags.include?("state")
  964.     if @flags.include?("state") || @flags.include?("buff")
  965.       c_width = bitmap.text_size(@value).width
  966.       icon_bitmap = $game_temp.iconset
  967.       icon_index = flag_state_icon
  968.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  969.       bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
  970.     end
  971.     bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
  972.     bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
  973.     self.bitmap = bitmap
  974.     self.x = @battler.screen_x
  975.     self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
  976.     self.x -= SceneManager.scene.spriteset.viewport1.ox
  977.     self.y = @battler.screen_y - @battler.sprite.oy/2
  978.     self.y -= @battler.sprite.oy/2 if @battler.actor?
  979.     self.y -= SceneManager.scene.spriteset.viewport1.oy
  980.     self.ox = bw/2; self.oy = bh/2
  981.     self.zoom_x = self.zoom_y = rules_array[0]
  982.     if @flags.include?("no zoom")
  983.       self.zoom_x = self.zoom_y = rules_array[1]
  984.     end
  985.     @target_zoom = rules_array[1]
  986.     @zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
  987.     self.z = 500
  988.   end
  989.  
  990.   #--------------------------------------------------------------------------
  991.   # update
  992.   #--------------------------------------------------------------------------
  993.   def update
  994.     super
  995.     #---
  996.     if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
  997.       @hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
  998.       @hue_duration -= 1
  999.       self.bitmap.hue_change(15) if @hue_duration <= 0
  1000.     end
  1001.     #---
  1002.     if @zoom_direction == "up"
  1003.       self.zoom_x = [self.zoom_x + 0.075, @target_zoom].min
  1004.       self.zoom_y = [self.zoom_y + 0.075, @target_zoom].min
  1005.     else
  1006.       self.zoom_x = [self.zoom_x - 0.075, @target_zoom].max
  1007.       self.zoom_y = [self.zoom_y - 0.075, @target_zoom].max
  1008.     end
  1009.     #---
  1010.     @full -= 1
  1011.     return if @full > 0
  1012.     self.y -= 1
  1013.     self.opacity -= @fade
  1014.   end
  1015.  
  1016.   #--------------------------------------------------------------------------
  1017.   # flag_state_icon
  1018.   #--------------------------------------------------------------------------
  1019.   def flag_state_icon
  1020.     for item in @flags; return item if item.is_a?(Integer); end
  1021.     return 0
  1022.   end
  1023.  
  1024. end # Sprite_Popup
  1025.  
  1026. #==============================================================================
  1027. # ■ Spriteset_Battle
  1028. #==============================================================================
  1029.  
  1030. class Spriteset_Battle
  1031.  
  1032.   #--------------------------------------------------------------------------
  1033.   # public instance variables
  1034.   #--------------------------------------------------------------------------
  1035.   attr_accessor :actor_sprites
  1036.   attr_accessor :enemy_sprites
  1037.   attr_accessor :viewport1
  1038.   attr_accessor :viewportPopups
  1039.  
  1040.   #--------------------------------------------------------------------------
  1041.   # alias method: create_viewports
  1042.   #--------------------------------------------------------------------------
  1043.   alias spriteset_battle_create_viewports_abe create_viewports
  1044.   def create_viewports
  1045.     spriteset_battle_create_viewports_abe
  1046.     @viewportPopups = Viewport.new
  1047.     @viewportPopups.z = 200
  1048.   end
  1049.  
  1050.   #--------------------------------------------------------------------------
  1051.   # alias method: dispose_viewports
  1052.   #--------------------------------------------------------------------------
  1053.   alias spriteset_battle_dispose_viewports_abe dispose_viewports
  1054.   def dispose_viewports
  1055.     spriteset_battle_dispose_viewports_abe
  1056.     @viewportPopups.dispose
  1057.   end
  1058.  
  1059.   #--------------------------------------------------------------------------
  1060.   # alias method: update_viewports
  1061.   #--------------------------------------------------------------------------
  1062.   alias spriteset_battle_update_viewports_abe update_viewports
  1063.   def update_viewports
  1064.     spriteset_battle_update_viewports_abe
  1065.     @viewportPopups.update
  1066.   end
  1067.  
  1068. end # Spriteset_Battle
  1069.  
  1070. #==============================================================================
  1071. # ■ Game_Temp
  1072. #==============================================================================
  1073.  
  1074. class Game_Temp
  1075.  
  1076.   #--------------------------------------------------------------------------
  1077.   # public instance variables
  1078.   #--------------------------------------------------------------------------
  1079.   attr_accessor :battle_aid
  1080.   attr_accessor :evaluating
  1081.   attr_accessor :iconset
  1082.  
  1083.   #--------------------------------------------------------------------------
  1084.   # alias method: initialize
  1085.   #--------------------------------------------------------------------------
  1086.   alias game_temp_initialize_abe initialize
  1087.   def initialize
  1088.     game_temp_initialize_abe
  1089.     @iconset = Cache.system("Iconset")
  1090.   end
  1091.  
  1092. end # Game_Temp
  1093.  
  1094. #==============================================================================
  1095. # ■ Game_Action
  1096. #==============================================================================
  1097.  
  1098. class Game_Action
  1099.  
  1100.   #--------------------------------------------------------------------------
  1101.   # overwrite method: speed
  1102.   #--------------------------------------------------------------------------
  1103.   def speed
  1104.     speed = subject.agi
  1105.     speed += item.speed if item
  1106.     speed += subject.atk_speed if attack?
  1107.     return speed
  1108.   end
  1109.  
  1110.   #--------------------------------------------------------------------------
  1111.   # alias method: evaluate_item_with_target
  1112.   #--------------------------------------------------------------------------
  1113.   alias evaluate_item_with_target_abe evaluate_item_with_target
  1114.   def evaluate_item_with_target(target)
  1115.     $game_temp.evaluating = true
  1116.     result = evaluate_item_with_target_abe(target)
  1117.     $game_temp.evaluating = false
  1118.     return result
  1119.   end
  1120.  
  1121. end # Game_Action
  1122.  
  1123. #==============================================================================
  1124. # ■ Game_ActionResult
  1125. #==============================================================================
  1126.  
  1127. class Game_ActionResult
  1128.  
  1129.   #--------------------------------------------------------------------------
  1130.   # alias method: clear
  1131.   #--------------------------------------------------------------------------
  1132.   alias game_actionresult_clear_abe clear
  1133.   def clear
  1134.     game_actionresult_clear_abe
  1135.     clear_stored_damage
  1136.   end
  1137.  
  1138.   #--------------------------------------------------------------------------
  1139.   # new method: clear_stored_damage
  1140.   #--------------------------------------------------------------------------
  1141.   def clear_stored_damage
  1142.     @stored_hp_damage = 0
  1143.     @stored_mp_damage = 0
  1144.     @stored_tp_damage = 0
  1145.     @stored_hp_drain = 0
  1146.     @stored_mp_drain = 0
  1147.   end
  1148.  
  1149.   #--------------------------------------------------------------------------
  1150.   # new method: store_damage
  1151.   #--------------------------------------------------------------------------
  1152.   def store_damage
  1153.     @stored_hp_damage += @hp_damage
  1154.     @stored_mp_damage += @mp_damage
  1155.     @stored_tp_damage += @tp_damage
  1156.     @stored_hp_drain += @hp_drain
  1157.     @stored_mp_drain += @mp_drain
  1158.   end
  1159.  
  1160.   #--------------------------------------------------------------------------
  1161.   # new method: restore_damage
  1162.   #--------------------------------------------------------------------------
  1163.   def restore_damage
  1164.     @hp_damage = @stored_hp_damage
  1165.     @mp_damage = @stored_mp_damage
  1166.     @tp_damage = @stored_tp_damage
  1167.     @hp_drain = @stored_hp_drain
  1168.     @mp_drain = @stored_mp_drain
  1169.   end
  1170.  
  1171. end # Game_ActionResult
  1172.  
  1173. #==============================================================================
  1174. # ■ Game_BattlerBase
  1175. #==============================================================================
  1176.  
  1177. class Game_BattlerBase
  1178.  
  1179.   #--------------------------------------------------------------------------
  1180.   # public instance variables
  1181.   #--------------------------------------------------------------------------
  1182.   attr_accessor :popups
  1183.  
  1184.   #--------------------------------------------------------------------------
  1185.   # new method: create_popup
  1186.   #--------------------------------------------------------------------------
  1187.   def create_popup(value, rules = "DEFAULT", flags = [])
  1188.     return unless SceneManager.scene_is?(Scene_Battle)
  1189.     return unless YEA::BATTLE::ENABLE_POPUPS
  1190.     return if Switch.hide_popups
  1191.     @popups = [] if @popups.nil?
  1192.     @popups.push([value, rules, flags])
  1193.   end
  1194.  
  1195.   #--------------------------------------------------------------------------
  1196.   # new method: make_damage_popups
  1197.   #--------------------------------------------------------------------------
  1198.   def make_damage_popups(user)
  1199.     if @result.hp_drain != 0
  1200.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1201.       rules = "DRAIN"
  1202.       user.create_popup(text, rules)
  1203.       setting = :hp_dmg  if @result.hp_drain < 0
  1204.       setting = :hp_heal if @result.hp_drain > 0
  1205.       rules = "HP_DMG"   if @result.hp_drain < 0
  1206.       rules = "HP_HEAL"  if @result.hp_drain > 0
  1207.       value = @result.hp_drain.abs
  1208.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1209.       user.create_popup(text, rules)
  1210.     end
  1211.     if @result.mp_drain != 0
  1212.       text = YEA::BATTLE::POPUP_SETTINGS[:drained]
  1213.       rules = "DRAIN"
  1214.       user.create_popup(text, rules)
  1215.       setting = :mp_dmg  if @result.mp_drain < 0
  1216.       setting = :mp_heal if @result.mp_drain > 0
  1217.       rules = "HP_DMG"   if @result.mp_drain < 0
  1218.       rules = "HP_HEAL"  if @result.mp_drain > 0
  1219.       value = @result.mp_drain.abs
  1220.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1221.       user.create_popup(text, rules)
  1222.     end
  1223.     #---
  1224.     flags = []
  1225.     flags.push("critical") if @result.critical
  1226.     if @result.hp_damage != 0
  1227.       setting = :hp_dmg  if @result.hp_damage > 0
  1228.       setting = :hp_heal if @result.hp_damage < 0
  1229.       rules = "HP_DMG"   if @result.hp_damage > 0
  1230.       rules = "HP_HEAL"  if @result.hp_damage < 0
  1231.       value = @result.hp_damage.abs
  1232.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1233.       create_popup(text, rules, flags)
  1234.     end
  1235.     if @result.mp_damage != 0
  1236.       setting = :mp_dmg  if @result.mp_damage > 0
  1237.       setting = :mp_heal if @result.mp_damage < 0
  1238.       rules = "MP_DMG"   if @result.mp_damage > 0
  1239.       rules = "MP_HEAL"  if @result.mp_damage < 0
  1240.       value = @result.mp_damage.abs
  1241.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1242.       create_popup(text, rules, flags)
  1243.     end
  1244.     if @result.tp_damage != 0
  1245.       setting = :tp_dmg  if @result.tp_damage > 0
  1246.       setting = :tp_heal if @result.tp_damage < 0
  1247.       rules = "TP_DMG"   if @result.tp_damage > 0
  1248.       rules = "TP_HEAL"  if @result.tp_damage < 0
  1249.       value = @result.tp_damage.abs
  1250.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
  1251.       create_popup(text, rules)
  1252.     end
  1253.     @result.store_damage
  1254.     @result.clear_damage_values
  1255.   end
  1256.  
  1257.   #--------------------------------------------------------------------------
  1258.   # alias method: erase_state
  1259.   #--------------------------------------------------------------------------
  1260.   alias game_battlerbase_erase_state_abe erase_state
  1261.   def erase_state(state_id)
  1262.     make_state_popup(state_id, :rem_state) if @states.include?(state_id)
  1263.     game_battlerbase_erase_state_abe(state_id)
  1264.   end
  1265.  
  1266.   #--------------------------------------------------------------------------
  1267.   # new method: make_during_state_popup
  1268.   #--------------------------------------------------------------------------
  1269.   def make_during_state_popup
  1270.     state_id = most_important_state_id
  1271.     return if state_id == 0
  1272.     make_state_popup(state_id, :dur_state)
  1273.   end
  1274.  
  1275.   #--------------------------------------------------------------------------
  1276.   # new method: most_important_state_id
  1277.   #--------------------------------------------------------------------------
  1278.   def most_important_state_id
  1279.     states.each {|state| return state.id unless state.message3.empty? }
  1280.     return 0
  1281.   end
  1282.  
  1283.   #--------------------------------------------------------------------------
  1284.   # new method: make_state_popup
  1285.   #--------------------------------------------------------------------------
  1286.   def make_state_popup(state_id, type)
  1287.     state = $data_states[state_id]
  1288.     return if state.icon_index == 0
  1289.     rules = state.popup_rules[type]
  1290.     return if rules.nil?
  1291.     text = sprintf(YEA::BATTLE::POPUP_SETTINGS[type], state.name)
  1292.     flags = ["state", state.icon_index]
  1293.     create_popup(text, rules, flags)
  1294.   end
  1295.  
  1296.   #--------------------------------------------------------------------------
  1297.   # new method: make_miss_popups
  1298.   #--------------------------------------------------------------------------
  1299.   def make_miss_popups(user, item)
  1300.     return if dead?
  1301.     if @result.missed
  1302.       text = YEA::BATTLE::POPUP_SETTINGS[:missed]
  1303.       rules = "DEFAULT"
  1304.       create_popup(text, rules)
  1305.     end
  1306.     if @result.evaded
  1307.       text = YEA::BATTLE::POPUP_SETTINGS[:evaded]
  1308.       rules = "DEFAULT"
  1309.       create_popup(text, rules)
  1310.     end
  1311.     if @result.hit? && !@result.success
  1312.       text = YEA::BATTLE::POPUP_SETTINGS[:failed]
  1313.       rules = "DEFAULT"
  1314.       create_popup(text, rules)
  1315.     end
  1316.     if @result.hit? && item.damage.to_hp?
  1317.       if @result.hp_damage == 0 && @result.hp_damage == 0
  1318.         text = YEA::BATTLE::POPUP_SETTINGS[:nulled]
  1319.         rules = "DEFAULT"
  1320.         create_popup(text, rules)
  1321.       end
  1322.     end
  1323.   end
  1324.  
  1325.   #--------------------------------------------------------------------------
  1326.   # new method: make_rate_popup
  1327.   #--------------------------------------------------------------------------
  1328.   def make_rate_popup(rate)
  1329.     return if rate == 1.0
  1330.     flags = []
  1331.     if rate > 1.0
  1332.       text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
  1333.       rules = "WEAK_ELE"
  1334.       flags.push("weakness")
  1335.     elsif rate == 0.0
  1336.       text = YEA::BATTLE::POPUP_SETTINGS[:immune]
  1337.       rules = "IMMU_ELE"
  1338.       flags.push("immune")
  1339.     elsif rate < 0.0
  1340.       text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
  1341.       rules = "ABSB_ELE"
  1342.       flags.push("absorbed")
  1343.     else
  1344.       text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
  1345.       rules = "REST_ELE"
  1346.       flags.push("resistant")
  1347.     end
  1348.     create_popup(text, rules, flags)
  1349.   end
  1350.  
  1351.   #--------------------------------------------------------------------------
  1352.   # new method: make_buff_popup
  1353.   #--------------------------------------------------------------------------
  1354.   def make_buff_popup(param_id, positive = true)
  1355.     return unless alive?
  1356.     name = Vocab::param(param_id)
  1357.     if positive
  1358.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_buff], name)
  1359.       rules = "BUFF"
  1360.       buff_level = 1
  1361.     else
  1362.       text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_debuff], name)
  1363.       rules = "DEBUFF"
  1364.       buff_level = -1
  1365.     end
  1366.     icon = buff_icon_index(buff_level, param_id)
  1367.     flags = ["buff", icon]
  1368.     create_popup(text, rules, flags)
  1369.   end
  1370.  
  1371. end # Game_BattlerBase
  1372.  
  1373. #==============================================================================
  1374. # ■ Game_Battler
  1375. #==============================================================================
  1376.  
  1377. class Game_Battler < Game_BattlerBase
  1378.  
  1379.   #--------------------------------------------------------------------------
  1380.   # public instance variables
  1381.   #--------------------------------------------------------------------------
  1382.   attr_accessor :pseudo_ani_id
  1383.  
  1384.   #--------------------------------------------------------------------------
  1385.   # alias method: on_battle_end
  1386.   #--------------------------------------------------------------------------
  1387.   alias game_battler_on_battle_end_abe on_battle_end
  1388.   def on_battle_end
  1389.     game_battler_on_battle_end_abe
  1390.     @popups = []
  1391.   end
  1392.  
  1393.   #--------------------------------------------------------------------------
  1394.   # alias method: clear_sprite_effects
  1395.   #--------------------------------------------------------------------------
  1396.   alias game_battler_clear_sprite_effects_abe clear_sprite_effects
  1397.   def clear_sprite_effects
  1398.     game_battler_clear_sprite_effects_abe
  1399.     @pseudo_ani_id = 0
  1400.   end
  1401.  
  1402.   #--------------------------------------------------------------------------
  1403.   # alias method: item_apply
  1404.   #--------------------------------------------------------------------------
  1405.   alias game_battler_item_apply_abe item_apply
  1406.   def item_apply(user, item)
  1407.     game_battler_item_apply_abe(user, item)
  1408.     make_miss_popups(user, item)
  1409.   end
  1410.  
  1411.   #--------------------------------------------------------------------------
  1412.   # alias method: make_damage_value
  1413.   #--------------------------------------------------------------------------
  1414.   alias game_battler_make_damage_value_abe make_damage_value
  1415.   def make_damage_value(user, item)
  1416.     game_battler_make_damage_value_abe(user, item)
  1417.     rate = item_element_rate(user, item)
  1418.     make_rate_popup(rate) unless $game_temp.evaluating
  1419.   end
  1420.  
  1421.   #--------------------------------------------------------------------------
  1422.   # alias method: execute_damage
  1423.   #--------------------------------------------------------------------------
  1424.   alias game_battler_execute_damage_abe execute_damage
  1425.   def execute_damage(user)
  1426.     game_battler_execute_damage_abe(user)
  1427.     make_damage_popups(user)
  1428.   end
  1429.  
  1430.   #--------------------------------------------------------------------------
  1431.   # alias method: item_effect_recover_hp
  1432.   #--------------------------------------------------------------------------
  1433.   alias game_battler_item_effect_recover_hp_abe item_effect_recover_hp
  1434.   def item_effect_recover_hp(user, item, effect)
  1435.     game_battler_item_effect_recover_hp_abe(user, item, effect)
  1436.     make_damage_popups(user)
  1437.   end
  1438.  
  1439.   #--------------------------------------------------------------------------
  1440.   # alias method: item_effect_recover_mp
  1441.   #--------------------------------------------------------------------------
  1442.   alias game_battler_item_effect_recover_mp_abe item_effect_recover_mp
  1443.   def item_effect_recover_mp(user, item, effect)
  1444.     game_battler_item_effect_recover_mp_abe(user, item, effect)
  1445.     make_damage_popups(user)
  1446.   end
  1447.  
  1448.   #--------------------------------------------------------------------------
  1449.   # alias method: item_effect_gain_tp
  1450.   #--------------------------------------------------------------------------
  1451.   alias game_battler_item_effect_gain_tp_abe item_effect_gain_tp
  1452.   def item_effect_gain_tp(user, item, effect)
  1453.     game_battler_item_effect_gain_tp_abe(user, item, effect)
  1454.     make_damage_popups(user)
  1455.   end
  1456.  
  1457.   #--------------------------------------------------------------------------
  1458.   # alias method: item_user_effect
  1459.   #--------------------------------------------------------------------------
  1460.   alias game_battler_item_user_effect_abe item_user_effect
  1461.   def item_user_effect(user, item)
  1462.     game_battler_item_user_effect_abe(user, item)
  1463.     @result.restore_damage
  1464.   end
  1465.  
  1466.   #--------------------------------------------------------------------------
  1467.   # alias method: add_new_state
  1468.   #--------------------------------------------------------------------------
  1469.   alias game_battler_add_new_state_abe add_new_state
  1470.   def add_new_state(state_id)
  1471.     game_battler_add_new_state_abe(state_id)
  1472.     make_state_popup(state_id, :add_state) if @states.include?(state_id)
  1473.   end
  1474.  
  1475.   #--------------------------------------------------------------------------
  1476.   # alias method: add_buff
  1477.   #--------------------------------------------------------------------------
  1478.   alias game_battler_add_buff_abe add_buff
  1479.   def add_buff(param_id, turns)
  1480.     make_buff_popup(param_id, true)
  1481.     game_battler_add_buff_abe(param_id, turns)
  1482.   end
  1483.  
  1484.   #--------------------------------------------------------------------------
  1485.   # alias method: add_debuff
  1486.   #--------------------------------------------------------------------------
  1487.   alias game_battler_add_debuff_abe add_debuff
  1488.   def add_debuff(param_id, turns)
  1489.     make_buff_popup(param_id, false)
  1490.     game_battler_add_debuff_abe(param_id, turns)
  1491.   end
  1492.  
  1493.   #--------------------------------------------------------------------------
  1494.   # alias method: regenerate_all
  1495.   #--------------------------------------------------------------------------
  1496.   alias game_battler_regenerate_all_abe regenerate_all
  1497.   def regenerate_all
  1498.     game_battler_regenerate_all_abe
  1499.     return unless alive?
  1500.     make_damage_popups(self)
  1501.   end
  1502.  
  1503.   #--------------------------------------------------------------------------
  1504.   # new method: can_collapse?
  1505.   #--------------------------------------------------------------------------
  1506.   def can_collapse?
  1507.     return false unless dead?
  1508.     unless actor?
  1509.       return false unless sprite.battler_visible
  1510.       array = [:collapse, :boss_collapse, :instant_collapse]
  1511.       return false if array.include?(sprite.effect_type)
  1512.     end
  1513.     return true
  1514.   end
  1515.  
  1516.   #--------------------------------------------------------------------------
  1517.   # new method: draw_mp?
  1518.   #--------------------------------------------------------------------------
  1519.   def draw_mp?; return true; end
  1520.  
  1521.   #--------------------------------------------------------------------------
  1522.   # new method: draw_tp?
  1523.   #--------------------------------------------------------------------------
  1524.   def draw_tp?
  1525.     return $data_system.opt_display_tp
  1526.   end
  1527.  
  1528. end # Game_Battler
  1529.  
  1530. #==============================================================================
  1531. # ■ Game_Actor
  1532. #==============================================================================
  1533.  
  1534. class Game_Actor < Game_Battler
  1535.  
  1536.   #def battler_name
  1537.     #return "Slime"
  1538.   #end
  1539.  
  1540.   #def battler_hue
  1541.     #return 0
  1542.   #end
  1543.  
  1544.   #--------------------------------------------------------------------------
  1545.   # overwrite method: perform_damage_effect
  1546.   #--------------------------------------------------------------------------
  1547.   def perform_damage_effect
  1548.     $game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
  1549.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1550.     Sound.play_actor_damage
  1551.   end
  1552.  
  1553.   #--------------------------------------------------------------------------
  1554.   # overwrite method: use_sprite?
  1555.   #--------------------------------------------------------------------------
  1556.   def use_sprite?; return true; end
  1557.  
  1558.   #--------------------------------------------------------------------------
  1559.   # new method: screen_x
  1560.   #--------------------------------------------------------------------------
  1561.   def screen_x
  1562.     return 0 unless SceneManager.scene_is?(Scene_Battle)
  1563.     status_window = SceneManager.scene.status_window
  1564.     return 0 if status_window.nil?
  1565.     item_rect_width = (status_window.width-24) / $game_party.max_battle_members
  1566.     ext = SceneManager.scene.info_viewport.ox
  1567.     rect = SceneManager.scene.status_window.item_rect(self.index)
  1568.     constant = 128 + 12
  1569.     return constant + rect.x + item_rect_width / 2 - ext
  1570.   end
  1571.  
  1572.   #--------------------------------------------------------------------------
  1573.   # new method: screen_y
  1574.   #--------------------------------------------------------------------------
  1575.   def screen_y
  1576.     return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
  1577.     return Graphics.height - 120 if SceneManager.scene.status_window.nil?
  1578.     return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
  1579.   end
  1580.  
  1581.   #--------------------------------------------------------------------------
  1582.   # new method: screen_z
  1583.   #--------------------------------------------------------------------------
  1584.   def screen_z; return 100; end
  1585.  
  1586.   #--------------------------------------------------------------------------
  1587.   # new method: sprite
  1588.   #--------------------------------------------------------------------------
  1589.   def sprite
  1590.     index = $game_party.battle_members.index(self)
  1591.     return SceneManager.scene.spriteset.actor_sprites[index]
  1592.   end
  1593.  
  1594.   #--------------------------------------------------------------------------
  1595.   # new method: draw_mp?
  1596.   #--------------------------------------------------------------------------
  1597.   def draw_mp?
  1598.     return true unless draw_tp?
  1599.     for skill in skills
  1600.       next unless added_skill_types.include?(skill.stype_id)
  1601.       return true if skill.mp_cost > 0
  1602.     end
  1603.     return false
  1604.   end
  1605.  
  1606.   #--------------------------------------------------------------------------
  1607.   # new method: draw_tp?
  1608.   #--------------------------------------------------------------------------
  1609.   def draw_tp?
  1610.     return false unless $data_system.opt_display_tp
  1611.     for skill in skills
  1612.       next unless added_skill_types.include?(skill.stype_id)
  1613.       return true if skill.tp_cost > 0
  1614.     end
  1615.     return false
  1616.   end
  1617.  
  1618. end # Game_Actor
  1619.  
  1620. #==============================================================================
  1621. # ■ Game_Enemy
  1622. #==============================================================================
  1623.  
  1624. class Game_Enemy < Game_Battler
  1625.  
  1626.   #--------------------------------------------------------------------------
  1627.   # overwrite method: perform_damage_effect
  1628.   #--------------------------------------------------------------------------
  1629.   def perform_damage_effect
  1630.     @sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
  1631.     Sound.play_enemy_damage
  1632.   end
  1633.  
  1634.   #--------------------------------------------------------------------------
  1635.   # new methods: attack_animation_id
  1636.   #--------------------------------------------------------------------------
  1637.   def atk_animation_id1; return enemy.atk_animation_id1; end
  1638.   def atk_animation_id2; return enemy.atk_animation_id2; end
  1639.  
  1640.   #--------------------------------------------------------------------------
  1641.   # new method: sprite
  1642.   #--------------------------------------------------------------------------
  1643.   def sprite
  1644.     return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  1645.   end
  1646.  
  1647. end # Game_Enemy
  1648.  
  1649. #==============================================================================
  1650. # ■ Game_Unit
  1651. #==============================================================================
  1652.  
  1653. class Game_Unit
  1654.  
  1655.   #--------------------------------------------------------------------------
  1656.   # alias method: make_actions
  1657.   #--------------------------------------------------------------------------
  1658.   alias game_unit_make_actions_abe make_actions
  1659.   def make_actions
  1660.     game_unit_make_actions_abe
  1661.     refresh_autobattler_status_window
  1662.   end
  1663.  
  1664.   #--------------------------------------------------------------------------
  1665.   # new method: refresh_autobattler_status_window
  1666.   #--------------------------------------------------------------------------
  1667.   def refresh_autobattler_status_window
  1668.     return unless SceneManager.scene_is?(Scene_Battle)
  1669.     return unless self.is_a?(Game_Party)
  1670.     SceneManager.scene.refresh_autobattler_status_window
  1671.   end
  1672.  
  1673. end # Game_Unit
  1674.  
  1675. #==============================================================================
  1676. # ■ Window_PartyCommand
  1677. #==============================================================================
  1678.  
  1679. class Window_PartyCommand < Window_Command
  1680.  
  1681.   #--------------------------------------------------------------------------
  1682.   # overwrite method: process_handling
  1683.   #--------------------------------------------------------------------------
  1684.   def process_handling
  1685.     return unless open? && active
  1686.     return process_dir6 if Input.repeat?(:RIGHT)
  1687.     return super
  1688.   end
  1689.  
  1690.   #--------------------------------------------------------------------------
  1691.   # new method: process_dir6
  1692.   #--------------------------------------------------------------------------
  1693.   def process_dir6
  1694.     Sound.play_cursor
  1695.     Input.update
  1696.     deactivate
  1697.     call_handler(:dir6)
  1698.   end
  1699.  
  1700. end # Window_PartyCommand
  1701.  
  1702. #==============================================================================
  1703. # ■ Window_ActorCommand
  1704. #==============================================================================
  1705.  
  1706. class Window_ActorCommand < Window_Command
  1707.  
  1708.   #--------------------------------------------------------------------------
  1709.   # overwrite method: process_handling
  1710.   #--------------------------------------------------------------------------
  1711.   def process_handling
  1712.     return unless open? && active
  1713.     return process_dir4 if Input.repeat?(:LEFT)
  1714.     return process_dir6 if Input.repeat?(:RIGHT)
  1715.     return super
  1716.   end
  1717.  
  1718.   #--------------------------------------------------------------------------
  1719.   # new method: process_dir4
  1720.   #--------------------------------------------------------------------------
  1721.   def process_dir4
  1722.     Sound.play_cursor
  1723.     Input.update
  1724.     deactivate
  1725.     call_handler(:cancel)
  1726.   end
  1727.  
  1728.   #--------------------------------------------------------------------------
  1729.   # new method: process_dir6
  1730.   #--------------------------------------------------------------------------
  1731.   def process_dir6
  1732.     Sound.play_cursor
  1733.     Input.update
  1734.     deactivate
  1735.     call_handler(:dir6)
  1736.   end
  1737.  
  1738. end # Window_ActorCommand
  1739.  
  1740. #==============================================================================
  1741. # ■ Window_BattleStatus
  1742. #==============================================================================
  1743.  
  1744. class Window_BattleStatus < Window_Selectable
  1745.  
  1746.   #--------------------------------------------------------------------------
  1747.   # overwrite method: initialize
  1748.   #--------------------------------------------------------------------------
  1749.   def initialize
  1750.     super(0, 0, window_width, window_height)
  1751.     self.openness = 0
  1752.     @party = $game_party.battle_members.clone
  1753.   end
  1754.  
  1755.   #--------------------------------------------------------------------------
  1756.   # overwrite method: col_max
  1757.   #--------------------------------------------------------------------------
  1758.   def col_max; return $game_party.max_battle_members; end
  1759.  
  1760.   #--------------------------------------------------------------------------
  1761.   # new method: battle_members
  1762.   #--------------------------------------------------------------------------
  1763.   def battle_members; return $game_party.battle_members; end
  1764.  
  1765.   #--------------------------------------------------------------------------
  1766.   # new method: actor
  1767.   #--------------------------------------------------------------------------
  1768.   def actor; return battle_members[@index]; end
  1769.  
  1770.   #--------------------------------------------------------------------------
  1771.   # overwrite method: update
  1772.   #--------------------------------------------------------------------------
  1773.   def update
  1774.     super
  1775.     return if @party == $game_party.battle_members
  1776.     @party = $game_party.battle_members.clone
  1777.     refresh
  1778.   end
  1779.  
  1780.   #--------------------------------------------------------------------------
  1781.   # overwrite method: draw_item
  1782.   #--------------------------------------------------------------------------
  1783.   def draw_item(index)
  1784.     return if index.nil?
  1785.     clear_item(index)
  1786.     actor = battle_members[index]
  1787.     rect = item_rect(index)
  1788.     return if actor.nil?
  1789.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
  1790.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  1791.     draw_actor_action(actor, rect.x, rect.y)
  1792.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  1793.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  1794.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  1795.     draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  1796.     if draw_tp?(actor) && draw_mp?(actor)
  1797.       dw = rect.width/2-2
  1798.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  1799.       draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  1800.       dw = rect.width - rect.width/2 - 2
  1801.       draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
  1802.     elsif draw_tp?(actor) && !draw_mp?(actor)
  1803.       draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
  1804.     else
  1805.       draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  1806.     end
  1807.   end
  1808.  
  1809.   #--------------------------------------------------------------------------
  1810.   # overwrite method: item_rect
  1811.   #--------------------------------------------------------------------------
  1812.   def item_rect(index)
  1813.     rect = Rect.new
  1814.     rect.width = contents.width / $game_party.max_battle_members
  1815.     rect.height = contents.height
  1816.     rect.x = index * rect.width
  1817.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  1818.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  1819.     end
  1820.     rect.y = 0
  1821.     return rect
  1822.   end
  1823.  
  1824.   #--------------------------------------------------------------------------
  1825.   # overwrite method: draw_face
  1826.   #--------------------------------------------------------------------------
  1827.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  1828.     bitmap = Cache.face(face_name)
  1829.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  1830.     fy = face_index / 4 * 96 + 2
  1831.     fw = [item_rect(0).width - 4, 92].min
  1832.     rect = Rect.new(fx, fy, fw, 92)
  1833.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  1834.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  1835.     bitmap.dispose
  1836.   end
  1837.  
  1838.   #--------------------------------------------------------------------------
  1839.   # overwrite method: draw_actor_name
  1840.   #--------------------------------------------------------------------------
  1841.   def draw_actor_name(actor, dx, dy, dw = 112)
  1842.     reset_font_settings
  1843.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  1844.     change_color(hp_color(actor))
  1845.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  1846.   end
  1847.  
  1848.   #--------------------------------------------------------------------------
  1849.   # new method: draw_actor_action
  1850.   #--------------------------------------------------------------------------
  1851.   def draw_actor_action(actor, dx, dy)
  1852.     draw_icon(action_icon(actor), dx, dy)
  1853.   end
  1854.  
  1855.   #--------------------------------------------------------------------------
  1856.   # new method: action_icon
  1857.   #--------------------------------------------------------------------------
  1858.   def action_icon(actor)
  1859.     return Icon.no_action if actor.current_action.nil?
  1860.     return Icon.no_action if actor.current_action.item.nil?
  1861.     return actor.current_action.item.icon_index
  1862.   end
  1863.  
  1864.   #--------------------------------------------------------------------------
  1865.   # new method: draw_tp?
  1866.   #--------------------------------------------------------------------------
  1867.   def draw_tp?(actor)
  1868.     return actor.draw_tp?
  1869.   end
  1870.  
  1871.   #--------------------------------------------------------------------------
  1872.   # new method: draw_mp?
  1873.   #--------------------------------------------------------------------------
  1874.   def draw_mp?(actor)
  1875.     return actor.draw_mp?
  1876.   end
  1877.  
  1878.   #--------------------------------------------------------------------------
  1879.   # overwrite method: draw_current_and_max_values
  1880.   #--------------------------------------------------------------------------
  1881.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  1882.     change_color(color1)
  1883.     draw_text(dx, dy, dw, line_height, current.group, 2)
  1884.   end
  1885.  
  1886.   #--------------------------------------------------------------------------
  1887.   # overwrite method: draw_actor_hp
  1888.   #--------------------------------------------------------------------------
  1889.   def draw_actor_hp(actor, dx, dy, width = 124)
  1890.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  1891.     change_color(system_color)
  1892.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1893.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  1894.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  1895.       hp_color(actor), normal_color)
  1896.     end
  1897.  
  1898.   #--------------------------------------------------------------------------
  1899.   # overwrite method: draw_actor_mp
  1900.   #--------------------------------------------------------------------------
  1901.   def draw_actor_mp(actor, dx, dy, width = 124)
  1902.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  1903.     change_color(system_color)
  1904.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1905.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  1906.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  1907.       mp_color(actor), normal_color)
  1908.     end
  1909.  
  1910.   #--------------------------------------------------------------------------
  1911.   # overwrite method: draw_actor_tp
  1912.   #--------------------------------------------------------------------------
  1913.   def draw_actor_tp(actor, dx, dy, width = 124)
  1914.     draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  1915.     change_color(system_color)
  1916.     cy = (Font.default_size - contents.font.size) / 2 + 1
  1917.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  1918.     change_color(tp_color(actor))
  1919.     draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  1920.   end
  1921.  
  1922. end # Window_BattleStatus
  1923.  
  1924. #==============================================================================
  1925. # ■ Window_BattleActor
  1926. #==============================================================================
  1927.  
  1928. class Window_BattleActor < Window_BattleStatus
  1929.  
  1930.   #--------------------------------------------------------------------------
  1931.   # overwrite method: show
  1932.   #--------------------------------------------------------------------------
  1933.   def show
  1934.     create_flags
  1935.     super
  1936.   end
  1937.  
  1938.   #--------------------------------------------------------------------------
  1939.   # new method: create_flags
  1940.   #--------------------------------------------------------------------------
  1941.   def create_flags
  1942.     set_select_flag(:any)
  1943.     select(0)
  1944.     return if $game_temp.battle_aid.nil?
  1945.     if $game_temp.battle_aid.need_selection?
  1946.       select(0)
  1947.       set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  1948.     elsif $game_temp.battle_aid.for_user?
  1949.       battler = BattleManager.actor
  1950.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  1951.       select(id)
  1952.       set_select_flag(:user)
  1953.     elsif $game_temp.battle_aid.for_all?
  1954.       select(0)
  1955.       set_select_flag(:all)
  1956.       set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  1957.     elsif $game_temp.battle_aid.for_random?
  1958.       select(0)
  1959.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  1960.     end
  1961.   end
  1962.  
  1963.   #--------------------------------------------------------------------------
  1964.   # new method: set_flag
  1965.   #--------------------------------------------------------------------------
  1966.   def set_select_flag(flag)
  1967.     @select_flag = flag
  1968.     case @select_flag
  1969.     when :all, :all_dead, :random
  1970.       @cursor_all = true
  1971.     else
  1972.       @cursor_all = false
  1973.     end
  1974.   end
  1975.  
  1976.   #--------------------------------------------------------------------------
  1977.   # overwrite method: update_cursor
  1978.   #--------------------------------------------------------------------------
  1979.   def update_cursor
  1980.     if @cursor_all
  1981.       cursor_rect.set(0, 0, contents.width, contents.height)
  1982.       self.top_row = 0
  1983.     elsif @index < 0
  1984.       cursor_rect.empty
  1985.     else
  1986.       ensure_cursor_visible
  1987.       cursor_rect.set(item_rect(@index))
  1988.     end
  1989.   end
  1990.  
  1991.   #--------------------------------------------------------------------------
  1992.   # overwrite method: cursor_movable?
  1993.   #--------------------------------------------------------------------------
  1994.   def cursor_movable?
  1995.     return false if @select_flag == :user
  1996.     return super
  1997.   end
  1998.  
  1999.   #--------------------------------------------------------------------------
  2000.   # overwrite method: current_item_enabled?
  2001.   #--------------------------------------------------------------------------
  2002.   def current_item_enabled?
  2003.     return true if $game_temp.battle_aid.nil?
  2004.     if $game_temp.battle_aid.need_selection?
  2005.       member = $game_party.battle_members[@index]
  2006.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  2007.     elsif $game_temp.battle_aid.for_dead_friend?
  2008.       for member in $game_party.battle_members
  2009.         return true if member.dead?
  2010.       end
  2011.       return false
  2012.     end
  2013.     return true
  2014.   end
  2015.  
  2016. end # Window_BattleActor
  2017.  
  2018. #==============================================================================
  2019. # ■ Window_BattleStatusAid
  2020. #==============================================================================
  2021.  
  2022. class Window_BattleStatusAid < Window_BattleStatus
  2023.  
  2024.   #--------------------------------------------------------------------------
  2025.   # public instance variables
  2026.   #--------------------------------------------------------------------------
  2027.   attr_accessor :status_window
  2028.  
  2029.   #--------------------------------------------------------------------------
  2030.   # overwrite method: initialize
  2031.   #--------------------------------------------------------------------------
  2032.   def initialize
  2033.     super
  2034.     self.visible = false
  2035.     self.openness = 255
  2036.   end
  2037.  
  2038.   #--------------------------------------------------------------------------
  2039.   # overwrite method: window_width
  2040.   #--------------------------------------------------------------------------
  2041.   def window_width; return 128; end
  2042.  
  2043.   #--------------------------------------------------------------------------
  2044.   # overwrite method: show
  2045.   #--------------------------------------------------------------------------
  2046.   def show
  2047.     super
  2048.     refresh
  2049.   end
  2050.  
  2051.   #--------------------------------------------------------------------------
  2052.   # overwrite method: refresh
  2053.   #--------------------------------------------------------------------------
  2054.   def refresh
  2055.     contents.clear
  2056.     return if @status_window.nil?
  2057.     draw_item(@status_window.index)
  2058.   end
  2059.  
  2060.   #--------------------------------------------------------------------------
  2061.   # overwrite method: item_rect
  2062.   #--------------------------------------------------------------------------
  2063.   def item_rect(index)
  2064.     return Rect.new(0, 0, contents.width, contents.height)
  2065.   end
  2066.  
  2067. end # Window_BattleStatusAid
  2068.  
  2069. #==============================================================================
  2070. # ■ Window_BattleEnemy
  2071. #==============================================================================
  2072.  
  2073. class Window_BattleEnemy < Window_Selectable
  2074.  
  2075.   #--------------------------------------------------------------------------
  2076.   # overwrite method: initialize
  2077.   #--------------------------------------------------------------------------
  2078.   def initialize(info_viewport)
  2079.     super(0, Graphics.height, window_width, fitting_height(1))
  2080.     refresh
  2081.     self.visible = false
  2082.     @info_viewport = info_viewport
  2083.   end
  2084.  
  2085.   #--------------------------------------------------------------------------
  2086.   # overwrite method: col_max
  2087.   #--------------------------------------------------------------------------
  2088.   def col_max; return item_max; end
  2089.  
  2090.   #--------------------------------------------------------------------------
  2091.   # overwrite method: show
  2092.   #--------------------------------------------------------------------------
  2093.   def show
  2094.     create_flags
  2095.     super
  2096.   end
  2097.  
  2098.   #--------------------------------------------------------------------------
  2099.   # new method: create_flags
  2100.   #--------------------------------------------------------------------------
  2101.   def create_flags
  2102.     set_select_flag(:any)
  2103.     select(0)
  2104.     return if $game_temp.battle_aid.nil?
  2105.     if $game_temp.battle_aid.need_selection?
  2106.       select(0)
  2107.     elsif $game_temp.battle_aid.for_all?
  2108.       select(0)
  2109.       set_select_flag(:all)
  2110.     elsif $game_temp.battle_aid.for_random?
  2111.       select(0)
  2112.       set_select_flag(:random)
  2113.     end
  2114.   end
  2115.  
  2116.   #--------------------------------------------------------------------------
  2117.   # new method: set_flag
  2118.   #--------------------------------------------------------------------------
  2119.   def set_select_flag(flag)
  2120.     @select_flag = flag
  2121.     case @select_flag
  2122.     when :all, :random
  2123.       @cursor_all = true
  2124.     else
  2125.       @cursor_all = false
  2126.     end
  2127.   end
  2128.  
  2129.   #--------------------------------------------------------------------------
  2130.   # new method: select_all?
  2131.   #--------------------------------------------------------------------------
  2132.   def select_all?
  2133.     return true if @select_flag == :all
  2134.     return true if @select_flag == :random
  2135.     return false
  2136.   end
  2137.  
  2138.   #--------------------------------------------------------------------------
  2139.   # overwrite method: update_cursor
  2140.   #--------------------------------------------------------------------------
  2141.   def update_cursor
  2142.     if @cursor_all
  2143.       cursor_rect.set(0, 0, contents.width, contents.height)
  2144.       self.top_row = 0
  2145.     elsif @index < 0
  2146.       cursor_rect.empty
  2147.     else
  2148.       ensure_cursor_visible
  2149.       cursor_rect.set(item_rect(@index))
  2150.     end
  2151.   end
  2152.  
  2153.   #--------------------------------------------------------------------------
  2154.   # overwrite method: cursor_movable?
  2155.   #--------------------------------------------------------------------------
  2156.   def cursor_movable?
  2157.     return false if @select_flag == :user
  2158.     return super
  2159.   end
  2160.  
  2161.   #--------------------------------------------------------------------------
  2162.   # overwrite method: current_item_enabled?
  2163.   #--------------------------------------------------------------------------
  2164.   def current_item_enabled?
  2165.     return true if $game_temp.battle_aid.nil?
  2166.     if $game_temp.battle_aid.need_selection?
  2167.       member = $game_party.battle_members[@index]
  2168.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  2169.     elsif $game_temp.battle_aid.for_dead_friend?
  2170.       for member in $game_party.battle_members
  2171.         return true if member.dead?
  2172.       end
  2173.       return false
  2174.     end
  2175.     return true
  2176.   end
  2177.  
  2178.   #--------------------------------------------------------------------------
  2179.   # overwrite method: enemy
  2180.   #--------------------------------------------------------------------------
  2181.   def enemy; @data[index]; end
  2182.  
  2183.   #--------------------------------------------------------------------------
  2184.   # overwrite method: refresh
  2185.   #--------------------------------------------------------------------------
  2186.   def refresh
  2187.     make_item_list
  2188.     create_contents
  2189.     draw_all_items
  2190.   end
  2191.  
  2192.   #--------------------------------------------------------------------------
  2193.   # overwrite method: make_item_list
  2194.   #--------------------------------------------------------------------------
  2195.   def make_item_list
  2196.     @data = $game_troop.alive_members
  2197.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  2198.   end
  2199.  
  2200.   #--------------------------------------------------------------------------
  2201.   # overwrite method: draw_item
  2202.   #--------------------------------------------------------------------------
  2203.   def draw_item(index); return; end
  2204.  
  2205.   #--------------------------------------------------------------------------
  2206.   # overwrite method: update
  2207.   #--------------------------------------------------------------------------
  2208.   def update
  2209.     super
  2210.     return unless active
  2211.     enemy.sprite_effect_type = :whiten
  2212.     return unless select_all?
  2213.     for enemy in $game_troop.alive_members
  2214.       enemy.sprite_effect_type = :whiten
  2215.     end
  2216.   end
  2217.  
  2218. end # Window_BattleEnemy
  2219.  
  2220. #==============================================================================
  2221. # ■ Window_BattleHelp
  2222. #==============================================================================
  2223.  
  2224. class Window_BattleHelp < Window_Help
  2225.  
  2226.   #--------------------------------------------------------------------------
  2227.   # public instance variables
  2228.   #--------------------------------------------------------------------------
  2229.   attr_accessor :actor_window
  2230.   attr_accessor :enemy_window
  2231.  
  2232.   #--------------------------------------------------------------------------
  2233.   # update
  2234.   #--------------------------------------------------------------------------
  2235.   def update
  2236.     super
  2237.     if !self.visible and @text != ""
  2238.       @text = ""
  2239.       return refresh
  2240.     end
  2241.     update_battler_name
  2242.   end
  2243.  
  2244.   #--------------------------------------------------------------------------
  2245.   # update_battler_name
  2246.   #--------------------------------------------------------------------------
  2247.   def update_battler_name
  2248.     return unless @actor_window.active || @enemy_window.active
  2249.     if @actor_window.active
  2250.       battler = $game_party.battle_members[@actor_window.index]
  2251.     elsif @enemy_window.active
  2252.       battler = @enemy_window.enemy
  2253.     end
  2254.     if special_display?
  2255.       refresh_special_case(battler)
  2256.     else
  2257.       refresh_battler_name(battler) if battler_name(battler) != @text
  2258.     end
  2259.   end
  2260.  
  2261.   #--------------------------------------------------------------------------
  2262.   # battler_name
  2263.   #--------------------------------------------------------------------------
  2264.   def battler_name(battler)
  2265.     text = battler.name.clone
  2266.     return text
  2267.   end
  2268.  
  2269.   #--------------------------------------------------------------------------
  2270.   # refresh_battler_name
  2271.   #--------------------------------------------------------------------------
  2272.   def refresh_battler_name(battler)
  2273.     contents.clear
  2274.     reset_font_settings
  2275.     change_color(normal_color)
  2276.     @text = battler_name(battler)
  2277.     icons = battler.state_icons + battler.buff_icons
  2278.     dy = icons.size <= 0 ? line_height / 2 : 0
  2279.     draw_text(0, dy, contents.width, line_height, @text, 1)
  2280.     dx = (contents.width - (icons.size * 24)) / 2
  2281.     draw_actor_icons(battler, dx, line_height, contents.width)
  2282.   end
  2283.  
  2284.   #--------------------------------------------------------------------------
  2285.   # special_display?
  2286.   #--------------------------------------------------------------------------
  2287.   def special_display?
  2288.     return false if $game_temp.battle_aid.nil?
  2289.     return false if $game_temp.battle_aid.for_user?
  2290.     return !$game_temp.battle_aid.need_selection?
  2291.   end
  2292.  
  2293.   #--------------------------------------------------------------------------
  2294.   # refresh_special_case
  2295.   #--------------------------------------------------------------------------
  2296.   def refresh_special_case(battler)
  2297.     if $game_temp.battle_aid.for_opponent?
  2298.       if $game_temp.battle_aid.for_all?
  2299.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  2300.       else
  2301.         case $game_temp.battle_aid.number_of_targets
  2302.         when 1
  2303.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  2304.         else
  2305.           number = $game_temp.battle_aid.number_of_targets
  2306.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  2307.         end
  2308.       end
  2309.     else # $game_temp.battle_aid.for_friend?
  2310.       if $game_temp.battle_aid.for_dead_friend?
  2311.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  2312.       elsif $game_temp.battle_aid.for_random?
  2313.         case $game_temp.battle_aid.number_of_targets
  2314.         when 1
  2315.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  2316.         else
  2317.           number = $game_temp.battle_aid.number_of_targets
  2318.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  2319.         end
  2320.       else
  2321.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  2322.       end
  2323.     end
  2324.     return if text == @text
  2325.     @text = text
  2326.     contents.clear
  2327.     reset_font_settings
  2328.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  2329.   end
  2330.  
  2331. end # Window_BattleHelp
  2332.  
  2333. #==============================================================================
  2334. # ■ Window_BattleLog
  2335. #==============================================================================
  2336.  
  2337. class Window_BattleLog < Window_Selectable
  2338.  
  2339.   #--------------------------------------------------------------------------
  2340.   # alias method: display_current_state
  2341.   #--------------------------------------------------------------------------
  2342.   alias window_battlelog_display_current_state_abe display_current_state
  2343.   def display_current_state(subject)
  2344.     subject.make_during_state_popup
  2345.     return unless YEA::BATTLE::MSG_CURRENT_STATE
  2346.     window_battlelog_display_current_state_abe(subject)
  2347.   end
  2348.  
  2349.   #--------------------------------------------------------------------------
  2350.   # alias method: display_use_item
  2351.   #--------------------------------------------------------------------------
  2352.   alias window_battlelog_display_use_item_abe display_use_item
  2353.   def display_use_item(subject, item)
  2354.     return unless YEA::BATTLE::MSG_CURRENT_ACTION
  2355.     window_battlelog_display_use_item_abe(subject, item)
  2356.   end
  2357.  
  2358.   #--------------------------------------------------------------------------
  2359.   # alias method: display_counter
  2360.   #--------------------------------------------------------------------------
  2361.   alias window_battlelog_display_counter_abe display_counter
  2362.   def display_counter(target, item)
  2363.     if YEA::BATTLE::MSG_COUNTERATTACK
  2364.       window_battlelog_display_counter_abe(target, item)
  2365.     else
  2366.       Sound.play_evasion
  2367.     end
  2368.   end
  2369.  
  2370.   #--------------------------------------------------------------------------
  2371.   # alias method: display_reflection
  2372.   #--------------------------------------------------------------------------
  2373.   alias window_battlelog_display_reflection_abe display_reflection
  2374.   def display_reflection(target, item)
  2375.     if YEA::BATTLE::MSG_REFLECT_MAGIC
  2376.       window_battlelog_display_reflection_abe(target, item)
  2377.     else
  2378.       Sound.play_reflection
  2379.     end
  2380.   end
  2381.  
  2382.   #--------------------------------------------------------------------------
  2383.   # alias method: display_substitute
  2384.   #--------------------------------------------------------------------------
  2385.   alias window_battlelog_display_substitute_abe display_substitute
  2386.   def display_substitute(substitute, target)
  2387.     return unless YEA::BATTLE::MSG_SUBSTITUTE_HIT
  2388.     window_battlelog_display_substitute_abe(substitute, target)
  2389.   end
  2390.  
  2391.   #--------------------------------------------------------------------------
  2392.   # alias method: display_failure
  2393.   #--------------------------------------------------------------------------
  2394.   alias window_battlelog_display_failure_abe display_failure
  2395.   def display_failure(target, item)
  2396.     return unless YEA::BATTLE::MSG_FAILURE_HIT
  2397.     window_battlelog_display_failure_abe(target, item)
  2398.   end
  2399.  
  2400.   #--------------------------------------------------------------------------
  2401.   # alias method: display_critical
  2402.   #--------------------------------------------------------------------------
  2403.   alias window_battlelog_display_critical_abe display_critical
  2404.   def display_critical(target, item)
  2405.     return unless YEA::BATTLE::MSG_CRITICAL_HIT
  2406.     window_battlelog_display_critical_abe(target, item)
  2407.   end
  2408.  
  2409.   #--------------------------------------------------------------------------
  2410.   # alias method: display_miss
  2411.   #--------------------------------------------------------------------------
  2412.   alias window_battlelog_display_miss_abe display_miss
  2413.   def display_miss(target, item)
  2414.     return unless YEA::BATTLE::MSG_HIT_MISSED
  2415.     window_battlelog_display_miss_abe(target, item)
  2416.   end
  2417.  
  2418.   #--------------------------------------------------------------------------
  2419.   # alias method: display_evasion
  2420.   #--------------------------------------------------------------------------
  2421.   alias window_battlelog_display_evasion_abe display_evasion
  2422.   def display_evasion(target, item)
  2423.     if YEA::BATTLE::MSG_EVASION
  2424.       window_battlelog_display_evasion_abe(target, item)
  2425.     else
  2426.       if !item || item.physical?
  2427.         Sound.play_evasion
  2428.       else
  2429.         Sound.play_magic_evasion
  2430.       end
  2431.     end
  2432.   end
  2433.  
  2434.   #--------------------------------------------------------------------------
  2435.   # overwrite method: display_hp_damage
  2436.   #--------------------------------------------------------------------------
  2437.   def display_hp_damage(target, item)
  2438.     return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
  2439.     if target.result.hp_damage > 0 && target.result.hp_drain == 0
  2440.       target.perform_damage_effect
  2441.     end
  2442.     Sound.play_recovery if target.result.hp_damage < 0
  2443.     return unless YEA::BATTLE::MSG_HP_DAMAGE
  2444.     add_text(target.result.hp_damage_text)
  2445.     wait
  2446.   end
  2447.  
  2448.   #--------------------------------------------------------------------------
  2449.   # overwrite method: display_mp_damage
  2450.   #--------------------------------------------------------------------------
  2451.   def display_mp_damage(target, item)
  2452.     return if target.dead? || target.result.mp_damage == 0
  2453.     Sound.play_recovery if target.result.mp_damage < 0
  2454.     return unless YEA::BATTLE::MSG_MP_DAMAGE
  2455.     add_text(target.result.mp_damage_text)
  2456.     wait
  2457.   end
  2458.  
  2459.   #--------------------------------------------------------------------------
  2460.   # overwrite method: display_tp_damage
  2461.   #--------------------------------------------------------------------------
  2462.   def display_tp_damage(target, item)
  2463.     return if target.dead? || target.result.tp_damage == 0
  2464.     Sound.play_recovery if target.result.tp_damage < 0
  2465.     return unless YEA::BATTLE::MSG_TP_DAMAGE
  2466.     add_text(target.result.tp_damage_text)
  2467.     wait
  2468.   end
  2469.  
  2470.   #--------------------------------------------------------------------------
  2471.   # alias method: display_added_states
  2472.   #--------------------------------------------------------------------------
  2473.   alias window_battlelog_display_added_states_abe display_added_states
  2474.   def display_added_states(target)
  2475.     return unless YEA::BATTLE::MSG_ADDED_STATES
  2476.     window_battlelog_display_added_states_abe(target)
  2477.   end
  2478.  
  2479.   #--------------------------------------------------------------------------
  2480.   # alias method: display_removed_states
  2481.   #--------------------------------------------------------------------------
  2482.   alias window_battlelog_display_removed_states_abe display_removed_states
  2483.   def display_removed_states(target)
  2484.     return unless YEA::BATTLE::MSG_REMOVED_STATES
  2485.     window_battlelog_display_removed_states_abe(target)
  2486.   end
  2487.  
  2488.   #--------------------------------------------------------------------------
  2489.   # alias method: display_changed_buffs
  2490.   #--------------------------------------------------------------------------
  2491.   alias window_battlelog_display_changed_buffs_abe display_changed_buffs
  2492.   def display_changed_buffs(target)
  2493.     return unless YEA::BATTLE::MSG_CHANGED_BUFFS
  2494.     window_battlelog_display_changed_buffs_abe(target)
  2495.   end
  2496.  
  2497. end # Window_BattleLog
  2498.  
  2499. #==============================================================================
  2500. # ■ Window_SkillList
  2501. #==============================================================================
  2502.  
  2503. class Window_SkillList < Window_Selectable
  2504.  
  2505.   #--------------------------------------------------------------------------
  2506.   # overwrite method: spacing
  2507.   #--------------------------------------------------------------------------
  2508.   def spacing
  2509.     return 8 if $game_party.in_battle
  2510.     return super
  2511.   end
  2512.  
  2513. end # Window_SkillList
  2514.  
  2515. #==============================================================================
  2516. # ■ Window_ItemList
  2517. #==============================================================================
  2518.  
  2519. class Window_ItemList < Window_Selectable
  2520.  
  2521.   #--------------------------------------------------------------------------
  2522.   # overwrite method: spacing
  2523.   #--------------------------------------------------------------------------
  2524.   def spacing
  2525.     return 8 if $game_party.in_battle
  2526.     return super
  2527.   end
  2528.  
  2529. end # Window_ItemList
  2530.  
  2531. #==============================================================================
  2532. # ■ Scene_Battle
  2533. #==============================================================================
  2534.  
  2535. class Scene_Battle < Scene_Base
  2536.  
  2537.   #--------------------------------------------------------------------------
  2538.   # public instance variables
  2539.   #--------------------------------------------------------------------------
  2540.   attr_accessor :enemy_window
  2541.   attr_accessor :info_viewport
  2542.   attr_accessor :spriteset
  2543.   attr_accessor :status_window
  2544.   attr_accessor :status_aid_window
  2545.   attr_accessor :subject
  2546.  
  2547.   #--------------------------------------------------------------------------
  2548.   # alias method: create_spriteset
  2549.   #--------------------------------------------------------------------------
  2550.   alias scene_battle_create_spriteset_abe create_spriteset
  2551.   def create_spriteset
  2552.     BattleManager.init_battle_type
  2553.     scene_battle_create_spriteset_abe
  2554.   end
  2555.  
  2556.   #--------------------------------------------------------------------------
  2557.   # alias method: update_basic
  2558.   #--------------------------------------------------------------------------
  2559.   alias scene_battle_update_basic_abe update_basic
  2560.   def update_basic
  2561.     scene_battle_update_basic_abe
  2562.     update_debug
  2563.   end
  2564.  
  2565.   #--------------------------------------------------------------------------
  2566.   # new method: update_debug
  2567.   #--------------------------------------------------------------------------
  2568.   def update_debug
  2569.     return unless $TEST || $BTEST
  2570.     debug_heal_party if Input.trigger?(:F5)
  2571.     debug_damage_party if Input.trigger?(:F6)
  2572.     debug_fill_tp if Input.trigger?(:F7)
  2573.     debug_kill_all if Input.trigger?(:F8)
  2574.   end
  2575.  
  2576.   #--------------------------------------------------------------------------
  2577.   # new method: debug_heal_party
  2578.   #--------------------------------------------------------------------------
  2579.   def debug_heal_party
  2580.     Sound.play_recovery
  2581.     for member in $game_party.battle_members
  2582.       member.recover_all
  2583.     end
  2584.     @status_window.refresh
  2585.   end
  2586.  
  2587.   #--------------------------------------------------------------------------
  2588.   # new method: debug_damage_party
  2589.   #--------------------------------------------------------------------------
  2590.   def debug_damage_party
  2591.     Sound.play_actor_damage
  2592.     for member in $game_party.alive_members
  2593.       member.hp = 1
  2594.       member.mp = 0
  2595.       member.tp = 0
  2596.     end
  2597.     @status_window.refresh
  2598.   end
  2599.  
  2600.   #--------------------------------------------------------------------------
  2601.   # new method: debug_fill_tp
  2602.   #--------------------------------------------------------------------------
  2603.   def debug_fill_tp
  2604.     Sound.play_recovery
  2605.     for member in $game_party.alive_members
  2606.       member.tp = member.max_tp
  2607.     end
  2608.     @status_window.refresh
  2609.   end
  2610.  
  2611.   #--------------------------------------------------------------------------
  2612.   # new method: debug_kill_all
  2613.   #--------------------------------------------------------------------------
  2614.   def debug_kill_all
  2615.     for enemy in $game_troop.alive_members
  2616.       enemy.hp = 0
  2617.       enemy.perform_collapse_effect
  2618.     end
  2619.     BattleManager.judge_win_loss
  2620.     @log_window.wait
  2621.     @log_window.wait_for_effect
  2622.   end
  2623.  
  2624.   #--------------------------------------------------------------------------
  2625.   # alias method: create_all_windows
  2626.   #--------------------------------------------------------------------------
  2627.   alias scene_battle_create_all_windows_abe create_all_windows
  2628.   def create_all_windows
  2629.     scene_battle_create_all_windows_abe
  2630.     create_battle_status_aid_window
  2631.     set_help_window
  2632.   end
  2633.  
  2634.   #--------------------------------------------------------------------------
  2635.   # alias method: create_info_viewport
  2636.   #--------------------------------------------------------------------------
  2637.   alias scene_battle_create_info_viewport_abe create_info_viewport
  2638.   def create_info_viewport
  2639.     scene_battle_create_info_viewport_abe
  2640.     @status_window.refresh
  2641.   end
  2642.  
  2643.   #--------------------------------------------------------------------------
  2644.   # new method: create_battle_status_aid_window
  2645.   #--------------------------------------------------------------------------
  2646.   def create_battle_status_aid_window
  2647.     @status_aid_window = Window_BattleStatusAid.new
  2648.     @status_aid_window.status_window = @status_window
  2649.     @status_aid_window.x = Graphics.width - @status_aid_window.width
  2650.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  2651.   end
  2652.  
  2653.   #--------------------------------------------------------------------------
  2654.   # overwrite method: create_help_window
  2655.   #--------------------------------------------------------------------------
  2656.   def create_help_window
  2657.     @help_window = Window_BattleHelp.new
  2658.     @help_window.hide
  2659.   end
  2660.  
  2661.   #--------------------------------------------------------------------------
  2662.   # new method: set_help_window
  2663.   #--------------------------------------------------------------------------
  2664.   def set_help_window
  2665.     @help_window.actor_window = @actor_window
  2666.     @help_window.enemy_window = @enemy_window
  2667.   end
  2668.  
  2669.   #--------------------------------------------------------------------------
  2670.   # alias method: create_party_command_window
  2671.   #--------------------------------------------------------------------------
  2672.   alias scene_battle_create_party_command_window_abe create_party_command_window
  2673.   def create_party_command_window
  2674.     scene_battle_create_party_command_window_abe
  2675.     @party_command_window.set_handler(:dir6, method(:command_fight))
  2676.   end
  2677.  
  2678.   #--------------------------------------------------------------------------
  2679.   # alias method: create_actor_command_window
  2680.   #--------------------------------------------------------------------------
  2681.   alias scene_battle_create_actor_command_window_abe create_actor_command_window
  2682.   def create_actor_command_window
  2683.     scene_battle_create_actor_command_window_abe
  2684.     @actor_command_window.set_handler(:dir4, method(:prior_command))
  2685.     @actor_command_window.set_handler(:dir6, method(:next_command))
  2686.   end
  2687.  
  2688.   #--------------------------------------------------------------------------
  2689.   # alias method: create_skill_window
  2690.   #--------------------------------------------------------------------------
  2691.   alias scene_battle_create_skill_window_abe create_skill_window
  2692.   def create_skill_window
  2693.     scene_battle_create_skill_window_abe
  2694.     @skill_window.height = @info_viewport.rect.height
  2695.     @skill_window.width = Graphics.width - @actor_command_window.width
  2696.     @skill_window.y = Graphics.height - @skill_window.height
  2697.   end
  2698.  
  2699.   #--------------------------------------------------------------------------
  2700.   # alias method: create_item_window
  2701.   #--------------------------------------------------------------------------
  2702.   alias scene_battle_create_item_window_abe create_item_window
  2703.   def create_item_window
  2704.     scene_battle_create_item_window_abe
  2705.     @item_window.height = @skill_window.height
  2706.     @item_window.width = @skill_window.width
  2707.     @item_window.y = Graphics.height - @item_window.height
  2708.   end
  2709.  
  2710.   #--------------------------------------------------------------------------
  2711.   # alias method: show_fast?
  2712.   #--------------------------------------------------------------------------
  2713.   alias scene_battle_show_fast_abe show_fast?
  2714.   def show_fast?
  2715.     return true if YEA::BATTLE::AUTO_FAST
  2716.     return scene_battle_show_fast_abe
  2717.   end
  2718.  
  2719.   #--------------------------------------------------------------------------
  2720.   # alias method: next_command
  2721.   #--------------------------------------------------------------------------
  2722.   alias scene_battle_next_command_abe next_command
  2723.   def next_command
  2724.     @status_window.show
  2725.     redraw_current_status
  2726.     @actor_command_window.show
  2727.     @status_aid_window.hide
  2728.     scene_battle_next_command_abe
  2729.   end
  2730.  
  2731.   #--------------------------------------------------------------------------
  2732.   # alias method: prior_command
  2733.   #--------------------------------------------------------------------------
  2734.   alias scene_battle_prior_command_abe prior_command
  2735.   def prior_command
  2736.     redraw_current_status
  2737.     scene_battle_prior_command_abe
  2738.   end
  2739.  
  2740.   #--------------------------------------------------------------------------
  2741.   # new method: redraw_current_status
  2742.   #--------------------------------------------------------------------------
  2743.   def redraw_current_status
  2744.     return if @status_window.index < 0
  2745.     @status_window.draw_item(@status_window.index)
  2746.   end
  2747.  
  2748.   #--------------------------------------------------------------------------
  2749.   # alias method: command_attack
  2750.   #--------------------------------------------------------------------------
  2751.   alias scene_battle_command_attack_abe command_attack
  2752.   def command_attack
  2753.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  2754.     scene_battle_command_attack_abe
  2755.   end
  2756.  
  2757.   #--------------------------------------------------------------------------
  2758.   # alias method: command_skill
  2759.   #--------------------------------------------------------------------------
  2760.   alias scene_battle_command_skill_abe command_skill
  2761.   def command_skill
  2762.     scene_battle_command_skill_abe
  2763.     @status_window.hide
  2764.     @actor_command_window.hide
  2765.     @status_aid_window.show
  2766.   end
  2767.  
  2768.   #--------------------------------------------------------------------------
  2769.   # alias method: command_item
  2770.   #--------------------------------------------------------------------------
  2771.   alias scene_battle_command_item_abe command_item
  2772.   def command_item
  2773.     scene_battle_command_item_abe
  2774.     @status_window.hide
  2775.     @actor_command_window.hide
  2776.     @status_aid_window.show
  2777.   end
  2778.  
  2779.   #--------------------------------------------------------------------------
  2780.   # overwrite method: on_skill_ok
  2781.   #--------------------------------------------------------------------------
  2782.   def on_skill_ok
  2783.     @skill = @skill_window.item
  2784.     $game_temp.battle_aid = @skill
  2785.     BattleManager.actor.input.set_skill(@skill.id)
  2786.     BattleManager.actor.last_skill.object = @skill
  2787.     if @skill.for_opponent?
  2788.       select_enemy_selection
  2789.     elsif @skill.for_friend?
  2790.       select_actor_selection
  2791.     else
  2792.       @skill_window.hide
  2793.       next_command
  2794.       $game_temp.battle_aid = nil
  2795.     end
  2796.   end
  2797.  
  2798.   #--------------------------------------------------------------------------
  2799.   # alias method: on_skill_cancel
  2800.   #--------------------------------------------------------------------------
  2801.   alias scene_battle_on_skill_cancel_abe on_skill_cancel
  2802.   def on_skill_cancel
  2803.     scene_battle_on_skill_cancel_abe
  2804.     @status_window.show
  2805.     @actor_command_window.show
  2806.     @status_aid_window.hide
  2807.   end
  2808.  
  2809.   #--------------------------------------------------------------------------
  2810.   # overwrite method: on_item_ok
  2811.   #--------------------------------------------------------------------------
  2812.   def on_item_ok
  2813.     @item = @item_window.item
  2814.     $game_temp.battle_aid = @item
  2815.     BattleManager.actor.input.set_item(@item.id)
  2816.     if @item.for_opponent?
  2817.       select_enemy_selection
  2818.     elsif @item.for_friend?
  2819.       select_actor_selection
  2820.     else
  2821.       @item_window.hide
  2822.       next_command
  2823.       $game_temp.battle_aid = nil
  2824.     end
  2825.     $game_party.last_item.object = @item
  2826.   end
  2827.  
  2828.   #--------------------------------------------------------------------------
  2829.   # alias method: on_item_cancel
  2830.   #--------------------------------------------------------------------------
  2831.   alias scene_battle_on_item_cancel_abe on_item_cancel
  2832.   def on_item_cancel
  2833.     scene_battle_on_item_cancel_abe
  2834.     @status_window.show
  2835.     @actor_command_window.show
  2836.     @status_aid_window.hide
  2837.   end
  2838.  
  2839.   #--------------------------------------------------------------------------
  2840.   # alias method: select_actor_selection
  2841.   #--------------------------------------------------------------------------
  2842.   alias scene_battle_select_actor_selection_abe select_actor_selection
  2843.   def select_actor_selection
  2844.     @status_aid_window.refresh
  2845.     scene_battle_select_actor_selection_abe
  2846.     @status_window.hide
  2847.     @skill_window.hide
  2848.     @item_window.hide
  2849.     @help_window.show
  2850.   end
  2851.  
  2852.   #--------------------------------------------------------------------------
  2853.   # alias method: on_actor_ok
  2854.   #--------------------------------------------------------------------------
  2855.   alias scene_battle_on_actor_ok_abe on_actor_ok
  2856.   def on_actor_ok
  2857.     $game_temp.battle_aid = nil
  2858.     scene_battle_on_actor_ok_abe
  2859.     @status_window.show
  2860.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  2861.       @actor_command_window.visible = !@confirm_command_window.visible
  2862.     else
  2863.       @actor_command_window.show
  2864.     end
  2865.     @status_aid_window.hide
  2866.   end
  2867.  
  2868.   #--------------------------------------------------------------------------
  2869.   # alias method: on_actor_cancel
  2870.   #--------------------------------------------------------------------------
  2871.   alias scene_battle_on_actor_cancel_abe on_actor_cancel
  2872.   def on_actor_cancel
  2873.     BattleManager.actor.input.clear
  2874.     @status_aid_window.refresh
  2875.     $game_temp.battle_aid = nil
  2876.     scene_battle_on_actor_cancel_abe
  2877.     case @actor_command_window.current_symbol
  2878.     when :skill
  2879.       @skill_window.show
  2880.     when :item
  2881.       @item_window.show
  2882.     end
  2883.   end
  2884.  
  2885.   #--------------------------------------------------------------------------
  2886.   # alias method: select_enemy_selection
  2887.   #--------------------------------------------------------------------------
  2888.   alias scene_battle_select_enemy_selection_abe select_enemy_selection
  2889.   def select_enemy_selection
  2890.     @status_aid_window.refresh
  2891.     scene_battle_select_enemy_selection_abe
  2892.     @help_window.show
  2893.   end
  2894.   #--------------------------------------------------------------------------
  2895.   # alias method: on_enemy_ok
  2896.   #--------------------------------------------------------------------------
  2897.   alias scene_battle_on_enemy_ok_abe on_enemy_ok
  2898.   def on_enemy_ok
  2899.     $game_temp.battle_aid = nil
  2900.     scene_battle_on_enemy_ok_abe
  2901.   end
  2902.  
  2903.   #--------------------------------------------------------------------------
  2904.   # alias method: on_enemy_cancel
  2905.   #--------------------------------------------------------------------------
  2906.   alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  2907.   def on_enemy_cancel
  2908.     BattleManager.actor.input.clear
  2909.     @status_aid_window.refresh
  2910.     $game_temp.battle_aid = nil
  2911.     scene_battle_on_enemy_cancel_abe
  2912.     if @skill_window.visible || @item_window.visible
  2913.       @help_window.show
  2914.     else
  2915.       @help_window.hide
  2916.     end
  2917.   end
  2918.  
  2919.   #--------------------------------------------------------------------------
  2920.   # alias method: battle_start
  2921.   #--------------------------------------------------------------------------
  2922.   alias scene_battle_battle_start_abe battle_start
  2923.   def battle_start
  2924.     scene_battle_battle_start_abe
  2925.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2926.     @party_command_window.deactivate
  2927.     if BattleManager.input_start
  2928.       command_fight
  2929.     else
  2930.       turn_start
  2931.     end
  2932.   end
  2933.  
  2934.   #--------------------------------------------------------------------------
  2935.   # overwrite method: turn_end
  2936.   #--------------------------------------------------------------------------
  2937.   def turn_end
  2938.     all_battle_members.each do |battler|
  2939.       battler.on_turn_end
  2940.       status_redraw_target(battler)
  2941.       @log_window.display_auto_affected_status(battler)
  2942.       @log_window.wait_and_clear
  2943.     end
  2944.     update_party_cooldowns if $imported["YEA-CommandParty"]
  2945.     BattleManager.turn_end
  2946.     process_event
  2947.     start_party_command_selection
  2948.     return unless YEA::BATTLE::SKIP_PARTY_COMMAND
  2949.     if BattleManager.input_start
  2950.       @party_command_window.deactivate
  2951.       command_fight
  2952.     else
  2953.       @party_command_window.deactivate
  2954.       turn_start
  2955.     end
  2956.   end
  2957.  
  2958.   #--------------------------------------------------------------------------
  2959.   # overwrite method: execute_action
  2960.   #--------------------------------------------------------------------------
  2961.   def execute_action
  2962.     @subject.sprite_effect_type = :whiten if YEA::BATTLE::FLASH_WHITE_EFFECT
  2963.     use_item
  2964.     @log_window.wait_and_clear
  2965.   end
  2966.  
  2967.   #--------------------------------------------------------------------------
  2968.   # overwrite method: apply_item_effects
  2969.   #--------------------------------------------------------------------------
  2970.   def apply_item_effects(target, item)
  2971.     if $imported["YEA-LunaticObjects"]
  2972.       lunatic_object_effect(:prepare, item, @subject, target)
  2973.     end
  2974.     target.item_apply(@subject, item)
  2975.     status_redraw_target(@subject)
  2976.     status_redraw_target(target) unless target == @subject
  2977.     @log_window.display_action_results(target, item)
  2978.     if $imported["YEA-LunaticObjects"]
  2979.       lunatic_object_effect(:during, item, @subject, target)
  2980.     end
  2981.     perform_collapse_check(target)
  2982.   end
  2983.  
  2984.   #--------------------------------------------------------------------------
  2985.   # overwite method: invoke_counter_attack
  2986.   #--------------------------------------------------------------------------
  2987.   def invoke_counter_attack(target, item)
  2988.     @log_window.display_counter(target, item)
  2989.     attack_skill = $data_skills[target.attack_skill_id]
  2990.     @subject.item_apply(target, attack_skill)
  2991.     status_redraw_target(@subject)
  2992.     status_redraw_target(target) unless target == @subject
  2993.     @log_window.display_action_results(@subject, attack_skill)
  2994.     perform_collapse_check(target)
  2995.     perform_collapse_check(@subject)
  2996.   end
  2997.  
  2998.   #--------------------------------------------------------------------------
  2999.   # new method: perform_collapse_check
  3000.   #--------------------------------------------------------------------------
  3001.   def perform_collapse_check(target)
  3002.     return if YEA::BATTLE::MSG_ADDED_STATES
  3003.     target.perform_collapse_effect if target.can_collapse?
  3004.     @log_window.wait
  3005.     @log_window.wait_for_effect
  3006.   end
  3007.  
  3008.   #--------------------------------------------------------------------------
  3009.   # overwrite method: show_attack_animation
  3010.   #--------------------------------------------------------------------------
  3011.   def show_attack_animation(targets)
  3012.     show_normal_animation(targets, @subject.atk_animation_id1, false)
  3013.     wait_for_animation
  3014.     show_normal_animation(targets, @subject.atk_animation_id2, true)
  3015.   end
  3016.  
  3017.   #--------------------------------------------------------------------------
  3018.   # overwrite method: show_normal_animation
  3019.   #--------------------------------------------------------------------------
  3020.   def show_normal_animation(targets, animation_id, mirror = false)
  3021.     animation = $data_animations[animation_id]
  3022.     return if animation.nil?
  3023.     ani_check = false
  3024.     targets.each do |target|
  3025.       if ani_check && target.animation_id <= 0
  3026.         target.pseudo_ani_id = animation_id
  3027.       else
  3028.         target.animation_id = animation_id
  3029.       end
  3030.       target.animation_mirror = mirror
  3031.       ani_check = true if animation.to_screen?
  3032.     end
  3033.   end
  3034.  
  3035.   #--------------------------------------------------------------------------
  3036.   # overwrite method: process_action_end
  3037.   #--------------------------------------------------------------------------
  3038.   def process_action_end
  3039.     @subject.on_action_end
  3040.     status_redraw_target(@subject)
  3041.     @log_window.display_auto_affected_status(@subject)
  3042.     @log_window.wait_and_clear
  3043.     @log_window.display_current_state(@subject)
  3044.     @log_window.wait_and_clear
  3045.     BattleManager.judge_win_loss
  3046.   end
  3047.  
  3048.   #--------------------------------------------------------------------------
  3049.   # overwrite method: use_item
  3050.   #--------------------------------------------------------------------------
  3051.   def use_item
  3052.     item = @subject.current_action.item
  3053.     @log_window.display_use_item(@subject, item)
  3054.     @subject.use_item(item)
  3055.     status_redraw_target(@subject)
  3056.     if $imported["YEA-LunaticObjects"]
  3057.       lunatic_object_effect(:before, item, @subject, @subject)
  3058.     end
  3059.     process_casting_animation if $imported["YEA-CastAnimations"]
  3060.     targets = @subject.current_action.make_targets.compact rescue []
  3061.     show_animation(targets, item.animation_id) if show_all_animation?(item)
  3062.     targets.each {|target|
  3063.       if $imported["YEA-TargetManager"]
  3064.         target = alive_random_target(target, item) if item.for_random?
  3065.       end
  3066.       item.repeats.times { invoke_item(target, item) } }
  3067.     if $imported["YEA-LunaticObjects"]
  3068.       lunatic_object_effect(:after, item, @subject, @subject)
  3069.     end
  3070.   end
  3071.  
  3072.   #--------------------------------------------------------------------------
  3073.   # alias method: invoke_item
  3074.   #--------------------------------------------------------------------------
  3075.   alias scene_battle_invoke_item_abe invoke_item
  3076.   def invoke_item(target, item)
  3077.     show_animation([target], item.animation_id) if separate_ani?(target, item)
  3078.     if target.dead? != item.for_dead_friend?
  3079.       @subject.last_target_index = target.index
  3080.       return
  3081.     end
  3082.     scene_battle_invoke_item_abe(target, item)
  3083.   end
  3084.  
  3085.   #--------------------------------------------------------------------------
  3086.   # new method: show_all_animation?
  3087.   #--------------------------------------------------------------------------
  3088.   def show_all_animation?(item)
  3089.     return true if item.one_animation
  3090.     return false if $data_animations[item.animation_id].nil?
  3091.     return false unless $data_animations[item.animation_id].to_screen?
  3092.     return true
  3093.   end
  3094.  
  3095.   #--------------------------------------------------------------------------
  3096.   # new method: separate_ani?
  3097.   #--------------------------------------------------------------------------
  3098.   def separate_ani?(target, item)
  3099.     return false if item.one_animation
  3100.     return false if $data_animations[item.animation_id].nil?
  3101.     return false if $data_animations[item.animation_id].to_screen?
  3102.     return target.dead? == item.for_dead_friend?
  3103.   end
  3104.  
  3105.   #--------------------------------------------------------------------------
  3106.   # new method: status_redraw_target
  3107.   #--------------------------------------------------------------------------
  3108.   def status_redraw_target(target)
  3109.     return unless target.actor?
  3110.     @status_window.draw_item($game_party.battle_members.index(target))
  3111.   end
  3112.  
  3113.   #--------------------------------------------------------------------------
  3114.   # alias method: start_party_command_selection
  3115.   #--------------------------------------------------------------------------
  3116.   alias start_party_command_selection_abe start_party_command_selection
  3117.   def start_party_command_selection
  3118.     @status_window.refresh unless scene_changing?
  3119.     start_party_command_selection_abe
  3120.   end
  3121.  
  3122.   #--------------------------------------------------------------------------
  3123.   # overwrite method: refresh_status
  3124.   #--------------------------------------------------------------------------
  3125.   def refresh_status; return; end
  3126.  
  3127.   #--------------------------------------------------------------------------
  3128.   # new method: refresh_autobattler_status_window
  3129.   #--------------------------------------------------------------------------
  3130.   def refresh_autobattler_status_window
  3131.     for member in $game_party.battle_members
  3132.       next unless member.auto_battle?
  3133.       @status_window.draw_item(member.index)
  3134.     end
  3135.   end
  3136.  
  3137.   #--------------------------------------------------------------------------
  3138.   # new method: hide_extra_gauges
  3139.   #--------------------------------------------------------------------------
  3140.   def hide_extra_gauges
  3141.     # Made for compatibility
  3142.   end
  3143.  
  3144.   #--------------------------------------------------------------------------
  3145.   # new method: show_extra_gauges
  3146.   #--------------------------------------------------------------------------
  3147.   def show_extra_gauges
  3148.     # Made for compatibility
  3149.   end
  3150.  
  3151. end # Scene_Battle
  3152. #==============================================================================
  3153. #
  3154. # ▼ YSA Battle System: Classical ATB
  3155. # -- Last Updated: 2012.01.20
  3156. # -- Level: Easy, Normal
  3157. # -- Requires: YEA - Ace Battle Engine v1.15+.
  3158. #
  3159. #==============================================================================
  3160.  
  3161. $imported = {} if $imported.nil?
  3162. $imported["YSA-CATB"] = true
  3163.  
  3164. #==============================================================================
  3165. # ▼ Updates
  3166. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3167. # 2012.01.20 - Compatible with: Lunatic CATB Rate.
  3168. #            - Fix a bug with first strike.
  3169. # 2012.01.19 - Fix a small bug with Action's Icon Updating.
  3170. #            - Fix a critical bug with target selecting.
  3171. #            - Fix a bug with states updating.
  3172. #            - Fix a small bug with actor's status when choosing skill/item.
  3173. #            - Fix a critical bug with auto battle.
  3174. # 2012.01.16 - Fix ATB speed changes when a battler's agi changes.
  3175. #            - Add casting time.
  3176. # 2012.01.16 - Add a function for preemptive strike and surprised.
  3177. #            - Fix a small bug with make action.
  3178. # 2012.01.13 - Bugfix for ATB Type Wait.
  3179. #            - Upgrade a little ATB gauge.
  3180. #            - Upgrade turn count.
  3181. #            - Compatible with: Lunatic CATB Start.
  3182. # 2012.01.12 - Started Script and Finished.
  3183. #
  3184. #==============================================================================
  3185. # ▼ Introduction
  3186. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3187. # This script will add a battle type into YEA Battle Engine Ace.
  3188. # Battle Type: Classical ATB.
  3189. #
  3190. #==============================================================================
  3191. # ▼ Instructions
  3192. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3193. # To install this script, open up your script editor and copy/paste this script
  3194. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  3195. #
  3196. # First, set the default battle system for your game to be :catb by either going
  3197. # to the Ace Battle Engine script and setting DEFAULT_BATTLE_SYSTEM as :catb or
  3198. # by using the following script call:
  3199. #
  3200. # $game_system:set_battle_system(:catb)
  3201. #
  3202. # Second, you can set the default wait for your game by either setting DEFAULT_WAIT
  3203. # or using the following script call:
  3204. #
  3205. # $game_system:set_catb_wait_type(wait_type)
  3206. #
  3207. # Which there are 4 types:
  3208. #   - :full     : ATB always run, except when animation run
  3209. #   - :quarter  : ATB pause when select skill/item/target
  3210. #   - :semi     : ATB pause when select target
  3211. #   - :wait     : ATB pause when choose action for actor
  3212. #
  3213. # Third, you can set the default turn counting for your game by either setting
  3214. # DEFAULT_TURN or using the following script call:
  3215. #
  3216. # $game_system:set_catb_turn_type(turn_type)
  3217. #
  3218. # Which there are 2 types:
  3219. #   - :tick     : Count as a turn after X frame
  3220. #   - :action   : Count as a turn after X actions
  3221. #
  3222. # -----------------------------------------------------------------------------
  3223. # Skill/Item Notetags - These notetags go in the skill/item notebox in the database.
  3224. # -----------------------------------------------------------------------------
  3225. # <charge rate: x%>
  3226. # Enable casting time (skill charge) for Skill or Item. Skill/Item will be charged
  3227. # at normal ATB filled speed * x%, which means it will be charged at x% rate.
  3228. #
  3229. #==============================================================================
  3230. # ▼ Compatibility
  3231. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3232. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  3233. # it will run with RPG Maker VX without adjusting.
  3234. #
  3235. # This script requires Yanfly Engine Ace - Ace Battle Engine v1.15+ and the
  3236. # script must be placed under Ace Battle Engine in the script listing.
  3237. #
  3238. #==============================================================================
  3239.  
  3240. #==============================================================================
  3241. # ▼ Configuration
  3242. #==============================================================================
  3243.  
  3244. module YSA
  3245.   module CATB
  3246.  
  3247.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3248.     # - General Configuration -
  3249.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3250.     DEFAULT_FILL_TIME = 120 # Frames
  3251.     DEFAULT_WAIT      = :wait # :full, :semi, :quarter, :wait
  3252.     FILL_TIME_VARIABLE  = 15 # Change DEFAULT_FILL_TIME by variable.
  3253.  
  3254.     PAUSE_WHEN_ACTIVE_PARTY_COMMAND = true
  3255.  
  3256.     PREEMTIVE_ATB_ACTOR = 70
  3257.     PREEMTIVE_ATB_ENEMY = 0
  3258.     SURPRISE_ATB_ACTOR = 0
  3259.     SURPRISE_ATB_ENEMY = 70
  3260.  
  3261.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3262.     # - Turn Configuration -
  3263.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3264.     DEFAULT_TURN          = :action # :tick, :action
  3265.  
  3266.     TICK_COUNT            = 150    # Turn after TICK_COUNT
  3267.     TICK_COUNT_VARIABLE   = 16     # Change TICK_COUNT by variable.
  3268.  
  3269.     AFTER_ACTION          = 1      # Turn after AFTER_ACTION actions.
  3270.     AFTER_ACTION_VARIABLE  = 17     # Change AFTER_ACTION by variable.
  3271.  
  3272.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3273.     # - Actor ATB Gauges -
  3274.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3275.     GAUGE_COLOR1 = 32
  3276.     GAUGE_COLOR2 = 31
  3277.     CHARGE_COLOR1 = 18
  3278.     CHARGE_COLOR2 = 10
  3279.     ATB_GAUGE_Y_PLUS = 12
  3280.     ATB_PHRASE = "ATB"
  3281.  
  3282.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3283.     # - Enemy ATB Gauges -
  3284.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3285.     SHOW_ENEMY_ATB_GAUGE    = true  # Display Enemy HP Gauge?
  3286.     ENEMY_GAUGE_WIDTH      = 128    # How wide the enemy gauges are.
  3287.     ENEMY_GAUGE_HEIGHT     = 12     # How tall the enemy gauges are.
  3288.     ENEMY_ATB_GAUGE_COLOUR1 = 1     # Colour 1 for ATB.
  3289.     ENEMY_ATB_GAUGE_COLOUR2 = 4     # Colour 2 for ATB.
  3290.     ENEMY_BACKGAUGE_COLOUR = 19     # Gauge Back colour.
  3291.  
  3292.   end
  3293. end
  3294.  
  3295. #==============================================================================
  3296. # ▼ Editting anything past this point may potentially result in causing
  3297. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  3298. # halitosis so edit at your own risk.
  3299. #==============================================================================
  3300.  
  3301. module YSA
  3302.   module REGEXP
  3303.   module USABLEITEM
  3304.  
  3305.     CHARGE_RATE = /<(?:CHARGE_RATE|charge rate):[ ](\d+)?([%%])>/i
  3306.  
  3307.   end # USABLEITEM
  3308.   end # REGEXP
  3309. end # YSA
  3310.  
  3311. #==============================================================================
  3312. # ■ DataManager
  3313. #==============================================================================
  3314.  
  3315. module DataManager
  3316.  
  3317.   #--------------------------------------------------------------------------
  3318.   # alias method: load_database
  3319.   #--------------------------------------------------------------------------
  3320.   class <<self; alias load_database_catb load_database; end
  3321.   def self.load_database
  3322.     load_database_catb
  3323.     load_notetags_catb
  3324.   end
  3325.  
  3326.   #--------------------------------------------------------------------------
  3327.   # new method: load_notetags_catb
  3328.   #--------------------------------------------------------------------------
  3329.   def self.load_notetags_catb
  3330.     groups = [$data_skills, $data_items]
  3331.     for group in groups
  3332.       for obj in group
  3333.         next if obj.nil?
  3334.         obj.load_notetags_catb
  3335.       end
  3336.     end
  3337.   end
  3338.  
  3339. end # DataManager
  3340.  
  3341. #==============================================================================
  3342. # ■ RPG::UsableItem
  3343. #==============================================================================
  3344.  
  3345. class RPG::UsableItem < RPG::BaseItem
  3346.  
  3347.   #--------------------------------------------------------------------------
  3348.   # public instance variables
  3349.   #--------------------------------------------------------------------------
  3350.   attr_accessor :charge_rate
  3351.   attr_accessor :charge_on
  3352.  
  3353.   #--------------------------------------------------------------------------
  3354.   # common cache: load_notetags_catb
  3355.   #--------------------------------------------------------------------------
  3356.   def load_notetags_catb
  3357.     @charge_rate = 100
  3358.     @charge_on = false
  3359.     #---
  3360.     self.note.split(/[\r\n]+/).each { |line|
  3361.       case line
  3362.       #---
  3363.       when YSA::REGEXP::USABLEITEM::CHARGE_RATE
  3364.         @charge_on = true
  3365.         @charge_rate = $1.to_i
  3366.       #---
  3367.       end
  3368.     } # self.note.split
  3369.     #---
  3370.     @charge_rate = 100 if @charge_rate <= 0
  3371.   end
  3372.  
  3373. end # RPG::UsableItem
  3374.  
  3375. #==============================================================================
  3376. # ■ BattleManager
  3377. #==============================================================================
  3378.  
  3379. module BattleManager
  3380.  
  3381.   #--------------------------------------------------------------------------
  3382.   # alias method:
  3383.   #     - make_action_orders
  3384.   #     - prior_command
  3385.   #     - next_command
  3386.   #     - in_turn?
  3387.   #     - battle_start
  3388.   #--------------------------------------------------------------------------
  3389.   class <<self
  3390.     alias catb_make_action_orders make_action_orders
  3391.     alias catb_prior_command prior_command
  3392.     alias catb_next_command next_command
  3393.     alias catb_in_turn? in_turn?
  3394.     alias catb_battle_start battle_start
  3395.   end
  3396.  
  3397.   #--------------------------------------------------------------------------
  3398.   # battle_start
  3399.   #--------------------------------------------------------------------------
  3400.   def self.battle_start
  3401.     catb_battle_start
  3402.     if btype?(:catb)
  3403.       @average_agi = 0
  3404.       make_catb_action_orders
  3405.       battler_hash = $game_party.members + $game_troop.members
  3406.       battler_hash.each { |a|
  3407.         if @preemptive
  3408.           a.make_first_catb_value(1)
  3409.         elsif @surprise
  3410.           a.make_first_catb_value(2)
  3411.         else
  3412.           a.make_first_catb_value(0)
  3413.         end
  3414.         @average_agi += a.agi
  3415.       }
  3416.       @average_agi /= battler_hash.size
  3417.     end
  3418.   end
  3419.  
  3420.   #--------------------------------------------------------------------------
  3421.   # next_command
  3422.   #--------------------------------------------------------------------------
  3423.   def self.next_command
  3424.     return false if btype?(:catb)
  3425.     catb_next_command
  3426.   end
  3427.  
  3428.   #--------------------------------------------------------------------------
  3429.   # alias method: in_turn?
  3430.   #--------------------------------------------------------------------------
  3431.   def self.in_turn?
  3432.     return true if btype?(:catb)
  3433.     return catb_in_turn?
  3434.   end
  3435.  
  3436.   #--------------------------------------------------------------------------
  3437.   # new method: make_catb_action_orders
  3438.   #--------------------------------------------------------------------------
  3439.   class <<self
  3440.   def make_catb_action_orders
  3441.     @action_actors = []
  3442.     @action_enemies = []
  3443.     @action_battlers = []
  3444.   end
  3445.   end
  3446.  
  3447.   #--------------------------------------------------------------------------
  3448.   # new method: average_agi
  3449.   #--------------------------------------------------------------------------
  3450.   class <<self
  3451.   def average_agi
  3452.     return @average_agi
  3453.   end
  3454.   end
  3455.  
  3456.   #--------------------------------------------------------------------------
  3457.   # new method: set_actor
  3458.   #--------------------------------------------------------------------------
  3459.   class <<self
  3460.   def set_actor(actor_index)
  3461.     @actor_index = actor_index
  3462.   end
  3463.   end
  3464.  
  3465.   #--------------------------------------------------------------------------
  3466.   # prior_command
  3467.   #--------------------------------------------------------------------------
  3468.   def self.prior_command
  3469.     return false if btype?(:catb)
  3470.     catb_prior_command
  3471.   end
  3472.  
  3473.   #--------------------------------------------------------------------------
  3474.   # new method: make_catb_action
  3475.   #--------------------------------------------------------------------------
  3476.   class <<self
  3477.   def make_catb_action(battler)
  3478.     make_catb_action_orders if !@action_battlers || !@action_actors || !@action_enemies
  3479.     return false if @action_battlers.include?(battler)
  3480.     @action_battlers.push(battler)
  3481.     @action_actors.push(battler) if battler.actor?
  3482.     @action_enemies.push(battler) if battler.enemy?
  3483.     return true
  3484.   end
  3485.   end
  3486.  
  3487.   #--------------------------------------------------------------------------
  3488.   # new method: delete_catb_action
  3489.   #--------------------------------------------------------------------------
  3490.   class <<self
  3491.   def delete_catb_action(battler)
  3492.     return false if !battler
  3493.     @action_battlers.delete(battler)
  3494.     @action_battlers = @action_battlers.compact
  3495.     @action_actors.delete(battler) if battler.actor?
  3496.     @action_actors = @action_actors.compact
  3497.     @action_enemies.delete(battler) if battler.enemy?
  3498.     @action_enemies = @action_enemies.compact
  3499.     return true
  3500.   end
  3501.   end
  3502.  
  3503.   #--------------------------------------------------------------------------
  3504.   # new method: action_list
  3505.   #--------------------------------------------------------------------------
  3506.   class <<self
  3507.   def action_list(type = :all)
  3508.     return @action_battlers if type == :all
  3509.     return @action_actors if type == :actor
  3510.     return @action_enemies if type = :enemy
  3511.   end
  3512.   end
  3513.  
  3514. end # BattleManager
  3515.  
  3516. #==============================================================================
  3517. # ■ Game_System
  3518. #==============================================================================
  3519.  
  3520. class Game_System
  3521.  
  3522.   #--------------------------------------------------------------------------
  3523.   # alias method: set_battle_system
  3524.   #--------------------------------------------------------------------------
  3525.   alias qatb_set_battle_system set_battle_system
  3526.   def set_battle_system(type)
  3527.     case type
  3528.     when :catb; @battle_system = :catb
  3529.     else;       qatb_set_battle_system(type)
  3530.     end
  3531.   end
  3532.  
  3533.   #--------------------------------------------------------------------------
  3534.   # alias method: battle_system_corrected
  3535.   #--------------------------------------------------------------------------
  3536.   alias qatb_battle_system_corrected battle_system_corrected
  3537.   def battle_system_corrected(type)
  3538.     case type
  3539.     when :catb; return :catb
  3540.     else;       return qatb_battle_system_corrected(type)
  3541.     end
  3542.   end
  3543.  
  3544.   #--------------------------------------------------------------------------
  3545.   # new method: catb_fill_time
  3546.   #--------------------------------------------------------------------------
  3547.   def catb_fill_time
  3548.     return $game_variables[YSA::CATB::FILL_TIME_VARIABLE] > 0 ? $game_variables[YSA::CATB::FILL_TIME_VARIABLE] : YSA::CATB::DEFAULT_FILL_TIME
  3549.   end
  3550.  
  3551.   #--------------------------------------------------------------------------
  3552.   # new method: catb_tick_count
  3553.   #--------------------------------------------------------------------------
  3554.   def catb_tick_count
  3555.     return $game_variables[YSA::CATB::TICK_COUNT_VARIABLE] > 0 ? $game_variables[YSA::CATB::TICK_COUNT_VARIABLE] : YSA::CATB::TICK_COUNT
  3556.   end
  3557.  
  3558.   #--------------------------------------------------------------------------
  3559.   # new method: catb_after_action
  3560.   #--------------------------------------------------------------------------
  3561.   def catb_after_action
  3562.     return $game_variables[YSA::CATB::AFTER_ACTION_VARIABLE] > 0 ? $game_variables[YSA::CATB::AFTER_ACTION_VARIABLE] : YSA::CATB::AFTER_ACTION
  3563.   end
  3564.  
  3565.   #--------------------------------------------------------------------------
  3566.   # new method: catb_turn_type
  3567.   #--------------------------------------------------------------------------
  3568.   def catb_turn_type
  3569.     return @catb_turn_type ? @catb_turn_type : YSA::CATB::DEFAULT_TURN
  3570.   end
  3571.  
  3572.   #--------------------------------------------------------------------------
  3573.   # new method: catb_wait_type
  3574.   #--------------------------------------------------------------------------
  3575.   def catb_wait_type
  3576.     return @catb_wait_type ? @catb_wait_type : YSA::CATB::DEFAULT_WAIT
  3577.   end
  3578.  
  3579.   #--------------------------------------------------------------------------
  3580.   # new method: set_catb_wait_type
  3581.   #--------------------------------------------------------------------------
  3582.   def set_catb_wait_type(type = :full)
  3583.     @catb_wait_type = type
  3584.   end
  3585.  
  3586.   #--------------------------------------------------------------------------
  3587.   # new method: set_catb_turn_type
  3588.   #--------------------------------------------------------------------------
  3589.   def set_catb_turn_type(type = :tick)
  3590.     @catb_turn_type = type
  3591.   end
  3592.  
  3593. end # Game_System
  3594.  
  3595. #==============================================================================
  3596. # ■ Game_Battler
  3597. #==============================================================================
  3598.  
  3599. class Game_Battler < Game_BattlerBase
  3600.  
  3601.   MAX_CATB_VALUE = 100000.0
  3602.  
  3603.   #--------------------------------------------------------------------------
  3604.   # alias method: initialize
  3605.   #--------------------------------------------------------------------------
  3606.   alias catb_initialize initialize
  3607.   def initialize
  3608.     catb_initialize
  3609.     @catb_value = 0
  3610.     @ct_catb_value = 0
  3611.   end
  3612.  
  3613.   #--------------------------------------------------------------------------
  3614.   # new method: base_gain_catb
  3615.   #--------------------------------------------------------------------------
  3616.   def base_gain_catb
  3617.     return MAX_CATB_VALUE / $game_system.catb_fill_time
  3618.   end
  3619.  
  3620.   #--------------------------------------------------------------------------
  3621.   # new method: real_gain_catb
  3622.   #--------------------------------------------------------------------------
  3623.   def real_gain_catb
  3624.     value = (self.agi.to_f / BattleManager.average_agi) * base_gain_catb
  3625.     return value
  3626.   end
  3627.  
  3628.   #--------------------------------------------------------------------------
  3629.   # new method: make_catb_update
  3630.   #--------------------------------------------------------------------------
  3631.   def make_catb_update
  3632.     return if @catb_value >= MAX_CATB_VALUE
  3633.     return if not normal?
  3634.     value = $imported["YSA-LunaticCATBRate"] ? lunatic_catb_rate_formula : real_gain_catb
  3635.     @catb_value += [value, MAX_CATB_VALUE - @catb_value].min
  3636.   end
  3637.  
  3638.   #--------------------------------------------------------------------------
  3639.   # new method: make_catb_action
  3640.   #--------------------------------------------------------------------------
  3641.   def make_catb_action
  3642.     return unless @catb_value >= MAX_CATB_VALUE
  3643.     return clear_catb if not normal?
  3644.     return BattleManager.make_catb_action(self)
  3645.   end
  3646.  
  3647.   #--------------------------------------------------------------------------
  3648.   # new method: make_ct_catb_update
  3649.   #--------------------------------------------------------------------------
  3650.   def make_ct_catb_update
  3651.     return if @catb_value < MAX_CATB_VALUE
  3652.     return if @ct_catb_value >= MAX_CATB_VALUE
  3653.     return if !self.current_action
  3654.     return if !self.current_action.item
  3655.     return if self.actor? && !self.current_action.confirm
  3656.     clear_catb if not normal?
  3657.     @ct_catb_value = MAX_CATB_VALUE if !self.current_action.item.charge_on
  3658.     value = $imported["YSA-LunaticCATBRate"] ? lunatic_catb_rate_formula : real_gain_catb
  3659.     @ct_catb_value += [value * self.current_action.item.charge_rate / 100, MAX_CATB_VALUE - @ct_catb_value].min
  3660.   end
  3661.  
  3662.   #--------------------------------------------------------------------------
  3663.   # new method: charge_skill_done?
  3664.   #--------------------------------------------------------------------------
  3665.   def charge_skill_done?
  3666.     return @catb_value >= MAX_CATB_VALUE && @ct_catb_value >= MAX_CATB_VALUE
  3667.   end
  3668.  
  3669.   #--------------------------------------------------------------------------
  3670.   # new method: clear_catb
  3671.   #--------------------------------------------------------------------------
  3672.   def clear_catb
  3673.     make_actions
  3674.     @catb_value = 0
  3675.     @ct_catb_value = 0
  3676.     BattleManager.clear_actor if self.actor? && BattleManager.actor == self
  3677.     BattleManager.delete_catb_action(self)
  3678.   end
  3679.  
  3680.   #--------------------------------------------------------------------------
  3681.   # new method: make_first_catb_value
  3682.   #--------------------------------------------------------------------------
  3683.   def make_first_catb_value(pre = 0)
  3684.     make_actions
  3685.     @catb_value = 0
  3686.     @catb_value = YSA::CATB::PREEMTIVE_ATB_ACTOR if self.actor? && pre == 1
  3687.     @catb_value = YSA::CATB::PREEMTIVE_ATB_ENEMY if self.enemy? && pre == 1
  3688.     @catb_value = YSA::CATB::SURPRISE_ATB_ACTOR if self.actor? && pre == 2
  3689.     @catb_value = YSA::CATB::SURPRISE_ATB_ENEMY if self.enemy? && pre == 2
  3690.     lunatic_catb_start_formula(pre) if $imported["YSA-LunaticCATBStart"]
  3691.   end
  3692.  
  3693.   #--------------------------------------------------------------------------
  3694.   # new method: catb_filled_rate
  3695.   #--------------------------------------------------------------------------
  3696.   def catb_filled_rate
  3697.     return @catb_value / MAX_CATB_VALUE
  3698.   end
  3699.  
  3700.   #--------------------------------------------------------------------------
  3701.   # new method: catb_ct_filled_rate
  3702.   #--------------------------------------------------------------------------
  3703.   def catb_ct_filled_rate
  3704.     return @catb_value < MAX_CATB_VALUE ? 0 : @ct_catb_value / MAX_CATB_VALUE
  3705.   end
  3706.  
  3707. end # Game_Battler
  3708.  
  3709. #==============================================================================
  3710. # ■ Game_Action
  3711. #==============================================================================
  3712.  
  3713. class Game_Action
  3714.  
  3715.   #--------------------------------------------------------------------------
  3716.   # alias method: clear
  3717.   #--------------------------------------------------------------------------
  3718.   alias catb_clear clear
  3719.   def clear
  3720.     catb_clear
  3721.     @confirm = false
  3722.   end
  3723.  
  3724.   #--------------------------------------------------------------------------
  3725.   # new method: confirm=
  3726.   #--------------------------------------------------------------------------
  3727.   def confirm=(con)
  3728.     @confirm = con
  3729.   end
  3730.  
  3731.   #--------------------------------------------------------------------------
  3732.   # new method: confirm
  3733.   #--------------------------------------------------------------------------
  3734.   def confirm
  3735.     return @subject.auto_battle? ? true : @confirm
  3736.   end
  3737.  
  3738. end # Game_Action
  3739.  
  3740. #==============================================================================
  3741. # ■ Window_Base
  3742. #==============================================================================
  3743.  
  3744. class Window_Base < Window
  3745.   #--------------------------------------------------------------------------
  3746.   # catb_gauge_color
  3747.   #--------------------------------------------------------------------------
  3748.   def catb_color1;      text_color(YSA::CATB::GAUGE_COLOR1);      end;
  3749.   def catb_color2;      text_color(YSA::CATB::GAUGE_COLOR2);      end;
  3750.   def charge_color1;      text_color(YSA::CATB::CHARGE_COLOR1);      end;
  3751.   def charge_color2;      text_color(YSA::CATB::CHARGE_COLOR2);      end;
  3752. end # Window_Base
  3753.  
  3754. #==============================================================================
  3755. # ■ Window_BattleStatus
  3756. #==============================================================================
  3757.  
  3758. class Window_BattleStatus < Window_Selectable
  3759.  
  3760.   #--------------------------------------------------------------------------
  3761.   # alias method: draw_item
  3762.   #--------------------------------------------------------------------------
  3763.   alias catb_draw_item draw_item
  3764.   def draw_item(index)
  3765.     catb_draw_item(index)
  3766.     actor = battle_members[index]
  3767.     rect = item_rect(index)
  3768.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS + YSA::CATB::ATB_GAUGE_Y_PLUS
  3769.     return unless BattleManager.btype?(:catb)
  3770.     draw_actor_catb(actor, rect.x+2, line_height*1+gx, rect.width-4)
  3771.   end
  3772.  
  3773.   #--------------------------------------------------------------------------
  3774.   # new method: draw_actor_catb
  3775.   #--------------------------------------------------------------------------
  3776.   def draw_actor_catb(actor, dx, dy, width = 124)
  3777.     draw_gauge(dx, dy, width, actor.catb_filled_rate, catb_color1, catb_color2)
  3778.     if actor.catb_ct_filled_rate > 0
  3779.       draw_gauge(dx, dy, width, actor.catb_ct_filled_rate, charge_color1, charge_color2)
  3780.     end
  3781.     change_color(system_color)
  3782.     cy = (Font.default_size - contents.font.size) / 2 + 1
  3783.     draw_text(dx+2, dy+cy, 30, line_height, YSA::CATB::ATB_PHRASE)
  3784.   end
  3785.  
  3786.   #--------------------------------------------------------------------------
  3787.   # new method: draw_item_actor_catb
  3788.   #--------------------------------------------------------------------------
  3789.   def draw_item_actor_catb(index)
  3790.     return if index.nil?
  3791.     actor = battle_members[index]
  3792.     rect = item_rect(index)
  3793.     return if actor.nil?
  3794.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS + YSA::CATB::ATB_GAUGE_Y_PLUS
  3795.     draw_actor_catb(actor, rect.x+2, line_height*1+gx, rect.width-4)
  3796.   end
  3797.  
  3798.   #--------------------------------------------------------------------------
  3799.   # new method: refresh_catb
  3800.   #--------------------------------------------------------------------------
  3801.   def refresh_catb
  3802.     return unless BattleManager.btype?(:catb)
  3803.     item_max.times {|i| draw_item_actor_catb(i) }
  3804.   end
  3805.  
  3806. end # Window_BattleStatus
  3807.  
  3808. #==============================================================================
  3809. # ■ Sprite_Battler
  3810. #==============================================================================
  3811.  
  3812. class Sprite_Battler < Sprite_Base
  3813.  
  3814.   #--------------------------------------------------------------------------
  3815.   # alias method: initialize
  3816.   #--------------------------------------------------------------------------
  3817.   alias sprite_battler_initialize_catb initialize
  3818.   def initialize(viewport, battler = nil)
  3819.     sprite_battler_initialize_catb(viewport, battler)
  3820.     create_enemy_gauges_catb
  3821.   end
  3822.  
  3823.   #--------------------------------------------------------------------------
  3824.   # alias method: dispose
  3825.   #--------------------------------------------------------------------------
  3826.   alias sprite_battler_dispose_catb dispose
  3827.   def dispose
  3828.     sprite_battler_dispose_catb
  3829.     dispose_enemy_gauges_catb
  3830.   end
  3831.  
  3832.   #--------------------------------------------------------------------------
  3833.   # alias method: update
  3834.   #--------------------------------------------------------------------------
  3835.   alias sprite_battler_update_catb update
  3836.   def update
  3837.     sprite_battler_update_catb
  3838.     update_enemy_gauges_catb
  3839.   end
  3840.  
  3841.   #--------------------------------------------------------------------------
  3842.   # new method: create_enemy_gauges_catb
  3843.   #--------------------------------------------------------------------------
  3844.   def create_enemy_gauges_catb
  3845.     return if @battler.nil?
  3846.     return if @battler.actor?
  3847.     return unless BattleManager.btype?(:catb)
  3848.     @catb_back_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :back)
  3849.     @catb_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :catb)
  3850.     @catb_ct_gauge_viewport = Enemy_CATB_Gauge_Viewport.new(@battler, self, :catbct)
  3851.   end
  3852.  
  3853.   #--------------------------------------------------------------------------
  3854.   # new method: dispose_enemy_gauges_catb
  3855.   #--------------------------------------------------------------------------
  3856.   def dispose_enemy_gauges_catb
  3857.     return unless BattleManager.btype?(:catb)
  3858.     @catb_back_gauge_viewport.dispose unless @catb_back_gauge_viewport.nil?
  3859.     @catb_gauge_viewport.dispose unless @catb_gauge_viewport.nil?
  3860.     @catb_ct_gauge_viewport.dispose unless @catb_ct_gauge_viewport.nil?
  3861.   end
  3862.  
  3863.   #--------------------------------------------------------------------------
  3864.   # new method: update_enemy_gauges_catb
  3865.   #--------------------------------------------------------------------------
  3866.   def update_enemy_gauges_catb
  3867.     return unless BattleManager.btype?(:catb)
  3868.     @catb_back_gauge_viewport.update unless @catb_back_gauge_viewport.nil?
  3869.     @catb_gauge_viewport.update unless @catb_gauge_viewport.nil?
  3870.     @catb_ct_gauge_viewport.update unless @catb_ct_gauge_viewport.nil?
  3871.   end
  3872.  
  3873. end # Sprite_Battler
  3874.  
  3875. #==============================================================================
  3876. # ■ Enemy_CATB_Gauge_Viewport
  3877. #==============================================================================
  3878.  
  3879. class Enemy_CATB_Gauge_Viewport < Viewport
  3880.  
  3881.   #--------------------------------------------------------------------------
  3882.   # initialize
  3883.   #--------------------------------------------------------------------------
  3884.   def initialize(battler, sprite, type)
  3885.     @battler = battler
  3886.     @base_sprite = sprite
  3887.     @type = type
  3888.     dw = YSA::CATB::ENEMY_GAUGE_WIDTH
  3889.     dw += 2 if @type == :back
  3890.     @start_width = dw
  3891.     dh = YSA::CATB::ENEMY_GAUGE_HEIGHT
  3892.     dh += 2 if @type == :back
  3893.     rect = Rect.new(0, 0, dw, dh)
  3894.     super(rect)
  3895.     self.z = 125
  3896.     create_gauge_sprites
  3897.     self.visible = false
  3898.     update_position
  3899.   end
  3900.  
  3901.   #--------------------------------------------------------------------------
  3902.   # dispose
  3903.   #--------------------------------------------------------------------------
  3904.   def dispose
  3905.     @sprite.bitmap.dispose unless @sprite.bitmap.nil?
  3906.     @sprite.dispose
  3907.     super
  3908.   end
  3909.  
  3910.   #--------------------------------------------------------------------------
  3911.   # update
  3912.   #--------------------------------------------------------------------------
  3913.   def update
  3914.     super
  3915.     self.visible = @battler.dead? ? false : YSA::CATB::SHOW_ENEMY_ATB_GAUGE
  3916.     update_position
  3917.     update_gauge
  3918.   end
  3919.  
  3920.   #--------------------------------------------------------------------------
  3921.   # create_gauge_sprites
  3922.   #--------------------------------------------------------------------------
  3923.   def create_gauge_sprites
  3924.     @sprite = Plane.new(self)
  3925.     dw = self.rect.width * 2
  3926.     @sprite.bitmap = Bitmap.new(dw, self.rect.height)
  3927.     case @type
  3928.     when :back
  3929.       colour1 = Colour.text_colour(YSA::CATB::ENEMY_BACKGAUGE_COLOUR)
  3930.       colour2 = Colour.text_colour(YSA::CATB::ENEMY_BACKGAUGE_COLOUR)
  3931.     when :catb
  3932.       colour1 = Colour.text_colour(YSA::CATB::ENEMY_ATB_GAUGE_COLOUR1)
  3933.       colour2 = Colour.text_colour(YSA::CATB::ENEMY_ATB_GAUGE_COLOUR2)
  3934.     when :catbct
  3935.       colour1 = Colour.text_colour(YSA::CATB::CHARGE_COLOR1)
  3936.       colour2 = Colour.text_colour(YSA::CATB::CHARGE_COLOR2)
  3937.     end
  3938.     dx = 0
  3939.     dy = 0
  3940.     dw = self.rect.width
  3941.     dh = self.rect.height
  3942.     self.rect.width = target_gauge_width unless @type == :back
  3943.     @gauge_width = target_gauge_width
  3944.     @sprite.bitmap.gradient_fill_rect(dx, dy, dw, dh, colour1, colour2)
  3945.     @sprite.bitmap.gradient_fill_rect(dw, dy, dw, dh, colour2, colour1)
  3946.   end
  3947.  
  3948.   #--------------------------------------------------------------------------
  3949.   # update_position
  3950.   #--------------------------------------------------------------------------
  3951.   def update_position
  3952.     dx = @battler.screen_x - @start_width / 2
  3953.     self.rect.x = dx
  3954.     dh = self.rect.height + 1
  3955.     dh += 2 unless @type == :back
  3956.     dy = [@battler.screen_y, Graphics.height - dh - 120].min
  3957.     dy += 1 unless @type == :back
  3958.     dy -= YEA::BATTLE::ENEMY_GAUGE_HEIGHT if $imported["YEA-EnemyHPBars"]
  3959.     self.rect.y = dy
  3960.   end
  3961.  
  3962.   #--------------------------------------------------------------------------
  3963.   # update_gauge
  3964.   #--------------------------------------------------------------------------
  3965.   def update_gauge
  3966.     return if @gauge_width == target_gauge_width
  3967.     @gauge_width = target_gauge_width if @type == :catb
  3968.     @gauge_width = target_gauge_width_ct if @type == :catbct
  3969.     return if @type == :back
  3970.     self.rect.width = @gauge_width
  3971.   end
  3972.  
  3973.   #--------------------------------------------------------------------------
  3974.   # target_gauge_width
  3975.   #--------------------------------------------------------------------------
  3976.   def target_gauge_width
  3977.     return @battler.catb_filled_rate * @start_width
  3978.   end
  3979.  
  3980.   #--------------------------------------------------------------------------
  3981.   # target_gauge_width_ct
  3982.   #--------------------------------------------------------------------------
  3983.   def target_gauge_width_ct
  3984.     return @battler.catb_ct_filled_rate * @start_width
  3985.   end
  3986.  
  3987. end # Enemy_CATB_Gauge_Viewport
  3988.  
  3989. #==============================================================================
  3990. # ■ Window_BattleEnemy
  3991. #==============================================================================
  3992.  
  3993. class Window_BattleEnemy < Window_Selectable
  3994.  
  3995.   #--------------------------------------------------------------------------
  3996.   # alias method: col_max
  3997.   #--------------------------------------------------------------------------
  3998.   alias catb_col_max col_max
  3999.   def col_max; return catb_col_max == 0 ? 1 : catb_col_max; end
  4000.  
  4001. end # Window_BattleEnemy
  4002.  
  4003. #==============================================================================
  4004. # ■ Scene_Battle
  4005. #==============================================================================
  4006.  
  4007. class Scene_Battle < Scene_Base
  4008.  
  4009.   #--------------------------------------------------------------------------
  4010.   # alias method: process_action
  4011.   #--------------------------------------------------------------------------
  4012.   alias catb_process_action process_action
  4013.   def process_action
  4014.     process_catb
  4015.     perform_catb_action(@subject, true) if BattleManager.action_forced?
  4016.     catb_process_action unless BattleManager.btype?(:catb)
  4017.   end
  4018.  
  4019.   #--------------------------------------------------------------------------
  4020.   # new method: catb_pause?
  4021.   #--------------------------------------------------------------------------
  4022.   def catb_pause?
  4023.     return YSA::CATB::PAUSE_WHEN_ACTIVE_PARTY_COMMAND if @party_command_window.active
  4024.     return false if $game_system.catb_wait_type == :full
  4025.     return true if $game_system.catb_wait_type == :wait && (@actor_command_window.active || @skill_window.active || @item_window.active || @actor_window.active || @enemy_window.active)
  4026.     return true if $game_system.catb_wait_type == :quarter && (@skill_window.active || @item_window.active || @actor_window.active || @enemy_window.active)
  4027.     return true if $game_system.catb_wait_type == :semi && (@actor_window.active || @enemy_window.active)
  4028.   end
  4029.  
  4030.   #--------------------------------------------------------------------------
  4031.   # new method: process_catb
  4032.   #--------------------------------------------------------------------------
  4033.   def process_catb
  4034.     return unless SceneManager.scene_is?(Scene_Battle)
  4035.     return if scene_changing?
  4036.     return unless BattleManager.btype?(:catb)
  4037.     return if catb_pause?
  4038.     battler_hash = $game_party.members + $game_troop.members
  4039.     battler_hash.each { |a|
  4040.       a.make_catb_update
  4041.       a.make_catb_action
  4042.       a.make_ct_catb_update
  4043.     }
  4044.     #--- Update Tick Turn
  4045.     if $game_system.catb_turn_type == :tick
  4046.       @tick_clock = 0 if !@tick_clock
  4047.       @tick_clock += 1
  4048.       if @tick_clock >= $game_system.catb_tick_count
  4049.         @tick_clock = 0
  4050.         all_battle_members.each { |battler|
  4051.           battler.on_turn_end
  4052.         }
  4053.         @status_window.refresh
  4054.         $game_troop.increase_turn
  4055.       end
  4056.     end
  4057.     #--- Fix make action
  4058.     BattleManager.action_list(:actor).each { |battler|
  4059.       battler.make_actions if (battler.actor? && !battler.input)
  4060.     }
  4061.     #---
  4062.     @status_window.refresh_catb
  4063.     #--- Setup Actor
  4064.     @f_actor_index = 0 if !@f_actor_index || @f_actor_index < 0 || @f_actor_index + 1 > BattleManager.action_list(:actor).size
  4065.     f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  4066.     @f_actor_index += 1 if (@f_actor_index + 1) < BattleManager.action_list(:actor).size && f_actor && f_actor.input && f_actor.input.item && f_actor.input.confirm
  4067.     f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  4068.     if f_actor && f_actor.input && !f_actor.input.item && (!BattleManager.actor || @status_window.index != BattleManager.actor.index)
  4069.       BattleManager.set_actor(f_actor.index)
  4070.       @status_window.select(BattleManager.actor.index)
  4071.       @actor_command_window.setup(BattleManager.actor)
  4072.     end
  4073.     BattleManager.action_list.each { |battler|
  4074.       battler.make_actions if battler.enemy?
  4075.       perform_catb_action(battler) if !@subject
  4076.     }
  4077.   end
  4078.  
  4079.   #--------------------------------------------------------------------------
  4080.   # new method: perform_catb_action
  4081.   #--------------------------------------------------------------------------
  4082.   def perform_catb_action(subject, forced = false)
  4083.     return if subject && !subject.charge_skill_done?
  4084.     return if subject && subject.actor? && !forced && !subject.input
  4085.     return if subject && subject.actor? && !forced && !subject.input.item
  4086.     return if subject && subject.actor? && !forced && !subject.input.confirm
  4087.     @subject = subject if subject
  4088.     return if !@subject
  4089.     if @subject.current_action
  4090.       @subject.current_action.prepare
  4091.       execute_action
  4092.       process_event
  4093.       @status_aid_window.refresh if @status_aid_window.visible
  4094.       if $game_system.catb_turn_type == :action
  4095.         @tick_action = 0 if !@tick_action
  4096.         @tick_action += 1
  4097.         if @tick_action >= $game_system.catb_after_action
  4098.           @tick_action = 0
  4099.           all_battle_members.each { |battler|
  4100.             battler.on_turn_end
  4101.           }
  4102.           @status_window.refresh
  4103.           $game_troop.increase_turn
  4104.         end
  4105.       end
  4106.       @subject.on_action_end
  4107.     end
  4108.     return if BattleManager.judge_win_loss
  4109.     @subject.clear_catb
  4110.     @status_window.draw_item(@subject.index) if @subject.actor?
  4111.     @subject = nil
  4112.   end
  4113.  
  4114.   #--------------------------------------------------------------------------
  4115.   # alias method: create_actor_command_window
  4116.   #--------------------------------------------------------------------------
  4117.   alias catb_create_actor_command_window create_actor_command_window
  4118.   def create_actor_command_window
  4119.     catb_create_actor_command_window
  4120.     if BattleManager.btype?(:catb)
  4121.       @actor_command_window.set_handler(:dir4, method(:prior_f_actor))
  4122.       @actor_command_window.set_handler(:dir6, method(:next_f_actor))
  4123.     end
  4124.   end
  4125.  
  4126.   #--------------------------------------------------------------------------
  4127.   # new method: prior_f_actor
  4128.   #--------------------------------------------------------------------------
  4129.   def prior_f_actor
  4130.     if @f_actor_index && BattleManager.action_list(:actor).size > 0
  4131.       @f_actor_index -= 1
  4132.       @f_actor_index = 0 if @f_actor_index < 0
  4133.       f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  4134.       if f_actor
  4135.         BattleManager.set_actor(f_actor.index)
  4136.         @status_window.select(BattleManager.actor.index)
  4137.         @actor_command_window.setup(BattleManager.actor)
  4138.       end
  4139.     end
  4140.   end
  4141.  
  4142.   #--------------------------------------------------------------------------
  4143.   # new method: next_f_actor
  4144.   #--------------------------------------------------------------------------
  4145.   def next_f_actor
  4146.     if @f_actor_index && BattleManager.action_list(:actor).size > 0
  4147.       @f_actor_index += 1
  4148.       @f_actor_index = 0 if (@f_actor_index + 1) > BattleManager.action_list(:actor).size
  4149.       f_actor = BattleManager.action_list(:actor)[@f_actor_index]
  4150.       if f_actor
  4151.         BattleManager.set_actor(f_actor.index)
  4152.         @status_window.select(BattleManager.actor.index)
  4153.         @actor_command_window.setup(BattleManager.actor)
  4154.       end
  4155.     end
  4156.   end
  4157.  
  4158.   #--------------------------------------------------------------------------
  4159.   # alias method: turn_start
  4160.   #--------------------------------------------------------------------------
  4161.   alias catb_turn_start turn_start
  4162.   def turn_start
  4163.     if BattleManager.btype?(:catb)
  4164.       @party_command_window.close
  4165.       @actor_command_window.close
  4166.       @status_window.unselect
  4167.       @log_window.wait
  4168.       @log_window.clear
  4169.     else
  4170.       catb_turn_start
  4171.     end
  4172.   end
  4173.  
  4174.   #--------------------------------------------------------------------------
  4175.   # alias method: command_guard
  4176.   #--------------------------------------------------------------------------
  4177.   alias catb_command_guard command_guard
  4178.   def command_guard
  4179.     BattleManager.actor.input.confirm = true
  4180.     catb_command_guard
  4181.     @status_window.draw_item(BattleManager.actor.index)
  4182.   end
  4183.  
  4184.   #--------------------------------------------------------------------------
  4185.   # alias method: command_attack
  4186.   #--------------------------------------------------------------------------
  4187.   alias catb_command_attack command_attack
  4188.   def command_attack
  4189.     catb_command_attack
  4190.     @status_window.draw_item(BattleManager.actor.index)
  4191.   end
  4192.  
  4193.   #--------------------------------------------------------------------------
  4194.   # alias method: on_enemy_ok
  4195.   #--------------------------------------------------------------------------
  4196.   alias catb_on_enemy_ok on_enemy_ok
  4197.   def on_enemy_ok
  4198.     BattleManager.actor.input.confirm = true
  4199.     catb_on_enemy_ok
  4200.   end
  4201.  
  4202.   #--------------------------------------------------------------------------
  4203.   # alias method: on_enemy_cancel
  4204.   #--------------------------------------------------------------------------
  4205.   alias catb_on_enemy_cancel on_enemy_cancel
  4206.   def on_enemy_cancel
  4207.     BattleManager.actor.input.confirm = false
  4208.     catb_on_enemy_cancel
  4209.     @status_window.draw_item(BattleManager.actor.index)
  4210.   end
  4211.  
  4212.   #--------------------------------------------------------------------------
  4213.   # alias method: on_actor_ok
  4214.   #--------------------------------------------------------------------------
  4215.   alias catb_on_actor_ok on_actor_ok
  4216.   def on_actor_ok
  4217.     BattleManager.actor.input.confirm = true
  4218.     catb_on_actor_ok
  4219.   end
  4220.  
  4221.   #--------------------------------------------------------------------------
  4222.   # alias method: on_actor_cancel
  4223.   #--------------------------------------------------------------------------
  4224.   alias catb_on_actor_cancel on_actor_cancel
  4225.   def on_actor_cancel
  4226.     BattleManager.actor.input.confirm = false
  4227.     catb_on_actor_cancel
  4228.     @status_window.draw_item(BattleManager.actor.index)
  4229.   end
  4230.  
  4231.   #--------------------------------------------------------------------------
  4232.   # alias method: on_skill_ok
  4233.   #--------------------------------------------------------------------------
  4234.   alias catb_on_skill_ok on_skill_ok
  4235.   def on_skill_ok
  4236.     catb_on_skill_ok
  4237.     @status_window.draw_item(BattleManager.actor.index)
  4238.   end
  4239.  
  4240.   #--------------------------------------------------------------------------
  4241.   # alias method: on_item_ok
  4242.   #--------------------------------------------------------------------------
  4243.   alias catb_on_item_ok on_item_ok
  4244.   def on_item_ok
  4245.     catb_on_item_ok
  4246.     @status_window.draw_item(BattleManager.actor.index)
  4247.   end
  4248.  
  4249.   #--------------------------------------------------------------------------
  4250.   # alias method: update_info_viewport
  4251.   #--------------------------------------------------------------------------
  4252.   alias catb_update_info_viewport update_info_viewport
  4253.   def update_info_viewport
  4254.     catb_update_info_viewport
  4255.     if BattleManager.btype?(:catb)
  4256.       move_info_viewport(128) if @actor_command_window.active || @actor_window.active || @enemy_window.active || (($game_troop.all_dead? || $game_party.all_dead?)&& @bug_fix1)
  4257.       move_info_viewport(0)   if @party_command_window.active
  4258.     end
  4259.   end
  4260.  
  4261.   #--------------------------------------------------------------------------
  4262.   # rewrite method: perform_collapse_check
  4263.   #--------------------------------------------------------------------------
  4264.   def perform_collapse_check(target)
  4265.     return if YEA::BATTLE::MSG_ADDED_STATES
  4266.     if $game_troop.all_dead? || $game_party.all_dead?
  4267.       if @actor_window.active || @enemy_window.active
  4268.         @bug_fix1 = true
  4269.         @help_window.hide
  4270.         @actor_window.hide.deactivate
  4271.         @enemy_window.hide.deactivate
  4272.       end
  4273.     end
  4274.     target.perform_collapse_effect if target.can_collapse?
  4275.     @log_window.wait
  4276.   end
  4277.  
  4278. end # Scene_Battle
  4279. module YEA
  4280.   module BATTLE
  4281.     DEFAULT_BATTLE_SYSTEM = :catb
  4282.   end
  4283. end
  4284. #==============================================================================
  4285. #
  4286. # ▼ End of File
  4287. #
  4288. #==============================================================================
   
作者: dongdongdjh    时间: 2013-11-19 15:59
dongdongdjh 发表于 2013-11-16 13:57
最后次回复
我抬杠 呵呵 群里有人想要个这种效果的脚本,但是我们都是些水平不高的爱好者聚在一个群,没 ...

想想还是要的,不然之前的努力就白费了,如果能做到武器攻击类似 龙与地下城 2D3 4D2攻击的脚本就更好了,谢谢。
关于交流,实属无奈,如果求随机攻击脚本,必然会让去参考已有的随机属性脚本,如果说不要这个脚本,既然不要,那还来干嘛,真无法三言两语表达清。
作者: a000b1745    时间: 2013-11-19 21:03
S大~ 不好意思又麻煩你一下了。
(順帶一提~上次的隨機商品用的非常淋漓盡致 ^_^)

這次想訂製一個類似上次隨機商品的,但這次需求是隨機送東西的。
也就是說當我碰觸"聖誕老頭","聖誕老頭"會送我隨機道具,當然也是有道具範圍的。
譬如:
腳本設定 :B => [i20_40,a5_15]
"聖誕老頭"的事件裡面腳本寫上 - random_gift(:B, 3)
那麼聖誕老頭就會給我 道具20~40號, 裝備5~15號的其中三個物品^^!!

這裡有個需要注意的,這三個道具是可以重複的~
(也就是說有可能拿到 1蘋果1柳丁1香蕉 或是 3個蘋果...如果有開關控制能否重複更好囉)

-----------
其實可以用事件解決的...但是有80個物品要隨機送出...有點頭疼。

作者: Sion    时间: 2013-11-19 22:23
本帖最后由 Sion 于 2013-11-19 22:36 编辑
dongdongdjh 发表于 2013-11-19 15:59
想想还是要的,不然之前的努力就白费了,如果能做到武器攻击类似 龙与地下城 2D3 4D2攻击的脚本就更好了 ...


获取武器时随机增加0~9点攻击力。那个伤害掷骰子的功能跟这个脚本关系不大,要通过修改伤害公式实现。

RUBY 代码复制
  1. class Game_Party
  2.   # 覆盖方法
  3.   alias_method :gain_item_20131119, :gain_item
  4.   def gain_item(item, amount, include_equip = false)
  5.     if item.class != RPG::Weapon
  6.       gain_item_20131119(item, amount, include_equip)
  7.     else #处理武器
  8.       if amount > 0 # 获得武器
  9.         weapon = item
  10.         amount.times {
  11.           #如果不是武器副本则创建武器副本
  12.           item = weapon.create_new unless weapon.cloned
  13.           @weapons.push(item)
  14.         }
  15.       else # 失去武器
  16.         amount *= -1
  17.         amount.times {
  18.           if item.cloned
  19.             @weapons.delete(item)
  20.             amount -= 1
  21.           else
  22.             @weapons.each_with_index {|w, i|
  23.               if item.id == w.id
  24.                 @weapons.delete_at(i)
  25.                 amount -= 1
  26.                 break
  27.               end
  28.             }
  29.           end
  30.         }
  31.       end
  32.       if include_equip && amount > 0 #失去物品包含已装备的
  33.         discard_members_equip(item, amount)
  34.       end
  35.       $game_map.need_refresh = true
  36.     end
  37.   end
  38.  
  39.  
  40.   # 覆盖方法
  41.   def init_all_items
  42.     @items = {}
  43.     @weapons = []
  44.     @armors = {}
  45.   end
  46.   # 覆盖方法
  47.   def weapons
  48.     @weapons
  49.   end
  50.   # 覆盖方法
  51.   alias_method :item_number_20131119, :item_number
  52.   def item_number(item)
  53.     item.class == RPG::Weapon ? 1 : item_number_20131119(item)
  54.   end
  55. end
  56.  
  57. class RPG::Weapon
  58.   attr_accessor :cloned
  59.   def create_new
  60.     weapon = Marshal.load(Marshal.dump(self)) #创建武器副本 Deep clone.
  61.     weapon.cloned = true
  62.     weapon.params[2] += rand(10) #武器攻击随机增加 0~9
  63.     return weapon
  64.   end
  65. end
  66.  
  67. class Game_BaseItem
  68.   # 覆盖方法
  69.   def object
  70.     return $data_skills[@item_id]  if is_skill?
  71.     return $data_items[@item_id]   if is_item?
  72.     return @item                   if is_weapon?
  73.     return $data_armors[@item_id]  if is_armor?
  74.     return nil
  75.   end
  76.   # 覆盖方法
  77.   def object=(item)
  78.     @class = item ? item.class : nil
  79.     @item_id = item ? item.id : 0
  80.     @item = item if is_weapon?
  81.   end
  82.   # 覆盖方法
  83.   def set_equip(is_weapon, item_id) #用于初始化装备时获取随机攻击力武器
  84.     if is_weapon
  85.       @class = RPG::Weapon
  86.       @item  = $data_weapons[item_id].create_new
  87.     else
  88.       @class = RPG::Armor
  89.     end
  90.     @item_id = item_id
  91.   end
  92. end


老实说我觉得看别人的脚本很难学到什么,因为每个人的思维习惯不一样。
而且这个脚本很纠结,我也是是临时看过之后来改,要慢慢去读默认脚本怎么处理武器的,同时还需要查阅 Ace 内置的数据结构。
所以我在制作游戏的时候就只用利用默认的地图与事件功能,这两个我慢慢看完了,改起来也方便。其它的自己设计,阅读别人的脚本真的很蛋疼。
入门的话建议从场景学起,然后学习精灵的使用。
作者: 卡奥尼特    时间: 2013-11-20 01:52
本帖最后由 卡奥尼特 于 2013-11-20 02:33 编辑

能给我定制一个脚本吗?这个脚本很简单
就是实现物理反弹(和物理反击不一样,与魔法反射类似,但要物理版本的)的一个简单脚本

如果可以的话  (43楼的脚本代码未免也太长了。。。)
作者: 卡奥尼特    时间: 2013-11-20 01:58
本帖最后由 卡奥尼特 于 2013-11-20 19:04 编辑

如果可以的话我要定制一个物理反弹 (与自带的魔法反射类似) 的脚本,很简单的一个脚本
(简单一句也行啊!好吧我非常需要它)

(虽然物理反击类似,但是如果主角的攻击力为0的话。反击敌人就是无伤)
作者: 卡奥尼特    时间: 2013-11-20 12:01
我已经找过了,没有
作者: hno3000    时间: 2013-11-20 18:09
想定制一个 10X5方格的战棋战斗系统,类似于英雄无敌那种。
作者: hno3000    时间: 2013-11-20 21:47
hno3000 发表于 2013-11-20 18:09
想定制一个 10X5方格的战棋战斗系统,类似于英雄无敌那种。

这个很麻烦吗?……其实我想打算自己做的,但是系统太不熟悉了
作者: 喵呜喵5    时间: 2013-11-20 23:06
卡奥尼特 发表于 2013-11-20 12:01
我已经找过了,没有

虽然我想帮你,但是可以的话能请你描述清楚你需要什么样的效果么,

自己打开测试了一下,不论是物理反击或者是魔法反弹都是自己的攻击打空同时受到敌人的攻击……

虽然你不论是在这里还是在求助帖里面说这两个效果不一样,但是我还是没有看懂究竟“哪里”不一样啊……

是伤害不一样吗?何时才会发生伤害不一样的情况?

你在帖子里举例子说“主角的攻击力为0”,但是正常情况下用编辑器主角的攻击力是不会变成0的,最小值就是1。你不说清楚哪里有区别的话想帮你也做不到啊
作者: dongdongdjh    时间: 2013-11-21 14:58
Sion 发表于 2013-11-19 22:23
获取武器时随机增加0~9点攻击力。那个伤害掷骰子的功能跟这个脚本关系不大,要通过修改伤害公式实现。

c ...

谢谢 已学到不少
作者: 卡奥尼特    时间: 2013-11-21 21:35
本帖最后由 卡奥尼特 于 2013-11-22 15:25 编辑
喵呜喵5 发表于 2013-11-20 23:06
虽然我想帮你,但是可以的话能请你描述清楚你需要什么样的效果么,

自己打开测试了一下,不论是物理反击 ...


不用设置敌人的,设置自己的。都是1,敌人的不是1
这样,反击就无伤害了。可魔反就不同了
魔法反弹的原理是魔法攻击由敌人承受
物理反击的原理是物理攻击由敌人承受主角的攻击,主角攻击为1的话,就算反击也无用
这就是我对魔法反弹与物理反击的理解


所以我才需要一个物理反弹的脚本,敌人的物理攻击由敌人来承受
这就是我对物理反弹的理解


总之来说,我想要的效果就是和魔法反射一样。
这个效果是以物理攻击为主的,也就是物理版本的‘魔法反射’

@Sion  
作者: 喵呜喵5    时间: 2013-11-21 22:12
卡奥尼特 发表于 2013-11-21 21:35
不用设置敌人的,设置自己的。都是1,敌人的不是1
这样,反击就无伤害了。可魔反就不同了
魔法反弹的原理 ...

当然没用,敌人的防御力把主角的伤害全部抵消了啊,伤害公式里无视敌人防御力的伤害就能正常反击了吧?
作者: 倾灬城    时间: 2013-12-8 21:14
本帖最后由 倾灬城 于 2013-12-9 22:13 编辑

诶我想要一个选角色的脚本
很多网游都有的那种按方向键切换可以显示出不同的图片,选择其中一个后进行确认→起名→最后这个角色进入队伍
能够兼容鼠标脚本就更好了ouo
渣渣在此跪谢不已
————————————————————————————————————————————————————————————————
@Sion 嗯流程大概是这样:
主角接触某个角色,执行如下操作:
1.屏幕下方是三个角色的缩略图【或名称】如当前选择的是第一个角色,则显示第一个角色的图片
2.使用方向键移动选择的角色,则分别显示对应选择的图片
3.同时屏幕右上角一直有创建角色的按钮,点击后可创建当前选择的角色并更改角色姓名
啊文字描述太累qwq如果你玩过dnf等网游的话你就懂了

@喵呜喵5 这个怎么用事件实现和上面完全一样的效果0.0?
作者: 千古一帝    时间: 2013-12-9 21:37
求个VA横版战斗阵型脚本,就像VX版本的《六道》中的战斗一样
作者: 113340    时间: 2013-12-9 23:29
那个·············面向注释有“调查”的事件时,画面右下角显示“调查”十分好使,我先无节操的借用了。另外跪求版主大人·········这个脚本,能否增加一下功能?

例如说面向其他注释的时候,画面右下角会显示其他字眼?
例如说面对注释有“门”的事件时,右下角显示的是打开,
面对着注释着使用的事件的时候,右下角显示出使用?
面对着注释着对话的事件的时候,右下角显示出对话?
能否在一个脚本里实现3个以上同类型的功能?

阻版主大人一点小小宝贵时间,完善一下这个潜力很大的脚本!
作者: a000b1745    时间: 2013-12-10 22:47
假如想要做一個類似"復活點"的系統不知行不...
內容是這樣的:
在腳本區寫幾組MAP ID,
譬如  [MAP ID 99, X, Y] = [map id 01, map id 02, map id 03, map id 04]
意思是說"當玩家在map id = 01~04 戰敗的時候,不會跳入GAME OVER畫面、
而是到"map id 99 的(X,Y)座標上。(面向就看要怎麼寫比較順、都可以)
當然我只是舉例一組、有可能遊戲世界分很多區就可以設定很多組...

如果是這個架構也可以延伸到類似網遊的"傳送回家卷軸",
在某個領地使用"傳送回家卷軸" 就會回到那個領地的村子~{:2_260:}
作者: 喵呜喵5    时间: 2013-12-11 19:30
我又来定制脚本了......我希望做一个能和跟随在身后的角色对话的效果,具体如下:
1.当主角不朝向跟随角色时按方向键,主角不会穿过队友而只是朝向队友
2.当主角朝向队友时,按方向键可以正常穿过队友
3.当主角朝向队友时,按调查键可以执行预定的公共事件
4.地面上的按确定键触发事件的判定优先于与队友说话的判定
5.目前只需要考虑两人组队的情况,即,队友和队友不会重叠
作者: 喵呜喵5    时间: 2013-12-12 20:00
倾灬城 发表于 2013-12-8 21:14
诶我想要一个选角色的脚本
很多网游都有的那种按方向键切换可以显示出不同的图片,选择其中一个后进行确认 ...

范例



Project1.rar (1.27 MB, 下载次数: 58)
作者: Sion    时间: 2013-12-12 21:29
喵呜喵5 发表于 2013-12-11 19:30
我又来定制脚本了......我希望做一个能和跟随在身后的角色对话的效果,具体如下:
1.当主角不朝向跟随角色 ...

RUBY 代码复制
  1. class Game_Player
  2.   def talk_to_follower?
  3.     if @face_follower
  4.       @followers[0].turn_toward_player
  5.       $game_temp.reserve_common_event(1) #设置调用的公共事件
  6.       return true
  7.     else
  8.       return false
  9.     end
  10.   end
  11.   #
  12.   def passable?(x, y, d)
  13.     x2 = $game_map.round_x_with_direction(x, d)
  14.     y2 = $game_map.round_y_with_direction(y, d)
  15.     return false unless $game_map.valid?(x2, y2)
  16.     return true if @through || debug_through?
  17.     return false if collide_with_follower?(x, y, d)
  18.     return false unless map_passable?(x, y, d)
  19.     return false unless map_passable?(x2, y2, reverse_dir(d))
  20.     return false if collide_with_characters?(x2, y2)
  21.     return true
  22.   end
  23.   DirSym = [:DOWN, :LEFT, :RIGHT, :UP]
  24.   def collide_with_follower?(x, y, d)
  25.     if Input.trigger?(DirSym[d/2 - 1])
  26.       if @face_follower
  27.         @face_follower = false
  28.         return false
  29.       else
  30.         follower = @followers[0]
  31.         x2 = $game_map.round_x_with_direction(@x, d)
  32.         y2 = $game_map.round_y_with_direction(@y, d)
  33.         @face_follower = (follower.visible? && follower.pos?(x2, y2))
  34.         return true
  35.       end
  36.     else
  37.       return @face_follower
  38.     end
  39.   end
  40.   def move_straight(d, turn_ok = true)
  41.     @move_succeed = passable?(@x, @y, d)
  42.     if @move_succeed
  43.       @followers.move
  44.       set_direction(d)
  45.       @x = $game_map.round_x_with_direction(@x, d)
  46.       @y = $game_map.round_y_with_direction(@y, d)
  47.       @real_x = $game_map.x_with_direction(@x, reverse_dir(d))
  48.       @real_y = $game_map.y_with_direction(@y, reverse_dir(d))
  49.       increase_steps
  50.     elsif turn_ok
  51.       set_direction(d)
  52.       check_event_trigger_touch_front
  53.     end
  54.   end
  55.   # trigger
  56.   def check_action_event
  57.     return false if in_airship?
  58.     check_event_trigger_here([0])
  59.     return true if $game_map.setup_starting_event
  60.     check_event_trigger_there([0,1,2])
  61.     return true if $game_map.setup_starting_event
  62.     return talk_to_follower?
  63.   end
  64. end

好奇怪的功能{:2_276:}
目前流畅的转身是不会撞到身后的队友,先试试手感吧,默认系统改起来太多蛋疼的地方。
作者: Sion    时间: 2013-12-13 17:22
a000b1745 发表于 2013-12-10 22:47
假如想要做一個類似"復活點"的系統不知行不...
內容是這樣的:
在腳本區寫幾組MAP ID,


作者: pxq    时间: 2013-12-15 10:28
求一个显示敌人攻击效果的脚本,不需要太复杂,只要能像RMXP一样显示出己方的战斗图,显示出施法者和目标单位的动画效果就行,也不需要那种普通攻击会移动到敌方单位面前的那种。
作者: bbh    时间: 2013-12-19 11:54
= = 于是潜水N久的某人夜来无节操的定制一个脚本………………


想要实现的效果是在菜单以及state画面中显示人物的半身立绘,而非VA默认的脸图

大致效果类似于这个




显示地图名和装备栏的功能如果嫌麻烦可以舍弃。

最后,别在意这是个什么糟糕游戏,我们要的只是state窗口,state窗口嗯………………
作者: Sion    时间: 2013-12-19 13:16
本帖最后由 Sion 于 2013-12-19 13:17 编辑
bbh 发表于 2013-12-19 11:54
= = 于是潜水N久的某人夜来无节操的定制一个脚本………………


图书馆里的“教你修改菜单”的系列教程刚好可以做出这种效果,你先自己看看吧。
作者: qq987042370    时间: 2013-12-20 12:11
敌人消失效果为蓝色,而且是像天之痕那样先闪两下,然后一个个像素没掉那样
作者: sashitian    时间: 2013-12-25 14:03
新人,還什麼都不懂。。。請問有沒有擴展行走圖幀數的腳本?還有站立時也可以動的腳本??
原先系統的3幀實在是太少了,人物站著也不能動,感覺非常死板的說。。
作者: kkwo    时间: 2013-12-26 11:59
本帖最后由 kkwo 于 2013-12-26 12:01 编辑

鼠标系统的变化指针功能非常好用...
只是静态图好像不太醒目...
所以我想请问...
可以让鼠标变化的指针是动图吗?
作者: qq987042370    时间: 2013-12-27 19:04
Thank you!
作者: qq987042370    时间: 2013-12-27 19:11
Thank you!
作者: qq987042370    时间: 2013-12-27 19:13
怎么用来着···
作者: qq987042370    时间: 2013-12-28 11:47
再来一发吧:我弄一个VIP系统,纯事件的;怎么使公共事件在自动执行时的条件分歧时,可以走路,不然一直卡在那里
作者: 小w的w    时间: 2013-12-30 15:25
现在还可以求定制吗?
我想要一个与【http://tsukishinshi.blog73.fc2.com/blog-entry-2.html】这个类似的脚本,这个【イベント起動条件アイテム&スキル】是vx的,一直没找到va中与它效果类似的。

我主要是用这个脚本实现这个效果:当未持有特定物品时,特定地点无反应;当持有特定物品、并在特定地点前,从物品菜单内使用物品时,会出现是否使用物品的选项。当持有特定物品,但没有在特定地点前从物品菜单内使用物品,则物品无法使用(即按确认键后出现无法使用的提示音,但物品名称不会变成灰色,无法使用时物品菜单也不会自动关闭)。
举例:当未持有钥匙时,门无反应;当持有钥匙、并在门前,从物品菜单内使用钥匙时,会出现是否使用钥匙的选项。当持有钥匙,但没有在门前从物品菜单内使用钥匙,则钥匙无法使用(即按确认键后出现无法使用的提示音,但物品名称不会变成灰色,无法使用时物品菜单也不会自动关闭)。
举例视频:http://v.youku.com/v_show/id_XNjM4NjA5Mzgw.html
作者: Sion    时间: 2013-12-30 19:40
小w的w 发表于 2013-12-30 15:25
现在还可以求定制吗?
我想要一个与【http://tsukishinshi.blog73.fc2.com/blog-entry-2.html】这个类似的 ...


物品调用公共事件,里面用条件分支判断一下就行了。用变量代入玩家坐标、地图ID等信息来判断,玩家朝向 2468  对应小键盘上面的4个反向。
作者: 小w的w    时间: 2013-12-30 20:14
Sion 发表于 2013-12-30 19:40
物品调用公共事件,里面用条件分支判断一下就行了。用变量代入玩家坐标、地图ID等信息来判断,玩家朝向 2 ...

谢谢,不过这个我试过,是不能满足【当持有钥匙,但没有在门前从物品菜单内使用钥匙,则钥匙无法使用(即按确认键后出现无法使用的提示音,但物品名称不会变成灰色,无法使用时物品菜单也不会自动关闭)。】这个效果的。。
作者: Sion    时间: 2013-12-30 21:13
本帖最后由 Sion 于 2013-12-30 21:14 编辑
小w的w 发表于 2013-12-30 20:14
谢谢,不过这个我试过,是不能满足【当持有钥匙,但没有在门前从物品菜单内使用钥匙,则钥匙无法使用(即 ...


是这样吗?物品备注里填地图ID和坐标就可以了
范例.rar (475.22 KB, 下载次数: 51)
作者: 小w的w    时间: 2013-12-30 21:29
本帖最后由 小w的w 于 2013-12-30 21:31 编辑
Sion 发表于 2013-12-30 21:13
是这样吗?物品备注里填地图ID和坐标就可以了


是这样的,感谢!!
如果我想在多个地点使用物品,是不是可以在备注里填写多个地图ID和坐标呢?
另外如果我想让物品在不同地点出现不同的选项应该怎么办呢?
作者: Sion    时间: 2013-12-30 22:18
本帖最后由 Sion 于 2013-12-30 22:19 编辑
小w的w 发表于 2013-12-30 21:29
是这样的,感谢!!
如果我想在多个地点使用物品,是不是可以在备注里填写多个地图ID和坐标呢?
另外如果 ...


这个你需要在脚本里设置一个开关(默认是1)用来开启事件的第二页。
物品/事件里都要加备注/注释,你参考一下范例怎么弄的就行了。
范例.rar (475.38 KB, 下载次数: 44)
作者: 小w的w    时间: 2013-12-31 14:02
Sion 发表于 2013-12-30 22:18
这个你需要在脚本里设置一个开关(默认是1)用来开启事件的第二页。
物品/事件里都要加备注/注释,你参考 ...

我试了试,似乎同一时间只能有一个物品可以这样,如果想弄多个物品就会出现【明明使用的是纸条,却提示要使用钥匙吗?】这种情况。。
不过一般还是够用了,十分感谢!{:2_249:}
作者: Sion    时间: 2013-12-31 17:45
小w的w 发表于 2013-12-31 14:02
我试了试,似乎同一时间只能有一个物品可以这样,如果想弄多个物品就会出现【明明使用的是纸条,却提示要 ...

再加一个变量来判断物品ID就行了: 范例.rar (475.49 KB, 下载次数: 60)
作者: 婉烟沉沫    时间: 2014-1-3 11:17
QwQ战斗显示人物立绘←介个
作者: 893299399    时间: 2014-1-5 11:55
现在还能定制吗?想弄个【眨眼效果】
不是头像眨眼,是游戏画面那种眨眼效果,之前想过用事件,然后发现眨眼间隔不会弄,如果用计时器的话右上角又会出现时间...
总之上一次眨眼后10秒到30秒之间随机一个秒数作为间隔,可以在事件里设置是否开启眨眼和执行一次眨眼
作者: hk1211133    时间: 2014-1-6 19:45
希望大大能做VA版的橫式戰鬥,我不說回合制的我是說像XP的FMBS系統那樣子的拜託了
作者: qq544670783    时间: 2014-1-6 21:07
希望大大能做一个,适合VA的横版战斗脚本。这个我已经找了很久了,不知道为什么我用了很多个横版战斗脚本,可是每个一放进去游戏就会打不开。
作者: qq544670783    时间: 2014-1-10 17:17
能不能做一个让技能多段连击的脚本呢?不是游戏的那种,属于边连击边扣血的
作者: Sion    时间: 2014-1-11 00:16
qq544670783 发表于 2014-1-10 17:17
能不能做一个让技能多段连击的脚本呢?不是游戏的那种,属于边连击边扣血的 ...

我不想碰那个战斗系统啊什么是边连击边扣血啊
作者: qq544670783    时间: 2014-1-11 11:04
Sion 发表于 2014-1-11 00:16
我不想碰那个战斗系统啊什么是边连击边扣血啊

就是比如说VA不是有连击次数吗,我不想等他一招打完在一次次的扣血。我想在放技能时就扣了。
作者: Sion    时间: 2014-1-11 19:50
qq544670783 发表于 2014-1-11 11:04
就是比如说VA不是有连击次数吗,我不想等他一招打完在一次次的扣血。我想在放技能时就扣了。 ...

你是不是用了什么奇怪的脚本,我进去看了就是一下一下扣的啊。
作者: kkwo    时间: 2014-1-13 19:12
您好
我是之前提出希望让您的鼠标变化脚本变化的指针是动图的~
嗯因为不知道您何时搞定,请慢慢来没关係
只是可以的话我想先知道图片格式
像是动图的部份支援几张?
是放在同一张图还是不同张图?
因为我想说先知道可以先动工在慢慢等您的脚本XD
不好意思麻烦了~

作者: Sion    时间: 2014-1-13 20:07
kkwo 发表于 2014-1-13 19:12
您好
我是之前提出希望让您的鼠标变化脚本变化的指针是动图的~
嗯因为不知道您何时搞定,请慢慢来没关係

你帮我弄一点素材示例吧。每个动态图标分解成静态图片,弄成一行排好放到一个图里。帧数无所谓。
这些素材我会放到脚本里供别人参考使用,所以你随便弄一些就好。
作者: 双叶GL    时间: 2014-1-14 16:24
我想要个战斗脚本
名字大概是(前中卫系统)

角色添加一个状态显示所在位置

然后是前排没远程武器没办法攻击后排,也分类近战远程类技能最好= =而且相信很多人想要,因为,到现在也没搜到,不管是中文的,还是日文的类似脚本

K1PU`X(ZB80MYYM(]94)K2A.jpg (78.67 KB, 下载次数: 17)

K1PU`X(ZB80MYYM(]94)K2A.jpg

作者: kkwo    时间: 2014-1-14 17:11
Sion 发表于 2014-1-13 20:07
你帮我弄一点素材示例吧。每个动态图标分解成静态图片,弄成一行排好放到一个图里。帧数无所谓。
这些素 ...



這樣可以嗎?
還是說要分成4張?
作者: Sion    时间: 2014-1-15 17:11
kkwo 发表于 2014-1-14 17:11
這樣可以嗎?
還是說要分成4張?


RUBY 代码复制
  1. class << Mouse
  2. CursorFrames = [
  3. [10, 0, 8], # 设置图片的中心坐标、帧数
  4. [0, 50, 8],
  5. [20, 32, 8],
  6. [32, 50, 8]
  7. ]
  8. CursorSize = 64 #单个图标大小
  9. SwitchFrames = 10 #切换等待帧数
  10.  
  11.   def create_cursor(vp)
  12.     dispose_cursor if @sprite
  13.     [url=home.php?mod=space&uid=114926]@sprite[/url] = Sprite.new(vp)
  14.     @sprite.z = 9999
  15.     if File.exist?('Graphics/System/VariableCursor.png')
  16.       @sprite.bitmap = Cache.system('VariableCursor')
  17.     else
  18.       msgbox("Graphics/System/VariableCursor.png 缺失")
  19.       exit
  20.     end
  21.     @sprite.src_rect.set(0, 0, CursorSize, CursorSize)
  22.     change_cursor(0)
  23.     update_cursor
  24.   end
  25.   def change_cursor(i)
  26.     return if @cursor_i == i
  27.     @cursor_c = 0
  28.     @cursor_i = i
  29.     @sprite.ox, @sprite.oy, @cursor_f = *CursorFrames[i]
  30.     @cursor_f *= SwitchFrames
  31.     @sprite.src_rect.y = CursorSize * i
  32.     update_cursor_graphics
  33.   end
  34.  
  35.   alias_method :change_cursor_update, :update
  36.   def update
  37.     change_cursor_update
  38.     update_cursor_graphics
  39.   end
  40.   def update_cursor_graphics
  41.     @cursor_c += 1
  42.     @cursor_c = 0 if @cursor_c > @cursor_f
  43.     @sprite.src_rect.x = @cursor_c / SwitchFrames * CursorSize
  44.   end
  45. end
  46.  
  47. class Scene_Map
  48.   alias_method :change_cursor_update_mouse_action, :update_mouse_action
  49.   def update_mouse_action
  50.     $game_map.events_xy($game_map.mouse_map_x, \
  51.     $game_map.mouse_map_y).each {|event|
  52.       if event.mouse_start?
  53.         Mouse.change_cursor(1)
  54.         change_cursor_update_mouse_action
  55.         return
  56.       elsif event.cursor_index
  57.         Mouse.change_cursor(event.cursor_index)
  58.         change_cursor_update_mouse_action
  59.         return
  60.       end
  61.     }
  62.     Mouse.change_cursor(0)
  63.     change_cursor_update_mouse_action
  64.   end
  65.   alias_method :change_cursor_sion_mouse_call_menu, :call_menu
  66.   def call_menu
  67.     Mouse.change_cursor(0)
  68.     change_cursor_sion_mouse_call_menu
  69.   end
  70. end
  71.  
  72.  
  73. class Game_Event
  74. attr_reader\
  75. :locked,
  76. :cursor_index
  77.  
  78.   alias_method :change_cursor_lock, :lock
  79.   def lock
  80.     Mouse.change_cursor(0)
  81.     change_cursor_lock
  82.   end
  83.   alias_method :change_cursor_sion_mouse_start, :sion_mouse_start
  84.   def sion_mouse_start
  85.     Mouse.change_cursor(0)
  86.     change_cursor_sion_mouse_start
  87.   end
  88.   def sion_mouse_scan_list(cmd)
  89.     return false unless cmd.code == 108 || cmd.code == 408
  90.     text = cmd.parameters[0]
  91.     if text.include?("鼠标启动")
  92.       @mouse_start = true
  93.       @cursor_index = 1 #设置鼠标启动对应的鼠标指针索引
  94.     elsif /鼠标指针(\d+)/ =~ text
  95.       @cursor_index = $1.to_i
  96.     end
  97.     return @cursor_index
  98.   end
  99. end
  100.  
  101. class Game_Player < Game_Character
  102.   alias_method :change_cursor_make_encounter_count, :make_encounter_count
  103.   def make_encounter_count
  104.     Mouse.change_cursor(0)
  105.     change_cursor_make_encounter_count
  106.   end
  107. end


你这个素材没对齐 - -b
用这个替换原来的指针脚本,图片也替换掉就可以了。
作者: Sion    时间: 2014-1-15 17:16
双叶GL 发表于 2014-1-14 16:24
我想要个战斗脚本
名字大概是(前中卫系统)

这还要改敌人 AI 很麻烦的。
作者: moonshae    时间: 2014-1-17 17:00
突然发现这里可以求定制脚本

真心求教

防具升级脚本

其实我是把技能做成了防具。。。这样就可以实现装备技能的效果了


技能升级也就变成了防具的升级
升级需要点数,点数 = exp
手动升级,不需要使用技能获得熟练度一类的,单纯的手动消耗点数升级 ,点一下升一级
最大级数、基础升级点可以在备注栏里设定,因为每个技能有可能会不一样,所需升级点数逐级递增,这个设定成 基础点数*当前级数就好了,公式什么的我会改
技能升到特定的级别自动学会指定的skill(这个是数据库里的技能),也是希望能通过在备注栏里输入来设定,要求同一级数可以学多个技能,不同级数学不同技能
EX. LEARN_SKILL = [[1, 10],[1, 20],[15, 30]] 等级1时学会 技能编号10和20的技能,等级15时学会技能编号30的技能
设定的能力变化量随等级增加(就是mhp mmp atk def mat mdf......这些),也就是和等级关联,公式随便写一个就是了,我自己会改。



还有我想知道如何在其他脚本中调用这个脚本里防具的等级

呃 我知道我要求的很过分。。。。不过我努力了好几天了,确实自己写不出来。。。。。
作者: udxkydk    时间: 2014-1-17 17:02
大大能不能把  蛋疼的根据血量和状态显示不同立绘  再继续深化下。变成可以换装后也有同样的效果。。
好吧我不否认我想做成年人才可以玩的游戏!~
作者: Sion    时间: 2014-1-18 17:19
moonshae 发表于 2014-1-17 17:00
突然发现这里可以求定制脚本

真心求教

都不知道你怎么改的。这种特别个性化的系统还是算了,可以提供思路。
作者: Sion    时间: 2014-1-18 17:19
udxkydk 发表于 2014-1-17 17:02
大大能不能把  蛋疼的根据血量和状态显示不同立绘  再继续深化下。变成可以换装后也有同样的效果。。{:4_11 ...

什么叫换装后也有同样的效果?




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1