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
83cdb5a8
Commit
83cdb5a8
authored
Nov 19, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卡片操作
parent
2719711f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
103 additions
and
10 deletions
+103
-10
lib/action.rb
lib/action.rb
+16
-3
lib/card.rb
lib/card.rb
+6
-0
lib/game_field.rb
lib/game_field.rb
+21
-0
lib/iduel.rb
lib/iduel.rb
+3
-0
lib/iduel_action.rb
lib/iduel_action.rb
+20
-0
lib/scene_duel.rb
lib/scene_duel.rb
+4
-1
lib/window_action.rb
lib/window_action.rb
+3
-0
lib/window_field.rb
lib/window_field.rb
+30
-6
No files found.
lib/action.rb
View file @
83cdb5a8
...
@@ -88,6 +88,7 @@ class Action
...
@@ -88,6 +88,7 @@ class Action
@position
=
position
@position
=
position
end
end
def
run
def
run
p
1
from_field
=
case
@from_pos
from_field
=
case
@from_pos
when
Integer
when
Integer
player_field
.
field
player_field
.
field
...
@@ -151,9 +152,21 @@ class Action
...
@@ -151,9 +152,21 @@ class Action
super
(
from_player
,
from_pos
,
to_pos
,
card
,
nil
,
:set
)
super
(
from_player
,
from_pos
,
to_pos
,
card
,
nil
,
:set
)
end
end
end
end
class
Activate
<
Move
;
end
class
Activate
<
Move
class
Summon
<
Move
;
end
def
initialize
(
from_player
,
from_pos
,
to_pos
,
card
)
class
SpecialSummon
<
Move
;
end
super
(
from_player
,
from_pos
,
to_pos
,
card
,
nil
,
:attack
)
end
end
class
Summon
<
Move
def
initialize
(
from_player
,
from_pos
,
to_pos
,
card
)
super
(
from_player
,
from_pos
,
to_pos
,
card
,
nil
,
:attack
)
end
end
class
SpecialSummon
<
Move
def
initialize
(
from_player
,
from_pos
,
to_pos
,
card
,
position
=
:attack
)
super
(
from_player
,
from_pos
,
to_pos
,
card
,
nil
,
position
)
end
end
class
SendToGraveyard
<
Move
class
SendToGraveyard
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
def
initialize
(
from_player
,
from_pos
,
card
)
super
(
from_player
,
from_pos
,
card
,
:graveyard
)
super
(
from_player
,
from_pos
,
card
,
:graveyard
)
...
...
lib/card.rb
View file @
83cdb5a8
...
@@ -159,4 +159,10 @@ attr_accessor :tokens
...
@@ -159,4 +159,10 @@ attr_accessor :tokens
def
monster?
def
monster?
!
@attribute
.
nil?
!
@attribute
.
nil?
end
end
def
trap?
[:
通常陷阱
,
:
反击陷阱
,
:
永续陷阱
].
include?
card_type
end
def
spell?
[:
通常魔法
,
:
速攻魔法
,
:
装备魔法
,
:
场地魔法
,
:
仪式魔法
,
:
永续魔法
].
include?
card_type
end
end
end
\ No newline at end of file
lib/game_field.rb
View file @
83cdb5a8
...
@@ -38,4 +38,25 @@ class Game_Field
...
@@ -38,4 +38,25 @@ class Game_Field
@graveyard
=
[]
@graveyard
=
[]
@removed
=
[]
@removed
=
[]
end
end
def
empty_monster_field
[
8
,
7
,
9
,
6
,
10
].
each
do
|
pos
|
return
pos
if
@field
[
pos
].
nil?
end
return
end
def
empty_spelltrap_field
[
3
,
2
,
4
,
1
,
5
].
each
do
|
pos
|
return
pos
if
@field
[
pos
].
nil?
end
return
end
def
empty_field
(
card
)
if
card
.
monster?
empty_monster_field
elsif
card
.
card_type
==
:
场地魔法
@field
[
0
].
nil?
?
0
:
nil
else
empty_spelltrap_field
end
end
end
end
\ No newline at end of file
lib/iduel.rb
View file @
83cdb5a8
...
@@ -62,6 +62,9 @@ class Iduel
...
@@ -62,6 +62,9 @@ class Iduel
end
end
def
action
(
action
)
def
action
(
action
)
send
(
2
,
"
#{
checknum
(
"RMSG"
,
@session
)
}
@
#{
@key
}
"
,
"
#{
action
.
escape
}
▊▊▊000000"
)
#TODO:iduel校验字串
send
(
2
,
"
#{
checknum
(
"RMSG"
,
@session
)
}
@
#{
@key
}
"
,
"
#{
action
.
escape
}
▊▊▊000000"
)
#TODO:iduel校验字串
end
end
def
host
(
name
,
password
=
""
,
lv
=
0
,
color
=
0
)
def
host
(
name
,
password
=
""
,
lv
=
0
,
color
=
0
)
send
(
6
,
@key
,
name
,
password
,
checknum
(
"JOINROOMMSG"
,
@session
+
name
+
password
+
"0"
),
0
,
color
,
lv
,
0
,
nil
,
nil
)
#TODO:v.ak, v.al
send
(
6
,
@key
,
name
,
password
,
checknum
(
"JOINROOMMSG"
,
@session
+
name
+
password
+
"0"
),
0
,
color
,
lv
,
0
,
nil
,
nil
)
#TODO:v.ak, v.al
...
...
lib/iduel_action.rb
View file @
83cdb5a8
...
@@ -232,6 +232,26 @@ class Action
...
@@ -232,6 +232,26 @@ class Action
"[
#{
@id
}
] ◎→卡组洗切"
"[
#{
@id
}
] ◎→卡组洗切"
end
end
end
end
class
Set
def
escape
"[
#{
@id
}
] ◎→从手卡~取一张
#{
@card
.
monster?
?
"怪兽卡"
:
"魔/陷卡"
}
盖到场上(
#{
@to_pos
}
)"
end
end
class
Summon
def
escape
"[
#{
@id
}
] ◎→从手卡~召唤
#{
@card
.
escape
}
(
#{
@to_pos
}
)"
end
end
class
SpecialSummon
def
escape
"[
#{
@id
}
] ◎→从手卡~特殊召唤
#{
@card
.
escape
}
(
#{
@to_pos
}
)呈守备表示"
end
end
class
Activate
def
escape
"[
#{
@id
}
] ◎→从手卡~发动
#{
@card
.
escape
}
(
#{
@to_pos
}
)"
end
end
end
end
...
...
lib/scene_duel.rb
View file @
83cdb5a8
...
@@ -17,7 +17,7 @@ class Scene_Duel < Scene
...
@@ -17,7 +17,7 @@ class Scene_Duel < Scene
attr_reader
:cardinfo_window
attr_reader
:cardinfo_window
attr_reader
:action_window
attr_reader
:action_window
attr_reader
:player_field_window
def
initialize
(
room
)
def
initialize
(
room
)
super
()
super
()
@room
=
room
@room
=
room
...
@@ -122,12 +122,15 @@ class Scene_Duel < Scene
...
@@ -122,12 +122,15 @@ class Scene_Duel < Scene
case
event
.
sym
case
event
.
sym
when
Key
::
F1
when
Key
::
F1
Action
::
Shuffle
.
new
.
run
Action
::
Shuffle
.
new
.
run
@player_field_window
.
refresh
when
Key
::
F2
when
Key
::
F2
first_to_go
first_to_go
@player_field_window
.
refresh
when
Key
::
F3
when
Key
::
F3
Action
::
Dice
.
new
(
true
).
run
Action
::
Dice
.
new
(
true
).
run
when
Key
::
F5
when
Key
::
F5
reset
reset
@player_field_window
.
refresh
end
end
else
else
super
super
...
...
lib/window_action.rb
View file @
83cdb5a8
...
@@ -55,6 +55,9 @@ class Window_Action < Window_List
...
@@ -55,6 +55,9 @@ class Window_Action < Window_List
def
mousemoved
(
x
,
y
)
def
mousemoved
(
x
,
y
)
self
.
index
=
(
y
-
@y
)
/
WLH
self
.
index
=
(
y
-
@y
)
/
WLH
end
end
def
clicked
$scene
.
player_field_window
.
clicked
end
def
lostfocus
def
lostfocus
end
end
end
end
\ No newline at end of file
lib/window_field.rb
View file @
83cdb5a8
...
@@ -147,10 +147,10 @@ class Window_Field < Window
...
@@ -147,10 +147,10 @@ class Window_Field < Window
}
}
when
Integer
#手卡
when
Integer
#手卡
@index_card
=
@field
.
hand
[
@index
-
11
]
@index_card
=
@field
.
hand
[
@index
-
11
]
@action_names
=
{
"
放置到场上"
=>
true
,
@action_names
=
{
"
召唤"
=>
@index_card
.
monster?
,
"
召唤"
=>
@index_card
.
monster?
,
"
特殊召唤"
=>
false
,
"发动"
=>
!
@index_card
.
monster
?
,
"发动"
=>
@index_card
.
spell
?
,
"
特殊召唤
"
=>
true
,
"
放置到场上
"
=>
true
,
"放回卡组顶端"
=>
true
,
"放回卡组顶端"
=>
true
,
"送入墓地"
=>
true
,
"送入墓地"
=>
true
,
"从游戏中除外"
=>
true
,
"从游戏中除外"
=>
true
,
...
@@ -197,10 +197,34 @@ class Window_Field < Window
...
@@ -197,10 +197,34 @@ class Window_Field < Window
#场上
#场上
when
Integer
#手卡
when
Integer
#手卡
case
$scene
.
action_window
.
index
case
$scene
.
action_window
.
index
when
0
when
0
#召唤
Action
::
Set
.
new
(
true
,
:hand
,
6
,
@index_card
)
if
pos
=
@field
.
empty_field
(
@index_card
)
Action
::
Summon
.
new
(
true
,
:hand
,
pos
,
@index_card
).
run
else
p
"场位已满"
end
when
1
#特殊召唤
if
pos
=
@field
.
empty_field
(
@index_card
)
Action
::
SpecialSummon
.
new
(
true
,
:hand
,
pos
,
@index_card
,
:attack
).
run
else
p
"场位已满"
end
when
2
#发动
if
pos
=
@field
.
empty_field
(
@index_card
)
Action
::
Activate
.
new
(
true
,
:hand
,
pos
,
@index_card
).
run
else
p
"场位已满"
end
when
3
#放置
if
pos
=
@field
.
empty_field
(
@index_card
)
Action
::
Set
.
new
(
true
,
:hand
,
pos
,
@index_card
).
run
else
p
"场位已满"
end
end
end
end
end
@index
=
nil
refresh
refresh
mousemoved
(
Mouse
.
state
[
0
],
Mouse
.
state
[
1
])
end
end
end
end
\ No newline at end of file
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