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
48dcc949
Commit
48dcc949
authored
Dec 08, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nbx,动作窗口微调,焦点机制微调
parent
4d71de73
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
222 additions
and
170 deletions
+222
-170
lib/action.rb
lib/action.rb
+79
-39
lib/game.rb
lib/game.rb
+1
-1
lib/game_card.rb
lib/game_card.rb
+6
-1
lib/game_event.rb
lib/game_event.rb
+3
-2
lib/nbx/action.rb
lib/nbx/action.rb
+40
-9
lib/nbx/event.rb
lib/nbx/event.rb
+5
-3
lib/nbx/nbx.rb
lib/nbx/nbx.rb
+15
-11
lib/scene.rb
lib/scene.rb
+18
-22
lib/scene_duel.rb
lib/scene_duel.rb
+9
-45
lib/scene_hall.rb
lib/scene_hall.rb
+3
-0
lib/scene_single.rb
lib/scene_single.rb
+2
-1
lib/window.rb
lib/window.rb
+2
-2
lib/window_action.rb
lib/window_action.rb
+8
-5
lib/window_cardinfo.rb
lib/window_cardinfo.rb
+1
-3
lib/window_field.rb
lib/window_field.rb
+28
-24
lib/window_list.rb
lib/window_list.rb
+1
-1
lib/window_roomchat.rb
lib/window_roomchat.rb
+1
-1
No files found.
lib/action.rb
View file @
48dcc949
#encoding: UTF-8
#encoding: UTF-8
class
Action
class
Action
@@id
=
0
attr_accessor
:from_player
,
:msg
attr_accessor
:from_player
,
:msg
attr_accessor
:id
attr_accessor
:id
def
initialize
(
from_player
=
true
,
msg
=
nil
)
def
initialize
(
from_player
=
true
,
msg
=
nil
)
@id
=
@@id
@id
=
@@id
@from_player
=
from_player
@from_player
=
from_player
@msg
=
msg
@msg
=
msg
if
@from_player
@@id
+=
1
if
@from_player
@@id
+=
1
end
end
end
def
player_field
def
player_field
@from_player
?
@@player_field
:
@@
opponent_field
@from_player
?
$game
.
player_field
:
$game
.
opponent_field
end
end
def
opponent_field
def
opponent_field
@from_player
?
@@opponent_field
:
@@player_field
@from_player
?
$game
.
opponent_field
:
$game
.
player_field
end
def
self
.
player_field
=
(
field
)
@@player_field
=
field
end
def
self
.
opponent_field
=
(
field
)
@@opponent_field
=
field
end
end
def
run
def
run
$game
.
action
self
$game
.
action
self
...
@@ -39,7 +30,7 @@ class Action
...
@@ -39,7 +30,7 @@ class Action
def
run
def
run
super
super
player_field
.
hand
=
player_field
.
deck
.
shift
(
5
)
player_field
.
hand
=
player_field
.
deck
.
shift
(
5
)
player_field
.
hand
.
each
{
|
card
|
card
.
position
=
:attack
}
#player_field.hand.each{|card|card.position = :set
}
end
end
end
end
class
FirstToGo
<
Go
;
end
class
FirstToGo
<
Go
;
end
...
@@ -81,7 +72,7 @@ class Action
...
@@ -81,7 +72,7 @@ class Action
end
end
class
Move
<
Action
class
Move
<
Action
attr_reader
:from_pos
,
:to_pos
,
:card
,
:position
attr_reader
:from_pos
,
:to_pos
,
:card
,
:position
def
initialize
(
from_player
,
from_pos
,
to_pos
,
card
,
msg
=
nil
,
position
=
:set
)
def
initialize
(
from_player
,
from_pos
,
to_pos
=
nil
,
card
=
Card
::
Unknown
,
msg
=
nil
,
position
=
nil
)
super
(
from_player
,
msg
)
super
(
from_player
,
msg
)
@from_pos
=
from_pos
@from_pos
=
from_pos
@to_pos
=
to_pos
@to_pos
=
to_pos
...
@@ -109,7 +100,7 @@ class Action
...
@@ -109,7 +100,7 @@ class Action
if
@from_pos
.
is_a?
Integer
if
@from_pos
.
is_a?
Integer
from_pos
=
@from_pos
from_pos
=
@from_pos
else
else
from_pos
=
(
@card
.
is_a?
(
Game_Card
)
?
from_field
.
index
(
@card
)
:
from_field
.
index
{
|
card
|
card
.
card
==
@card
})
or
from_field
.
index
{
|
card
|!
card
.
known?
}
from_pos
=
(
@card
.
is_a?
(
Game_Card
)
?
from_field
.
index
(
@card
)
:
from_field
.
index
{
|
card
|
card
.
card
==
@card
})
||
from_field
.
index
{
|
card
|!
card
.
known?
}
end
end
to_field
=
case
@to_pos
to_field
=
case
@to_pos
...
@@ -119,32 +110,44 @@ class Action
...
@@ -119,32 +110,44 @@ class Action
player_field
.
hand
player_field
.
hand
when
:graveyard
when
:graveyard
player_field
.
graveyard
player_field
.
graveyard
when
:deck
when
:deck
,
:deckbottom
player_field
.
deck
player_field
.
deck
when
:extra
when
:extra
player_field
.
extra
player_field
.
extra
when
:removed
when
:removed
player_field
.
removed
player_field
.
removed
end
end
if
from_pos
if
from_pos
&&
from_field
[
from_pos
]
card
=
from_field
[
from_pos
]
case
@card
if
from_field
==
player_field
.
field
when
Game_Card
from_field
[
from_pos
]
=
nil
card
=
from_field
[
from_pos
]
=
@card
else
when
nil
,
Card
::
Unknown
from_field
.
delete_at
from_pos
card
=
from_field
[
from_pos
]
when
Card
card
=
from_field
[
from_pos
]
card
.
card
=
@card
end
if
@to_pos
if
from_field
==
player_field
.
field
from_field
[
from_pos
]
=
nil
else
from_field
.
delete_at
from_pos
end
end
end
else
else
card
=
Game_Card
.
new
(
@card
)
card
=
Game_Card
.
new
(
@card
)
p
"似乎凭空产生了卡片?"
p
"似乎凭空产生了卡片?"
p
self
p
self
end
end
card
.
position
=
@position
card
.
position
=
@position
if
@position
if
@to_pos
.
is_a?
Integer
if
@to_pos
to_field
[
@to_pos
]
=
card
if
@to_pos
.
is_a?
Integer
elsif
to_field
==
player_field
.
hand
to_field
[
@to_pos
]
=
card
to_field
<<
card
elsif
@to_pos
==
:hand
or
@to_pos
==
:deckbottom
else
to_field
<<
card
to_field
.
unshift
card
else
to_field
.
unshift
card
end
end
end
super
super
end
end
...
@@ -181,7 +184,7 @@ class Action
...
@@ -181,7 +184,7 @@ class Action
end
end
class
ReturnToHand
<
Move
class
ReturnToHand
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
def
initialize
(
from_player
,
from_pos
,
card
)
super
(
from_player
,
from_pos
,
:hand
,
card
,
nil
,
:
attack
)
super
(
from_player
,
from_pos
,
:hand
,
card
,
nil
,
:
set
)
end
end
end
end
class
ReturnToDeck
<
Move
class
ReturnToDeck
<
Move
...
@@ -189,6 +192,15 @@ class Action
...
@@ -189,6 +192,15 @@ class Action
super
(
from_player
,
from_pos
,
:deck
,
card
,
nil
,
:set
)
super
(
from_player
,
from_pos
,
:deck
,
card
,
nil
,
:set
)
end
end
end
end
class
ReturnToDeckBottom
<
Move
def
initialize
(
from_player
,
from_pos
,
card
=
Card
.
find
(
nil
))
if
from_pos
==
:deck
and
card
==
Card
.
find
(
nil
)
@from_player
=
from_player
card
=
player_field
.
deck
.
first
end
super
(
from_player
,
from_pos
,
:deckbottom
,
card
,
nil
,
:set
)
end
end
class
ReturnToExtra
<
Move
class
ReturnToExtra
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
def
initialize
(
from_player
,
from_pos
,
card
)
super
(
from_player
,
from_pos
,
:extra
,
card
,
nil
,
:set
)
super
(
from_player
,
from_pos
,
:extra
,
card
,
nil
,
:set
)
...
@@ -218,7 +230,17 @@ class Action
...
@@ -218,7 +230,17 @@ class Action
class
Draw
<
Move
class
Draw
<
Move
def
initialize
(
from_player
=
true
,
msg
=
nil
)
def
initialize
(
from_player
=
true
,
msg
=
nil
)
@from_player
=
from_player
@from_player
=
from_player
super
(
from_player
,
:deck
,
:hand
,
player_field
.
deck
.
first
,
msg
,
:attack
)
super
(
from_player
,
:deck
,
:hand
,
player_field
.
deck
.
first
,
msg
,
:set
)
end
end
class
MultiDraw
<
Action
def
initialize
(
from_player
,
count
,
msg
=
nil
)
super
(
from_player
,
msg
)
@count
=
count
end
def
run
super
player_field
.
hand
+=
player_field
.
deck
.
shift
(
@count
)
end
end
end
end
class
Refresh_Field
<
Action
class
Refresh_Field
<
Action
...
@@ -241,22 +263,40 @@ class Action
...
@@ -241,22 +263,40 @@ class Action
@turn
=
turn
@turn
=
turn
end
end
end
end
class
Effect_Activate
<
Action
class
Show
<
Move
attr_reader
:from_pos
,
:card
attr_reader
:from_pos
,
:card
def
initialize
(
from_player
,
from_pos
,
card
)
def
initialize
(
from_player
,
from_pos
,
card
)
super
(
from_player
)
super
(
from_player
,
from_pos
,
nil
,
card
)
@from_pos
=
from_pos
@from_pos
=
from_pos
@card
=
card
@card
=
card
end
end
def
run
end
if
@card
.
position
==
:set
class
Effect_Activate
<
Move
if
@card
.
monster?
def
initialize
(
from_player
,
from_pos
,
card
)
@card
.
position
=
:defense
@from_player
=
from_player
if
(
0
..
10
).
include?
(
from_pos
)
if
(
6
..
10
).
include?
(
from_pos
)
&&
player_field
.
field
[
from_pos
]
&&
(
player_field
.
field
[
from_pos
].
position
==
:set
||
player_field
.
field
[
from_pos
].
position
==
:defense
)
position
=
:defense
else
else
@card
.
position
=
:attack
position
=
:attack
end
end
else
position
=
nil
end
end
super
super
(
from_player
,
from_pos
,
nil
,
card
,
nil
,
position
)
end
end
class
Unknown
<
Action
def
initialize
(
*
args
)
puts
'unkonwn action'
p
args
end
end
def
run
puts
'unkonwn action run'
end
end
def
self
.
reset
@@id
=
1
end
end
reset
end
end
\ No newline at end of file
lib/game.rb
View file @
48dcc949
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#游戏适配器的抽象类
#游戏适配器的抽象类
class
Game
class
Game
attr_reader
:users
,
:rooms
attr_reader
:users
,
:rooms
attr_accessor
:user
,
:room
attr_accessor
:user
,
:room
,
:player_field
,
:opponent_field
def
initialize
def
initialize
@users
=
[]
@users
=
[]
@rooms
=
[]
@rooms
=
[]
...
...
lib/game_card.rb
View file @
48dcc949
...
@@ -14,11 +14,16 @@ class Game_Card
...
@@ -14,11 +14,16 @@ class Game_Card
@atk
=
@card
.
atk
@atk
=
@card
.
atk
@def
=
@card
.
def
@def
=
@card
.
def
end
end
def
card
=
(
card
)
@card
=
card
@atk
=
@card
.
atk
@def
=
@card
.
def
end
def
known?
def
known?
@card
!=
Card
::
Unknown
@card
!=
Card
::
Unknown
end
end
def
image_small
def
image_small
if
@position
==
:set
if
@position
==
:set
and
!
$game
.
player_field
.
hand
.
include?
(
self
)
Card
.
find
(
nil
).
image_small
Card
.
find
(
nil
).
image_small
else
else
@card
.
image_small
@card
.
image_small
...
...
lib/game_event.rb
View file @
48dcc949
...
@@ -113,9 +113,10 @@ class Game_Event
...
@@ -113,9 +113,10 @@ class Game_Event
end
end
class
Action
<
Game_Event
class
Action
<
Game_Event
attr_reader
:action
attr_reader
:action
,
:str
def
initialize
(
action
)
def
initialize
(
action
,
str
=
Action
.
escape
)
@action
=
action
@action
=
action
@str
=
str
end
end
end
end
...
...
lib/nbx/action.rb
View file @
48dcc949
#encoding: UTF-8
#encoding: UTF-8
require_relative
'../action'
require_relative
'../action'
class
Action
class
Action
CardFilter
=
/(
<(?:\[.*?\]\[(?:.*?)\]){0,1}[\s\d]*>
|一张怪兽卡|一张魔\/陷卡)/
.
to_s
CardFilter
=
/(
(?:<){0,1}(?:\[.*?\]\[(?:.*?)\]){0,1}[\s\d]*(?:>){0,1}
|一张怪兽卡|一张魔\/陷卡)/
.
to_s
#FieldCardFilter = /(<>|<??>|<(?:(?:表攻|表守|里守)\|){0,1}\[.*?\]\[(?:.*?)\]){0,1}[\s\d]*>)/.to_s
#FieldCardFilter = /(<>|<??>|<(?:(?:表攻|表守|里守)\|){0,1}\[.*?\]\[(?:.*?)\]){0,1}[\s\d]*>)/.to_s
PosFilter
=
/((?:手卡|场上|魔陷区|怪兽区|墓地|额外牌堆|除外区|卡组顶端|\(\d+\)){1,2})/
.
to_s
PosFilter
=
/((?:手卡|
手牌|
场上|魔陷区|怪兽区|墓地|额外牌堆|除外区|卡组顶端|\(\d+\)){1,2})/
.
to_s
PositionFilter
=
/(
|
攻击表示|防守表示|里侧表示|背面守备表示)/
.
to_s
PositionFilter
=
/(攻击表示|防守表示|里侧表示|背面守备表示)/
.
to_s
PhaseFilter
=
/(抽卡`阶段|准备`阶段|主`阶段1|战斗`阶段|主`阶段2|结束`阶段)/
.
to_s
PhaseFilter
=
/(抽卡`阶段|准备`阶段|主`阶段1|战斗`阶段|主`阶段2|结束`阶段)/
.
to_s
def
self
.
parse_pos
(
pos
)
def
self
.
parse_pos
(
pos
)
if
index
=
pos
.
index
(
"("
)
if
index
=
pos
.
index
(
"("
)
...
@@ -148,7 +148,6 @@ class Action
...
@@ -148,7 +148,6 @@ class Action
str
=~
/^\[(\d+)\] (.*)▊▊▊.*?$/m
str
=~
/^\[(\d+)\] (.*)▊▊▊.*?$/m
from_player
=
false
from_player
=
false
id
=
$1
.
to_i
id
=
$1
.
to_i
$chat_window
.
add
from_player
,
"[
#{
$1
}
]
#{
$2
}
"
result
=
case
$2
result
=
case
$2
when
/^┊(.*)┊$/m
when
/^┊(.*)┊$/m
Chat
.
new
from_player
,
$1
Chat
.
new
from_player
,
$1
...
@@ -172,6 +171,12 @@ class Action
...
@@ -172,6 +171,12 @@ class Action
Reset
.
new
from_player
Reset
.
new
from_player
when
"换SIDE……"
when
"换SIDE……"
Side
.
new
from_player
Side
.
new
from_player
when
"卡组洗切"
Shuffle
.
new
from_player
when
"将顶牌放回卡组底部"
ReturnToDeckBottom
.
new
(
from_player
,
:deck
)
when
/抽取\((\d+)\)张卡/
MultiDraw
.
new
from_player
,
$1
.
to_i
when
/\[\d+年\d+月\d+日禁卡表\](?:<(.+)> ){0,1}先攻/
when
/\[\d+年\d+月\d+日禁卡表\](?:<(.+)> ){0,1}先攻/
FirstToGo
.
new
from_player
,
$1
FirstToGo
.
new
from_player
,
$1
when
/\[\d+年\d+月\d+日禁卡表\](?:<(.+)> ){0,1}后攻/
when
/\[\d+年\d+月\d+日禁卡表\](?:<(.+)> ){0,1}后攻/
...
@@ -184,12 +189,14 @@ class Action
...
@@ -184,12 +189,14 @@ class Action
Activate
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
parse_card
(
$2
)
Activate
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
parse_card
(
$2
)
when
/从
#{
PosFilter
}
~召唤
#{
CardFilter
}#{
PosFilter
}
/
when
/从
#{
PosFilter
}
~召唤
#{
CardFilter
}#{
PosFilter
}
/
Summon
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
parse_card
(
$2
),
msg
Summon
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
parse_card
(
$2
),
msg
when
/从
#{
PosFilter
}
~特殊召唤
#{
CardFilter
}#{
PosFilter
}
呈
#{
PositionFilter
}
/
when
/从
#{
PosFilter
}
~特殊召唤
#{
CardFilter
}#{
PosFilter
}
(?:呈
#{
PositionFilter
}
){0,1
}/
SpecialSummon
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
card
(
$2
),
msg
,
parse_position
(
$4
)
SpecialSummon
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
parse_card
(
$2
),
msg
,
$4
?
parse_position
(
$4
)
:
:attack
when
/从手卡~取
#{
CardFilter
}
盖到
#{
PosFilter
}
/
when
/从手卡~取
#{
CardFilter
}
盖到
#{
PosFilter
}
/
Set
.
new
from_player
,
:hand
,
parse_pos
(
$2
),
parse_card
(
$1
)
Set
.
new
from_player
,
:hand
,
parse_pos
(
$2
),
parse_card
(
$1
)
when
/将
#{
CardFilter
}
从~
#{
PosFilter
}
~送往墓地/
when
/将
#{
CardFilter
}
从~
#{
PosFilter
}
~送往墓地/
SendToGraveyard
.
new
(
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
))
SendToGraveyard
.
new
(
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
))
when
/将~
#{
PosFilter
}
~的
#{
CardFilter
}
解~放/
Tribute
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
when
/将
#{
PosFilter
}
的
#{
CardFilter
}
从游戏中除外/
when
/将
#{
PosFilter
}
的
#{
CardFilter
}
从游戏中除外/
Remove
.
new
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
)
Remove
.
new
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
)
when
/
#{
CardFilter
}
从
#{
PosFilter
}
~放回卡组顶端/
when
/
#{
CardFilter
}
从
#{
PosFilter
}
~放回卡组顶端/
...
@@ -198,15 +205,19 @@ class Action
...
@@ -198,15 +205,19 @@ class Action
ReturnToExtra
.
new
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
)
ReturnToExtra
.
new
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
)
when
/从
#{
PosFilter
}
取
#{
CardFilter
}
加入手卡/
when
/从
#{
PosFilter
}
取
#{
CardFilter
}
加入手卡/
ReturnToHand
.
new
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
)
ReturnToHand
.
new
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
)
when
/
#{
PosFilter
}#{
CardFilter
}
效果发(?:\~){0,1}动/
when
/
(?:己方){0,1}
#{
PosFilter
}#{
CardFilter
}
效果发(?:\~){0,1}动/
Effect_Activate
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
Effect_Activate
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
when
/
#{
PosFilter
}#{
CardFilter
}
(?:变|改)为
#{
PositionFilter
}
/
ChangePosition
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
),
parse_position
(
$3
))
when
/
#{
PosFilter
}#{
CardFilter
}
打开/
Flip
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
when
/
#{
PhaseFilter
}
/
when
/
#{
PhaseFilter
}
/
ChangePhase
.
new
(
from_player
,
parse_phase
(
$1
))
ChangePhase
.
new
(
from_player
,
parse_phase
(
$1
))
else
else
p
str
,
1
Unknown
.
new
str
end
end
else
else
p
str
,
2
Unknown
.
new
str
end
end
result
.
id
=
id
result
.
id
=
id
result
result
...
@@ -228,6 +239,11 @@ class Action
...
@@ -228,6 +239,11 @@ class Action
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→抽牌"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→抽牌"
end
end
end
end
class
MultiDraw
def
escape
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→抽取(
#{
@count
}
)张卡"
end
end
class
Dice
class
Dice
def
escape
def
escape
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→掷骰子,结果为
#{
@result
}
"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→掷骰子,结果为
#{
@result
}
"
...
@@ -321,6 +337,11 @@ class Action
...
@@ -321,6 +337,11 @@ class Action
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→
#{
@from_pos
==
:hand
?
"一张卡"
:
@card
.
escape
}
从
#{
pos
}
~放回卡组顶端"
#TODO:set=【一张卡】
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→
#{
@from_pos
==
:hand
?
"一张卡"
:
@card
.
escape
}
从
#{
pos
}
~放回卡组顶端"
#TODO:set=【一张卡】
end
end
end
end
class
ReturnToDeckBottom
def
escape
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→将顶牌放回卡组底部"
end
end
class
ReturnToExtra
class
ReturnToExtra
def
escape
def
escape
pos
=
case
@from_pos
pos
=
case
@from_pos
...
@@ -357,6 +378,16 @@ class Action
...
@@ -357,6 +378,16 @@ class Action
end
end
end
end
end
end
class
Show
def
escape
case
from_pos
when
0
..
10
#场上
when
Integer
"第
#{
@from_pos
-
10
}
张手牌为:
#{
@card
.
escape
}
"
end
end
end
class
Effect_Activate
class
Effect_Activate
def
escape
def
escape
pos
=
case
@from_pos
pos
=
case
@from_pos
...
...
lib/nbx/event.rb
View file @
48dcc949
...
@@ -20,7 +20,7 @@ class Game_Event
...
@@ -20,7 +20,7 @@ class Game_Event
case
info
case
info
when
/▓SetName:(.*)▓/
when
/▓SetName:(.*)▓/
NewUser
NewUser
when
/\[VerInf\]\|(.*)/
when
/\[VerInf\]
|\[LinkOK\]
\|(.*)/
VerInf
VerInf
when
/(\[☆\]开启 游戏王NetBattleX Version .*\r\n\[.*年.*月.*日禁卡表\]\r\n)▊▊▊.*/
when
/(\[☆\]开启 游戏王NetBattleX Version .*\r\n\[.*年.*月.*日禁卡表\]\r\n)▊▊▊.*/
PlayerJoin
PlayerJoin
...
@@ -40,7 +40,7 @@ class Game_Event
...
@@ -40,7 +40,7 @@ class Game_Event
class
NewUser
class
NewUser
def
self
.
parse
(
info
,
host
=
$game
.
room
.
player2
.
id
)
def
self
.
parse
(
info
,
host
=
$game
.
room
.
player2
.
id
)
username
,
need_reply
=
info
.
split
(
','
)
username
,
need_reply
=
info
.
split
(
','
)
username
=
"对手"
if
username
.
empty?
username
=
"对手"
if
username
.
nil?
or
username
.
empty?
user
=
User
.
new
(
host
,
username
)
user
=
User
.
new
(
host
,
username
)
need_reply
=
need_reply
==
"1"
need_reply
=
need_reply
==
"1"
if
need_reply
and
user
!=
$game
.
user
#忽略来自自己的回复请求
if
need_reply
and
user
!=
$game
.
user
#忽略来自自己的回复请求
...
@@ -76,7 +76,9 @@ class Game_Event
...
@@ -76,7 +76,9 @@ class Game_Event
end
end
class
Action
class
Action
def
self
.
parse
(
info
)
def
self
.
parse
(
info
)
self
.
new
::
Action
.
parse
info
info
=~
/(.*)▊▊▊.*/m
str
=
$1
||
info
self
.
new
::
Action
.
parse
(
info
),
str
end
end
end
end
class
VerInf
class
VerInf
...
...
lib/nbx/nbx.rb
View file @
48dcc949
...
@@ -39,15 +39,8 @@ class NBX < Game
...
@@ -39,15 +39,8 @@ class NBX < Game
def
host
def
host
@room
=
Room
.
new
(
@user
.
id
,
@user
.
name
,
@user
)
@room
=
Room
.
new
(
@user
.
id
,
@user
.
name
,
@user
)
Game_Event
.
push
Game_Event
::
Host
.
new
(
@room
)
Game_Event
.
push
Game_Event
::
Host
.
new
(
@room
)
#p @room
#if room.player2
# @conn_hall.send(nil, "NewRoom", room.player1.name,room.player2.name, room.player2.host)
#else
send
(
nil
,
"NewRoom"
,
@room
.
player1
.
name
)
send
(
nil
,
"NewRoom"
,
@room
.
player1
.
name
)
#end
@conn_room_server
=
TCPServer
.
new
'0.0.0.0'
,
Port
#为了照顾NBX强制IPv4
@conn_room_server
=
TCPServer
.
new
'0.0.0.0'
,
Port
#为了照顾NBX强制IPv4
@accept_room
=
Thread
.
new
{
Thread
.
start
(
@conn_room_server
.
accept
)
{
|
client
|
accept
(
client
)}
while
@conn_room_server
}
@accept_room
=
Thread
.
new
{
Thread
.
start
(
@conn_room_server
.
accept
)
{
|
client
|
accept
(
client
)}
while
@conn_room_server
}
end
end
def
action
(
action
)
def
action
(
action
)
...
@@ -83,10 +76,21 @@ class NBX < Game
...
@@ -83,10 +76,21 @@ class NBX < Game
def
refresh
def
refresh
send
(
nil
,
'NewUser'
,
@user
.
name
,
1
)
send
(
nil
,
'NewUser'
,
@user
.
name
,
1
)
end
end
def
connect
(
server
,
port
=
Port
)
def
join
(
host
,
port
=
Port
)
#@conn = TCPSocket.open(server, port)
Thread
.
new
{
#@conn.set_encoding "GBK"
@conn_room
=
TCPSocket
.
new
(
host
,
port
)
#@recv_hall = Thread.new { recv @conn.gets(RS) while @conn }
@conn_room
.
set_encoding
"GBK"
@room
=
Room
.
new
(
@user
.
id
,
@user
.
name
,
@user
)
Game_Event
.
push
Game_Event
::
Join
.
new
(
@room
)
send
(
:room
,
"[VerInf]|
#{
Version
}
"
)
send
(
:room
,
"▓SetName:
#{
@user
.
name
}
▓"
)
send
(
:room
,
"[☆]开启 游戏王NetBattleX Version 2.7.0
\r\n
[10年3月1日禁卡表]
\r\n
▊▊▊E8CB04"
)
@room
.
player2
=
User
.
new
(
host
,
"对手"
)
while
info
=
@conn_room
.
gets
(
RS
)
recv_room
(
info
)
end
@conn_room
.
close
}
#TODO: 跟accept合并
end
end
def
recv
(
info
,
addrinfo
)
def
recv
(
info
,
addrinfo
)
...
...
lib/scene.rb
View file @
48dcc949
...
@@ -62,31 +62,11 @@ class Scene
...
@@ -62,31 +62,11 @@ class Scene
def
handle
(
event
)
def
handle
(
event
)
case
event
case
event
when
Event
::
MouseMotion
when
Event
::
MouseMotion
if
@active_window
and
@active_window
.
visible
&&
!
@active_window
.
include?
(
event
.
x
,
event
.
y
)
update_active_window
(
event
.
x
,
event
.
y
)
@active_window
.
lostfocus
@active_window
=
nil
end
self
.
windows
.
reverse
.
each
do
|
window
|
if
window
.
include?
(
event
.
x
,
event
.
y
)
&&
window
.
visible
@active_window
=
window
@active_window
.
mousemoved
(
event
.
x
,
event
.
y
)
break
true
end
end
when
Event
::
MouseButtonDown
when
Event
::
MouseButtonDown
update_active_window
(
event
.
x
,
event
.
y
)
case
event
.
button
case
event
.
button
when
Mouse
::
BUTTON_LEFT
when
Mouse
::
BUTTON_LEFT
if
@active_window
and
!
@active_window
.
include?
event
.
x
,
event
.
y
@active_window
.
lostfocus
@active_window
=
nil
end
self
.
windows
.
reverse
.
each
do
|
window
|
if
@active_window
and
@active_window
.
visible
&&
!
@active_window
.
include?
(
event
.
x
,
event
.
y
)
@active_window
=
window
@active_window
.
mousemoved
(
event
.
x
,
event
.
y
)
break
end
end
@active_window
.
clicked
if
@active_window
@active_window
.
clicked
if
@active_window
when
4
when
4
@active_window
.
cursor_up
@active_window
.
cursor_up
...
@@ -108,5 +88,21 @@ class Scene
...
@@ -108,5 +88,21 @@ class Scene
def
terminate
def
terminate
#$screen.fill_rect(0,0,$screen.w, $screen.h, 0xFF000000)
#$screen.fill_rect(0,0,$screen.w, $screen.h, 0xFF000000)
end
end
def
update_active_window
(
x
,
y
)
self
.
windows
.
reverse
.
each
do
|
window
|
if
window
.
include?
(
x
,
y
)
&&
window
.
visible
if
window
!=
@active_window
@active_window
.
lostfocus
(
window
)
if
@active_window
@active_window
=
window
end
@active_window
.
mousemoved
(
x
,
y
)
return
@active_window
end
end
if
@active_window
@active_window
.
lostfocus
@active_window
=
nil
end
end
end
end
lib/scene_duel.rb
View file @
48dcc949
...
@@ -18,8 +18,6 @@ class Scene_Duel < Scene
...
@@ -18,8 +18,6 @@ class Scene_Duel < Scene
require_relative
'window_roomchat'
require_relative
'window_roomchat'
attr_reader
:cardinfo_window
attr_reader
:cardinfo_window
attr_reader
:action_window
attr_reader
:action_window
attr_reader
:player_field
attr_reader
:opponent_field
attr_reader
:player_field_window
attr_reader
:player_field_window
attr_reader
:opponent_field_window
attr_reader
:opponent_field_window
attr_reader
:fieldback_window
attr_reader
:fieldback_window
...
@@ -39,20 +37,17 @@ class Scene_Duel < Scene
...
@@ -39,20 +37,17 @@ class Scene_Duel < Scene
@phases_window
=
Window_Phases
.
new
(
124
,
357
)
@phases_window
=
Window_Phases
.
new
(
124
,
357
)
@turn_player
=
true
@turn_player
=
true
@
player_field
=
Game_Field
.
new
Deck
.
load
(
"test1.TXT"
)
$game
.
player_field
=
Game_Field
.
new
Deck
.
load
(
"test1.TXT"
)
@
opponent_field
=
Game_Field
.
new
$game
.
opponent_field
=
Game_Field
.
new
@fieldback_window
=
Window_FieldBack
.
new
(
130
,
174
)
@fieldback_window
=
Window_FieldBack
.
new
(
130
,
174
)
@player_field_window
=
Window_Field
.
new
(
4
,
398
,
@
player_field
,
true
)
@player_field_window
=
Window_Field
.
new
(
4
,
398
,
$game
.
player_field
,
true
)
@opponent_field_window
=
Window_Field
.
new
(
4
,
60
,
@
opponent_field
,
false
)
@opponent_field_window
=
Window_Field
.
new
(
4
,
60
,
$game
.
opponent_field
,
false
)
@opponent_field_window
.
angle
=
180
@opponent_field_window
.
angle
=
180
Action
.
player_field
=
@player_field
Action
.
opponent_field
=
@opponent_field
@cardinfo_window
=
Window_CardInfo
.
new
(
715
,
0
)
@cardinfo_window
=
Window_CardInfo
.
new
(
715
,
0
)
@action_window
=
Window_Action
.
new
@
player_field_window
.
action_window
=
Window_Action
.
new
@chat_window
=
Window_RoomChat
.
new
(
@cardinfo_window
.
x
,
@cardinfo_window
.
height
,
1024
-
@cardinfo_window
.
x
,
768
-
@cardinfo_window
.
height
)
@chat_window
=
Window_RoomChat
.
new
(
@cardinfo_window
.
x
,
@cardinfo_window
.
height
,
1024
-
@cardinfo_window
.
x
,
768
-
@cardinfo_window
.
height
)
super
super
#(Thread.list - [Thread.current]).each{|t|t.kill}
#(Thread.list - [Thread.current]).each{|t|t.kill}
...
@@ -66,7 +61,7 @@ class Scene_Duel < Scene
...
@@ -66,7 +61,7 @@ class Scene_Duel < Scene
@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"
,
@player_field
.
lp
,
@player_field
.
hand
.
size
,
@player_field
.
deck
.
size
,
@player_field
.
graveyard
.
size
,
@player_field
.
removed
.
size
,
@
player_field
,
1
).
run
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
else
else
@phase
=
@phases_window
.
phase
=
phase
@phase
=
@phases_window
.
phase
=
phase
@phases_window
.
refresh
@phases_window
.
refresh
...
@@ -80,38 +75,6 @@ class Scene_Duel < Scene
...
@@ -80,38 +75,6 @@ class Scene_Duel < Scene
end
end
def
handle
(
event
)
def
handle
(
event
)
case
event
case
event
when
Event
::
MouseMotion
if
@active_window
and
@active_window
.
visible
&&
!
@active_window
.
include?
(
event
.
x
,
event
.
y
)
@active_window
.
lostfocus
@active_window
=
nil
end
self
.
windows
.
reverse
.
each
do
|
window
|
if
window
.
include?
(
event
.
x
,
event
.
y
)
&&
window
.
visible
@active_window
=
window
@active_window
.
mousemoved
(
event
.
x
,
event
.
y
)
break
true
end
end
when
Event
::
MouseButtonDown
case
event
.
button
when
Mouse
::
BUTTON_LEFT
if
@active_window
and
@active_window
.
visible
&&
!
@active_window
.
include?
(
event
.
x
,
event
.
y
)
@active_window
.
lostfocus
@active_window
=
nil
end
self
.
windows
.
reverse
.
each
do
|
window
|
if
window
.
include?
(
event
.
x
,
event
.
y
)
&&
window
.
visible
@active_window
=
window
@active_window
.
mousemoved
(
event
.
x
,
event
.
y
)
break
true
end
end
@active_window
.
clicked
if
@active_window
when
4
@active_window
.
cursor_up
when
5
@active_window
.
cursor_down
end
when
Event
::
MouseButtonUp
when
Event
::
MouseButtonUp
case
event
.
button
case
event
.
button
when
Mouse
::
BUTTON_LEFT
when
Mouse
::
BUTTON_LEFT
...
@@ -124,8 +87,8 @@ class Scene_Duel < Scene
...
@@ -124,8 +87,8 @@ class Scene_Duel < Scene
end
end
end
end
when
Mouse
::
BUTTON_RIGHT
when
Mouse
::
BUTTON_RIGHT
if
@action_window
if
@
player_field_window
.
action_window
@action_window
.
next
@
player_field_window
.
action_window
.
next
end
end
end
end
when
Event
::
KeyDown
when
Event
::
KeyDown
...
@@ -153,6 +116,7 @@ class Scene_Duel < Scene
...
@@ -153,6 +116,7 @@ class Scene_Duel < Scene
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
event
.
action
.
run
event
.
action
.
run
@player_field_window
.
refresh
@player_field_window
.
refresh
@opponent_field_window
.
refresh
@opponent_field_window
.
refresh
...
...
lib/scene_hall.rb
View file @
48dcc949
...
@@ -42,6 +42,9 @@ class Scene_Hall < Scene
...
@@ -42,6 +42,9 @@ class Scene_Hall < Scene
when
Key
::
F2
when
Key
::
F2
$game
.
host
$game
.
host
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"创建房间"
,
"正在等待对手"
){}
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"创建房间"
,
"正在等待对手"
){}
when
Key
::
F3
$game
.
join
'127.0.0.1'
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入房间"
){}
when
Key
::
F5
when
Key
::
F5
if
@roomlist
.
list
and
room
=
@roomlist
.
list
.
find
{
|
room
|
room
.
player1
==
$game
.
user
or
room
.
player2
==
$game
.
user
}
if
@roomlist
.
list
and
room
=
@roomlist
.
list
.
find
{
|
room
|
room
.
player1
==
$game
.
user
or
room
.
player2
==
$game
.
user
}
$game
.
qroom
room
$game
.
qroom
room
...
...
lib/scene_single.rb
View file @
48dcc949
...
@@ -12,7 +12,8 @@ class Scene_Single < Scene
...
@@ -12,7 +12,8 @@ class Scene_Single < Scene
login
login
end
end
def
login
def
login
$game
.
login
(
ENV
[
'username'
])
username
=
$config
[
'username'
]
&&
!
$config
[
'username'
].
empty?
?
$config
[
'username'
]
:
$_ENV
[
'username'
]
$game
.
login
username
end
end
def
update
def
update
while
event
=
Game_Event
.
poll
while
event
=
Game_Event
.
poll
...
...
lib/window.rb
View file @
48dcc949
...
@@ -37,7 +37,7 @@ class Window
...
@@ -37,7 +37,7 @@ class Window
end
end
def
include?
(
x
,
y
)
def
include?
(
x
,
y
)
x
>
@x
&&
x
<
@x
+
@width
&&
y
>
@y
&&
y
<
@y
+
@height
x
>
=
@x
&&
x
<
@x
+
@width
&&
y
>=
@y
&&
y
<
@y
+
@height
end
end
def
destroy
def
destroy
@destroyed
=
true
@destroyed
=
true
...
@@ -74,7 +74,7 @@ class Window
...
@@ -74,7 +74,7 @@ class Window
def
clicked
def
clicked
#子类定义
#子类定义
end
end
def
lostfocus
def
lostfocus
(
active_window
=
nil
)
#子类定义
#子类定义
end
end
end
end
\ No newline at end of file
lib/window_action.rb
View file @
48dcc949
...
@@ -25,6 +25,7 @@ class Window_Action < Window_List
...
@@ -25,6 +25,7 @@ class Window_Action < Window_List
@list_available
=
list
.
values
@list_available
=
list
.
values
@height
=
@viewport
[
3
]
=
@list
.
size
*
WLH
+
15
*
2
@height
=
@viewport
[
3
]
=
@list
.
size
*
WLH
+
15
*
2
@item_max
=
@list
.
size
@item_max
=
@list
.
size
p
list
@index
=
@list_available
.
find_index
(
true
)
||
0
@index
=
@list_available
.
find_index
(
true
)
||
0
refresh
refresh
@visible
=
true
@visible
=
true
...
@@ -34,15 +35,14 @@ class Window_Action < Window_List
...
@@ -34,15 +35,14 @@ class Window_Action < Window_List
end
end
def
clear
(
x
=
0
,
y
=
0
,
width
=
@width
,
height
=
@height
)
def
clear
(
x
=
0
,
y
=
0
,
width
=
@width
,
height
=
@height
)
@contents
.
put
(
@up
,
0
,
0
)
@contents
.
put
(
@up
,
0
,
0
)
Surface
.
transform_draw
(
@middle
,
@contents
,
0
,
1
,(
@list
.
size
*
WLH
+
17
).
to_f
/
@middle
.
h
,
0
,
0
,
0
,
15
,
Surface
::
TRANSFORM_SAFE
)
#+17
那里,我不知道为什么需要这么做,但是如果不+ 内容和底边会有一点空白
Surface
.
transform_draw
(
@middle
,
@contents
,
0
,
1
,(
@list
.
size
*
WLH
+
20
).
to_f
/
@middle
.
h
,
0
,
0
,
0
,
15
,
Surface
::
TRANSFORM_SAFE
)
#+
那里,我不知道为什么需要这么做,但是如果不+ 内容和底边会有一点空白
@contents
.
put
(
@down
,
0
,
@height
-
15
)
@contents
.
put
(
@down
,
0
,
@height
-
15
)
end
end
def
index
=
(
index
)
def
index
=
(
index
)
if
index
if
index
and
index
>
0
and
index
<
@item_max
super
(
index
)
super
(
index
)
refresh
refresh
end
end
#p @index
end
end
def
draw_item
(
index
,
status
=
0
)
def
draw_item
(
index
,
status
=
0
)
case
status
case
status
...
@@ -63,11 +63,14 @@ class Window_Action < Window_List
...
@@ -63,11 +63,14 @@ class Window_Action < Window_List
end
end
end
end
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
self
.
index
=
(
y
-
@y
)
/
WLH
self
.
index
=
(
y
-
@y
-
15
)
/
WLH
end
end
def
clicked
def
clicked
$scene
.
player_field_window
.
clicked
$scene
.
player_field_window
.
clicked
end
end
def
lostfocus
def
lostfocus
(
active_window
=
nil
)
if
active_window
!=
$scene
.
player_field_window
$scene
.
player_field_window
.
index
=
nil
end
end
end
end
end
\ No newline at end of file
lib/window_cardinfo.rb
View file @
48dcc949
# To change this template, choose Tools | Templates
#encoding: UTF-8
# and open the template in the editor.
class
Window_CardInfo
<
Window
class
Window_CardInfo
<
Window
WLH
=
20
WLH
=
20
def
initialize
(
x
,
y
)
def
initialize
(
x
,
y
)
...
...
lib/window_field.rb
View file @
48dcc949
...
@@ -19,7 +19,7 @@ class Window_Field < Window
...
@@ -19,7 +19,7 @@ class Window_Field < Window
Hand_Pos
=
[
0
,
201
,
62
,
8
]
#手卡: x, y, width, 间距
Hand_Pos
=
[
0
,
201
,
62
,
8
]
#手卡: x, y, width, 间距
#Card_Size = [Card::CardBack.w, Card::CardBack.h]
#Card_Size = [Card::CardBack.w, Card::CardBack.h]
Card_Size
=
[
54
,
81
]
Card_Size
=
[
54
,
81
]
attr_
reade
r
:action_window
attr_
accesso
r
:action_window
def
initialize
(
x
,
y
,
field
,
player
=
true
)
def
initialize
(
x
,
y
,
field
,
player
=
true
)
@border
=
Surface
.
load
'graphics/field/border.png'
@border
=
Surface
.
load
'graphics/field/border.png'
@border_horizontal
=
Surface
.
load
'graphics/field/border_horizontal.png'
#@border.transform_surface(0x66000000,90,1,1,Surface::TRANSFORM_SAFE|Surface::TRANSFORM_AA)#FUCK!
@border_horizontal
=
Surface
.
load
'graphics/field/border_horizontal.png'
#@border.transform_surface(0x66000000,90,1,1,Surface::TRANSFORM_SAFE|Surface::TRANSFORM_AA)#FUCK!
...
@@ -32,7 +32,7 @@ class Window_Field < Window
...
@@ -32,7 +32,7 @@ class Window_Field < Window
refresh
refresh
end
end
def
refresh
def
refresh
$scene
.
fieldback_window
.
card
=
$
scene
.
player_field
.
field
[
0
]
||
$scen
e
.
opponent_field
.
field
[
0
]
rescue
nil
$scene
.
fieldback_window
.
card
=
$
game
.
player_field
.
field
[
0
]
||
$gam
e
.
opponent_field
.
field
[
0
]
rescue
nil
@items
.
clear
@items
.
clear
@cards
.
clear
@cards
.
clear
if
!
@field
.
deck
.
empty?
if
!
@field
.
deck
.
empty?
...
@@ -103,7 +103,7 @@ class Window_Field < Window
...
@@ -103,7 +103,7 @@ class Window_Field < Window
end
end
if
index
.
nil?
or
!
@items
.
has_key?
(
index
)
or
(
index
==
:deck
and
@field
.
deck
.
empty?
)
or
(
index
==
:removed
and
@field
.
removed
.
empty?
)
or
(
index
==
:extra
and
@field
.
extra
.
empty?
)
or
(
index
==
:graveyard
and
@field
.
graveyard
.
empty?
)
if
index
.
nil?
or
!
@items
.
has_key?
(
index
)
or
(
index
==
:deck
and
@field
.
deck
.
empty?
)
or
(
index
==
:removed
and
@field
.
removed
.
empty?
)
or
(
index
==
:extra
and
@field
.
extra
.
empty?
)
or
(
index
==
:graveyard
and
@field
.
graveyard
.
empty?
)
@index
=
nil
@index
=
nil
$scene
.
action_window
.
list
=
nil
@action_window
.
list
=
nil
if
@action_window
else
else
@index
=
index
@index
=
index
draw_item
(
@index
,
1
)
draw_item
(
@index
,
1
)
...
@@ -123,14 +123,14 @@ class Window_Field < Window
...
@@ -123,14 +123,14 @@ class Window_Field < Window
}
}
when
:extra
when
:extra
@card
=
@field
.
extra
.
first
@card
=
@field
.
extra
.
first
@action_names
=
{
"特殊召唤"
=>
true
,
@action_names
=
{
"特殊召唤"
=>
!
@field
.
empty_field
(
@card
).
nil?
,
"效果发动"
=>
true
,
"效果发动"
=>
true
,
"从游戏中除外"
=>
true
,
"从游戏中除外"
=>
true
,
"送入墓地"
=>
true
"送入墓地"
=>
true
}
}
when
:removed
when
:removed
@card
=
@field
.
removed
.
first
@card
=
@field
.
removed
.
first
@action_names
=
{
"特殊召唤"
=>
@card
.
monster?
,
@action_names
=
{
"特殊召唤"
=>
@card
.
monster?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"效果发动"
=>
true
,
"效果发动"
=>
true
,
"加入手卡"
=>
true
,
"加入手卡"
=>
true
,
"返回卡组"
=>
true
,
"返回卡组"
=>
true
,
...
@@ -138,7 +138,7 @@ class Window_Field < Window
...
@@ -138,7 +138,7 @@ class Window_Field < Window
}
}
when
:graveyard
when
:graveyard
@card
=
@field
.
graveyard
.
first
@card
=
@field
.
graveyard
.
first
@action_names
=
{
"特殊召唤"
=>
@card
.
monster?
,
@action_names
=
{
"特殊召唤"
=>
@card
.
monster?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"效果发动"
=>
true
,
"效果发动"
=>
true
,
"加入手卡"
=>
true
,
"加入手卡"
=>
true
,
"返回卡组"
=>
true
,
"返回卡组"
=>
true
,
...
@@ -171,20 +171,22 @@ class Window_Field < Window
...
@@ -171,20 +171,22 @@ class Window_Field < Window
}
}
when
Integer
#手卡
when
Integer
#手卡
@card
=
@field
.
hand
[
@index
-
11
]
@card
=
@field
.
hand
[
@index
-
11
]
@action_names
=
{
"召唤"
=>
@card
.
monster?
,
@action_names
=
{
"召唤"
=>
@card
.
monster?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"特殊召唤"
=>
false
,
"特殊召唤"
=>
false
,
"发动"
=>
@card
.
spell?
,
"发动"
=>
@card
.
spell?
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"放置到场上"
=>
true
,
"放置到场上"
=>
true
&&
!
@field
.
empty_field
(
@card
).
nil?
,
"放回卡组顶端"
=>
true
,
"放回卡组顶端"
=>
true
,
"送入墓地"
=>
true
,
"送入墓地"
=>
true
,
"从游戏中除外"
=>
true
,
"从游戏中除外"
=>
true
,
"效果发动"
=>
true
"效果发动"
=>
true
}
}
end
end
$scene
.
action_window
.
list
=
@action_names
if
@action_window
@action_window
.
list
=
@action_names
@action_window
.
x
=
@x
+
@items
[
@index
][
0
]
-
(
@action_window
.
width
-
@items
[
@index
][
2
])
/
2
@action_window
.
y
=
@y
+
@items
[
@index
][
1
]
-
@action_window
.
height
end
$scene
.
cardinfo_window
.
card
=
@card
if
@card
.
known?
$scene
.
cardinfo_window
.
card
=
@card
if
@card
.
known?
$scene
.
action_window
.
x
=
@x
+
@items
[
@index
][
0
]
-
(
$scene
.
action_window
.
width
-
@items
[
@index
][
2
])
/
2
$scene
.
action_window
.
y
=
@y
+
@items
[
@index
][
1
]
-
$scene
.
action_window
.
viewport
[
3
]
#height
end
end
end
end
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
...
@@ -195,10 +197,10 @@ class Window_Field < Window
...
@@ -195,10 +197,10 @@ class Window_Field < Window
end
end
end
end
def
cursor_up
def
cursor_up
$scene
.
action_window
.
cursor_up
@
action_window
.
cursor_up
end
end
def
cursor_down
def
cursor_down
$scene
.
action_window
.
cursor_down
@
action_window
.
cursor_down
end
end
def
cursor_left
def
cursor_left
#self.index = @index ? (@index - 1) % [@list.size, @item_max].min : 0
#self.index = @index ? (@index - 1) % [@list.size, @item_max].min : 0
...
@@ -206,14 +208,16 @@ class Window_Field < Window
...
@@ -206,14 +208,16 @@ class Window_Field < Window
def
cursor_right
def
cursor_right
#self.index = @index ? (@index + 1) % [@list.size, @item_max].min : 0
#self.index = @index ? (@index + 1) % [@list.size, @item_max].min : 0
end
end
def
lostfocus
def
lostfocus
(
active_window
=
nil
)
self
.
index
=
nil
if
active_window
!=
@action_window
self
.
index
=
nil
end
end
end
def
clicked
def
clicked
return
if
!
$scene
.
action_window
.
visible
return
if
!
@player
||
@index
.
nil?
case
@index
case
@index
when
:deck
when
:deck
case
$scene
.
action_window
.
index
case
@
action_window
.
index
when
0
when
0
Action
::
Draw
.
new
(
true
).
run
Action
::
Draw
.
new
(
true
).
run
when
1
when
1
...
@@ -237,7 +241,7 @@ class Window_Field < Window
...
@@ -237,7 +241,7 @@ class Window_Field < Window
p
"未实现"
p
"未实现"
end
end
when
:extra
when
:extra
case
$scene
.
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
).
run
...
@@ -252,7 +256,7 @@ class Window_Field < Window
...
@@ -252,7 +256,7 @@ class Window_Field < Window
Action
::
SendToGraveyard
.
new
(
true
,
:extra
,
@card
).
run
Action
::
SendToGraveyard
.
new
(
true
,
:extra
,
@card
).
run
end
end
when
:removed
when
:removed
case
$scene
.
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
).
run
...
@@ -269,7 +273,7 @@ class Window_Field < Window
...
@@ -269,7 +273,7 @@ class Window_Field < Window
Action
::
SendToGraveyard
.
new
(
true
,
:removed
,
@card
).
run
Action
::
SendToGraveyard
.
new
(
true
,
:removed
,
@card
).
run
end
end
when
:graveyard
when
:graveyard
case
$scene
.
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
).
run
...
@@ -286,7 +290,7 @@ class Window_Field < Window
...
@@ -286,7 +290,7 @@ class Window_Field < Window
Action
::
Remove
.
new
(
true
,
:graveyard
,
@card
).
run
Action
::
Remove
.
new
(
true
,
:graveyard
,
@card
).
run
end
end
when
0
..
5
#后场
when
0
..
5
#后场
case
$scene
.
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
).
run
when
1
#返回卡组
when
1
#返回卡组
...
@@ -301,7 +305,7 @@ class Window_Field < Window
...
@@ -301,7 +305,7 @@ class Window_Field < Window
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:set
).
run
Action
::
ChangePosition
.
new
(
true
,
@index
,
@card
,
:set
).
run
end
end
when
6
..
10
#前场
when
6
..
10
#前场
case
$scene
.
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
).
run
when
1
when
1
...
@@ -328,7 +332,7 @@ class Window_Field < Window
...
@@ -328,7 +332,7 @@ class Window_Field < Window
Action
::
ReturnToHand
.
new
(
true
,
@index
,
@card
).
run
Action
::
ReturnToHand
.
new
(
true
,
@index
,
@card
).
run
end
end
when
Integer
#手卡
when
Integer
#手卡
case
$scene
.
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
).
run
...
...
lib/window_list.rb
View file @
48dcc949
...
@@ -70,7 +70,7 @@ class Window_List < Window
...
@@ -70,7 +70,7 @@ class Window_List < Window
#return unless include?(x,y)
#return unless include?(x,y)
#self.index = (y - @y) / @single_height
#self.index = (y - @y) / @single_height
end
end
def
lostfocus
def
lostfocus
(
active_window
=
nil
)
self
.
index
=
nil
self
.
index
=
nil
end
end
def
clicked
def
clicked
...
...
lib/window_roomchat.rb
View file @
48dcc949
...
@@ -22,7 +22,7 @@ class Window_RoomChat < Window
...
@@ -22,7 +22,7 @@ class Window_RoomChat < Window
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x99FFFFFF
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x99FFFFFF
)
@list
.
last
(
7
).
each_with_index
do
|
chat
,
index
|
@list
.
last
(
7
).
each_with_index
do
|
chat
,
index
|
player
,
content
=
chat
player
,
content
=
chat
@font
.
draw_blended_utf8
(
@contents
,
content
,
0
,
index
*
WLH
,
*
(
player
?
Player_Color
:
Opponent_Color
))
@font
.
draw_blended_utf8
(
@contents
,
content
.
empty?
?
" "
:
content
,
0
,
index
*
WLH
,
*
(
player
?
Player_Color
:
Opponent_Color
))
end
end
end
end
end
end
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