Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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
fallenstardust
YGOMobile-Cn-Ko-En
Commits
780173ad
Commit
780173ad
authored
Jan 20, 2020
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
fea56ff0
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
642 additions
and
612 deletions
+642
-612
Classes/ocgcore/card.cpp
Classes/ocgcore/card.cpp
+10
-9
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+2
-0
Classes/ocgcore/interpreter.cpp
Classes/ocgcore/interpreter.cpp
+5
-602
Classes/ocgcore/libcard.cpp
Classes/ocgcore/libcard.cpp
+262
-0
Classes/ocgcore/libdebug.cpp
Classes/ocgcore/libdebug.cpp
+19
-0
Classes/ocgcore/libduel.cpp
Classes/ocgcore/libduel.cpp
+218
-0
Classes/ocgcore/libeffect.cpp
Classes/ocgcore/libeffect.cpp
+62
-0
Classes/ocgcore/libgroup.cpp
Classes/ocgcore/libgroup.cpp
+51
-0
Classes/ocgcore/operations.cpp
Classes/ocgcore/operations.cpp
+2
-0
Classes/ocgcore/processor.cpp
Classes/ocgcore/processor.cpp
+5
-1
Classes/ocgcore/scriptlib.h
Classes/ocgcore/scriptlib.h
+6
-0
No files found.
Classes/ocgcore/card.cpp
View file @
780173ad
...
...
@@ -984,22 +984,23 @@ uint32 card::get_ritual_level(card* pcard) {
uint32
card
::
check_xyz_level
(
card
*
pcard
,
uint32
lv
)
{
if
(
status
&
STATUS_NO_LEVEL
)
return
0
;
uint32
lev
;
effect_set
eset
;
filter_effect
(
EFFECT_XYZ_LEVEL
,
&
eset
);
if
(
!
eset
.
size
())
{
lev
=
get_level
();
uint32
lev
=
get_level
();
if
(
lev
==
lv
)
return
lev
;
return
0
;
}
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_CARD
);
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
);
lev
=
eset
[
0
]
->
get_value
(
2
);
if
(((
lev
&
0xfff
)
==
lv
))
return
lev
&
0xffff
;
if
(((
lev
>>
16
)
&
0xfff
)
==
lv
)
return
(
lev
>>
16
)
&
0xffff
;
for
(
int32
i
=
0
;
i
<
eset
.
size
();
++
i
)
{
pduel
->
lua
->
add_param
(
this
,
PARAM_TYPE_CARD
);
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
);
uint32
lev
=
eset
[
i
]
->
get_value
(
2
);
if
(((
lev
&
0xfff
)
==
lv
))
return
lev
&
0xffff
;
if
(((
lev
>>
16
)
&
0xfff
)
==
lv
)
return
(
lev
>>
16
)
&
0xffff
;
}
return
0
;
}
// see get_level()
...
...
Classes/ocgcore/field.h
View file @
780173ad
...
...
@@ -185,6 +185,7 @@ struct processor {
event_list
point_event
;
event_list
instant_event
;
event_list
queue_event
;
event_list
delayed_activate_event
;
event_list
full_event
;
event_list
used_event
;
event_list
single_event
;
...
...
@@ -679,6 +680,7 @@ public:
#define TIMING_BATTLE_PHASE 0x1000000
#define TIMING_EQUIP 0x2000000
#define TIMING_BATTLE_STEP_END 0x4000000
#define TIMING_BATTLED 0x8000000
#define GLOBALFLAG_DECK_REVERSE_CHECK 0x1
#define GLOBALFLAG_BRAINWASHING_CHECK 0x2
...
...
Classes/ocgcore/interpreter.cpp
View file @
780173ad
This diff is collapsed.
Click to expand it.
Classes/ocgcore/libcard.cpp
View file @
780173ad
This diff is collapsed.
Click to expand it.
Classes/ocgcore/libdebug.cpp
View file @
780173ad
...
...
@@ -203,3 +203,22 @@ int32 scriptlib::debug_show_hint(lua_State *L) {
pduel
->
write_buffer8
(
0
);
return
0
;
}
static
const
struct
luaL_Reg
debuglib
[]
=
{
{
"Message"
,
scriptlib
::
debug_message
},
{
"AddCard"
,
scriptlib
::
debug_add_card
},
{
"SetPlayerInfo"
,
scriptlib
::
debug_set_player_info
},
{
"PreSummon"
,
scriptlib
::
debug_pre_summon
},
{
"PreEquip"
,
scriptlib
::
debug_pre_equip
},
{
"PreSetTarget"
,
scriptlib
::
debug_pre_set_target
},
{
"PreAddCounter"
,
scriptlib
::
debug_pre_add_counter
},
{
"ReloadFieldBegin"
,
scriptlib
::
debug_reload_field_begin
},
{
"ReloadFieldEnd"
,
scriptlib
::
debug_reload_field_end
},
{
"SetAIName"
,
scriptlib
::
debug_set_ai_name
},
{
"ShowHint"
,
scriptlib
::
debug_show_hint
},
{
NULL
,
NULL
}
};
void
scriptlib
::
open_debuglib
(
lua_State
*
L
)
{
luaL_newlib
(
L
,
debuglib
);
lua_setglobal
(
L
,
"Debug"
);
}
Classes/ocgcore/libduel.cpp
View file @
780173ad
This diff is collapsed.
Click to expand it.
Classes/ocgcore/libeffect.cpp
View file @
780173ad
...
...
@@ -561,3 +561,65 @@ int32 scriptlib::effect_use_count_limit(lua_State *L) {
}
return
0
;
}
static
const
struct
luaL_Reg
effectlib
[]
=
{
{
"CreateEffect"
,
scriptlib
::
effect_new
},
{
"GlobalEffect"
,
scriptlib
::
effect_newex
},
{
"Clone"
,
scriptlib
::
effect_clone
},
{
"Reset"
,
scriptlib
::
effect_reset
},
{
"GetFieldID"
,
scriptlib
::
effect_get_field_id
},
{
"SetDescription"
,
scriptlib
::
effect_set_description
},
{
"SetCode"
,
scriptlib
::
effect_set_code
},
{
"SetRange"
,
scriptlib
::
effect_set_range
},
{
"SetTargetRange"
,
scriptlib
::
effect_set_target_range
},
{
"SetAbsoluteRange"
,
scriptlib
::
effect_set_absolute_range
},
{
"SetCountLimit"
,
scriptlib
::
effect_set_count_limit
},
{
"SetReset"
,
scriptlib
::
effect_set_reset
},
{
"SetType"
,
scriptlib
::
effect_set_type
},
{
"SetProperty"
,
scriptlib
::
effect_set_property
},
{
"SetLabel"
,
scriptlib
::
effect_set_label
},
{
"SetLabelObject"
,
scriptlib
::
effect_set_label_object
},
{
"SetCategory"
,
scriptlib
::
effect_set_category
},
{
"SetHintTiming"
,
scriptlib
::
effect_set_hint_timing
},
{
"SetCondition"
,
scriptlib
::
effect_set_condition
},
{
"SetTarget"
,
scriptlib
::
effect_set_target
},
{
"SetCost"
,
scriptlib
::
effect_set_cost
},
{
"SetValue"
,
scriptlib
::
effect_set_value
},
{
"SetOperation"
,
scriptlib
::
effect_set_operation
},
{
"SetOwnerPlayer"
,
scriptlib
::
effect_set_owner_player
},
{
"GetDescription"
,
scriptlib
::
effect_get_description
},
{
"GetCode"
,
scriptlib
::
effect_get_code
},
{
"GetType"
,
scriptlib
::
effect_get_type
},
{
"GetProperty"
,
scriptlib
::
effect_get_property
},
{
"GetLabel"
,
scriptlib
::
effect_get_label
},
{
"GetLabelObject"
,
scriptlib
::
effect_get_label_object
},
{
"GetCategory"
,
scriptlib
::
effect_get_category
},
{
"GetOwner"
,
scriptlib
::
effect_get_owner
},
{
"GetHandler"
,
scriptlib
::
effect_get_handler
},
{
"GetCondition"
,
scriptlib
::
effect_get_condition
},
{
"GetTarget"
,
scriptlib
::
effect_get_target
},
{
"GetCost"
,
scriptlib
::
effect_get_cost
},
{
"GetValue"
,
scriptlib
::
effect_get_value
},
{
"GetOperation"
,
scriptlib
::
effect_get_operation
},
{
"GetActiveType"
,
scriptlib
::
effect_get_active_type
},
{
"IsActiveType"
,
scriptlib
::
effect_is_active_type
},
{
"GetOwnerPlayer"
,
scriptlib
::
effect_get_owner_player
},
{
"GetHandlerPlayer"
,
scriptlib
::
effect_get_handler_player
},
{
"IsHasProperty"
,
scriptlib
::
effect_is_has_property
},
{
"IsHasCategory"
,
scriptlib
::
effect_is_has_category
},
{
"IsHasType"
,
scriptlib
::
effect_is_has_type
},
{
"IsActivatable"
,
scriptlib
::
effect_is_activatable
},
{
"IsActivated"
,
scriptlib
::
effect_is_activated
},
{
"GetActivateLocation"
,
scriptlib
::
effect_get_activate_location
},
{
"GetActivateSequence"
,
scriptlib
::
effect_get_activate_sequence
},
{
"CheckCountLimit"
,
scriptlib
::
effect_check_count_limit
},
{
"UseCountLimit"
,
scriptlib
::
effect_use_count_limit
},
{
NULL
,
NULL
}
};
void
scriptlib
::
open_effectlib
(
lua_State
*
L
)
{
luaL_newlib
(
L
,
effectlib
);
lua_pushstring
(
L
,
"__index"
);
lua_pushvalue
(
L
,
-
2
);
lua_rawset
(
L
,
-
3
);
lua_setglobal
(
L
,
"Effect"
);
}
Classes/ocgcore/libgroup.cpp
View file @
780173ad
...
...
@@ -845,3 +845,54 @@ int32 scriptlib::group_meta_bxor(lua_State* L) {
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
}
static
const
struct
luaL_Reg
grouplib
[]
=
{
{
"CreateGroup"
,
scriptlib
::
group_new
},
{
"KeepAlive"
,
scriptlib
::
group_keep_alive
},
{
"DeleteGroup"
,
scriptlib
::
group_delete
},
{
"Clone"
,
scriptlib
::
group_clone
},
{
"FromCards"
,
scriptlib
::
group_from_cards
},
{
"Clear"
,
scriptlib
::
group_clear
},
{
"AddCard"
,
scriptlib
::
group_add_card
},
{
"RemoveCard"
,
scriptlib
::
group_remove_card
},
{
"GetNext"
,
scriptlib
::
group_get_next
},
{
"GetFirst"
,
scriptlib
::
group_get_first
},
{
"GetCount"
,
scriptlib
::
group_get_count
},
{
"__len"
,
scriptlib
::
group_get_count
},
{
"ForEach"
,
scriptlib
::
group_for_each
},
{
"Filter"
,
scriptlib
::
group_filter
},
{
"FilterCount"
,
scriptlib
::
group_filter_count
},
{
"FilterSelect"
,
scriptlib
::
group_filter_select
},
{
"Select"
,
scriptlib
::
group_select
},
{
"SelectUnselect"
,
scriptlib
::
group_select_unselect
},
{
"RandomSelect"
,
scriptlib
::
group_random_select
},
{
"IsExists"
,
scriptlib
::
group_is_exists
},
{
"CheckWithSumEqual"
,
scriptlib
::
group_check_with_sum_equal
},
{
"SelectWithSumEqual"
,
scriptlib
::
group_select_with_sum_equal
},
{
"CheckWithSumGreater"
,
scriptlib
::
group_check_with_sum_greater
},
{
"SelectWithSumGreater"
,
scriptlib
::
group_select_with_sum_greater
},
{
"GetMinGroup"
,
scriptlib
::
group_get_min_group
},
{
"GetMaxGroup"
,
scriptlib
::
group_get_max_group
},
{
"GetSum"
,
scriptlib
::
group_get_sum
},
{
"GetClassCount"
,
scriptlib
::
group_get_class_count
},
{
"Remove"
,
scriptlib
::
group_remove
},
{
"Merge"
,
scriptlib
::
group_merge
},
{
"Sub"
,
scriptlib
::
group_sub
},
{
"Equal"
,
scriptlib
::
group_equal
},
{
"IsContains"
,
scriptlib
::
group_is_contains
},
{
"SearchCard"
,
scriptlib
::
group_search_card
},
{
"GetBinClassCount"
,
scriptlib
::
group_get_bin_class_count
},
{
"__add"
,
scriptlib
::
group_meta_add
},
{
"__bor"
,
scriptlib
::
group_meta_add
},
{
"__sub"
,
scriptlib
::
group_meta_sub
},
{
"__band"
,
scriptlib
::
group_meta_band
},
{
"__bxor"
,
scriptlib
::
group_meta_bxor
},
{
NULL
,
NULL
}
};
void
scriptlib
::
open_grouplib
(
lua_State
*
L
)
{
luaL_newlib
(
L
,
grouplib
);
lua_pushstring
(
L
,
"__index"
);
lua_pushvalue
(
L
,
-
2
);
lua_rawset
(
L
,
-
3
);
lua_setglobal
(
L
,
"Group"
);
}
Classes/ocgcore/operations.cpp
View file @
780173ad
...
...
@@ -3930,6 +3930,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard
->
reset
(
RESET_LEAVE
,
RESET_EVENT
);
param
->
leave
.
insert
(
pcard
);
}
if
(
pcard
->
previous
.
location
==
LOCATION_OVERLAY
)
pcard
->
previous
.
controler
=
control_player
;
++
param
->
cvit
;
core
.
units
.
begin
()
->
step
=
4
;
return
FALSE
;
...
...
Classes/ocgcore/processor.cpp
View file @
780173ad
...
...
@@ -1262,6 +1262,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
core
.
quick_f_chain
.
clear
();
core
.
instant_event
.
clear
();
core
.
point_event
.
clear
();
core
.
delayed_activate_event
.
clear
();
core
.
full_event
.
clear
();
return
TRUE
;
}
...
...
@@ -1273,6 +1274,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
case
0
:
{
core
.
select_chains
.
clear
();
core
.
point_event
.
splice
(
core
.
point_event
.
end
(),
core
.
instant_event
);
core
.
full_event
.
splice
(
core
.
full_event
.
end
(),
core
.
delayed_activate_event
);
if
(
skip_trigger
)
{
core
.
units
.
begin
()
->
step
=
7
;
return
FALSE
;
...
...
@@ -1879,7 +1881,7 @@ int32 field::process_instant_event() {
}
}
// delayed activate effect
core
.
full
_event
.
push_back
(
ev
);
core
.
delayed_activate
_event
.
push_back
(
ev
);
// delayed quick effect
pr
=
effects
.
quick_o_effect
.
equal_range
(
ev
.
event_code
);
for
(
auto
eit
=
pr
.
first
;
eit
!=
pr
.
second
;)
{
...
...
@@ -3073,6 +3075,8 @@ int32 field::process_battle_command(uint16 step) {
pduel
->
write_buffer8
(
HINT_EVENT
);
pduel
->
write_buffer8
(
1
);
pduel
->
write_buffer32
(
43
);
core
.
hint_timing
[
0
]
|=
TIMING_BATTLED
;
core
.
hint_timing
[
1
]
|=
TIMING_BATTLED
;
add_process
(
PROCESSOR_POINT_EVENT
,
0
,
0
,
0
,
0
,
TRUE
);
return
FALSE
;
}
...
...
Classes/ocgcore/scriptlib.h
View file @
780173ad
...
...
@@ -269,6 +269,7 @@ public:
static
int32
card_reset_negate_effect
(
lua_State
*
L
);
static
int32
card_assume_prop
(
lua_State
*
L
);
static
int32
card_set_spsummon_once
(
lua_State
*
L
);
static
void
open_cardlib
(
lua_State
*
L
);
//Effect functions
static
int32
effect_new
(
lua_State
*
L
);
...
...
@@ -322,6 +323,7 @@ public:
static
int32
effect_get_activate_sequence
(
lua_State
*
L
);
static
int32
effect_check_count_limit
(
lua_State
*
L
);
static
int32
effect_use_count_limit
(
lua_State
*
L
);
static
void
open_effectlib
(
lua_State
*
L
);
//Group functions
static
int32
group_new
(
lua_State
*
L
);
...
...
@@ -358,6 +360,7 @@ public:
static
int32
group_is_contains
(
lua_State
*
L
);
static
int32
group_search_card
(
lua_State
*
L
);
static
int32
group_get_bin_class_count
(
lua_State
*
L
);
static
void
open_grouplib
(
lua_State
*
L
);
//Duel functions
static
int32
duel_enable_global_flag
(
lua_State
*
L
);
...
...
@@ -577,6 +580,8 @@ public:
static
int32
duel_swap_deck_and_grave
(
lua_State
*
L
);
static
int32
duel_majestic_copy
(
lua_State
*
L
);
static
void
open_duellib
(
lua_State
*
L
);
//group metamethods
//__len is in the group lib, which is same as group_get_count
static
int32
group_meta_add
(
lua_State
*
L
);
...
...
@@ -596,6 +601,7 @@ public:
static
int32
debug_reload_field_end
(
lua_State
*
L
);
static
int32
debug_set_ai_name
(
lua_State
*
L
);
static
int32
debug_show_hint
(
lua_State
*
L
);
static
void
open_debuglib
(
lua_State
*
L
);
};
#endif
/* SCRIPTLIB_H_ */
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