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
syntax_j
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
end
else
card
=
Game_Card
.
new
(
@card
)
p
"似乎凭空产生了卡片?"
p
uts
"似乎凭空产生了卡片?"
p
self
end
card
.
position
=
@position
if
@position
...
...
@@ -271,6 +271,12 @@ class Action
@card
=
card
end
end
class
MultiShow
<
Action
def
initialize
(
from_player
,
cards
)
super
(
from_player
,
nil
)
@cards
=
cards
end
end
class
Effect_Activate
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
@from_player
=
from_player
...
...
@@ -286,13 +292,18 @@ class Action
super
(
from_player
,
from_pos
,
nil
,
card
,
nil
,
position
)
end
end
class
Ignored
<
Action
def
initialize
(
str
)
@str
=
str
end
end
class
Unknown
<
Action
def
initialize
(
*
args
)
puts
'unkonwn action'
p
args
def
initialize
(
str
)
@str
=
str
p
uts
'unkonwn action '
+
str
end
def
run
puts
'unkonwn action run
'
puts
'unkonwn action run
'
+
@str
end
end
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
PlayerJoin
when
/关闭游戏王NetBattleX .*▊▊▊.*/
PlayerLeave
when
/(\[\d+\] .*
▊▊▊.*)
/m
when
/(\[\d+\] .*
|(?:
#{
::
Action
::
CardFilter
}
\r\n)*)▊▊▊.*
/m
Action
else
Error
...
...
@@ -76,9 +76,7 @@ class Game_Event
end
class
Action
def
self
.
parse
(
info
)
info
=~
/(.*)▊▊▊.*/m
str
=
$1
||
info
self
.
new
::
Action
.
parse
(
info
),
str
self
.
new
::
Action
.
parse
(
info
),
info
end
end
class
VerInf
...
...
lib/scene_duel.rb
View file @
8b07a504
...
...
@@ -55,23 +55,23 @@ class Scene_Duel < Scene
end
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
@turn_player
=
!
@turn_player
@phase
=
0
@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
@phase
=
@phases_window
.
phase
=
phase
@phases_window
.
refresh
end
end
def
reset
Action
::
Reset
.
new
(
true
).
run
action
Action
::
Reset
.
new
(
true
)
end
def
first_to_go
Action
::
FirstToGo
.
new
(
true
).
run
action
Action
::
FirstToGo
.
new
(
true
)
end
def
handle
(
event
)
case
event
...
...
@@ -94,13 +94,13 @@ class Scene_Duel < Scene
when
Event
::
KeyDown
case
event
.
sym
when
Key
::
F1
Action
::
Shuffle
.
new
.
run
action
Action
::
Shuffle
.
new
@player_field_window
.
refresh
when
Key
::
F2
first_to_go
@player_field_window
.
refresh
when
Key
::
F3
Action
::
Dice
.
new
(
true
).
run
action
Action
::
Dice
.
new
(
true
)
when
Key
::
F5
reset
@player_field_window
.
refresh
...
...
@@ -111,13 +111,24 @@ class Scene_Duel < Scene
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
)
case
event
when
Game_Event
::
Action
$chat_window
.
add
event
.
action
.
from_player
,
event
.
str
event
.
action
.
run
str
=
event
.
str
if
str
=~
/^\[\d+\] (?:●|◎)→(.*)$/m
str
=
$1
end
$chat_window
.
add
event
.
action
.
from_player
,
str
action
event
.
action
@player_field_window
.
refresh
@opponent_field_window
.
refresh
when
Game_Event
::
Error
...
...
lib/window_field.rb
View file @
8b07a504
...
...
@@ -215,22 +215,22 @@ class Window_Field < Window
end
def
clicked
return
if
!
@player
||
@index
.
nil?
case
@index
action
=
case
@index
when
:deck
case
@action_window
.
index
when
0
Action
::
Draw
.
new
(
true
)
.
run
Action
::
Draw
.
new
(
true
)
when
1
Action
::
Shuffle
.
new
.
run
Action
::
Shuffle
.
new
when
2
p
"未实现"
#Action::Draw.new(true)
.run
#Action::Draw.new(true)
when
3
p
"未实现"
when
4
Action
::
SendToGraveyard
.
new
(
true
,
:deck
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
:deck
,
@card
)
when
5
Action
::
Remove
.
new
(
true
,
:deck
,
@card
)
.
run
Action
::
Remove
.
new
(
true
,
:deck
,
@card
)
when
6
p
"未实现"
when
7
...
...
@@ -244,129 +244,130 @@ class Window_Field < Window
case
@action_window
.
index
when
0
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
p
"场位已满"
end
when
1
Action
::
Effect_Activate
.
new
(
true
,
:extra
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
:extra
,
@card
)
when
2
Action
::
Remove
.
new
(
true
,
:extra
,
@card
)
.
run
Action
::
Remove
.
new
(
true
,
:extra
,
@card
)
when
3
Action
::
SendToGraveyard
.
new
(
true
,
:extra
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
:extra
,
@card
)
end
when
:removed
case
@action_window
.
index
when
0
#特殊召唤
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
SpecialSummon
.
new
(
true
,
:removed
,
pos
,
@card
)
.
run
Action
::
SpecialSummon
.
new
(
true
,
:removed
,
pos
,
@card
)
else
p
"场位已满"
end
when
1
#效果发动
Action
::
Effect_Activate
.
new
(
true
,
:removed
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
:removed
,
@card
)
when
2
#加入手卡
Action
::
ReturnToHand
.
new
(
true
,
:removed
,
@card
)
.
run
Action
::
ReturnToHand
.
new
(
true
,
:removed
,
@card
)
when
3
Action
::
ReturnToDeck
.
new
(
true
,
:removed
,
@card
)
.
run
Action
::
ReturnToDeck
.
new
(
true
,
:removed
,
@card
)
when
4
Action
::
SendToGraveyard
.
new
(
true
,
:removed
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
:removed
,
@card
)
end
when
:graveyard
case
@action_window
.
index
when
0
#特殊召唤
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
SpecialSummon
.
new
(
true
,
:graveyard
,
pos
,
@card
)
.
run
Action
::
SpecialSummon
.
new
(
true
,
:graveyard
,
pos
,
@card
)
else
p
"场位已满"
end
when
1
#效果发动
Action
::
Effect_Activate
.
new
(
true
,
:graveyard
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
:graveyard
,
@card
)
when
2
#加入手卡
Action
::
ReturnToHand
.
new
(
true
,
:graveyard
,
@card
)
.
run
Action
::
ReturnToHand
.
new
(
true
,
:graveyard
,
@card
)
when
3
Action
::
ReturnToDeck
.
new
(
true
,
:graveyard
,
@card
)
.
run
Action
::
ReturnToDeck
.
new
(
true
,
:graveyard
,
@card
)
when
4
Action
::
Remove
.
new
(
true
,
:graveyard
,
@card
)
.
run
Action
::
Remove
.
new
(
true
,
:graveyard
,
@card
)
end
when
0
..
5
#后场
case
@action_window
.
index
when
0
#效果发动
Action
::
Effect_Activate
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
@index
,
@card
)
when
1
#返回卡组
Action
::
ReturnToDeck
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
ReturnToDeck
.
new
(
true
,
@index
,
@card
)
when
2
#送入墓地
Action
::
SendToGraveyard
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
@index
,
@card
)
when
3
#从游戏中除外
Action
::
Remove
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
Remove
.
new
(
true
,
@index
,
@card
)
when
4
#加入手卡
Action
::
ReturnToHand
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
ReturnToHand
.
new
(
true
,
@index
,
@card
)
when
5
#盖伏
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:set
)
.
run
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:set
)
end
when
6
..
10
#前场
case
@action_window
.
index
when
0
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:attack
)
.
run
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:attack
)
when
1
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:defense
)
.
run
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:defense
)
when
2
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:set
)
.
run
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:set
)
when
3
Action
::
FlipSummon
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
FlipSummon
.
new
(
true
,
@index
,
@card
)
when
4
Action
::
Flip
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
Flip
.
new
(
true
,
@index
,
@card
)
when
5
Action
::
Effect_Activate
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
@index
,
@card
)
when
6
p
"未实现"
when
7
p
"未实现"
when
8
Action
::
ReturnToDeck
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
ReturnToDeck
.
new
(
true
,
@index
,
@card
)
when
9
Action
::
SendToGraveyard
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
@index
,
@card
)
when
10
Action
::
Tribute
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
Tribute
.
new
(
true
,
@index
,
@card
)
when
11
Action
::
ReturnToHand
.
new
(
true
,
@index
,
@card
)
.
run
Action
::
ReturnToHand
.
new
(
true
,
@index
,
@card
)
end
when
Integer
#手卡
case
@action_window
.
index
when
0
#召唤
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
Summon
.
new
(
true
,
:hand
,
pos
,
@card
)
.
run
Action
::
Summon
.
new
(
true
,
:hand
,
pos
,
@card
)
else
p
"场位已满"
end
when
1
#特殊召唤
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
p
"场位已满"
end
when
2
#发动
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
Activate
.
new
(
true
,
:hand
,
pos
,
@card
)
.
run
Action
::
Activate
.
new
(
true
,
:hand
,
pos
,
@card
)
else
p
"场位已满"
end
when
3
#放置
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
Set
.
new
(
true
,
:hand
,
pos
,
@card
)
.
run
Action
::
Set
.
new
(
true
,
:hand
,
pos
,
@card
)
else
p
"场位已满"
end
when
4
#返回卡组
Action
::
ReturnToDeck
.
new
(
true
,
:hand
,
@card
)
.
run
Action
::
ReturnToDeck
.
new
(
true
,
:hand
,
@card
)
when
5
#送入墓地
Action
::
SendToGraveyard
.
new
(
true
,
:hand
,
@card
)
.
run
Action
::
SendToGraveyard
.
new
(
true
,
:hand
,
@card
)
when
6
#从游戏中除外
Action
::
Remove
.
new
(
true
,
:hand
,
@card
)
.
run
Action
::
Remove
.
new
(
true
,
:hand
,
@card
)
when
7
#效果发动
Action
::
Effect_Activate
.
new
(
true
,
:hand
,
@card
)
.
run
Action
::
Effect_Activate
.
new
(
true
,
:hand
,
@card
)
end
end
$scene
.
action
action
@index
=
nil
refresh
mousemoved
(
Mouse
.
state
[
0
],
Mouse
.
state
[
1
])
...
...
lib/window_roomchat.rb
View file @
8b07a504
...
...
@@ -2,13 +2,14 @@
# and open the template in the editor.
class
Window_RoomChat
<
Window
WLH
=
16
require_relative
'widget_scrollbar'
Player_Color
=
[
0
,
0
,
0xFF
]
Opponent_Color
=
[
0x66
,
0x66
,
0
]
def
initialize
(
x
,
y
,
width
,
height
)
super
(
x
,
y
,
width
,
height
-
WLH
)
@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
)
@scroll
=
Widget_ScrollBar
.
new
(
@x
+
@width
-
20
,
@y
,
@height
,
0
)
@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