Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaoye
mycard
Commits
8b07a504
Commit
8b07a504
authored
Dec 09, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NBX action解析大量增加
parent
48dcc949
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
173 additions
and
137 deletions
+173
-137
lib/action.rb
lib/action.rb
+16
-5
lib/nbx/action.rb
lib/nbx/action.rb
+88
-74
lib/nbx/event.rb
lib/nbx/event.rb
+2
-4
lib/scene_duel.rb
lib/scene_duel.rb
+20
-9
lib/window_field.rb
lib/window_field.rb
+45
-44
lib/window_roomchat.rb
lib/window_roomchat.rb
+2
-1
No files found.
lib/action.rb
View file @
8b07a504
...
@@ -136,7 +136,7 @@ class Action
...
@@ -136,7 +136,7 @@ class Action
end
end
else
else
card
=
Game_Card
.
new
(
@card
)
card
=
Game_Card
.
new
(
@card
)
p
"似乎凭空产生了卡片?"
p
uts
"似乎凭空产生了卡片?"
p
self
p
self
end
end
card
.
position
=
@position
if
@position
card
.
position
=
@position
if
@position
...
@@ -271,6 +271,12 @@ class Action
...
@@ -271,6 +271,12 @@ class Action
@card
=
card
@card
=
card
end
end
end
end
class
MultiShow
<
Action
def
initialize
(
from_player
,
cards
)
super
(
from_player
,
nil
)
@cards
=
cards
end
end
class
Effect_Activate
<
Move
class
Effect_Activate
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
def
initialize
(
from_player
,
from_pos
,
card
)
@from_player
=
from_player
@from_player
=
from_player
...
@@ -286,13 +292,18 @@ class Action
...
@@ -286,13 +292,18 @@ class Action
super
(
from_player
,
from_pos
,
nil
,
card
,
nil
,
position
)
super
(
from_player
,
from_pos
,
nil
,
card
,
nil
,
position
)
end
end
end
end
class
Ignored
<
Action
def
initialize
(
str
)
@str
=
str
end
end
class
Unknown
<
Action
class
Unknown
<
Action
def
initialize
(
*
args
)
def
initialize
(
str
)
puts
'unkonwn action'
@str
=
str
p
args
p
uts
'unkonwn action '
+
str
end
end
def
run
def
run
puts
'unkonwn action run
'
puts
'unkonwn action run
'
+
@str
end
end
end
end
def
self
.
reset
def
self
.
reset
...
...
lib/nbx/action.rb
View file @
8b07a504
This diff is collapsed.
Click to expand it.
lib/nbx/event.rb
View file @
8b07a504
...
@@ -26,7 +26,7 @@ class Game_Event
...
@@ -26,7 +26,7 @@ class Game_Event
PlayerJoin
PlayerJoin
when
/关闭游戏王NetBattleX .*▊▊▊.*/
when
/关闭游戏王NetBattleX .*▊▊▊.*/
PlayerLeave
PlayerLeave
when
/(\[\d+\] .*
▊▊▊.*)
/m
when
/(\[\d+\] .*
|(?:
#{
::
Action
::
CardFilter
}
\r\n)*)▊▊▊.*
/m
Action
Action
else
else
Error
Error
...
@@ -76,9 +76,7 @@ class Game_Event
...
@@ -76,9 +76,7 @@ class Game_Event
end
end
class
Action
class
Action
def
self
.
parse
(
info
)
def
self
.
parse
(
info
)
info
=~
/(.*)▊▊▊.*/m
self
.
new
::
Action
.
parse
(
info
),
info
str
=
$1
||
info
self
.
new
::
Action
.
parse
(
info
),
str
end
end
end
end
class
VerInf
class
VerInf
...
...
lib/scene_duel.rb
View file @
8b07a504
...
@@ -55,23 +55,23 @@ class Scene_Duel < Scene
...
@@ -55,23 +55,23 @@ class Scene_Duel < Scene
end
end
def
change_phase
(
phase
)
def
change_phase
(
phase
)
Action
::
ChangePhase
.
new
(
@turn_player
,
[
:DP
,
:SP
,
:M1
,
:BP
,
:M2
,
:EP
][
phase
]).
run
action
Action
::
ChangePhase
.
new
(
@turn_player
,
[
:DP
,
:SP
,
:M1
,
:BP
,
:M2
,
:EP
][
phase
])
if
phase
==
5
if
phase
==
5
@turn_player
=
!
@turn_player
@turn_player
=
!
@turn_player
@phase
=
0
@phase
=
0
@phases_window
.
player
=
@turn_player
@phases_window
.
player
=
@turn_player
Action
::
Turn_End
.
new
(
true
,
"Turn End"
,
$game
.
player_field
.
lp
,
$game
.
player_field
.
hand
.
size
,
$game
.
player_field
.
deck
.
size
,
$game
.
player_field
.
graveyard
.
size
,
$game
.
player_field
.
removed
.
size
,
$game
.
player_field
,
1
).
run
action
Action
::
Turn_End
.
new
(
true
,
"Turn End"
,
$game
.
player_field
.
lp
,
$game
.
player_field
.
hand
.
size
,
$game
.
player_field
.
deck
.
size
,
$game
.
player_field
.
graveyard
.
size
,
$game
.
player_field
.
removed
.
size
,
$game
.
player_field
,
1
)
else
else
@phase
=
@phases_window
.
phase
=
phase
@phase
=
@phases_window
.
phase
=
phase
@phases_window
.
refresh
@phases_window
.
refresh
end
end
end
end
def
reset
def
reset
Action
::
Reset
.
new
(
true
).
run
action
Action
::
Reset
.
new
(
true
)
end
end
def
first_to_go
def
first_to_go
Action
::
FirstToGo
.
new
(
true
).
run
action
Action
::
FirstToGo
.
new
(
true
)
end
end
def
handle
(
event
)
def
handle
(
event
)
case
event
case
event
...
@@ -94,13 +94,13 @@ class Scene_Duel < Scene
...
@@ -94,13 +94,13 @@ class Scene_Duel < Scene
when
Event
::
KeyDown
when
Event
::
KeyDown
case
event
.
sym
case
event
.
sym
when
Key
::
F1
when
Key
::
F1
Action
::
Shuffle
.
new
.
run
action
Action
::
Shuffle
.
new
@player_field_window
.
refresh
@player_field_window
.
refresh
when
Key
::
F2
when
Key
::
F2
first_to_go
first_to_go
@player_field_window
.
refresh
@player_field_window
.
refresh
when
Key
::
F3
when
Key
::
F3
Action
::
Dice
.
new
(
true
).
run
action
Action
::
Dice
.
new
(
true
)
when
Key
::
F5
when
Key
::
F5
reset
reset
@player_field_window
.
refresh
@player_field_window
.
refresh
...
@@ -111,13 +111,24 @@ class Scene_Duel < Scene
...
@@ -111,13 +111,24 @@ class Scene_Duel < Scene
end
end
def
action
(
action
)
str
=
action
.
escape
if
str
=~
/^\[\d+\] (?:●|◎)→(.*)$/m
str
=
$1
end
$chat_window
.
add
action
.
from_player
,
str
if
action
.
from_player
action
.
run
end
def
handle_game
(
event
)
def
handle_game
(
event
)
case
event
case
event
when
Game_Event
::
Action
when
Game_Event
::
Action
$chat_window
.
add
event
.
action
.
from_player
,
event
.
str
str
=
event
.
str
event
.
action
.
run
if
str
=~
/^\[\d+\] (?:●|◎)→(.*)$/m
str
=
$1
end
$chat_window
.
add
event
.
action
.
from_player
,
str
action
event
.
action
@player_field_window
.
refresh
@player_field_window
.
refresh
@opponent_field_window
.
refresh
@opponent_field_window
.
refresh
when
Game_Event
::
Error
when
Game_Event
::
Error
...
...
lib/window_field.rb
View file @
8b07a504
...
@@ -215,22 +215,22 @@ class Window_Field < Window
...
@@ -215,22 +215,22 @@ class Window_Field < Window
end
end
def
clicked
def
clicked
return
if
!
@player
||
@index
.
nil?
return
if
!
@player
||
@index
.
nil?
case
@index
action
=
case
@index
when
:deck
when
:deck
case
@action_window
.
index
case
@action_window
.
index
when
0
when
0
Action
::
Draw
.
new
(
true
)
.
run
Action
::
Draw
.
new
(
true
)
when
1
when
1
Action
::
Shuffle
.
new
.
run
Action
::
Shuffle
.
new
when
2
when
2
p
"未实现"
p
"未实现"
#Action::Draw.new(true)
.run
#Action::Draw.new(true)
when
3
when
3
p
"未实现"
p
"未实现"
when
4
when
4
Action
::
SendToGraveyard
.
new
(
true
,
:deck
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
:deck
,
@card
)
when
5
when
5
Action
::
Remove
.
new
(
true
,
:deck
,
@card
)
.
run
Action
::
Remove
.
new
(
true
,
:deck
,
@card
)
when
6
when
6
p
"未实现"
p
"未实现"
when
7
when
7
...
@@ -244,129 +244,130 @@ class Window_Field < Window
...
@@ -244,129 +244,130 @@ class Window_Field < Window
case
@action_window
.
index
case
@action_window
.
index
when
0
when
0
if
pos
=
@field
.
empty_field
(
@card
)
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
SpecialSummon
.
new
(
true
,
:extra
,
pos
,
@card
,
nil
,
:attack
)
.
run
Action
::
SpecialSummon
.
new
(
true
,
:extra
,
pos
,
@card
,
nil
,
:attack
)
else
else
p
"场位已满"
p
"场位已满"
end
end
when
1
when
1
Action
::
Effect_Activate
.
new
(
true
,
:extra
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
:extra
,
@card
)
when
2
when
2
Action
::
Remove
.
new
(
true
,
:extra
,
@card
)
.
run
Action
::
Remove
.
new
(
true
,
:extra
,
@card
)
when
3
when
3
Action
::
SendToGraveyard
.
new
(
true
,
:extra
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
:extra
,
@card
)
end
end
when
:removed
when
:removed
case
@action_window
.
index
case
@action_window
.
index
when
0
#特殊召唤
when
0
#特殊召唤
if
pos
=
@field
.
empty_field
(
@card
)
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
SpecialSummon
.
new
(
true
,
:removed
,
pos
,
@card
)
.
run
Action
::
SpecialSummon
.
new
(
true
,
:removed
,
pos
,
@card
)
else
else
p
"场位已满"
p
"场位已满"
end
end
when
1
#效果发动
when
1
#效果发动
Action
::
Effect_Activate
.
new
(
true
,
:removed
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
:removed
,
@card
)
when
2
#加入手卡
when
2
#加入手卡
Action
::
ReturnToHand
.
new
(
true
,
:removed
,
@card
)
.
run
Action
::
ReturnToHand
.
new
(
true
,
:removed
,
@card
)
when
3
when
3
Action
::
ReturnToDeck
.
new
(
true
,
:removed
,
@card
)
.
run
Action
::
ReturnToDeck
.
new
(
true
,
:removed
,
@card
)
when
4
when
4
Action
::
SendToGraveyard
.
new
(
true
,
:removed
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
:removed
,
@card
)
end
end
when
:graveyard
when
:graveyard
case
@action_window
.
index
case
@action_window
.
index
when
0
#特殊召唤
when
0
#特殊召唤
if
pos
=
@field
.
empty_field
(
@card
)
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
SpecialSummon
.
new
(
true
,
:graveyard
,
pos
,
@card
)
.
run
Action
::
SpecialSummon
.
new
(
true
,
:graveyard
,
pos
,
@card
)
else
else
p
"场位已满"
p
"场位已满"
end
end
when
1
#效果发动
when
1
#效果发动
Action
::
Effect_Activate
.
new
(
true
,
:graveyard
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
:graveyard
,
@card
)
when
2
#加入手卡
when
2
#加入手卡
Action
::
ReturnToHand
.
new
(
true
,
:graveyard
,
@card
)
.
run
Action
::
ReturnToHand
.
new
(
true
,
:graveyard
,
@card
)
when
3
when
3
Action
::
ReturnToDeck
.
new
(
true
,
:graveyard
,
@card
)
.
run
Action
::
ReturnToDeck
.
new
(
true
,
:graveyard
,
@card
)
when
4
when
4
Action
::
Remove
.
new
(
true
,
:graveyard
,
@card
)
.
run
Action
::
Remove
.
new
(
true
,
:graveyard
,
@card
)
end
end
when
0
..
5
#后场
when
0
..
5
#后场
case
@action_window
.
index
case
@action_window
.
index
when
0
#效果发动
when
0
#效果发动
Action
::
Effect_Activate
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
@index
,
@card
)
when
1
#返回卡组
when
1
#返回卡组
Action
::
ReturnToDeck
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
ReturnToDeck
.
new
(
true
,
@index
,
@card
)
when
2
#送入墓地
when
2
#送入墓地
Action
::
SendToGraveyard
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
@index
,
@card
)
when
3
#从游戏中除外
when
3
#从游戏中除外
Action
::
Remove
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
Remove
.
new
(
true
,
@index
,
@card
)
when
4
#加入手卡
when
4
#加入手卡
Action
::
ReturnToHand
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
ReturnToHand
.
new
(
true
,
@index
,
@card
)
when
5
#盖伏
when
5
#盖伏
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:set
)
.
run
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:set
)
end
end
when
6
..
10
#前场
when
6
..
10
#前场
case
@action_window
.
index
case
@action_window
.
index
when
0
when
0
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:attack
)
.
run
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:attack
)
when
1
when
1
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:defense
)
.
run
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:defense
)
when
2
when
2
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:set
)
.
run
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:set
)
when
3
when
3
Action
::
FlipSummon
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
FlipSummon
.
new
(
true
,
@index
,
@card
)
when
4
when
4
Action
::
Flip
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
Flip
.
new
(
true
,
@index
,
@card
)
when
5
when
5
Action
::
Effect_Activate
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
@index
,
@card
)
when
6
when
6
p
"未实现"
p
"未实现"
when
7
when
7
p
"未实现"
p
"未实现"
when
8
when
8
Action
::
ReturnToDeck
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
ReturnToDeck
.
new
(
true
,
@index
,
@card
)
when
9
when
9
Action
::
SendToGraveyard
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
@index
,
@card
)
when
10
when
10
Action
::
Tribute
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
Tribute
.
new
(
true
,
@index
,
@card
)
when
11
when
11
Action
::
ReturnToHand
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
ReturnToHand
.
new
(
true
,
@index
,
@card
)
end
end
when
Integer
#手卡
when
Integer
#手卡
case
@action_window
.
index
case
@action_window
.
index
when
0
#召唤
when
0
#召唤
if
pos
=
@field
.
empty_field
(
@card
)
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
Summon
.
new
(
true
,
:hand
,
pos
,
@card
)
.
run
Action
::
Summon
.
new
(
true
,
:hand
,
pos
,
@card
)
else
else
p
"场位已满"
p
"场位已满"
end
end
when
1
#特殊召唤
when
1
#特殊召唤
if
pos
=
@field
.
empty_field
(
@card
)
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
SpecialSummon
.
new
(
true
,
:hand
,
pos
,
@card
,
nil
,
:attack
)
.
run
Action
::
SpecialSummon
.
new
(
true
,
:hand
,
pos
,
@card
,
nil
,
:attack
)
else
else
p
"场位已满"
p
"场位已满"
end
end
when
2
#发动
when
2
#发动
if
pos
=
@field
.
empty_field
(
@card
)
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
Activate
.
new
(
true
,
:hand
,
pos
,
@card
)
.
run
Action
::
Activate
.
new
(
true
,
:hand
,
pos
,
@card
)
else
else
p
"场位已满"
p
"场位已满"
end
end
when
3
#放置
when
3
#放置
if
pos
=
@field
.
empty_field
(
@card
)
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
Set
.
new
(
true
,
:hand
,
pos
,
@card
)
.
run
Action
::
Set
.
new
(
true
,
:hand
,
pos
,
@card
)
else
else
p
"场位已满"
p
"场位已满"
end
end
when
4
#返回卡组
when
4
#返回卡组
Action
::
ReturnToDeck
.
new
(
true
,
:hand
,
@card
)
.
run
Action
::
ReturnToDeck
.
new
(
true
,
:hand
,
@card
)
when
5
#送入墓地
when
5
#送入墓地
Action
::
SendToGraveyard
.
new
(
true
,
:hand
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
:hand
,
@card
)
when
6
#从游戏中除外
when
6
#从游戏中除外
Action
::
Remove
.
new
(
true
,
:hand
,
@card
)
.
run
Action
::
Remove
.
new
(
true
,
:hand
,
@card
)
when
7
#效果发动
when
7
#效果发动
Action
::
Effect_Activate
.
new
(
true
,
:hand
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
:hand
,
@card
)
end
end
end
end
$scene
.
action
action
@index
=
nil
@index
=
nil
refresh
refresh
mousemoved
(
Mouse
.
state
[
0
],
Mouse
.
state
[
1
])
mousemoved
(
Mouse
.
state
[
0
],
Mouse
.
state
[
1
])
...
...
lib/window_roomchat.rb
View file @
8b07a504
...
@@ -2,13 +2,14 @@
...
@@ -2,13 +2,14 @@
# and open the template in the editor.
# and open the template in the editor.
class
Window_RoomChat
<
Window
class
Window_RoomChat
<
Window
WLH
=
16
require_relative
'widget_scrollbar'
require_relative
'widget_scrollbar'
Player_Color
=
[
0
,
0
,
0xFF
]
Player_Color
=
[
0
,
0
,
0xFF
]
Opponent_Color
=
[
0x66
,
0x66
,
0
]
Opponent_Color
=
[
0x66
,
0x66
,
0
]
def
initialize
(
x
,
y
,
width
,
height
)
def
initialize
(
x
,
y
,
width
,
height
)
super
(
x
,
y
,
width
,
height
-
WLH
)
super
(
x
,
y
,
width
,
height
-
WLH
)
@chat_input
=
Widget_InputBox
.
new
(
@x
,
@y
+
@height
,
@width
,
WLH
){
|
text
|
Action
::
Chat
.
new
(
true
,
text
).
run
}
@chat_input
=
Widget_InputBox
.
new
(
@x
,
@y
+
@height
,
@width
,
WLH
){
|
text
|
Action
::
Chat
.
new
(
true
,
text
).
run
}
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
1
6
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
1
4
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x99FFFFFF
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x99FFFFFF
)
@scroll
=
Widget_ScrollBar
.
new
(
@x
+
@width
-
20
,
@y
,
@height
,
0
)
@scroll
=
Widget_ScrollBar
.
new
(
@x
+
@width
-
20
,
@y
,
@height
,
0
)
@list
=
[]
@list
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment