Project1

标题: 转:战斗中换人,口袋口袋依旧是口袋 口袋换人系统 [打印本页]

作者: px.凤翔九天    时间: 2010-12-16 22:42
标题: 转:战斗中换人,口袋口袋依旧是口袋 口袋换人系统
以前曾经写了一个,貌似那个贴已经失踪到不懂哪里去了,所以今天重写了一个。而且之前写那个还可以玩围攻,这个是模仿口袋的战斗换人,功能就是那样,没得介绍,插入脚本后即可用。
  1. module LimBattlePlug
    3 z. N9 F& |' `1 p+ B4 \
  2. ! x, o; ]7 ?' m  r8 p; b' p  M2 k& b7 d
  3. # 队伍最大人数
    1 D+ S0 J$ Z& a7 e" [
  4. MaxPartySize = 8
    9 x+ A) l) O2 c" c* X
  5. ; P4 W, ~' Q3 T- [. u
  6. # 出战人数2 C. i3 t" A8 G( X9 M/ @
  7. MaxBattlerSize = 1
    / ~- L, c7 R9 v8 [" X" B

  8. 7 l+ C& r* h! _, `
  9. # 换人语句
    , q% S3 ]! {3 Z5 G
  10. WordChangeBattler = "换人"
    + J# Q5 Z: t9 z$ l" g

  11. # s$ d2 @, c' p' ]5 n7 B
  12. # 换人时播放的动画
    0 \6 U- |. R0 @7 ^
  13. AnimationChangeBattler = 268 q9 N5 q. z* k. i& d( ^( o5 q

  14. 1 H1 L# s7 @1 Z  S9 O) j4 ^
  15. end
    6 C9 l1 t2 E: Q; z$ Y& ^/ H
  16. 9 f& s* v' w0 p1 b* \
  17. class Game_BattleAction! Y# ^$ D7 d4 S" C5 ~+ M# K
  18.   attr_accessor :change_to_battler' ]+ N' u2 n4 _0 l
  19.   # 初始化* n! q3 H& C2 [0 X/ L) F# w
  20.   alias lbp_initialize initialize
      C( ^' A* I, Y4 F9 J8 I% ~
  21.   def initialize
    - }& Y: ?  K; Y$ e
  22.     lbp_initialize( h0 |4 H! t" j3 U- O* L# D/ _
  23.     @change_to_battler = 0) B1 r& m9 U0 S- D/ H. J
  24.   end! {4 t6 J; ^! a/ @: Q
  25.   # 欲更换角色编号
    $ P, f3 J+ K7 [8 C( U# d
  26.   def set_change_battler! _9 V( Y7 e( \
  27.     @kind = 3
    + T& N7 K( t/ f9 `2 f( a: ?8 @
  28.   end; E5 |3 E( d5 T/ ~
  29.   # 判断行动是否为更换角色- V& `5 P. x0 D; t# L
  30.   def is_change_battler?2 Q5 X1 k; _2 d6 W" X0 l; K
  31.     return (@kind == 3)! g$ J) P: N6 u" w* H
  32.   end6 }3 u! [+ i" c( \
  33. end/ y% K! w, }  M* t. C1 v
  34. 0 ?' l, F1 H7 P5 n, a# @' k9 i% X
  35. class Game_Party
    0 O! v! U7 T7 ~* v
  36.   include LimBattlePlug3 L5 O2 p6 m3 y" V- y
  37.   attr_reader :actors2
    8 S' r7 j- w& |8 U6 U6 S
  38.   alias lpb_initialize initialize1 }& T) u/ d7 s# ]- C
  39.   def initialize& V# N* W# S& e% N
  40.     lpb_initialize" d3 P! Z7 J3 `& }* I$ G* F
  41.     @actors2 = []
    0 b  G0 H. Z2 c2 f
  42.   end6 F3 @  _, j  v! r! v. I8 a* \
  43.   # 角色加入
    5 U# p6 C2 _9 n8 w
  44.   def add_actor(actor_id)
    9 ?1 n) |. _) B* Q$ E' o
  45.     actor = $game_actors[actor_id]/ ~% R" {( D5 q
  46.     if @actors.size < MaxPartySize and not @actors.include?(actor)' n" q# r' a) L) U
  47.       @actors.push(actor)
      E2 B+ o# J5 m# Y
  48.       $game_player.refresh% b3 v: U3 i% N/ D+ {: k& V/ r; ?% Q5 @
  49.     end8 `* o5 o- w% K: n6 N9 [4 s0 {
  50.   end
    " o: J' W# [' ?+ l  {0 a4 B% Q
  51.   # 设置战斗的角色
    4 `5 @: e& J7 A- H
  52.   def set_actor_to_battle% N6 R2 @0 b/ u% _/ ^1 J
  53.     @actors2 = []
    1 {8 S; X% X& m4 o8 n: ^
  54.     @actors.each do |actor|
    ; f/ `" g6 P! ^4 G' `% M) H7 m
  55.       @actors2.push(actor)/ H2 H5 |+ R7 R8 @4 t( d
  56.     end
    7 j$ m: W. p/ Y/ a' W
  57.     @actors = []
    # h, _! v0 [4 _# J
  58.     @actors2.each do |actor|' l/ Y: ?# ?3 N
  59.       @actors.push(actor)8 ~! Q- f8 q, |/ i1 {
  60.       break if @actors.size == MaxBattlerSize9 k2 E% P/ w# n0 G, q/ q
  61.     end
    + W' P" e$ E  ]
  62.   end. ^' u& p# @! ]+ r' d
  63.   # 还原战斗的角色1 T# g  x) v1 p) _3 G1 i* R
  64.   def set_actor_to_normal- A1 s; j5 H  n. c6 f
  65.     @actors = []
    % }! ^/ T; X0 X' l( T. R
  66.     @actors2.each do |actor|9 p+ C8 Z3 ?3 {8 F3 \
  67.       @actors.push(actor)2 Q4 P! k+ G5 Q
  68.     end* }+ W# x( ~2 m1 g4 G  {
  69.   end! `3 M- Z: v9 Q8 V# R
  70.   # 获取角色id数组
    3 N7 N: g6 B( B6 K# o
  71.   def get_actors_id
    % h1 O+ p# b- a. X" a, ?
  72.     id = []7 l0 e/ m% q  a; G8 x
  73.     @actors.each{|actor|id.push(actor.id)}* P6 S3 O& Y& C* x& x
  74.     return id- O( x. J% y: Q% \
  75.   end$ D5 u  c' H1 N; m
  76.   # 获取角色id数组$ O1 H2 g8 H! p( a# i. p: m
  77.   def get_actors2_id
    4 a2 O# V% n8 k" O9 I
  78.     id = []6 h* ~+ z! ?4 I2 y% @' R4 N2 f
  79.     @actors2.each{|actor|id.push(actor.id)}
    3 e: f, r. p7 D2 e
  80.     return id
    2 a$ E5 C7 L2 l: o4 t6 o
  81.   end" s2 r+ c% ?- q8 w
  82.   # 兑换角色9 o- C2 W( B2 J
  83.   def change_actor(index,id)3 d" _: w! i2 p* f6 S) m& s/ C
  84.     @actors[index] = $game_actors[id]
    ' M: a& i- e, c% @1 r
  85.   end
    2 Z" i# H. C( l1 R5 q3 w
  86.   # 全灭判定
    . [* K2 A* e# \8 s: k7 j4 A5 q
  87.   def all_dead?
    8 E4 K& h1 j# w- u( C
  88.     # 同伴人数为 0 的情况下2 X/ i  V% J" X8 ]" ?& H, r! [
  89.     if $game_party.actors.size == 0' b! q& y. H0 A# ^
  90.       return false
    - W& u" `. q$ y* ]3 L* Q
  91.     end
    % @: R. k* T: |! q
  92.     # 同伴中无人 HP 在 0 以上
    % Z( j" y% f4 S- F* ~
  93.     for actor in @actors22 o: M" S( \' [/ B7 @
  94.       if actor.hp > 0
    $ V; g0 |& A( q* p% E) y
  95.         return false. [8 f- f. J7 G, n
  96.       end  {1 }$ Q1 _" L! D; S& z
  97.     end
    $ @  u' q3 [- M, Q6 Z
  98.     for actor in @actors
    9 P6 q5 o& {& \& @4 o/ x8 w7 Q  ~
  99.       if actor.hp > 0$ I, {6 I/ Z/ Q# ]
  100.         return false* g6 S& c8 c4 j$ I- @  u! x9 O# f
  101.       end! D6 v) Q9 X1 p" I
  102.     end
    # c5 H, I6 B, x' R4 G+ Z
  103.     # 全灭3 H3 G3 K$ d' b& v3 m& ]
  104.     return true
    & L% ^2 W5 [0 U
  105.   end
    1 g8 F% ~  W. U
  106.   # 其他角色. I% m$ P9 t0 u3 @
  107.   def other_actors
    4 j4 J7 g8 P% q- I5 L; |9 \
  108.     actors = []: f, [" K2 k5 y  H. G9 y1 S
  109.     @actors2.each{|actor|actors.push(actor) if [email protected]?(actor)}
    5 S$ D" J# ~9 V3 J$ `: o
  110.     return actors6 C. e; L) O$ g/ m  |
  111.   end0 F  t7 B$ H" S+ y9 G
  112.   # 角色位置互换. t$ V; @6 Y1 ?! W& Z* S
  113.   def change_actor_pos(id1,id2)
    / C& R1 n8 Z+ K; D  A8 i" }! B
  114.     actor_id = []7 ?) D7 U: @4 M0 z9 s
  115.     @actors.each do |actor|
    , `7 V  J2 a* p, L$ E0 `
  116.       actor_id.push(actor.id)2 i# X" h4 d' F
  117.     end
    7 k7 V; b+ N; B3 z
  118.     return if !actor_id.include?(id1) and !actor_id.include?(id2)
    + X/ B8 B- y; s- A
  119.     id1_index = id2_index = -1
    1 G. k+ ]/ @/ X3 @  x
  120.     (0...actor_id.size).each do |i|
    1 y0 b$ K: Q6 s9 ?# @
  121.       if actor_id[i] == id1) k3 y3 C5 g1 [& C, a1 [7 \
  122.         id1_index = i
    * l* r4 Z" f# w$ n# @! l4 Z8 b
  123.       elsif actor_id[i] == id26 x, Z: w: i# C0 s6 r# P* E3 l+ P, `
  124.         id2_index = i
    - Q  R' W3 p& j  }# ~! j7 u# q, u0 z
  125.       end
      s5 w! E# w/ ?& o* ^
  126.     end
    1 R  [) L: G1 B# i3 I
  127.     temp_actor = @actors[id1_index]
    5 R# t3 X. [7 U9 S# S
  128.     @actors[id1_index] = @actors[id2_index]
    , x9 U$ V+ p3 W0 e  c
  129.     @actors[id2_index] = temp_actor
    . R: r  X' d7 E% V
  130.   end
    ' ?2 Y" E6 A8 U1 @
  131. end% B- w$ e9 u: Y1 C% w  F
  132. . t8 I3 H: B% p/ m( T* L
  133. class Window_Actor < Window_Selectable  T# z8 d" m! c# k4 N% b
  134.   # 初始化% E4 S1 H: ]: H! K# S5 m  x
  135.   def initialize1 _* Y) _3 z4 u# x8 W' h
  136.     super(0,64,640,256)
    ) \! l6 }+ J, r6 z  }
  137.     self.back_opacity = 160
    2 \7 n+ i8 q" J# L- `# D# X1 @
  138.     refresh5 b8 s6 ~+ C! G: j1 U4 z. C7 m
  139.     self.index = -1
    3 d, p* _6 O9 U! c, y
  140.     self.active = false
    / K, [, A8 `9 C0 L$ F6 w# o
  141.   end/ o  Z+ z! T6 y) U5 b' ~" K# W, D
  142.   # 刷新
    - F6 B4 p1 A* _, a* b
  143.   def refresh( b! w9 S% T+ z! Z' P
  144.     @item_max = $game_party.actors2.size+ s  Y% G2 f" x3 @4 B3 _
  145.     @data = []- a8 z. c% j, c9 S0 _
  146.     $game_party.actors.each do |actor|0 t  t" [9 f! \, F8 [1 d
  147.       @data.push(actor)
    0 O; B7 x4 [0 ^! F; u; u' P
  148.     end
    9 o, A7 V, `% o9 k, M* ~6 d
  149.     $game_party.actors2.each do |actor|
    4 v0 n1 x6 g2 K5 ]4 G
  150.       @data.push(actor) if [email protected]?(actor)
    % M! d2 f; S9 P
  151.     end: |- G& |+ d! {
  152.     if self.contents != nil1 R  m3 y) M# H( V0 o# ~. G
  153.       self.contents.clear
    $ p# F9 b% R' }
  154.       self.contents = nil
    + I: s2 M& `3 m  h
  155.     end
    & L# n4 r% v/ Y' g! e* r
  156.     self.contents = Bitmap.new(608,@data.size*32)% G% N. K' M5 ~3 J* ^! Y+ `
  157.     x = 4  E2 }- i8 W- g1 N
  158.     y = 0
    4 Z% s, p2 E  Y$ X0 m7 @
  159.     @data.each do |actor|
    8 S0 J8 |( E- N% W/ E( P& \
  160.       bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)$ @5 j9 @! v7 B6 G6 V9 b
  161.       rect = Rect.new(0,0,bitmap.width/4,31)
    5 K1 q* \9 p" N( o( j
  162.       self.contents.blt(x+16-bitmap.width/8,y,bitmap,rect)3 U7 J$ L1 q6 Y8 _" `
  163.       draw_actor_name(actor,x+36,y)* n$ p4 Z: s; }" r1 q; e& r' ~1 `
  164.       draw_actor_state(actor,156,y)" W3 t5 c  z+ [7 X4 n( F% K
  165.       draw_actor_hp(actor,x+256,y,96)0 M0 ~& Z7 U! r% ~; d, I$ V6 G
  166.       draw_actor_sp(actor,x+376,y,96)# s7 F/ t; r+ d
  167.       if $game_party.actors.include?(actor)
    # y) V$ U  K2 ^
  168.         self.contents.font.color = text_color(6)* N1 U. j7 T1 Z- P$ I
  169.         cword = "出战"
    8 ^' p' N% c5 k
  170.       else! y4 R: F( Y0 D4 L9 W( N
  171.         self.contents.font.color = text_color(0)
    + V1 @! m1 s9 s# T6 X0 A
  172.         cword = "待战"
    : ]6 K  F7 C. c% x
  173.       end
    + t; v- S7 m- {& U$ E0 ?+ l
  174.       self.contents.draw_text(x+496,y,60,32,cword)( [2 ?# G0 T- X; j# h! ?
  175.       y += 32
    ( n1 f0 f/ c+ `5 W, r! n
  176.     end
    & U* a& d% U& w- ]0 o
  177.   end
      Z4 V9 e3 P/ m2 p: N; Y8 f
  178.   # 获取当前角色编号
    # @. ], R, M# f+ B* n( s
  179.   def actor_id
      f0 g0 Z+ ]4 L- K; S6 w; |
  180.     return @data[self.index].id
    5 i5 R0 B4 b, Z, `$ F
  181.   end: h- k( W! p7 E+ B* M% X
  182.   # 刷新帮助  E, ?  U0 U1 \8 [$ d* t- u
  183.   def update_help) \0 H0 Y2 u) n+ f* H* m6 n2 e
  184.     @help_window.set_text(@data[self.index] == nil ?\
    . [/ m8 ~' K$ s0 o' z
  185.                           "" : @data[self.index].name)
    - R) U! h+ ~; N+ N
  186.   end* @; @( M+ a/ k$ C) l. q
  187. end
    3 K3 w: W. Q% P
  188. 4 H/ n& x; q/ T
  189. class Scene_Battle" u; T: `. l' {0 ]# l
  190.   include LimBattlePlug
    7 r) n" u9 i7 t* X% _( {$ M# d
  191.   # 初始化
    , T! b% J# g6 R* L1 z
  192.   def initialize
    $ Q' q, K6 S1 e& S* F* ^
  193.     $game_party.set_actor_to_battle
    + I8 Y2 N- @) \* Z1 H/ N4 s# ?
  194.   end
    6 s* n" n6 g. g+ k6 K% [9 I4 R9 N! C
  195.   # 主处理- M( H1 V, v% C
  196.   def main
    8 F0 o1 o& |) w4 w7 ]! z
  197.     # 初始化战斗用的各种暂时数据
    3 W/ l' S& f3 [) m1 ?9 M6 p
  198.     $game_temp.in_battle = true
    5 c7 Z- w4 |. \1 k& q, W# s
  199.     $game_temp.battle_turn = 05 A' ]+ w# O( _6 ~
  200.     $game_temp.battle_event_flags.clear
    / j, _% u8 r0 P3 G) P+ I$ R, M
  201.     $game_temp.battle_abort = false
    8 K6 K/ G. n7 K8 P
  202.     $game_temp.battle_main_phase = false  f0 |6 s% U$ c  \. w9 D7 [8 F, t
  203.     $game_temp.battleback_name = $game_map.battleback_name! ]$ i/ ]( q% i9 N  ]( K* I
  204.     $game_temp.forcing_battler = nil
    & T' j9 ^0 M8 ?+ r
  205.     # 初始化战斗用事件解释器3 p( ?) T, \4 X& l- t
  206.     $game_system.battle_interpreter.setup(nil, 0)
    & O4 R' g" W# T4 ~, m; F* s/ m" @
  207.     # 准备队伍, `9 x8 M! T5 U! |8 g
  208.     @troop_id = $game_temp.battle_troop_id( s  z" W/ H8 k
  209.     $game_troop.setup(@troop_id)
    2 G; t/ x9 U9 q" W8 t. v8 j+ E0 u5 _
  210.     # 生成角色命令窗口
    9 z: B; ~7 V3 i
  211.     s1 = $data_system.words.attack! S5 x% D9 q0 a4 O
  212.     s2 = $data_system.words.skill
    & D: f( w0 @1 s- e! m/ x
  213.     s3 = $data_system.words.guard
    1 Q% {4 ?# U' O2 P8 P# o" F$ _
  214.     s4 = $data_system.words.item
    % ~' `0 ~( w( n% y% i- G, K9 E" o
  215.     s5 = WordChangeBattler/ F! e8 v# U* ?! g
  216.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])
    # V/ v3 I& \& ?+ w7 y. [
  217.     @actor_command_window.y = 128
    / ^5 H6 q4 ~) M; h, f8 s7 m! w
  218.     @actor_command_window.back_opacity = 160; q9 S  C: l" K/ f" B9 Z* t
  219.     @actor_command_window.active = false
    6 E* s' }% I! f2 A) ?' `
  220.     @actor_command_window.visible = false% }9 |9 T2 I/ c6 B
  221.     # 生成其它窗口
    3 \7 {2 R1 ^$ `. J, f0 C
  222.     @party_command_window = Window_PartyCommand.new
      h6 \% F  @2 v) W. {. B
  223.     @help_window = Window_Help.new
    : C, B6 [5 q/ r: H
  224.     @help_window.back_opacity = 160
    + G! R1 N8 ?  |6 t
  225.     @help_window.visible = false3 u0 f, n1 X1 p2 w( _
  226.     @status_window = Window_BattleStatus.new
    2 S: x1 i$ g7 t1 R: k
  227.     @message_window = Window_Message.new" B2 L- v' |4 t/ Y" c* h
  228.     # 生成活动块7 B9 J6 u5 L4 L. B' x
  229.     @spriteset = Spriteset_Battle.new
    3 N7 u: i3 x( ~: l4 k. `
  230.     # 初始化等待计数, O3 f9 X/ d" t1 z8 s
  231.     @wait_count = 0
    5 R+ {  C( ], w$ F  a: q
  232.     # 执行过渡7 S2 k0 h$ z9 H" `: d( I
  233.     if $data_system.battle_transition == ""9 s6 }$ v5 j0 `& o6 P
  234.       Graphics.transition(20)( o2 T5 ]$ V) u) \$ C+ M
  235.     else3 h9 v3 v9 J8 t3 I* T
  236.       Graphics.transition(40, "Graphics/Transitions/" +# ?+ O: X) k$ j3 J
  237.         $data_system.battle_transition)6 v" P) Y0 ~& K( }; s+ _" ?
  238.     end6 @" X$ b8 p- T: R" N  A* l' u7 c
  239.     # 开始自由战斗回合
    ; a' D/ M' o3 b! X% C1 D$ G
  240.     start_phase1. A( Q; t+ g4 s0 f3 L8 |2 C
  241.     # 主循环
    9 M* o; i6 u6 a3 t' I2 g. A0 C: A5 T
  242.     loop do/ _2 h# \/ F% S0 x! `
  243.       # 刷新游戏画面
    9 I2 G# M" M! M' [8 ]2 R- d; Z  @9 P
  244.       Graphics.update
    4 C+ |5 P- V# K3 Z
  245.       # 刷新输入信息& X: @7 P) K# P( N
  246.       Input.update- y! t( x5 d9 ?+ u
  247.       # 刷新画面
    * ]( L6 Y; J3 \$ R: U1 @0 P
  248.       update% s" r8 w+ `2 r
  249.       # 如果画面切换的话就中断循环3 ?  f) [3 w* I# P% o+ S4 y6 E& m
  250.       if $scene != self( `# @( X) W/ s* F, v# @
  251.         break
    2 h* O3 D% C  Y  N- |- N
  252.       end1 C+ h$ y  v# }* X/ f: V$ g
  253.     end7 i, O+ H" P0 ~5 R0 X& w
  254.     # 刷新地图: S; h) }  U: q2 a( @0 t& o
  255.     $game_map.refresh
    ! M# v9 r4 S4 `% S5 B
  256.     # 准备过渡  ]  S8 z" r: C, g3 E# B, g
  257.     Graphics.freeze: k0 r* S# v$ p" ?
  258.     # 释放窗口
    % b. R" y' a3 o% w8 n
  259.     @actor_command_window.dispose
    : u. I+ O2 r( p, l
  260.     @party_command_window.dispose
    + z( s9 j7 c& h$ L  J- M
  261.     @help_window.dispose
    , Z3 U3 e% e3 q: g
  262.     @status_window.dispose/ U* |: O* @3 @5 g& E6 {
  263.     @message_window.dispose
    7 s  j1 k5 G: t- o- h
  264.     if @skill_window != nil# N1 Y6 a$ Y1 u) }
  265.       @skill_window.dispose
    ! m% P) U! P& y8 z) D& O
  266.     end6 t' K$ h/ |+ ?% A1 {8 u, }3 H* m
  267.     if @item_window != nil$ T0 \* P2 ?/ j2 n7 n* g
  268.       @item_window.dispose
    $ R: I. |" o1 l0 V3 W
  269.     end
      D5 U" @& B5 {
  270.     if @actor_window != nil
    / R2 g4 c3 J, P) ?3 e2 [: x
  271.       @actor_window.dispose
    & [& i+ }2 c* a7 P
  272.     end
    6 i- n6 A' j: Z+ \' B% l7 q
  273.     if @result_window != nil! ^& n% N& d- r' V
  274.       @result_window.dispose
    6 H3 Q3 e1 e! }! s- W. `: p$ e
  275.     end3 j; K- ?8 b& w/ P
  276.     # 释放活动块
    ( h% W$ V+ j4 x# |2 P$ T
  277.     @spriteset.dispose  F, y$ V. z2 z' [
  278.     # 标题画面切换中的情况5 Q9 I+ E6 n$ u9 I0 K3 z
  279.     if $scene.is_a?(Scene_Title)
    ' P( h8 g6 l% E0 ^0 W
  280.       # 淡入淡出画面
    6 j' F5 y3 n" w% `' x
  281.       Graphics.transition
    ) Q7 \1 r4 N" s9 ?; a0 v( x" }
  282.       Graphics.freeze
    . F8 l0 P7 s4 @& r, C, m0 H, Y
  283.     end
    / ~. T2 c1 W# Z8 I& e- H
  284.     # 战斗测试或者游戏结束以外的画面切换中的情况
    5 q6 h8 P/ K% k7 p& o: E! C
  285.     if $BTEST and not $scene.is_a?(Scene_Gameover)
    , k! Z/ x! k: H  N2 W4 u& ^9 y
  286.       $scene = nil
    2 P" i0 H  a$ A
  287.     end
    ) m3 }  |9 E4 b! _
  288.   end* j  G' s2 `- X* [) k
  289.   # 战斗结束8 Y" E6 g. N0 T  |' Q
  290.   alias lpb_battle_end battle_end2 P9 m& R* P7 q3 M6 |5 ~. I
  291.   def battle_end(n): @1 u1 @5 F# S$ t4 W. q9 p
  292.     lpb_battle_end(n)$ P% W+ j6 b: J7 C& U# d* a
  293.     $game_party.set_actor_to_normal" @% @! M" i  i" o9 _
  294.   end
    8 L, T" w% q5 M* x8 E% C$ J, {
  295.   # 开始回合3
    7 H- [; x1 D* j4 ?
  296.   alias lbp_start_phase3 start_phase3
    & n8 x" c  i, s
  297.   def start_phase35 L  A$ s" S2 D: J- ^1 e' b
  298.     @changed_battler_id = []
    % Y0 q  f8 A6 t
  299.     lbp_start_phase3" E7 J/ ?- [+ I- {( {4 t
  300.   end* ^* t4 s* [( x% S! x
  301.   # 刷新角色命令回合画面' W- I! u2 @" i
  302.   def update_phase3
    ) t7 q% n% d% S
  303.     # 敌人光标有效的情况下* }* g+ i9 X+ ~5 `: R
  304.     if @enemy_arrow != nil
    7 r/ k& n8 l, A, T! X
  305.       update_phase3_enemy_select8 g" @! `$ V& G1 j9 g! {* ]
  306.     # 角色光标有效的情况下4 f! Q9 U1 f2 p
  307.     elsif @actor_arrow != nil
    ! R: Z: t+ m6 Z
  308.       update_phase3_actor_select
    ( `6 w- u# C1 n' {6 W; L# M! }  u
  309.     # 特技窗口有效的情况下
    3 w  u. c8 p* m2 g2 s! B8 _
  310.     elsif @skill_window != nil
    " z5 ~% u) h  Z
  311.       update_phase3_skill_select
    $ S" o/ N  X" f# N
  312.     # 物品窗口有效的情况下
    $ }, g% F" C7 X# A& p
  313.     elsif @item_window != nil) _% m5 h/ d# z' T  U# B
  314.       update_phase3_item_select
    9 F% k3 j& B' N
  315.     elsif @actor_window != nil
    6 X) G  S( m% }1 ^; h9 z& n3 [
  316.       update_phase3_battler_select% h: f% S. D1 M+ x
  317.     # 角色指令窗口有效的情况下6 d2 C: k! f! m& w3 E
  318.     elsif @actor_command_window.active( r) ~  M! ?( Y; M
  319.       update_phase3_basic_command- A( \5 F7 \) S
  320.     end
    ; h9 ?1 A- b! y. f- \4 m
  321.   end
    9 j2 X8 J3 X, I5 G& ^6 ]$ p
  322.   # 角色基本命令, W' n2 z. P' v5 B. n
  323.   def update_phase3_basic_command
    , A( Q1 `. U; W  j- n6 F3 B
  324.     # 按下 B 键的情况下$ ~$ T# `7 v0 Q; Q6 h
  325.     if Input.trigger?(Input::B)- z5 e& r4 J/ V+ ]! }) C/ Q
  326.       # 演奏取消 SE" r/ j/ U# i/ Q, e& S8 x6 |
  327.       $game_system.se_play($data_system.cancel_se)
    5 C) o$ L: p2 W; ~0 F5 j" u
  328.       # 转向前一个角色的指令输入$ s! `/ v' e6 X* e
  329.       phase3_prior_actor" @, V. w8 }5 j6 y
  330.       return9 N# p, B/ m4 U
  331.     end9 m( G* P& Y* n- x$ a1 a
  332.     # 按下 C 键的情况下
    3 k- W4 X& m1 _) d# e6 W; \! h+ t
  333.     if Input.trigger?(Input::C)1 l4 r- a: z3 D1 J! R
  334.       # 角色指令窗口光标位置分之
    0 G/ b: m6 I* |& b' ?  l
  335.       case @actor_command_window.index
    : Q. V' Z/ @+ D$ v, J2 g
  336.       when 0  # 攻击
    % |0 w  a6 r& q+ P$ }' E6 Q
  337.         # 演奏确定 SE
    ; [  u7 B& N2 s
  338.         $game_system.se_play($data_system.decision_se)2 I: K; y# Z5 c5 k! i! H; R
  339.         # 设置行动
    2 N: ^2 z) C2 P" J
  340.         @active_battler.current_action.kind = 0
    # M- \0 K7 n9 Y+ W. c: `3 \  X
  341.         @active_battler.current_action.basic = 0) b* t  d" f5 C0 `8 M$ ?# m' E
  342.         # 开始选择敌人
    5 z* y0 K/ v& G
  343.         start_enemy_select
    2 q6 d. B" }$ z' _1 v) G' J8 P# Z0 e
  344.       when 1  # 特技: S, \4 p. x! p; _1 y
  345.         # 演奏确定 SE, P. ]6 |7 ~5 j9 A. t% ?5 d
  346.         $game_system.se_play($data_system.decision_se)
    * e2 ^, u5 Z  Q; l4 o, }
  347.         # 设置行动
    - i& w, N) M% D3 \
  348.         @active_battler.current_action.kind = 1
    ) u: Z7 W$ y1 ~7 V$ U6 H
  349.         # 开始选择特技
    $ g0 a7 p, k- k" `. c2 s6 o
  350.         start_skill_select: O6 L3 a  R, ]9 i- p! Q/ m
  351.       when 2  # 防御
    " \8 ^# Y# B  _' {2 M
  352.         # 演奏确定 SE
    5 L% u6 C1 T: p2 ]4 H
  353.         $game_system.se_play($data_system.decision_se)
    4 d( M! t7 l; O4 L: }2 S; p, F9 D
  354.         # 设置行动
    3 c6 x8 }( r0 {1 T4 N+ g
  355.         @active_battler.current_action.kind = 0
    / s- x$ P# s2 r5 O+ [# ~
  356.         @active_battler.current_action.basic = 1
    9 Y" @/ y5 y$ S! v# l6 T4 z. F
  357.         # 转向下一位角色的指令输入
    ; p7 q4 A, B  p
  358.         phase3_next_actor
    7 x$ m& v# D9 k5 {6 L: M
  359.       when 3  # 物品2 ^. u/ i! H1 ?, ?' N8 R
  360.         # 演奏确定 SE
      w, U& |8 s& |, Z5 s% w
  361.         $game_system.se_play($data_system.decision_se)# P: m+ y' g" d: O& w: U7 _" a
  362.         # 设置行动
    + [  I7 t0 U" Y4 x$ P
  363.         @active_battler.current_action.kind = 24 u2 t* A  M8 [# j: t  F
  364.         # 开始选择物品# N9 W7 ]% C/ L
  365.         start_item_select- W. m! l! d- z3 ~: o7 l
  366.       when 4 # 换人
    ! \( v# _9 g8 y' {/ Y
  367.         $game_system.se_play($data_system.decision_se)
    / M' P  L, q% C* j
  368.         @active_battler.current_action.set_change_battler' R, l- G$ T' V: `
  369.         start_battler_select
    1 `: ~4 {  ~$ i
  370.       end
    0 u7 L" n: G- {' d5 v0 I3 H/ w. t
  371.       return7 {# T3 B3 d  L& D! k5 a: X7 ]
  372.     end
    # Z  B) ~5 c& |2 Q5 p7 l# l5 _
  373.   end
    ' S$ [2 W; ~  F, R
  374.   # 开始角色选择
    ! h& ^* h6 _: }: ^1 n
  375.   def start_battler_select8 D3 C: Z7 o3 R
  376.     @actor_window = Window_Actor.new6 W. K" t2 G1 T3 C" |, C
  377.     @actor_window.active = true. g- ^6 l% g0 y
  378.     @actor_window.index = 0! \- @1 h( j" }) |
  379.     @actor_window.help_window = @help_window
    & r; b' v6 X. B" S& C. E
  380.     @actor_command_window.active = false$ H7 K1 f# M8 }0 z
  381.     @actor_command_window.visible = false
    1 W6 G1 g/ h% _/ W* {) i
  382.   end+ s6 ^1 d4 |4 d& W) I
  383.   # 结束角色选择
    : a  D4 V$ s, n. d- z# g8 t5 F8 o
  384.   def end_battler_select
    ) i+ G9 q- T, Q1 ?+ l5 m' l
  385.     @actor_window.dispose
    * Z2 [1 t6 o# I9 |+ W3 G) L0 Y
  386.     @actor_window = nil  g# ~4 o. N3 J9 }* t8 D5 x9 t
  387.     @help_window.visible = false
    7 Y9 }- H- t  K/ m
  388.     @actor_command_window.active = true
    : B# t& @: [  |3 U7 u+ A
  389.     @actor_command_window.visible = true0 R1 Q9 ?! B! p  Q$ ]/ k
  390.   end+ Y+ x$ K5 o7 ?  ]
  391.   # 刷新角色选择
    0 O* R2 W. ?" }$ |" c
  392.   def update_phase3_battler_select
    . D# V2 N8 q8 C: K" q
  393.     @actor_window.visible = true
    , f# Y2 E, S7 A; k
  394.     @actor_window.update
      D1 F% v+ a4 H- G* H9 u
  395.     if Input.trigger?(Input::B)  U1 [" |, j5 U. E' e3 p4 r& h
  396.       $game_system.se_play($data_system.cancel_se)+ u+ k& j# y8 ?6 _6 R
  397.       end_battler_select
    ( S% c' l* g! o, ]6 E
  398.       return
    . |' s, D. Z4 B( K: c& t
  399.     end* t' q6 L3 u  a
  400.     if Input.trigger?(Input::C)
    0 L  l1 B% E' D
  401.       actor_id = @actor_window.actor_id
    0 X7 s6 N8 r. l7 P/ T$ a, S
  402.       if $game_party.get_actors_id.include?(actor_id) or" y5 y! R5 B. R; ]) u9 q" A1 @
  403.          $game_actors[actor_id].dead? or 9 e! `/ ?5 _* |
  404.          @changed_battler_id.include?(actor_id)1 \  |, h) o; \2 p2 h! Y
  405.         $game_system.se_play($data_system.buzzer_se)
    2 k6 T$ l/ i3 K1 I9 A7 B6 C, Z
  406.         return
    % B# I8 k$ r2 C* X; F( S
  407.       end' H+ r  {, ?) g& G
  408.       $game_system.se_play($data_system.decision_se)
    * s/ }. S8 i. X$ |. n; N1 u7 `6 r) F
  409.       @active_battler.current_action.change_to_battler = actor_id8 I  ]0 Q  V9 U+ M) D# U3 }
  410.       @changed_battler_id.push(actor_id)
    & I1 J4 B. y" n, w8 X& P
  411.       end_battler_select3 X4 f* m: y4 j) a! u- r4 l
  412.       phase3_next_actor! {7 P' i9 m9 e$ z$ K# V
  413.       return- G* X1 a+ y! H5 e4 s
  414.     end
    ( q. ]5 O+ e5 l7 V, D8 p4 O  G. L
  415.   end
    ! `; p! d7 Z" f7 a6 j: \9 x
  416.   # 行动方动画/ b; G; S( y3 L2 w1 E& K; K
  417.   def update_phase4_step32 s+ |) H) @# Z: F5 `' t$ E8 x
  418.     if @active_battler.current_action.is_change_battler?+ k  ^1 S2 l+ u6 [3 O; m
  419.       @animation1_id = AnimationChangeBattler7 s, B; g# q) \& ^5 f5 N
  420.       @target_battlers = []
    1 E+ f" [- b) e# u. b
  421.     end! D2 [6 ~* ]5 W% q" X
  422.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
    : j3 ]5 E9 J5 M5 v; o
  423.     if @animation1_id == 0: N* w9 m; W, X* b: n8 b" F6 _
  424.       @active_battler.white_flash = true
    9 o- w3 @. r! t. d% r& D" E" y
  425.     else! h1 f6 H: y+ S( `# D. J
  426.       @active_battler.animation_id = @animation1_id# ?9 W$ R; u4 J7 t$ R
  427.       @active_battler.animation_hit = true3 o( k$ s$ I" K# u. @) x, i
  428.     end& [4 j# H" [$ l6 o; l
  429.     # 移至步骤 49 y- w) e# U' X/ f& D. F
  430.     @phase4_step = 4$ z1 b, I& Q) g' Z
  431.   end" |' E1 M! ^; |% K5 r2 j3 u0 y8 P
  432.   # 对象方动画
    ) F# f, F! s* T4 v& f( M1 @
  433.   def update_phase4_step46 A# D# ~3 a; J( G7 L- p( C8 K& t
  434.     if @active_battler.current_action.is_change_battler?0 A6 @# e4 V9 x2 n& I
  435.       actor1_id = @active_battler.current_action.change_to_battler. ]: u/ ~* m; |3 J8 c. u8 q
  436.       actor2_id = @active_battler.id
    8 j0 N2 J' o+ g: y3 H/ e
  437.       (0...$game_party.actors.size).each do |i|' ?, `2 i7 X) i3 {( ^6 y' B+ ~3 D
  438.         if $game_party.actors[i].id == actor2_id
    , m6 [3 e# [' S1 t
  439.           $game_party.change_actor(i,actor1_id)
    ) U1 P; N- t& @
  440.           @active_battler = $game_actors[actor1_id]4 h( z# D3 q; I; o: r4 C8 m
  441.           @status_window.refresh/ j3 C1 P+ D' f8 K8 z3 Z5 j
  442.         end( f3 ^& a; Z' Q" c4 _3 @
  443.       end
    , x( w5 Y! P9 J
  444.     end3 G- p8 g# g4 I, G8 P) ^4 A+ v
  445.     # 对像方动画
    " b* G9 G1 y9 S, K
  446.     for target in @target_battlers
    / _. e+ K1 B& M1 y6 z3 K
  447.       target.animation_id = @animation2_id( y9 t; j3 B# r; y: J
  448.       target.animation_hit = (target.damage != "Miss")
    0 B* [8 O0 D2 E1 A8 B6 ?
  449.     end
    ; M: y: \* e1 J8 N' `- N% o
  450.     # 限制动画长度、最低 8 帧
      Q' G4 ^* X. ]2 C& y# o/ z
  451.     @wait_count = 8
    4 \. k$ u! ^/ J8 D1 Y
  452.     # 移至步骤 5
    $ B, H, L# d% L0 N7 F9 Q8 v
  453.     @phase4_step = 5
    $ f$ z2 o- L, m, x6 D! |
  454.   end8 ~! p+ M5 p% e  C6 F% ?
  455.   # 公共事件; Y, S5 J' h1 y  ?
  456.   def update_phase4_step6- j( A: r! @* F8 [8 o- U1 v
  457.     @target_battlers.each do |target|
    5 y: r3 E: ]4 m
  458.       if target.is_a?(Game_Actor) and target.dead? and
    . d. D/ _" m- C( u9 z" c
  459.          !$game_party.other_actors.all?{|actor|actor.dead?}3 R0 ?$ t4 ?; m6 z9 B+ o) W& i! Z! ]
  460.         @actor_window = Window_Actor.new
    8 \+ `6 o7 K& [9 g; R9 h8 o
  461.         @actor_window.index = 01 z/ g- h+ \5 {0 A9 x, H# h/ Z
  462.         @actor_window.active = true
    8 P9 e7 i% [6 p, k
  463.         @actor_window.help_window = @help_window, Z. e$ C0 L! A% V4 B6 }6 g
  464.         actor_id = -1
    , h' W& k! \1 H& h/ _5 A
  465.         loop do
    ) o- i5 {- c3 q* i. ?
  466.           Graphics.update
    . R: ?! [- b* L, I" ~% e( Y, a
  467.           Input.update; l5 H( w- g5 M: Q0 G% [
  468.           @actor_window.update
      A  N% s/ x8 l1 {
  469.           if Input.trigger?(Input::C)
    & v* Q/ F1 @) y! R* A1 U
  470.             actor = $game_actors[@actor_window.actor_id]
    ( b; s1 G: d* j! D* e4 K7 \  D$ I
  471.             if actor.dead? or
    $ U4 `8 G. o1 V7 {7 L  B( E" ~
  472.                (@changed_battler_id.include?(actor.id) and 7 I1 s2 U! V+ x- y8 G. R
  473.                 target.current_action.change_to_battler != actor.id) or
    ! A5 w/ l& Z( J1 G; E( D+ W
  474.                $game_party.actors.include?(actor)
    : m3 {3 c3 i7 \3 E5 C5 h
  475.               $game_system.se_play($data_system.buzzer_se)4 Z; z1 p: e9 ~; h0 q
  476.             else
    0 @& C. G, U3 o, ~9 q/ S
  477.               actor_id = actor.id
    7 T/ x6 Z2 A+ b* o5 j
  478.             end
    & p3 x6 S. }  G' T" e7 d$ [3 Y
  479.           end$ J( P( w/ p+ f7 ~
  480.           break if actor_id >= 0
    / i; Q' E( I0 T
  481.         end
    & k( z# k8 e  Q% [7 Y5 O% G( U9 S
  482.         @actor_window.visible = false
    3 z. q# }2 Q) E/ n/ d
  483.         @actor_window.dispose" s' |7 ~; x, ?* b+ [2 h! m
  484.         @actor_window = nil7 y' G# N1 E& e% Z0 M. D3 U' b' p
  485.         @help_window.visible = false
    , R' ]+ h2 Y9 A. Y" z- y. a$ Z5 D
  486.         (0...$game_party.actors.size).each do |i|( k0 E. c6 \+ j7 t$ c8 A
  487.           if $game_party.actors[i].id == target.id, W: }* I# n& v+ I4 v
  488.             $game_party.change_actor(i,actor_id)
    4 S7 j6 W6 e0 n9 @  }7 ]3 D
  489.             @status_window.refresh/ b! J' L! q% B; S1 h
  490.           end
    ; j) v$ ~- L& c$ ^3 x. a2 A9 ~
  491.         end, }) a+ b3 z( P8 c8 v
  492.       end  V: G+ q1 A: O: N9 p# @6 e* J  L6 G
  493.     end) \4 C. i8 t& l$ |" P. a
  494.     # 清除强制行动对像的战斗者
    - W, x5 z$ V/ g# i9 a
  495.     $game_temp.forcing_battler = nil
    9 A  z9 t1 {' e7 r' }
  496.     # 公共事件 ID 有效的情况下. V6 x$ f6 x4 i
  497.     if @common_event_id > 0
    2 A4 L$ i" Q+ b( V
  498.       # 设置事件4 D/ b: t6 U. P/ @% d1 h4 W, u" r
  499.       common_event = $data_common_events[@common_event_id]" X, C% }2 p0 R6 C4 \+ j
  500.       $game_system.battle_interpreter.setup(common_event.list, 0)
    " S% p, T6 `# T9 e
  501.     end$ M% w, Q; E! p6 `  r! O8 a; y7 m
  502.     # 移至步骤 18 q/ Y. y! Q: |. S; \! j
  503.     @phase4_step = 1$ ]$ s+ z4 _  J# g" ]7 v
  504.   end
    5 ^  w: a2 B5 e; U6 A8 g
  505. end% u1 w; y: a2 ?% ~
  506. " m4 U4 T0 b: s% }$ m; T9 S( n! W
  507. class Window_MenuStatus
    0 m/ v: T* Y% q1 h
  508.   def refresh
    ) ]! b( e* t/ H# l& o3 q" X1 f
  509.     self.contents.clear; A5 K# `8 Y; v- |4 C1 n
  510.     @item_max = $game_party.actors.size; E( L, ?+ o0 p9 [5 K
  511.     for i in 0...$game_party.actors.size
    5 o% A" m+ d* Y) S/ m
  512.       x = 4
    , s: x) ^- q; _$ D6 B; Q0 n) k
  513.       y = i * 329 a" C9 ^' N# V- E3 d; J
  514.       actor = $game_party.actors[i]6 M2 R9 f* g# n
  515.       bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)
    3 c' C2 w" y# I: p! `. \& D. Y
  516.       rect = Rect.new(0,0,bitmap.width/4,31)+ i% G1 m; l& L% _# E2 a
  517.       self.contents.blt(x+16-bitmap.width/8,y,bitmap,rect)
    * p" L8 h: z) c$ J, s
  518.       draw_actor_name(actor, x+36, y)
    1 l' O3 Y8 U5 S9 w# h, I& v
  519.       draw_actor_state(actor, x + 136,y)
    . t" i  ?) ]2 L9 a9 X% E0 ~
  520.       draw_actor_hp(actor, x + 236, y,96)
    6 a+ W: [9 d3 f" }; w. @
  521.       draw_actor_sp(actor, x + 336, y,96)
    ' z1 I; h- \& g/ a) R
  522.     end5 h- o( @( B$ |# W& h
  523.   end5 }; o, n, Z4 ~% ^& B
  524.   def update_cursor_rect
    2 \4 L" r1 i9 ^0 P
  525.     super
    3 E; @2 l2 `- L0 [8 z! L) c
  526.   end$ X' |4 ~* \6 ]3 }
  527. end
复制代码
说明:这个东西是转自enghao_lim的一篇帖子,版权归原作者所有。
作者: 姬文翔    时间: 2011-3-25 03:32
我现在就在用这个做一个类似的游戏。但用了这个脚本后发现有个大问题
8 x5 s* X+ s7 V3 {3 _只有最后解决掉敌人的那个人才能得到经验……怎样改成只要是在该场战斗中出过场的都可以得到一些经验呢?
作者: 1584927450    时间: 2012-6-30 15:17
LZ能否帮我写个XP的口袋脚本,和你此帖的脚本功能一样,但是是四个队员出战,剩下的待命,可换人那种,求求你了,这是我梦寐以求的口袋脚本!!!!!!!!!!!!!!!!!




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