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
a79aa886
Commit
a79aa886
authored
Nov 21, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Game_Card强化,表示形式初步
parent
82f8b9d2
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
95 additions
and
76 deletions
+95
-76
clean.cmd
clean.cmd
+2
-1
graphics/field/border_horizontal.png
graphics/field/border_horizontal.png
+0
-0
lib/action.rb
lib/action.rb
+38
-24
lib/game_card.rb
lib/game_card.rb
+23
-9
lib/game_field.rb
lib/game_field.rb
+8
-7
lib/scene.rb
lib/scene.rb
+7
-1
lib/scene_duel.rb
lib/scene_duel.rb
+2
-0
lib/window.rb
lib/window.rb
+1
-15
lib/window_chat.rb
lib/window_chat.rb
+1
-1
lib/window_field.rb
lib/window_field.rb
+13
-15
log.txt
log.txt
+0
-3
No files found.
clean.cmd
View file @
a79aa886
cd
/d
%~dp0
cd
/d
%~dp0
del
graphics
\avatars\
*
_
*
.png
del
graphics
\avatars\
*
_
*
.png
del
Thumbs
.db
/s /F /A
:S
del
Thumbs
.db
/s /F /A
:S
del
fonts
\
*
_STOP.
*
del
fonts
\
*
_STOP.
*
\ No newline at end of file
del
log
.txt
\ No newline at end of file
graphics/field/border_horizontal.png
0 → 100644
View file @
a79aa886
This diff was suppressed by a .gitattributes entry.
lib/action.rb
View file @
a79aa886
...
@@ -25,20 +25,20 @@ class Action
...
@@ -25,20 +25,20 @@ class Action
def
run
def
run
#子类定义
#子类定义
end
end
class
Reset
<
Action
;
end
class
Reset
<
Action
class
Draw
<
Action
def
run
def
run
player_field
.
hand
<<
player_field
.
deck
.
shif
t
player_field
.
rese
t
super
super
end
end
end
end
class
Deck
<
Action
;
end
class
Deck
<
Action
;
end
class
Side
<
Deck
;
end
class
Side
<
Deck
;
end
class
Go
<
Action
class
Go
<
Reset
def
run
def
run
player_field
.
deck
.
shuffle!
player_field
.
hand
=
player_field
.
deck
.
shift
(
5
)
super
super
player_field
.
hand
=
player_field
.
deck
.
shift
(
5
)
player_field
.
hand
.
each
{
|
card
|
card
.
position
=
:attack
}
end
end
end
end
class
FirstToGo
<
Go
;
end
class
FirstToGo
<
Go
;
end
...
@@ -80,7 +80,7 @@ class Action
...
@@ -80,7 +80,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
=
:
attack
)
def
initialize
(
from_player
,
from_pos
,
to_pos
,
card
,
msg
=
nil
,
position
=
:
set
)
super
(
from_player
,
msg
)
super
(
from_player
,
msg
)
@from_pos
=
from_pos
@from_pos
=
from_pos
@to_pos
=
to_pos
@to_pos
=
to_pos
...
@@ -104,18 +104,13 @@ class Action
...
@@ -104,18 +104,13 @@ class Action
when
:removed
when
:removed
player_field
.
removed
player_field
.
removed
end
end
if
@from_pos
.
is_a?
Integer
if
@from_pos
.
is_a?
Integer
from_pos
=
@from_pos
from_pos
=
@from_pos
else
else
from_pos
=
from_field
.
index
(
@card
)
||
from_field
.
index
(
Card
.
find
(
nil
))
from_pos
=
@card
.
is_a?
(
Game_Card
)
?
from_field
.
index
(
@card
)
:
from_field
.
index
{
|
card
|
card
.
card
==
@card
.
card
}
or
from_field
.
index
{
|
card
|!
card
.
known?
}
end
if
from_pos
if
from_field
==
player_field
.
field
from_field
[
from_pos
]
=
nil
else
from_field
.
delete_at
from_pos
end
end
end
to_field
=
case
@to_pos
to_field
=
case
@to_pos
when
Integer
when
Integer
player_field
.
field
player_field
.
field
...
@@ -130,12 +125,25 @@ class Action
...
@@ -130,12 +125,25 @@ class Action
when
:removed
when
:removed
player_field
.
removed
player_field
.
removed
end
end
if
from_pos
card
=
from_field
[
from_pos
]
if
from_field
==
player_field
.
field
from_field
[
from_pos
]
=
nil
else
from_field
.
delete_at
from_pos
end
else
card
=
Game_Card
.
new
(
@card
)
p
"似乎凭空产生了卡片?"
p
self
end
card
.
position
=
@position
if
@to_pos
.
is_a?
Integer
if
@to_pos
.
is_a?
Integer
to_field
[
@to_pos
]
=
@
card
to_field
[
@to_pos
]
=
card
#elsif to_field == player_field.fiel
d
elsif
to_field
==
player_field
.
han
d
# to_pos = from_field.index(nil) || 11
to_field
<<
card
else
else
to_field
.
unshift
@
card
to_field
.
unshift
card
end
end
super
super
end
end
...
@@ -162,27 +170,27 @@ class Action
...
@@ -162,27 +170,27 @@ class Action
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
,
:graveyard
,
card
)
super
(
from_player
,
from_pos
,
:graveyard
,
card
,
nil
,
:attack
)
end
end
end
end
class
Remove
<
Move
class
Remove
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
def
initialize
(
from_player
,
from_pos
,
card
)
super
(
from_player
,
from_pos
,
:removed
,
card
)
super
(
from_player
,
from_pos
,
:removed
,
card
,
:attack
)
end
end
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
)
super
(
from_player
,
from_pos
,
:hand
,
card
,
:attack
)
end
end
end
end
class
ReturnToDeck
<
Move
class
ReturnToDeck
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
def
initialize
(
from_player
,
from_pos
,
card
)
super
(
from_player
,
from_pos
,
:deck
,
card
)
super
(
from_player
,
from_pos
,
:deck
,
card
,
:set
)
end
end
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
)
super
(
from_player
,
from_pos
,
:extra
,
card
,
:set
)
end
end
end
end
class
Control
<
Move
class
Control
<
Move
...
@@ -198,6 +206,12 @@ class Action
...
@@ -198,6 +206,12 @@ class Action
end
end
class
FlipSummon
<
Flip
class
FlipSummon
<
Flip
end
end
class
Draw
<
Move
def
initialize
(
from_player
=
true
,
msg
=
nil
)
@from_player
=
from_player
super
(
from_player
,
:deck
,
:hand
,
player_field
.
deck
.
first
,
msg
,
:attack
)
end
end
class
Refresh_Field
<
Action
class
Refresh_Field
<
Action
attr_reader
:lp
,
:hand_count
,
:deck_count
,
:graveyard_count
,
:removed_count
,
:field
attr_reader
:lp
,
:hand_count
,
:deck_count
,
:graveyard_count
,
:removed_count
,
:field
def
initialize
(
from_player
,
msg
,
lp
,
hand_count
,
deck_count
,
graveyard_count
,
removed_count
,
field
)
def
initialize
(
from_player
,
msg
,
lp
,
hand_count
,
deck_count
,
graveyard_count
,
removed_count
,
field
)
...
...
lib/game_card.rb
View file @
a79aa886
class
Game_Card
<
Card
#encoding: UTF-8
#attr_reader :card
class
Game_Card
attr_accessor
:position
attr_accessor
:card
,
:position
#attack|defense|set,
#def initialize(card)
@@count
=
0
# @card = card
def
initialize
(
card
=
nil
)
#end
@@count
+=
1
#def method_missing(method, *args)
puts
"创建活动卡片<
#{
card
?
card
.
name
:
'??'
}
>,共计
#{
@@count
}
张"
# @card.send(method, *args)
@card
=
card
||
Card
.
find
(
nil
)
#end
@position
=
:set
end
def
known?
true
end
def
image_small
if
@position
==
:set
Card
.
find
(
nil
).
image_small
else
@card
.
image_small
end
end
def
method_missing
(
method
,
*
args
)
@card
.
send
(
method
,
*
args
)
end
end
end
\ No newline at end of file
lib/game_field.rb
View file @
a79aa886
...
@@ -25,19 +25,20 @@ class Game_Field
...
@@ -25,19 +25,20 @@ class Game_Field
attr_accessor
:removed
attr_accessor
:removed
def
initialize
(
deck
=
nil
)
def
initialize
(
deck
=
nil
)
@deck_original
=
deck
||
Deck
.
new
(
Array
.
new
(
60
,
Card
.
find
(
nil
)),
Array
.
new
(
15
,
Card
.
find
(
nil
)))
reset
end
def
reset
@lp
=
8000
@lp
=
8000
if
deck
@deck
=
@deck_original
.
main
.
collect
{
|
card
|
Game_Card
.
new
(
card
)}.
shuffle
@deck
=
deck
.
main
@extra
=
@deck_original
.
extra
.
collect
{
|
card
|
Game_Card
.
new
(
card
)}
@extra
=
deck
.
extra
else
@deck
=
Array
.
new
(
60
,
Card
.
find
(
nil
))
@extra
=
Array
.
new
(
15
,
Card
.
find
(
nil
))
end
@field
=
Array
.
new
(
11
)
@field
=
Array
.
new
(
11
)
@hand
=
[]
@hand
=
[]
@graveyard
=
[]
@graveyard
=
[]
@removed
=
[]
@removed
=
[]
end
end
def
empty_monster_field
def
empty_monster_field
[
8
,
7
,
9
,
6
,
10
].
each
do
|
pos
|
[
8
,
7
,
9
,
6
,
10
].
each
do
|
pos
|
return
pos
if
@field
[
pos
].
nil?
return
pos
if
@field
[
pos
].
nil?
...
...
lib/scene.rb
View file @
a79aa886
...
@@ -57,7 +57,13 @@ class Scene
...
@@ -57,7 +57,13 @@ class Scene
#@fpscount += 1
#@fpscount += 1
$screen
.
put
(
@background
,
0
,
0
)
$screen
.
put
(
@background
,
0
,
0
)
@windows
.
each
do
|
window
|
@windows
.
each
do
|
window
|
Surface
.
blit
(
window
.
contents
,
*
window
.
viewport
,
$screen
,
window
.
x
,
window
.
y
)
if
window
.
contents
&&
window
.
visible
if
window
.
angle
.
zero?
Surface
.
blit
(
window
.
contents
,
*
window
.
viewport
,
$screen
,
window
.
x
,
window
.
y
)
if
window
.
contents
&&
window
.
visible
else
contents
=
window
.
contents
.
transform_surface
(
0x66000000
,
180
,
1
,
1
,
0
)
Surface
.
blit
(
contents
,
*
window
.
viewport
,
$screen
,
window
.
x
,
window
.
y
)
if
window
.
contents
&&
window
.
visible
#Surface.transform_blit(window.contents,$screen,0,1,1,100,100,100,100,Surface::TRANSFORM_AA)#,0,0)
end
#$screen.put(window.contents, window.x, window.y) if window.contents && window.visible
#$screen.put(window.contents, window.x, window.y) if window.contents && window.visible
end
end
$screen
.
update_rect
(
0
,
0
,
0
,
0
)
$screen
.
update_rect
(
0
,
0
,
0
,
0
)
...
...
lib/scene_duel.rb
View file @
a79aa886
...
@@ -46,6 +46,8 @@ class Scene_Duel < Scene
...
@@ -46,6 +46,8 @@ class Scene_Duel < Scene
@player_field_window
=
Window_Field
.
new
(
4
,
398
,
@player_field
,
true
)
@player_field_window
=
Window_Field
.
new
(
4
,
398
,
@player_field
,
true
)
@opponent_field_window
=
Window_Field
.
new
(
4
,
60
,
@opponent_field
,
false
)
@opponent_field_window
=
Window_Field
.
new
(
4
,
60
,
@opponent_field
,
false
)
@opponent_field_window
.
angle
=
180
Action
.
player_field
=
@player_field
Action
.
player_field
=
@player_field
Action
.
opponent_field
=
@opponent_field
Action
.
opponent_field
=
@opponent_field
...
...
lib/window.rb
View file @
a79aa886
...
@@ -8,22 +8,8 @@ class Window
...
@@ -8,22 +8,8 @@ class Window
@width
=
width
@width
=
width
@height
=
height
@height
=
height
@visible
=
true
@visible
=
true
@angle
=
0
@viewport
=
[
0
,
0
,
@width
,
@height
]
@viewport
=
[
0
,
0
,
@width
,
@height
]
big_endian
=
([
1
].
pack
(
"N"
)
==
[
1
].
pack
(
"L"
))
=begin
if big_endian
rmask = 0xff000000
gmask = 0x00ff0000
bmask = 0x0000ff00
amask = 0x000000ff
else
rmask = 0x000000ff
gmask = 0x0000ff00
bmask = 0x00ff0000
amask = 0xff000000
end
#p rmask, gmask, bmask, amask
=end
amask
=
0xff000000
amask
=
0xff000000
rmask
=
0x00ff0000
rmask
=
0x00ff0000
gmask
=
0x0000ff00
gmask
=
0x0000ff00
...
...
lib/window_chat.rb
View file @
a79aa886
...
@@ -21,7 +21,7 @@ class Window_Chat < Window
...
@@ -21,7 +21,7 @@ class Window_Chat < Window
refresh
refresh
end
end
def
refresh
def
refresh
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x
FF
FFFFFF
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x
66
FFFFFF
)
@list
.
last
(
7
).
each_with_index
do
|
chat
,
index
|
@list
.
last
(
7
).
each_with_index
do
|
chat
,
index
|
user
,
content
=
*
chat
user
,
content
=
*
chat
@font
.
draw_blended_utf8
(
@contents
,
user
.
name
,
0
,
index
*
WLH
,
*
User_Color
)
@font
.
draw_blended_utf8
(
@contents
,
user
.
name
,
0
,
index
*
WLH
,
*
User_Color
)
...
...
lib/window_field.rb
View file @
a79aa886
...
@@ -22,6 +22,7 @@ class Window_Field < Window
...
@@ -22,6 +22,7 @@ class Window_Field < Window
attr_reader
:action_window
attr_reader
: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!
super
(
x
,
y
,
711
,
282
)
super
(
x
,
y
,
711
,
282
)
@field
=
field
@field
=
field
@player
=
player
@player
=
player
...
@@ -53,7 +54,11 @@ class Window_Field < Window
...
@@ -53,7 +54,11 @@ class Window_Field < Window
@field
.
field
.
each_with_index
do
|
card
,
index
|
@field
.
field
.
each_with_index
do
|
card
,
index
|
if
card
if
card
@items
[
index
]
=
[
Field_Pos
[
index
][
0
],
Field_Pos
[
index
][
1
]]
+
Card_Size
if
(
6
..
10
).
include?
(
index
)
and
card
.
position
!=
:attack
@items
[
index
]
=
[
Field_Pos
[
index
][
0
]
+
(
Card_Size
[
0
]
-
Card_Size
[
1
])
/
2
,
Field_Pos
[
index
][
1
]
+
(
Card_Size
[
1
]
-
Card_Size
[
0
])
/
2
,
Card_Size
[
1
],
Card_Size
[
0
]]
else
@items
[
index
]
=
[
Field_Pos
[
index
][
0
],
Field_Pos
[
index
][
1
]]
+
Card_Size
end
@cards
[
index
]
=
card
@cards
[
index
]
=
card
end
end
end
end
...
@@ -69,8 +74,13 @@ class Window_Field < Window
...
@@ -69,8 +74,13 @@ class Window_Field < Window
@items
.
each_key
{
|
index
|
draw_item
(
index
)}
@items
.
each_key
{
|
index
|
draw_item
(
index
)}
end
end
def
draw_item
(
index
,
status
=
0
)
def
draw_item
(
index
,
status
=
0
)
@contents
.
put
(
@cards
[
index
].
image_small
,
@items
[
index
][
0
],
@items
[
index
][
1
])
if
(
6
..
10
).
include?
(
index
)
and
@cards
[
index
].
position
!=
:attack
@contents
.
put
(
@border
,
@items
[
index
][
0
]
-
1
,
@items
[
index
][
1
]
-
1
)
if
status
==
1
Surface
.
transform_draw
(
@cards
[
index
].
image_small
,
@contents
,
90
,
1
,
1
,
0
,
0
,
@items
[
index
][
0
]
+
Card_Size
[
1
],
@items
[
index
][
1
],
Surface
::
TRANSFORM_SAFE
)
@contents
.
put
(
@border_horizontal
,
@items
[
index
][
0
]
-
1
,
@items
[
index
][
1
]
-
1
)
if
status
==
1
else
@contents
.
put
(
@cards
[
index
].
image_small
,
@items
[
index
][
0
],
@items
[
index
][
1
])
@contents
.
put
(
@border
,
@items
[
index
][
0
]
-
1
,
@items
[
index
][
1
]
-
1
)
if
status
==
1
end
end
end
def
item_rect
(
index
)
def
item_rect
(
index
)
@items
[
index
]
@items
[
index
]
...
@@ -281,18 +291,6 @@ class Window_Field < Window
...
@@ -281,18 +291,6 @@ class Window_Field < Window
Action
::
Set
.
new
(
true
,
@index
,
@index
,
@card
).
run
Action
::
Set
.
new
(
true
,
@index
,
@index
,
@card
).
run
end
end
when
6
..
10
#前场
when
6
..
10
#前场
#{"攻击表示" => false,
# "守备表示" => false,
# "里侧表示" => true,
# "反转召唤" => true,
# "打开" => true,
# "效果发动" => true,
# "攻击宣言" => false,
# "转移控制权" => false,
# "放回卡组顶端" => true,
# "送入墓地" => true,
# "解放" => true,
# "加入手卡" => true,
case
$scene
.
action_window
.
index
case
$scene
.
action_window
.
index
when
0
when
0
p
"未实现"
p
"未实现"
...
...
log.txt
deleted
100644 → 0
View file @
82f8b9d2
#<SDL::Event::Active:0x2a17ef8 @gain=false, @state=1>
#<SDL::Event::Active:0x2a17c40 @gain=true, @state=1>
<< #0|zh99997,96e79218965eb72c92a549dd5a330112,f5276841bca2e536788917498435693b,20110131Ąé
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