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
del
graphics
\avatars\
*
_
*
.png
del
Thumbs
.db
/s /F /A
:S
del
fonts
\
*
_STOP.
*
\ No newline at end of file
del
fonts
\
*
_STOP.
*
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
def
run
#子类定义
end
class
Reset
<
Action
;
end
class
Draw
<
Action
class
Reset
<
Action
def
run
player_field
.
hand
<<
player_field
.
deck
.
shif
t
player_field
.
rese
t
super
end
end
class
Deck
<
Action
;
end
class
Side
<
Deck
;
end
class
Go
<
Action
class
Go
<
Reset
def
run
player_field
.
deck
.
shuffle!
player_field
.
hand
=
player_field
.
deck
.
shift
(
5
)
super
player_field
.
hand
=
player_field
.
deck
.
shift
(
5
)
player_field
.
hand
.
each
{
|
card
|
card
.
position
=
:attack
}
end
end
class
FirstToGo
<
Go
;
end
...
...
@@ -80,7 +80,7 @@ class Action
end
class
Move
<
Action
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
)
@from_pos
=
from_pos
@to_pos
=
to_pos
...
...
@@ -104,18 +104,13 @@ class Action
when
:removed
player_field
.
removed
end
if
@from_pos
.
is_a?
Integer
from_pos
=
@from_pos
else
from_pos
=
from_field
.
index
(
@card
)
||
from_field
.
index
(
Card
.
find
(
nil
))
end
if
from_pos
if
from_field
==
player_field
.
field
from_field
[
from_pos
]
=
nil
else
from_field
.
delete_at
from_pos
end
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
to_field
=
case
@to_pos
when
Integer
player_field
.
field
...
...
@@ -130,12 +125,25 @@ class Action
when
:removed
player_field
.
removed
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
to_field
[
@to_pos
]
=
@
card
#elsif to_field == player_field.fiel
d
# to_pos = from_field.index(nil) || 11
to_field
[
@to_pos
]
=
card
elsif
to_field
==
player_field
.
han
d
to_field
<<
card
else
to_field
.
unshift
@
card
to_field
.
unshift
card
end
super
end
...
...
@@ -162,27 +170,27 @@ class Action
end
class
SendToGraveyard
<
Move
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
class
Remove
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
super
(
from_player
,
from_pos
,
:removed
,
card
)
super
(
from_player
,
from_pos
,
:removed
,
card
,
:attack
)
end
end
class
ReturnToHand
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
super
(
from_player
,
from_pos
,
:hand
,
card
)
super
(
from_player
,
from_pos
,
:hand
,
card
,
:attack
)
end
end
class
ReturnToDeck
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
super
(
from_player
,
from_pos
,
:deck
,
card
)
super
(
from_player
,
from_pos
,
:deck
,
card
,
:set
)
end
end
class
ReturnToExtra
<
Move
def
initialize
(
from_player
,
from_pos
,
card
)
super
(
from_player
,
from_pos
,
:extra
,
card
)
super
(
from_player
,
from_pos
,
:extra
,
card
,
:set
)
end
end
class
Control
<
Move
...
...
@@ -198,6 +206,12 @@ class Action
end
class
FlipSummon
<
Flip
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
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
)
...
...
lib/game_card.rb
View file @
a79aa886
class
Game_Card
<
Card
#attr_reader :card
attr_accessor
:position
#def initialize(card)
# @card = card
#end
#def method_missing(method, *args)
# @card.send(method, *args)
#end
#encoding: UTF-8
class
Game_Card
attr_accessor
:card
,
:position
#attack|defense|set,
@@count
=
0
def
initialize
(
card
=
nil
)
@@count
+=
1
puts
"创建活动卡片<
#{
card
?
card
.
name
:
'??'
}
>,共计
#{
@@count
}
张"
@card
=
card
||
Card
.
find
(
nil
)
@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
\ No newline at end of file
lib/game_field.rb
View file @
a79aa886
...
...
@@ -25,19 +25,20 @@ class Game_Field
attr_accessor
:removed
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
if
deck
@deck
=
deck
.
main
@extra
=
deck
.
extra
else
@deck
=
Array
.
new
(
60
,
Card
.
find
(
nil
))
@extra
=
Array
.
new
(
15
,
Card
.
find
(
nil
))
end
@deck
=
@deck_original
.
main
.
collect
{
|
card
|
Game_Card
.
new
(
card
)}.
shuffle
@extra
=
@deck_original
.
extra
.
collect
{
|
card
|
Game_Card
.
new
(
card
)}
@field
=
Array
.
new
(
11
)
@hand
=
[]
@graveyard
=
[]
@removed
=
[]
end
def
empty_monster_field
[
8
,
7
,
9
,
6
,
10
].
each
do
|
pos
|
return
pos
if
@field
[
pos
].
nil?
...
...
lib/scene.rb
View file @
a79aa886
...
...
@@ -57,7 +57,13 @@ class Scene
#@fpscount += 1
$screen
.
put
(
@background
,
0
,
0
)
@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
end
$screen
.
update_rect
(
0
,
0
,
0
,
0
)
...
...
lib/scene_duel.rb
View file @
a79aa886
...
...
@@ -46,6 +46,8 @@ class Scene_Duel < Scene
@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
.
angle
=
180
Action
.
player_field
=
@player_field
Action
.
opponent_field
=
@opponent_field
...
...
lib/window.rb
View file @
a79aa886
...
...
@@ -8,22 +8,8 @@ class Window
@width
=
width
@height
=
height
@visible
=
true
@angle
=
0
@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
rmask
=
0x00ff0000
gmask
=
0x0000ff00
...
...
lib/window_chat.rb
View file @
a79aa886
...
...
@@ -21,7 +21,7 @@ class Window_Chat < Window
refresh
end
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
|
user
,
content
=
*
chat
@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
attr_reader
:action_window
def
initialize
(
x
,
y
,
field
,
player
=
true
)
@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
)
@field
=
field
@player
=
player
...
...
@@ -53,7 +54,11 @@ class Window_Field < Window
@field
.
field
.
each_with_index
do
|
card
,
index
|
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
end
end
...
...
@@ -69,8 +74,13 @@ class Window_Field < Window
@items
.
each_key
{
|
index
|
draw_item
(
index
)}
end
def
draw_item
(
index
,
status
=
0
)
@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
if
(
6
..
10
).
include?
(
index
)
and
@cards
[
index
].
position
!=
:attack
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
def
item_rect
(
index
)
@items
[
index
]
...
...
@@ -281,18 +291,6 @@ class Window_Field < Window
Action
::
Set
.
new
(
true
,
@index
,
@index
,
@card
).
run
end
when
6
..
10
#前场
#{"攻击表示" => false,
# "守备表示" => false,
# "里侧表示" => true,
# "反转召唤" => true,
# "打开" => true,
# "效果发动" => true,
# "攻击宣言" => false,
# "转移控制权" => false,
# "放回卡组顶端" => true,
# "送入墓地" => true,
# "解放" => true,
# "加入手卡" => true,
case
$scene
.
action_window
.
index
when
0
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